WSL2-Linux-Kernel/drivers/s390/cio
Eric Farman 2af7a834a4 vfio-ccw: Serialize FSM IDLE state with I/O completion
Today, the stacked call to vfio_ccw_sch_io_todo() does three things:

  1) Update a solicited IRB with CP information, and release the CP
     if the interrupt was the end of a START operation.
  2) Copy the IRB data into the io_region, under the protection of
     the io_mutex
  3) Reset the vfio-ccw FSM state to IDLE to acknowledge that
     vfio-ccw can accept more work.

The trouble is that step 3 is (A) invoked for both solicited and
unsolicited interrupts, and (B) sitting after the mutex for step 2.
This second piece becomes a problem if it processes an interrupt
for a CLEAR SUBCHANNEL while another thread initiates a START,
thus allowing the CP and FSM states to get out of sync. That is:

    CPU 1                           CPU 2
    fsm_do_clear()
    fsm_irq()
                                    fsm_io_request()
    vfio_ccw_sch_io_todo()
                                    fsm_io_helper()

Since the FSM state and CP should be kept in sync, let's make a
note when the CP is released, and rely on that as an indication
that the FSM should also be reset at the end of this routine and
open up the device for more work.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20210511195631.3995081-4-farman@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2021-05-12 12:59:50 +02:00
..
Makefile s390/cio: add CRW inject functionality 2021-03-22 11:36:04 +01:00
airq.c s390/irq: replace setup_irq() by request_irq() 2020-03-11 14:18:44 +01:00
blacklist.c s390/cio: cio_ignore_proc_seq_next should increase position index 2020-02-17 18:01:57 +01:00
blacklist.h s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
ccwgroup.c s390/ccwgroup: use bus->dev_groups for bus-based sysfs attributes 2020-12-07 06:55:21 -08:00
ccwreq.c s390/cio: add basic protected virtualization support 2019-06-15 12:25:00 +02:00
chp.c s390/cio: use DECLARE_WAIT_QUEUE_HEAD for static work_queue_head_t 2021-04-12 12:46:41 +02:00
chp.h s390/cio: Add support for FCES status notification 2020-11-16 08:14:38 -07:00
chsc.c s390/cio: Add support for FCES status notification 2020-11-16 08:14:38 -07:00
chsc.h s390/cio: Export information about Endpoint-Security Capability 2020-11-16 08:14:37 -07:00
chsc_sch.c s390/cio: remove pm support from chsc subchannel driver 2020-12-02 18:19:25 +01:00
chsc_sch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cio.c s390/irq: replace setup_irq() by request_irq() 2020-03-11 14:18:44 +01:00
cio.h s390/cio: fix virtio-ccw DMA without PV 2019-10-10 10:49:46 +02:00
cio_debug.h s390/cio: introduce CIO debugfs directory 2021-03-22 11:36:04 +01:00
cio_debugfs.c s390/cio: introduce CIO debugfs directory 2021-03-22 11:36:04 +01:00
cio_inject.c s390/cio: add CRW inject functionality 2021-03-22 11:36:04 +01:00
cio_inject.h s390/cio: add CRW inject functionality 2021-03-22 11:36:04 +01:00
cmf.c s390/cio: remove pm support from ccw bus driver 2020-12-02 18:19:25 +01:00
crw.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
css.c s390/cio: use DECLARE_WAIT_QUEUE_HEAD() for wait_queue 2021-04-05 11:30:57 +02:00
css.h s390/cio: remove pm support from css-bus driver 2020-12-02 18:19:25 +01:00
device.c s390/cio: remove invalid condition on IO_SCH_UNREG 2021-04-30 17:17:01 +02:00
device.h s390/cio: remove pm support from ccw bus driver 2020-12-02 18:19:25 +01:00
device_fsm.c s390/time,idle: get rid of unsigned long long 2021-03-08 10:46:27 +01:00
device_id.c s390/cio: add basic protected virtualization support 2019-06-15 12:25:00 +02:00
device_ops.c s390/cio: Helper functions to read CSSID, IID, and CHID 2020-09-15 13:21:46 -07:00
device_pgid.c s390/cio: add basic protected virtualization support 2019-06-15 12:25:00 +02:00
device_status.c s390/cio: add basic protected virtualization support 2019-06-15 12:25:00 +02:00
eadm_sch.c s390/cio: remove pm support from eadm-sch drivers 2020-12-02 18:19:24 +01:00
eadm_sch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fcx.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
idset.c s390/cio: Remove unused inline function idset_sch_get_first 2020-05-20 10:22:49 +02:00
idset.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io_sch.h s390/cio: remove pm support from ccw bus driver 2020-12-02 18:19:25 +01:00
ioasm.c s390/cio: add CRW inject functionality 2021-03-22 11:36:04 +01:00
ioasm.h s390: assume diag308 set always works 2018-04-10 07:38:59 +02:00
isc.c s390: cio: add SPDX identifiers to the remaining files 2017-11-24 14:28:41 +01:00
itcw.c s390/cio: fix kernel-doc usage 2018-02-05 07:34:52 +01:00
orb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qdio.h s390/qdio: let driver manage the QAOB 2021-03-22 11:36:05 +01:00
qdio_debug.c s390/qdio: inline qdio_kick_handler() 2021-02-13 17:17:55 +01:00
qdio_debug.h s390/qdio: cleanly split alloc and establish 2020-04-06 13:13:50 +02:00
qdio_main.c s390/qdio: let driver manage the QAOB 2021-03-22 11:36:05 +01:00
qdio_setup.c s390/qdio: let driver manage the QAOB 2021-03-22 11:36:05 +01:00
qdio_thinint.c s390/qdio: track time of last data IRQ for each device 2021-02-09 15:57:04 +01:00
scm.c bus_find_device: Unify the match callback with class_find_device 2019-06-24 05:22:31 +02:00
trace.c s390/cio: Remove tracing for rchp instruction 2019-05-08 15:01:22 +02:00
trace.h s390/cio: Remove tracing for rchp instruction 2019-05-08 15:01:22 +02:00
vfio_ccw_async.c vfio-ccw: make vfio_ccw_async_region_ops static 2019-07-29 18:05:03 +02:00
vfio_ccw_chp.c vfio-ccw: Fix a build error due to missing include of linux/slab.h 2020-07-03 11:41:31 +02:00
vfio_ccw_cp.c vfio-ccw: Check initialized flag in cp_init() 2021-05-12 12:59:50 +02:00
vfio_ccw_cp.h vfio-ccw: Refactor how the traces are built 2019-10-17 11:35:56 +02:00
vfio_ccw_drv.c vfio-ccw: Serialize FSM IDLE state with I/O completion 2021-05-12 12:59:50 +02:00
vfio_ccw_fsm.c vfio-ccw: Reset FSM state to IDLE inside FSM 2021-05-12 12:59:50 +02:00
vfio_ccw_ops.c vfio-ccw: Reset FSM state to IDLE inside FSM 2021-05-12 12:59:50 +02:00
vfio_ccw_private.h vfio-ccw: Wire in the request callback 2020-12-03 16:21:08 -07:00
vfio_ccw_trace.c vfio-ccw: Add trace for CRW event 2020-06-03 11:28:19 +02:00
vfio_ccw_trace.h vfio-ccw: Add trace for CRW event 2020-06-03 11:28:19 +02:00