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

Re: [PATCH v6 03/13] vpci: move lock outside of struct vpci


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 7 Feb 2022 15:27:18 +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=ujlmL1pGk3S5HXxSrKv59ZMnBRiLBJ2kraMVbrRGEXQ=; b=QXoJuuKhIlSPrzle6KJWmsDYq8zbbqmnpQ1UIcxNsdMFIc0y5yRFvfQCp8lf5YNr5QygS1NUTkYiBkjPNMmMMa7v6o7RrFG81TuRd/THGYEyQPrNznvZZO23oztaQgSy1Vy+5OabLr7/1Ha4D33ctJwJL1DOuh58SBTXlaihFWPYH+FurzM9kCMSzZ00K7d9VXRDBkd+yWbd+4xdyPn7ixH6/2EH0jHmgA3opCe5krU1Vx6HoyvfVoRC7usc/xRZ8Mi76AysBNX06YkcVsH2r7554M6QPRB6h+frW+09XQgSAza53IFQy4bWeb0R88J0Zz9NLujwzZfqzA2DIiUJJA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqW7AYAaymZiOJ14cMn5u4e7PRmvmWLMoWc3Go5tqOQ+mTCVkz7hxBpspC3BXKuu/edfdaxzytlsnmqNqu92qRK3Rx5T9SYJlvqsPYzSCcAOqKB7wKeqm0KSfuo6pGsuoEJWsBVQUyY0wXTvKuXP87A0OWrSOJm+I+lB+aOoDoUgcC8J6NXXXPerMi8ALpiSQTq+QL3USD6NTrtd03jMlLPhmdko29WK0lxfL67qzc6MyKNUcGP9JZDY1Eww07OflzMQRYfY3Fy7mi90UMfoFEt9qaL0c69yHX2Fg9ktM7YqtKeWkgYLGNwKvXrXdi6p+WHqen7/W63tAV7UPGXR4w==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 07 Feb 2022 14:27:41 +0000
  • Ironport-data: A9a23:MWvY2qt1NkAD04akEkyZZavbLufnVHVYMUV32f8akzHdYApBsoF/q tZmKT3SOPqLajT8f9lzbYm3oUsCvsfcm9JnHgdq+y4wESoW+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHdJZS5LwbZj2NYy2YfhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NplubztVkA3YfL3lroiTUdiFyJYYYpC5+qSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 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0zvnkehTMYR39jtpZ+4V0/qbhQbaDC1z3dGwT
  • Ironport-sdr: fnEeB445qKt3BUhMj0eHj9yx63XTNsjF0dTqE3Rs2qgMOv0CZBak6WUIqzF/7QWHFeb9vGjW3B uGL/UQyb0LQdoL7vccENpSrldwXMkYuZAD0rB2Q5pZfUzcNwOuBKWBJM/sup3h5LwYpiSAVtrs e/TK5DKEmEhoIGQN+VPba2uJFv2AODXfgagTqYXpqg+fWUN7gZhCrMYx+fendzVovRWXTRvCBq mhW9a3cgQB6ee3Ll/HwXwu6i1RAJf2iSO/NcDfVFG1nFcGbDMIXHHAc3GfVnNFSYHPQ3iGD6Kn UrxlN4H6HqikliRIIbpKWfDg
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Feb 07, 2022 at 03:11:03PM +0100, Jan Beulich wrote:
> On 07.02.2022 14:53, Oleksandr Andrushchenko wrote:
> > On 07.02.22 14:46, Roger Pau Monné wrote:
> >> I think the per-domain rwlock seems like a good option. I would do
> >> that as a pre-patch.
> > It is. But it seems it won't solve the thing we started this adventure for:
> > 
> > With per-domain read lock and still ABBA in modify_bars (hope the below
> > is correctly seen with a monospace font):
> > 
> > cpu0: vpci_write-> d->RLock -> pdev1->lock ->                               
> >                    rom_write -> modify_bars: tmp (pdev2) ->lock
> > cpu1:        vpci_write-> d->RLock pdev2->lock -> cmd_write -> modify_bars: 
> > tmp (pdev1) ->lock
> > 
> > There is no API to upgrade read lock to write lock in modify_bars which 
> > could help,
> > so in both cases vpci_write should take write lock.
> 
> Hmm, yes, I think you're right: It's not modify_bars() itself which needs
> to acquire the write lock, but its (perhaps indirect) caller. Effectively
> vpci_write() would need to take the write lock if the range written
> overlaps the BARs or the command register.

I'm confused. If we use a per-domain rwlock approach there would be no
need to lock tmp again in modify_bars, because we should hold the
rwlock in write mode, so there's no ABBA?

We will have however to drop the per domain read and vpci locks and
pick the per-domain lock in write mode.

Thanks, Roger.



 


Rackspace

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