vfio/ccw: Remove WARN_ON during shutdown
Subsystems (4)
Eric Farman
maintainerPATCH 1/1 vfio/ccw: Remove WARN_ON during shutdown
The logic in vfio_ccw_sch_shutdown() always assumed that the input subchannel would point to a vfio_ccw_private struct, without checking that one exists. The blamed commit put in a check for this scenario, to prevent the possibility of a missing private.
The trouble is that check was put alongside a WARN_ON(), presuming that such a scenario would be a cause for concern. But this can be triggered by binding a subchannel to vfio-ccw, and rebooting the system before starting the mdev (via "mdevctl start" or similar) or after stopping it. In those cases, shutdown doesn't need to worry because either the private was never allocated, or it was cleaned up by vfio_ccw_mdev_remove().
Remove the WARN_ON() piece of this check, since there are plausible scenarios where private would be NULL in this path.
--- drivers/s390/cio/vfio_ccw_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_drv.c +1 -1
@@ -225,7 +225,7 @@ static void vfio_ccw_sch_shutdown(struct subchannel *sch)struct vfio_ccw_parent *parent =dev_get_drvdata (&sch->dev);struct vfio_ccw_private *private =dev_get_drvdata (&parent->dev); -if (WARN_ON (!private)) +if (!private)return ;vfio_ccw_fsm_event (private,VFIO_CCW_EVENT_CLOSE );
Signature · 1 line
2.37.2
Quoted 13 lines · Eric Farman
The logic in
vfio_ccw_sch_shutdown()always assumed that the input subchannel would point to avfio_ccw_privatestruct, without checking that one exists. The blamed commit put in a check for this scenario, to prevent the possibility of a missing private.The trouble is that check was put alongside a
WARN_ON(), presuming that such a scenario would be a cause for concern. But this can be triggered by binding a subchannel to vfio-ccw, and rebooting the system before starting the mdev (via "mdevctl start" or similar) or after stopping it. In those cases, shutdown doesn't need to worry because either the private was never allocated, or it was cleaned up byvfio_ccw_mdev_remove().
Quoted 5 lines
Remove the
WARN_ON()piece of this check, since there are plausible scenarios where private would be NULL in this path.Fixes 9e6f07cd1eaa ("vfio/ccw: create a parent struct")Signed-off-by Eric Farman <[email protected]>
The other ops in vfio_ccw_sch_driver look OK in that they quietly tolerate this scenario -- with .irq being an exception but the rationale and what we log there makes sense to me (we shouldn't get an interrupt on a disabled subchannel) plus it's only a debug log not a WARN.
Quoted 27 lines · On Fri, 10 Feb 2023 18:42:27 +0100 Eric Farman <[email protected]> wrote:
The logic in
vfio_ccw_sch_shutdown()always assumed that the input subchannel would point to avfio_ccw_privatestruct, without checking that one exists. The blamed commit put in a check for this scenario, to prevent the possibility of a missing private.The trouble is that check was put alongside a
WARN_ON(), presuming that such a scenario would be a cause for concern. But this can be triggered by binding a subchannel to vfio-ccw, and rebooting the system before starting the mdev (via "mdevctl start" or similar) or after stopping it. In those cases, shutdown doesn't need to worry because either the private was never allocated, or it was cleaned up byvfio_ccw_mdev_remove().Remove the
WARN_ON()piece of this check, since there are plausible scenarios where private would be NULL in this path.Fixes 9e6f07cd1eaa ("vfio/ccw: create a parent struct")Signed-off-by Eric Farman <[email protected]>--- drivers/s390/cio/vfio_ccw_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/cio/vfio_ccw_drv.c +0
-0
drivers/s390/cio/vfio_ccw_drv.c static void vfio_ccw_sch_shutdown(struct subchannel *sch) · line 231
Quoted 8 lines
drivers/s390/cio/vfio_ccw_drv.c +1
-1@@ -225,7 +225,7 @@ static void vfio_ccw_sch_shutdown(struct subchannel *sch)struct vfio_ccw_parent *parent =dev_get_drvdata (&sch->dev);struct vfio_ccw_private *private =dev_get_drvdata (&parent->dev); -if (WARN_ON (!private)) +if (!private)return ;vfio_ccw_fsm_event (private,VFIO_CCW_EVENT_CLOSE );
I see I'm on the To: line here, is this intended to go through the vfio tree rather than s390? Thanks,
Alex
Eric Farman
maintainerQuoted 45 lines · Alex Williamson
Quoted 33 lines · On Fri, 10 Feb 2023 18:42:27 +0100 Eric Farman <[email protected]> wrote:
The logic in
vfio_ccw_sch_shutdown()always assumed that the input subchannel would point to avfio_ccw_privatestruct, without checking
that one exists. The blamed commit put in a check for this scenario,
to prevent the possibility of a missing private.The trouble is that check was put alongside a
WARN_ON(), presuming that such a scenario would be a cause for concern. But this can be triggered by binding a subchannel to vfio-ccw, and rebooting the system before starting the mdev (via "mdevctl start" or similar) or after stopping it. In those cases, shutdown doesn't need to worry because either the private was never allocated, or it was cleaned up byvfio_ccw_mdev_remove().Remove the
WARN_ON()piece of this check, since there are plausible scenarios where private would be NULL in this path.Fixes 9e6f07cd1eaa ("vfio/ccw: create a parent struct")Signed-off-by Eric Farman <[email protected]>---
drivers/s390/cio/vfio_ccw_drv.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/cio/vfio_ccw_drv.c +0
-0@@ -225,7 +225,7 @@ static void vfio_ccw_sch_shutdown(struct subchannel *sch)struct
vfio_ccw_parent*parent = dev_get_drvdata(&sch-Quoted 1 line
dev);
Quoted 8 lines
struct
vfio_ccw_private*private = dev_get_drvdata(&parent-Quoted 1 line
dev);
- if (WARN_ON(!private))
+ if (!private)
return;
vfio_ccw_fsm_event(private,VFIO_CCW_EVENT_CLOSE);
Quoted 3 lines
I see I'm on the To: line here, is this intended to go through the vfio
tree rather than s390?
Either way. I put you as "to" as the blamed commit went via vfio, but I could ask Heiko or Vasili to take it if that's easier.
Eric
Quoted 27 lines · Eric Farman
Quoted 26 lines · Alex Williamson
Quoted 23 lines · On Fri, 10 Feb 2023 18:42:27 +0100 Eric Farman <[email protected]> wrote:
The logic in
vfio_ccw_sch_shutdown()always assumed that the input subchannel would point to avfio_ccw_privatestruct, without checking
that one exists. The blamed commit put in a check for this scenario,
to prevent the possibility of a missing private.The trouble is that check was put alongside a
WARN_ON(), presuming that such a scenario would be a cause for concern. But this can be triggered by binding a subchannel to vfio-ccw, and rebooting the system before starting the mdev (via "mdevctl start" or similar) or after stopping it. In those cases, shutdown doesn't need to worry because either the private was never allocated, or it was cleaned up byvfio_ccw_mdev_remove().Remove the
WARN_ON()piece of this check, since there are plausible scenarios where private would be NULL in this path.Fixes 9e6f07cd1eaa ("vfio/ccw: create a parent struct")Signed-off-by Eric Farman <[email protected]>---
drivers/s390/cio/vfio_ccw_drv.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
...
Quoted 6 lines
Quoted 3 lines
I see I'm on the To: line here, is this intended to go through the vfio
tree rather than s390?Either way. I put you as "to" as the blamed commit went via vfio, but I could ask Heiko or Vasili to take it if that's easier.
I picked it up, so it will go via s390. Thanks!