Message ID | 20200903095713.193109-2-frank.heimes@canonical.com |
---|---|
State | New |
Headers | show |
Series | zPCI device hot-plug during boot may result in unusable device (LP: 1893778) | expand |
On 03.09.20 11:57, frank.heimes@canonical.com wrote: > From: Niklas Schnelle <schnelle@linux.ibm.com> > > BugLink: https://bugs.launchpad.net/bugs/1893778 > > A configuration request event may be stale, that is the event > may reference a zdev which was already configured. > This can happen when a hotplug happens during boot such that > the device is discovered and configured in the initial clp_list_pci(), > then after initialization we enable events and process > the original configuration request which additionally still contains > the old disabled function handle leading to a failure during device > enablement and subsequent I/O lockout. > > Fix this by restoring the check that the device to be configured is in > standby which was removed in commit f606b3ef47c9 ("s390/pci: adapt events > for zbus"). > > This check does not need serialization as we only enable the events after > zPCI has fully initialized, which includes the initial clp_list_pci(), > rescan only does updates and events are serialized with respect to each > other. > > Fixes: f606b3ef47c9 ("s390/pci: adapt events for zbus") > Cc: <stable@vger.kernel.org> # 5.8 > Reported-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> > Tested-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> > Acked-by: Pierre Morel <pmorel@linux.ibm.com> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> > Signed-off-by: Heiko Carstens <hca@linux.ibm.com> > (cherry picked from commit b76fee1bc56c31a9d2a49592810eba30cc06d61a) > Signed-off-by: Frank Heimes <frank.heimes@canonical.com> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> > --- > arch/s390/pci/pci_event.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c > index 538da3faa048..9a3a291cad43 100644 > --- a/arch/s390/pci/pci_event.c > +++ b/arch/s390/pci/pci_event.c > @@ -92,6 +92,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) > ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1); > break; > } > + /* the configuration request may be stale */ > + if (zdev->state != ZPCI_FN_STATE_STANDBY) > + break; > zdev->fh = ccdf->fh; > zdev->state = ZPCI_FN_STATE_CONFIGURED; > ret = zpci_enable_device(zdev); >
On Thu, Sep 03, 2020 at 11:57:13AM +0200, frank.heimes@canonical.com wrote: > From: Niklas Schnelle <schnelle@linux.ibm.com> > > BugLink: https://bugs.launchpad.net/bugs/1893778 > > A configuration request event may be stale, that is the event > may reference a zdev which was already configured. > This can happen when a hotplug happens during boot such that > the device is discovered and configured in the initial clp_list_pci(), > then after initialization we enable events and process > the original configuration request which additionally still contains > the old disabled function handle leading to a failure during device > enablement and subsequent I/O lockout. > > Fix this by restoring the check that the device to be configured is in > standby which was removed in commit f606b3ef47c9 ("s390/pci: adapt events > for zbus"). > > This check does not need serialization as we only enable the events after > zPCI has fully initialized, which includes the initial clp_list_pci(), > rescan only does updates and events are serialized with respect to each > other. > > Fixes: f606b3ef47c9 ("s390/pci: adapt events for zbus") > Cc: <stable@vger.kernel.org> # 5.8 > Reported-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> > Tested-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> > Acked-by: Pierre Morel <pmorel@linux.ibm.com> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> > Signed-off-by: Heiko Carstens <hca@linux.ibm.com> > (cherry picked from commit b76fee1bc56c31a9d2a49592810eba30cc06d61a) > Signed-off-by: Frank Heimes <frank.heimes@canonical.com> > --- > arch/s390/pci/pci_event.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c > index 538da3faa048..9a3a291cad43 100644 > --- a/arch/s390/pci/pci_event.c > +++ b/arch/s390/pci/pci_event.c > @@ -92,6 +92,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) > ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1); > break; > } > + /* the configuration request may be stale */ > + if (zdev->state != ZPCI_FN_STATE_STANDBY) > + break; > zdev->fh = ccdf->fh; > zdev->state = ZPCI_FN_STATE_CONFIGURED; > ret = zpci_enable_device(zdev); > -- > 2.25.1 Acked-by: William Breathitt Gray <william.gray@canonical.com>
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c index 538da3faa048..9a3a291cad43 100644 --- a/arch/s390/pci/pci_event.c +++ b/arch/s390/pci/pci_event.c @@ -92,6 +92,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1); break; } + /* the configuration request may be stale */ + if (zdev->state != ZPCI_FN_STATE_STANDBY) + break; zdev->fh = ccdf->fh; zdev->state = ZPCI_FN_STATE_CONFIGURED; ret = zpci_enable_device(zdev);