|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/4] x86: tighten PCI-related locking assertions
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@xxxxxxxx>
>
> Acked-by: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |