[PATCH 1/3] nvme-pci: clear shadow doorbell memory on resets

Keith Busch kbusch at kernel.org
Wed Oct 6 05:07:34 PDT 2021


On Mon, Oct 04, 2021 at 09:35:04AM +0000, John Levon wrote:
> On Mon, Apr 27, 2020 at 04:52:41PM -0700, Keith Busch wrote:
> 
> > The host memory doorbell and event buffers need to be initialized on
> > each reset so the driver doesn't observe stale values from the previous
> > instantiation.
> > 
> > Signed-off-by: Keith Busch <kbusch at kernel.org>
> > ---
> >  drivers/nvme/host/pci.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index cf386c84588b..d388fff9c358 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -228,8 +228,11 @@ static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)
> >  {
> >  	unsigned int mem_size = nvme_dbbuf_size(dev->db_stride);
> >  
> > -	if (dev->dbbuf_dbs)
> > +	if (dev->dbbuf_dbs) {
> > +		memset(dev->dbbuf_dbs, 0, mem_size);
> > +		memset(dev->dbbuf_eis, 0, mem_size);
> >  		return 0;
> > +	}
> >  
> >  	dev->dbbuf_dbs = dma_alloc_coherent(dev->dev, mem_size,
> >  					    &dev->dbbuf_dbs_dma_addr,
> 
> Hi Keith, we came across this issue recently, and we just found this above
> patch. Was there any specific reason it was never merged?

I don't recall why this wasn't merged. I can't find this series in my
tree anymore, and it also appears that the mailing list has lost the
original patch set. Do you happen to have the rest of the patch emails?
If so, could you possibly send them to me?



More information about the Linux-nvme mailing list