All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"julien@xen.org" <julien@xen.org>,
	"sstabellini@kernel.org" <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Artem Mygaiev <Artem_Mygaiev@epam.com>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Rahul Singh <rahul.singh@arm.com>
Subject: Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure
Date: Mon, 14 Feb 2022 09:47:07 +0100	[thread overview]
Message-ID: <YgoXC8vJvsz4lwBM@Air-de-Roger> (raw)
In-Reply-To: <6905d6ab-e435-fb65-2e93-446644b69b82@epam.com>

On Mon, Feb 14, 2022 at 06:33:07AM +0000, Oleksandr Andrushchenko wrote:
> 
> 
> On 11.02.22 17:44, Roger Pau Monné wrote:
> > On Fri, Feb 11, 2022 at 12:13:38PM +0000, Oleksandr Andrushchenko wrote:
> >>
> >> On 11.02.22 13:40, Roger Pau Monné wrote:
> >>> On Fri, Feb 11, 2022 at 07:27:39AM +0000, Oleksandr Andrushchenko wrote:
> >>>> Hi, Roger!
> >>>>
> >>>> On 10.02.22 18:16, Roger Pau Monné wrote:
> >>>>> On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote:
> >>>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> >>>>>>
> >>>>>> Introduce a per-domain read/write lock to check whether vpci is present,
> >>>>>> so we are sure there are no accesses to the contents of the vpci struct
> >>>>>> if not. This lock can be used (and in a few cases is used right away)
> >>>>>> so that vpci removal can be performed while holding the lock in write
> >>>>>> mode. Previously such removal could race with vpci_read for example.
> >>>>> Sadly there's still a race in the usage of pci_get_pdev_by_domain wrt
> >>>>> pci_remove_device, and likely when vPCI gets also used in
> >>>>> {de}assign_device I think.
> >>>> Yes, this is indeed an issue, but I was not trying to solve it in
> >>>> context of vPCI locking yet. I think we should discuss how do
> >>>> we approach pdev locking, so I can create a patch for that.
> >>>> that being said, I would like not to solve pdev in  this patch yet
> >>>>
> >>>> ...I do understand we do want to avoid that, but at the moment
> >>>> a single reliable way for making sure pdev is alive seems to
> >>>> be pcidevs_lock....
> >>> I think we will need to make pcidevs_lock a rwlock and take it in read
> >>> mode for pci_get_pdev_by_domain.
> >>>
> >>> We didn't have this scenario before where PCI emulation is done in the
> >>> hypervisor, and hence the locking around those data structures has not
> >>> been designed for those use-cases.
> >> Yes, I do understand that.
> >> I hope pcidevs lock move to rwlock can be done as a separate
> >> patch. While this is not done, do you think we can proceed with
> >> vPCI series and pcidevs locking re-work being done after?
> > Ideally we would like to sort out the locking once and for all. I
> > would like to be sure that what we introduce now doesn't turn out to
> > interact badly when we decide to look at the pcidevs locking issue.
> Ok, so I'll start converting pcidevs into rwlock then

Sorry, maybe I didn't express myself correctly, since the current
series doesn't lead to a functional implementation of vPCI for domUs I
would be fine with postponing the locking work, as long as the
currently introduced code doesn't make it any worse or extend the
locking scheme into new paths, but maybe that's not very helpful.

Thanks, Roger.


  reply	other threads:[~2022-02-14  8:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 13:36 [PATCH] vpci: introduce per-domain lock to protect vpci structure Oleksandr Andrushchenko
2022-02-10 16:16 ` Roger Pau Monné
2022-02-11  7:27   ` Oleksandr Andrushchenko
2022-02-11 11:40     ` Roger Pau Monné
2022-02-11 12:13       ` Oleksandr Andrushchenko
2022-02-11 15:44         ` Roger Pau Monné
2022-02-14  6:33           ` Oleksandr Andrushchenko
2022-02-14  8:47             ` Roger Pau Monné [this message]
2022-02-14  8:53               ` Oleksandr Andrushchenko
2022-02-14  9:36       ` Oleksandr Andrushchenko
2022-02-14 10:34         ` Roger Pau Monné
2022-02-14 10:53           ` Oleksandr Andrushchenko
2022-02-14 11:11             ` Roger Pau Monné
2022-02-14 11:15               ` Oleksandr Andrushchenko
2022-02-14 11:25                 ` Roger Pau Monné
2022-02-14 11:37                   ` Oleksandr Andrushchenko
2022-02-14 12:57                     ` Jan Beulich
2022-02-14 13:13                       ` Oleksandr Andrushchenko
2022-02-14 13:22                         ` Jan Beulich
2022-02-14 13:27                           ` Oleksandr Andrushchenko
2022-02-14 13:48                             ` Jan Beulich
2022-02-14 14:00                               ` Oleksandr Andrushchenko
2022-02-14 14:09                                 ` Jan Beulich
2022-02-15  8:30                                 ` Roger Pau Monné
2022-02-15  8:39                                   ` Oleksandr Andrushchenko
2022-02-11  8:46   ` Oleksandr Andrushchenko
2022-02-11 11:51     ` Roger Pau Monné
2022-02-11 12:14       ` Oleksandr Andrushchenko
2022-02-14 14:19 ` Jan Beulich
2022-02-14 14:26   ` Oleksandr Andrushchenko
2022-02-14 14:31     ` Jan Beulich
2022-02-14 14:34       ` Oleksandr Andrushchenko

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=YgoXC8vJvsz4lwBM@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=Artem_Mygaiev@epam.com \
    --cc=Oleksandr_Andrushchenko@epam.com \
    --cc=Oleksandr_Tyshchenko@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=rahul.singh@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.