From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"julien@xen.org" <julien@xen.org>,
"sstabellini@kernel.org" <sstabellini@kernel.org>,
Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Artem Mygaiev <Artem_Mygaiev@epam.com>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Rahul Singh <rahul.singh@arm.com>
Subject: Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure
Date: Mon, 14 Feb 2022 11:34:10 +0100 [thread overview]
Message-ID: <YgowIg5MvTaf2zsR@Air-de-Roger> (raw)
In-Reply-To: <33fb1095-64ed-29ef-ba6b-cbde21d941f8@epam.com>
On Mon, Feb 14, 2022 at 09:36:39AM +0000, Oleksandr Andrushchenko wrote:
>
>
> On 11.02.22 13:40, Roger Pau Monné wrote:
> > +
> >>>> for ( i = 0; i < msix->max_entries; i++ )
> >>>> {
> >>>> const struct vpci_msix_entry *entry = &msix->entries[i];
> >>> Since this function is now called with the per-domain rwlock read
> >>> locked it's likely not appropriate to call process_pending_softirqs
> >>> while holding such lock (check below).
> >> You are right, as it is possible that:
> >>
> >> process_pending_softirqs -> vpci_process_pending -> read_lock
> >>
> >> Even more, vpci_process_pending may also
> >>
> >> read_unlock -> vpci_remove_device -> write_lock
> >>
> >> in its error path. So, any invocation of process_pending_softirqs
> >> must not hold d->vpci_rwlock at least.
> >>
> >> And also we need to check that pdev->vpci was not removed
> >> in between or *re-created*
> >>> We will likely need to re-iterate over the list of pdevs assigned to
> >>> the domain and assert that the pdev is still assigned to the same
> >>> domain.
> >> So, do you mean a pattern like the below should be used at all
> >> places where we need to call process_pending_softirqs?
> >>
> >> read_unlock
> >> process_pending_softirqs
> >> read_lock
> >> pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn);
> >> if ( pdev && pdev->vpci && is_the_same_vpci(pdev->vpci) )
> >> <continue processing>
> > Something along those lines. You likely need to continue iterate using
> > for_each_pdev.
> How do we tell if pdev->vpci is the same? Jan has already brought
> this question before [1] and I was about to use some ID for that purpose:
> pdev->vpci->id = d->vpci_id++ and then we use pdev->vpci->id for checks
Given this is a debug message I would be OK with just doing the
minimal checks to prevent Xen from crashing (ie: pdev->vpci exists)
and that the resume MSI entry is not past the current limit. Otherwise
just print a message and move on to the next device.
The recreating of pdev->vpci only occurs as a result of some admin
operations, and doing it while also trying to print the current MSI
status is not a reliable approach. So dumping an incomplete or
incoherent state as a result of ongoing admin operations would be
fine.
Thanks, Roger.
next prev parent reply other threads:[~2022-02-14 10:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 13:36 [PATCH] vpci: introduce per-domain lock to protect vpci structure Oleksandr Andrushchenko
2022-02-10 16:16 ` Roger Pau Monné
2022-02-11 7:27 ` Oleksandr Andrushchenko
2022-02-11 11:40 ` Roger Pau Monné
2022-02-11 12:13 ` Oleksandr Andrushchenko
2022-02-11 15:44 ` Roger Pau Monné
2022-02-14 6:33 ` Oleksandr Andrushchenko
2022-02-14 8:47 ` Roger Pau Monné
2022-02-14 8:53 ` Oleksandr Andrushchenko
2022-02-14 9:36 ` Oleksandr Andrushchenko
2022-02-14 10:34 ` Roger Pau Monné [this message]
2022-02-14 10:53 ` Oleksandr Andrushchenko
2022-02-14 11:11 ` Roger Pau Monné
2022-02-14 11:15 ` Oleksandr Andrushchenko
2022-02-14 11:25 ` Roger Pau Monné
2022-02-14 11:37 ` Oleksandr Andrushchenko
2022-02-14 12:57 ` Jan Beulich
2022-02-14 13:13 ` Oleksandr Andrushchenko
2022-02-14 13:22 ` Jan Beulich
2022-02-14 13:27 ` Oleksandr Andrushchenko
2022-02-14 13:48 ` Jan Beulich
2022-02-14 14:00 ` Oleksandr Andrushchenko
2022-02-14 14:09 ` Jan Beulich
2022-02-15 8:30 ` Roger Pau Monné
2022-02-15 8:39 ` Oleksandr Andrushchenko
2022-02-11 8:46 ` Oleksandr Andrushchenko
2022-02-11 11:51 ` Roger Pau Monné
2022-02-11 12:14 ` Oleksandr Andrushchenko
2022-02-14 14:19 ` Jan Beulich
2022-02-14 14:26 ` Oleksandr Andrushchenko
2022-02-14 14:31 ` Jan Beulich
2022-02-14 14:34 ` Oleksandr Andrushchenko
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=YgowIg5MvTaf2zsR@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=Artem_Mygaiev@epam.com \
--cc=Oleksandr_Andrushchenko@epam.com \
--cc=Oleksandr_Tyshchenko@epam.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=rahul.singh@arm.com \
--cc=sstabellini@kernel.org \
--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.