Message ID | 20230612181038.14421-2-dave@stgolabs.net |
---|---|
State | Accepted |
Commit | 8ea9c33d48f20479e87b5fc3a97cd25e656d30dc |
Headers | show |
Series | cxl: Support device sanitation | expand |
On Mon, 12 Jun 2023 11:10:32 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote: > For cases when the mailbox background operation is not complete, > do not "handle" the interrupt, as it was not from this device. > And furthermore there are no racy scenarios such as the hw being > out of sync with the driver and starting a new background op > behind its back. > > Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com> > Fixes: ccadf1310fb (cxl/mbox: Add background cmd handling machinery) Fixes is a bit strong for something that shouldn't be seen anyway. > Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Otherwise LGTM Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/cxl/pci.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c > index a78e40e6d0e0..4b2575502f49 100644 > --- a/drivers/cxl/pci.c > +++ b/drivers/cxl/pci.c > @@ -118,9 +118,11 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id) > struct cxl_dev_id *dev_id = id; > struct cxl_dev_state *cxlds = dev_id->cxlds; > > + if (!cxl_mbox_background_complete(cxlds)) > + return IRQ_NONE; > + > /* short-circuit the wait in __cxl_pci_mbox_send_cmd() */ > - if (cxl_mbox_background_complete(cxlds)) > - rcuwait_wake_up(&cxlds->mbox_wait); > + rcuwait_wake_up(&cxlds->mbox_wait); > > return IRQ_HANDLED; > }
On 6/12/23 11:10, Davidlohr Bueso wrote: > For cases when the mailbox background operation is not complete, > do not "handle" the interrupt, as it was not from this device. > And furthermore there are no racy scenarios such as the hw being > out of sync with the driver and starting a new background op > behind its back. > > Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com> > Fixes: ccadf1310fb (cxl/mbox: Add background cmd handling machinery) > Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/cxl/pci.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c > index a78e40e6d0e0..4b2575502f49 100644 > --- a/drivers/cxl/pci.c > +++ b/drivers/cxl/pci.c > @@ -118,9 +118,11 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id) > struct cxl_dev_id *dev_id = id; > struct cxl_dev_state *cxlds = dev_id->cxlds; > > + if (!cxl_mbox_background_complete(cxlds)) > + return IRQ_NONE; > + > /* short-circuit the wait in __cxl_pci_mbox_send_cmd() */ > - if (cxl_mbox_background_complete(cxlds)) > - rcuwait_wake_up(&cxlds->mbox_wait); > + rcuwait_wake_up(&cxlds->mbox_wait); > > return IRQ_HANDLED; > }
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index a78e40e6d0e0..4b2575502f49 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -118,9 +118,11 @@ static irqreturn_t cxl_pci_mbox_irq(int irq, void *id) struct cxl_dev_id *dev_id = id; struct cxl_dev_state *cxlds = dev_id->cxlds; + if (!cxl_mbox_background_complete(cxlds)) + return IRQ_NONE; + /* short-circuit the wait in __cxl_pci_mbox_send_cmd() */ - if (cxl_mbox_background_complete(cxlds)) - rcuwait_wake_up(&cxlds->mbox_wait); + rcuwait_wake_up(&cxlds->mbox_wait); return IRQ_HANDLED; }
For cases when the mailbox background operation is not complete, do not "handle" the interrupt, as it was not from this device. And furthermore there are no racy scenarios such as the hw being out of sync with the driver and starting a new background op behind its back. Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com> Fixes: ccadf1310fb (cxl/mbox: Add background cmd handling machinery) Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> --- drivers/cxl/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)