[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 14 Feb 2022 09:47:07 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kGCVuJ1wF5D/hUbD2805DTVSD6WhajzxFCZ9JVtj7pY=; b=EIj2foSZPOP6CmAUCtp9U3e3rAsQjLjLq74xPeONQJ0XMz6I49k78xl2XE4PNFTV7WwjRH6ilaiGHpApDODF479jgNYC8w1iPDB+Y81jQ+fHjzCVBu7D4g9hN0zLH8rVSC60UXf+mbLp6KVGzl/BJMpIOyP0I8z0vyTbjxeMDjypEMGrdRsV5YBge3WJY3Su7CANUgPmLeBEn/MbO67V/tPcWVhMmNTE1jbA1MjIVD2RctB/wixeIj+QwT88+ZfRnuBBk2uuRrJ71OH4Oj8r557JYyq6jBg6N2Qdc9hg3Ys1ryVHwzy3OnqM2HOBT0YoZkPe0PQrBmGkLV3Biz1S3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jGfiT0hy+C4I3lvv2oEJbyKSNquHRnG9t735RMAfMnHU3mEqwf5q7O3On3S0b+cqmlDChkhmLknWdJo1OVeMOMX6mL673Q3FnscNGMtveW+tE8PjxogCacW14z13H5cSigbcDv4xFwUKI1zb5AXwpca8PuXCIB/6EBwlEkMa/J1nD/h0wM/N6UAL2CKnUPVvqwrSc58iAbkAoKzh4x/vTXA2A+WfQ1ng6vR4jzw2PW+AbHuoynB7Huhwc8OlLm8jfsA20qE4weO6Bqwh0v35yTuO2tKbkWyW3vkBoeQg5Aq9TFK9oSmZ9VsGIvLxk+1Kzqrvn7ckp8KKcFrY5ptDJw==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • Delivery-date: Mon, 14 Feb 2022 08:48:11 +0000
  • Ironport-data: A9a23:Qa268q+4i6/NNqvXpKY8DrUDjniTJUtcMsCJ2f8bNWPcYEJGY0x3z DcaWjvQP6mLN2LweN93YNvk/E8FvZ7Tz9FrHlE/+3o8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7Rg3tYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhel ohvtqSLSDx2N/CRu/tHXUliMC9XaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcGgG5r2pATQJ4yY eIicCZEbjHAeCddJ2pH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s6Dlk849jVdzwXjEzfm97pdK2VtxXW0pyioaVQ4y68qTxkEjjPeHsFso4+3ReVjYXXew1 A1LZZr+qoSL2t+OsiuO28+XM9ybSJX3QzGRn7CUmhpk70wn4HY5FTxe5ouY8yO2nlpUJRv/pQa Gb1eZvqPOln8AktZ4JxDZip7
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
> >>>>>>
> >>>>>> 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.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.