kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineeth Vijayan <vneethv@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Eric Farman <farman@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Christoph Hellwig <hch@lst.de>,
	Leon Romanovsky <leonro@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Tarun Gupta <targupta@nvidia.com>
Subject: Re: s390 common I/O layer locking
Date: Tue, 4 May 2021 17:10:42 +0200	[thread overview]
Message-ID: <292442e8-3b1a-56c4-b974-05e8b358ba64@linux.ibm.com> (raw)
In-Reply-To: <20210503125440.0acd7c1f.cohuck@redhat.com>


On 5/3/21 12:54 PM, Cornelia Huck wrote:
> On Fri, 30 Apr 2021 14:19:08 -0300
> Jason Gunthorpe <jgg@nvidia.com> wrote:
>
>> On Fri, Apr 30, 2021 at 02:31:40PM +0200, Cornelia Huck wrote:
>>> On Thu, 29 Apr 2021 15:13:47 -0300
>>> Jason Gunthorpe <jgg@nvidia.com> wrote:
>>>> All the checks for !private need some kind of locking. The driver core
>>>> model is that the 'struct device_driver' callbacks are all called
>>>> under the device_lock (this prevents the driver unbinding during the
>>>> callback). I didn't check if ccs does this or not..
>>> probe/remove/shutdown are basically a forward of the callbacks at the
>>> bus level.
>> These are all covered by device_lock
>>
>>> The css bus should make sure that we serialize
>>> irq/sch_event/chp_event with probe/remove.
>> Hum it doesn't look OK, like here:
>>
>> css_process_crw()
>>    css_evaluate_subchannel()
>>     sch = bus_find_device()
>>        -- So we have a refcount on the struct device
>>     css_evaluate_known_subchannel() {
>> 	if (sch->driver) {
>> 		if (sch->driver->sch_event)
>> 			ret = sch->driver->sch_event(sch, slow);
>>     }
>>
>> But the above call and touches to sch->driver (which is really just
>> sch->dev.driver) are unlocked and racy.
>>
>> I would hold the device_lock() over all touches to sch->driver outside
>> of a driver core callback.
> I think this issue did not come up much before, as most drivers on the
> css bus tend to stay put during the lifetime of the device; but yes, it
> seems we're missing some locking.
>
> For the css bus, we need locking for the event callbacks; for irq, this
> may interact with the subchannel lock and likely needs some care.
>
> I also looked at the other busses in the common I/O layer: scm looks
> good at a glance, ccwgroup and ccw have locking for online/offline; the
> other callbacks for the ccw drivers probably need to take the device
> lock as well.
>
> Common I/O layer maintainers, does that look right?
>
I just had a quick glance on the CIO layer drivers. And at first look, 
you are right.
It looks likewe need modifications in the event callbacks (referring css 
here)
Let me go thoughthis thoroughly and update.
Thank you.

  reply	other threads:[~2021-05-04 15:10 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 20:00 [PATCH v2 00/13] Remove vfio_mdev.c, mdev_parent_ops and more Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 01/13] vfio/mdev: Remove CONFIG_VFIO_MDEV_DEVICE Jason Gunthorpe
2021-04-27 11:05   ` Cornelia Huck
2021-04-26 20:00 ` [PATCH v2 02/13] vfio/mdev: Allow the mdev_parent_ops to specify the device driver to bind Jason Gunthorpe
2021-04-27 12:32   ` Cornelia Huck
2021-04-27 23:20     ` Jason Gunthorpe
2021-04-28  6:03   ` Christoph Hellwig
2021-04-28  7:56     ` Dan Williams
2021-04-28 12:41       ` Christoph Hellwig
2021-04-28 14:00         ` Jason Gunthorpe
2021-04-28 19:58           ` Dan Williams
2021-04-28 23:38             ` Jason Gunthorpe
2021-04-29  0:00               ` Dave Jiang
2021-05-26  0:42             ` Jason Gunthorpe
2021-05-26  1:42               ` Dan Williams
2021-05-27 11:44               ` Christoph Hellwig
2021-05-27 14:53                 ` Jason Gunthorpe
2021-05-27 15:13                   ` Christoph Hellwig
2021-04-29  6:51           ` Christoph Hellwig
2021-05-04  9:36           ` Christoph Hellwig
2021-05-04 11:30             ` Jason Gunthorpe
2021-04-28  6:44   ` Leon Romanovsky
2021-04-28 14:14     ` Jason Gunthorpe
2021-04-28 14:24       ` Leon Romanovsky
2021-04-26 20:00 ` [PATCH v2 03/13] vfio/mtty: Convert to use vfio_register_group_dev() Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 04/13] vfio/mdpy: " Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 05/13] vfio/mbochs: " Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 07/13] vfio/ccw: " Jason Gunthorpe
2021-04-27 20:06   ` Eric Farman
2021-04-27 22:10     ` Jason Gunthorpe
2021-04-28 12:55       ` Eric Farman
2021-04-28 13:21         ` Jason Gunthorpe
2021-04-28 17:09   ` Cornelia Huck
2021-04-28 17:20     ` Jason Gunthorpe
2021-04-29 11:58       ` Cornelia Huck
2021-04-29 18:13         ` Jason Gunthorpe
2021-04-30 12:31           ` Cornelia Huck
2021-04-30 17:19             ` Jason Gunthorpe
2021-05-03 10:54               ` s390 common I/O layer locking (was: [PATCH v2 07/13] vfio/ccw: Convert to use vfio_register_group_dev()) Cornelia Huck
2021-05-04 15:10                 ` Vineeth Vijayan [this message]
2021-07-24 13:24                   ` s390 common I/O layer locking Christoph Hellwig
2021-08-03 14:27                     ` Vineeth Vijayan
2021-08-10 15:00                       ` Cornelia Huck
2021-04-26 20:00 ` [PATCH v2 09/13] vfio/mdev: Remove vfio_mdev.c Jason Gunthorpe
2021-04-28  6:07   ` Christoph Hellwig
2021-04-28  6:36     ` Greg Kroah-Hartman
2021-04-28 12:53       ` Jason Gunthorpe
2021-04-29  6:53         ` Christoph Hellwig
2021-04-29  6:56           ` Greg Kroah-Hartman
2021-05-03 17:32             ` Jason Gunthorpe
2021-05-04  9:38               ` Christoph Hellwig
2021-05-04 16:20                 ` Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 10/13] vfio/mdev: Remove mdev_parent_ops dev_attr_groups Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 11/13] vfio/mdev: Remove mdev_parent_ops Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 12/13] vfio/mdev: Use the driver core to create the 'remove' file Jason Gunthorpe
2021-04-26 20:00 ` [PATCH v2 13/13] vfio/mdev: Remove mdev drvdata Jason Gunthorpe
2021-04-27 21:30 ` [PATCH v2 00/13] Remove vfio_mdev.c, mdev_parent_ops and more Alex Williamson
2021-04-27 22:20   ` Jason Gunthorpe
2021-04-27 22:49     ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=292442e8-3b1a-56c4-b974-05e8b358ba64@linux.ibm.com \
    --to=vneethv@linux.ibm.com \
    --cc=ashok.raj@intel.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=farman@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=targupta@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).