All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger@xenproject.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Teddy Astie <teddy.astie@vates.tech>
Subject: Re: [PATCH 4/4] x86: tighten PCI-related locking assertions
Date: Tue, 17 Nov 2026 12:11:42 +0100	[thread overview]
Message-ID: <03d0cc4d-98b9-485d-a720-cecd792e113d@suse.com> (raw)
In-Reply-To: <avwvcs256XUGxVOc@Mac.lan>

On 17.11.2026 11:41, Roger Pau Monné wrote:
> On Thu, Oct 29, 2026 at 03:25:04PM +0100, Jan Beulich wrote:
>> With recent changes the .pi_update_irte() hook as well as
>> {,un}map_domain_pirq() and allocate_and_map_msi_pirq() won't be called
>> anymore with the global PCI lock held. Convert the assertions to check for
>> just the domain's PCI lock.
>>
>> With that the somewhat ugly ASSERT_PDEV_LIST_IS_READ_LOCKED() isn't used
>> outside of msi.c anymore, so move the #define there.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Roger Pau Monné <roger@xenproject.org>

Thanks. I'm a bit puzzled about your further remarks, though.

> I agree about keeping a single ASSERT_PDEV_LIST_IS_READ_LOCKED()
> definitions and dropping the unneeded NDEBUG preprocessor conditional.

Here you look to agree with ...

>> ---
>> It being just two use sites which remain, we may want to do away with
>> ASSERT_PDEV_LIST_IS_READ_LOCKED() altogether. Thoughts?
> 
> IIRC the reason for having this expression was so it could be used
> everywhere to ensure the domain pdev list was somehow locked (either
> by pcidevs lock or the per-domain rwlock).
> 
> If we now have fine grained control over the locking it possibly makes
> no sense to keep it.
> 
>> (It also isn't
>> qite clear to me why its #define(s) sit inside an #ifdef: The expression
>> used ought to be fine to use also in release builds, as it looks.)

... this observation, just to ...

> Hm, I'm not sure.  It looks like the debug expression could be used in
> non-debug builds.

... voice uncertainty here. And then ...

>> --- a/xen/arch/x86/msi.c
>> +++ b/xen/arch/x86/msi.c
>> @@ -737,6 +737,19 @@ static uint64_t read_pci_mem_bar(const s
>>      return (addr & PCI_BASE_ADDRESS_MEM_MASK) + disp;
>>  }
>>  
>> +#ifndef NDEBUG
>> +/*
>> + * Check to ensure there will be no changes to the entries in d->pdev_list (but
>> + * not the contents of each entry).
>> + * This check is not suitable for protecting other state or critical regions.
>> + */
>> +#define ASSERT_PDEV_LIST_IS_READ_LOCKED(d)                               \
>> +        /* NB: d may be evaluated multiple times, or not at all */       \
>> +        ASSERT(pcidevs_locked() || ((d) && rw_is_locked(&(d)->pci_lock)))
>> +#else
>> +#define ASSERT_PDEV_LIST_IS_READ_LOCKED(d) ((void)(d))
>> +#endif
> 
> Maybe while moving it you can leave just the !NDEBUG variant?Q

... you again suggest doing what my remark was effectively suggesting as
well.

Jan


  reply	other threads:[~2026-11-17 11:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 14:22 [PATCH 0/4] x86: yet more PCI locking adjustments Jan Beulich
2026-10-29 14:23 ` [PATCH 1/4] x86/physdev: use less heavy locking in physdev_unmap_pirq() Jan Beulich
2026-11-17 10:29   ` Roger Pau Monné
2026-10-29 14:24 ` [PATCH 2/4] x86/IRQ: use less heavy locking in free_domain_pirqs() Jan Beulich
2026-11-17 10:31   ` Roger Pau Monné
2026-11-17 10:38     ` Jan Beulich
2026-11-17 11:35       ` Roger Pau Monné
2026-10-29 14:24 ` [PATCH 3/4] x86/MSI: drop redundant checking Jan Beulich
2026-11-17 10:34   ` Roger Pau Monné
2026-10-29 14:25 ` [PATCH 4/4] x86: tighten PCI-related locking assertions Jan Beulich
2026-11-17 10:41   ` Roger Pau Monné
2026-11-17 11:11     ` Jan Beulich [this message]
2026-11-17 11:27       ` Roger Pau Monné

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=03d0cc4d-98b9-485d-a720-cecd792e113d@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger@xenproject.org \
    --cc=sstabellini@kernel.org \
    --cc=teddy.astie@vates.tech \
    --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.