All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Kevin Tian <kevin.tian@intel.com>, Paul Durrant <paul@xen.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 1/8] IOMMU/x86: drop locking from quarantine_init() hooks
Date: Tue, 12 Apr 2022 14:17:16 +0200	[thread overview]
Message-ID: <5c09c09c-01b5-c020-5a8e-c0453e3b8fbe@suse.com> (raw)
In-Reply-To: <YlVc9shnBYKShLiP@Air-de-Roger>

On 12.04.2022 13:05, Roger Pau Monné wrote:
> On Mon, Apr 11, 2022 at 11:35:54AM +0200, Jan Beulich wrote:
>> Prior extension of these functions to enable per-device quarantine page
>> tables already didn't add more locking there, but merely left in place
>> what had been there before. But really locking is unnecessary here:
>> We're running with pcidevs_lock held (i.e. multiple invocations of the
>> same function [or their teardown equivalents] are impossible, and hence
>> there are no "local" races), while all consuming of the data being
>> populated here can't race anyway due to happening sequentially
>> afterwards. See also the comment in struct arch_pci_dev.
> 
> I would explicitly say that none of the code in the locked region
> touches any data in the domain_iommu struct, so taking the
> mapping_lock is unneeded.

But that would limit what the mapping_lock protects more than it actually
does: The entire page tables hanging off of the root table are also
protected by that lock. It's just that for a pdev, after having
installed identity mappings, the root doesn't hang off of hd. But in
principle - i.e. if the per-device mappings weren't static once created -
the lock would be the one to hold whenever any of these page tables was
modified.

> Long term we might wish to implemented a per-device lock that could be
> used here, instead of relying on the pcidevs lock.

Well, I would want to avoid this unless a need arises to not hold the
pcidevs lock here. Or, of course, if a need arose to dynamically alter
these page tables.

>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

Jan



  reply	other threads:[~2022-04-12 12:17 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  9:34 [PATCH 0/8] IOMMU: assorted follow-on to XSA-400 Jan Beulich
2022-04-11  9:35 ` [PATCH 1/8] IOMMU/x86: drop locking from quarantine_init() hooks Jan Beulich
2022-04-11 10:01   ` Andrew Cooper
2022-04-11 10:18     ` Jan Beulich
2022-04-12 13:14     ` Jan Beulich
2022-04-12 11:05   ` Roger Pau Monné
2022-04-12 12:17     ` Jan Beulich [this message]
2022-04-12 12:54       ` Roger Pau Monné
2022-04-12 13:12         ` Jan Beulich
2022-04-20  6:22   ` Tian, Kevin
2022-04-11  9:36 ` [PATCH 2/8] VT-d: drop ROOT_ENTRY_NR Jan Beulich
2022-04-12  8:20   ` Roger Pau Monné
2022-04-20  6:22   ` Tian, Kevin
2022-04-11  9:36 ` [PATCH 3/8] VT-d: plug memory leaks in iommu_alloc() Jan Beulich
2022-04-12  8:29   ` Roger Pau Monné
2022-04-20  6:23   ` Tian, Kevin
2022-04-11  9:37 ` [PATCH 4/8] VT-d: refuse to use IOMMU with reserved CAP.ND value Jan Beulich
2022-04-12  9:22   ` Roger Pau Monné
2022-04-12 10:35     ` Jan Beulich
2022-04-20  6:23   ` Tian, Kevin
2022-04-11  9:37 ` [PATCH 5/8] AMD/IOMMU: replace a few PCI_BDF2() Jan Beulich
2022-04-12  9:37   ` Roger Pau Monné
2022-04-11  9:38 ` [PATCH 6/8] IOMMU: log appropriate SBDF Jan Beulich
2022-04-12 10:05   ` Roger Pau Monné
2022-04-12 10:39     ` Jan Beulich
2022-04-11  9:40 ` [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2() Jan Beulich
2022-04-12 10:07   ` Roger Pau Monné
2022-04-13 13:48   ` Bertrand Marquis
2022-04-13 13:55     ` Jan Beulich
2022-04-13 13:58     ` Roger Pau Monné
2022-04-13 14:13       ` Bertrand Marquis
2022-04-13 14:38         ` Jan Beulich
2022-04-20  6:29   ` Tian, Kevin
2022-04-11  9:42 ` [PATCH 8/8] PCI: replace "secondary" flavors of PCI_{DEVFN,BDF,SBDF}() Jan Beulich
2022-04-12 10:49   ` Roger Pau Monné
2022-04-20  6:37   ` Tian, Kevin

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=5c09c09c-01b5-c020-5a8e-c0453e3b8fbe@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=kevin.tian@intel.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --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.