From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Stewart Hildebrand <stewart.hildebrand@amd.com>
Subject: Re: [PATCH v5 5/5] vPCI: re-init extended-capabilities when MMCFG availability changed
Date: Thu, 5 Mar 2026 11:20:34 +0100 [thread overview]
Message-ID: <aalY8t_2F0Pt5i3j@macbook.local> (raw)
In-Reply-To: <bb06fac8-43e7-4d9b-81b6-970066b8bb73@suse.com>
On Thu, Mar 05, 2026 at 10:45:29AM +0100, Jan Beulich wrote:
> On 05.03.2026 10:22, Roger Pau Monné wrote:
> > On Thu, Mar 05, 2026 at 10:00:13AM +0100, Jan Beulich wrote:
> >> On 04.03.2026 16:06, Roger Pau Monné wrote:
> >>> On Wed, Feb 25, 2026 at 12:44:44PM +0100, Jan Beulich wrote:
> >>>> When Dom0 informs us about MMCFG usability, this may change whether
> >>>> extended capabilities are available (accessible) for devices. Zap what
> >>>> might be on record, and re-initialize things.
> >>>>
> >>>> No synchronization is added for the case where devices may already be in
> >>>> use. That'll need sorting when (a) DomU support was added and (b) DomU-s
> >>>> may run already while Dom0 / hwdom still boots (dom0less, Hyperlaunch).
> >>>>
> >>>> vpci_cleanup_capabilities() also shouldn't have used
> >>>> pci_find_ext_capability(), as already when the function was introduced
> >>>> extended config space may not have been (properly) accessible anymore,
> >>>> no matter whether it was during init. Extended capability cleanup hooks
> >>>> need to cope with being called when the respective capability doesn't
> >>>> exist (and hence the corresponding ->init() hook was never called).
> >>>>
> >>>> Fixes: 70e6dace747e ("vpci: Use cleanup to free capability resource during deassign")
> >>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >>>> ---
> >>>> vpci_reinit_ext_capabilities()'es return value is checked only to log an
> >>>> error; it doesn't feel quite right to fail the hypercall because of this.
> >>>> Roger brought up the idea of de-assigning the device in such a case, but
> >>>> if a driver doesn't use extended capabilities the device would likely
> >>>> continue to work fine, for Dom0 this probably wouldn't be quite right
> >>>> anyway, and it's also unclear whether calling deassign_device() could be
> >>>> done from this context. Something like what pci_check_disable_device()
> >>>> does may be an option, if we really think we need to "break" the device.
> >>>
> >>> We may want to add a note there, stating that we have considered all
> >>> possible options, and hiding the capability and hoping the owner
> >>> domain would continue to work as expected seems the less bad of all of
> >>> them?
> >>
> >> While adding that note it occurred to me that in order to keep the device
> >> as functioning as possible, in the re-init case vpci_init_capabilities()
> >> might better not bail upon encountering a failure, but accumulate the
> >> error while continuing its loop in a best-effort manner. Thoughts? (One
> >> of the two return-s is already guarded by !is_hardware_domain(), so that
> >> could be left alone for the immediate purpose.)
> >
> > Right, yes, that would be preferable. We already print a message for
> > the failed to init capabilities, so there's no need to print another
> > one in the caller.
>
> Hmm, that's another aspect I didn't consider. Yes, the log message in the
> caller is redundant with the present code structure. If we expect that to
> remain like that, I can drop logging anything from
> physdev_check_pci_extcfg(). Which then re-raises the question whether
> vpci_reinit_ext_capabilities() might better return void. At which point
> the comment I put in physdev_check_pci_extcfg() (upon your request) would
> want to move there.
>
> But my earlier question went in a different direction, and you didn't
> comment on that at all.
Yes, I think we should accumulate errors. One device failing doesn't
mean the rest will also fail. We should continue the loop.
Thanks, Roger.
prev parent reply other threads:[~2026-03-05 10:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 11:41 [PATCH v5 0/5] vPCI: extended capability handling Jan Beulich
2026-02-25 11:43 ` [PATCH v5 1/5] vPCI: introduce private header Jan Beulich
2026-02-26 3:33 ` Stewart Hildebrand
2026-03-03 16:44 ` Roger Pau Monné
2026-03-03 16:48 ` Jan Beulich
2026-02-25 11:43 ` [PATCH v5 2/5] vPCI: move vpci_init_capabilities() to a separate file Jan Beulich
2026-02-25 11:43 ` [PATCH v5 3/5] vPCI: move capability-list init Jan Beulich
2026-02-25 11:44 ` [PATCH v5 4/5] vPCI/ReBAR: improve cleanup Jan Beulich
2026-03-04 13:46 ` Roger Pau Monné
2026-02-25 11:44 ` [PATCH v5 5/5] vPCI: re-init extended-capabilities when MMCFG availability changed Jan Beulich
2026-03-04 15:06 ` Roger Pau Monné
2026-03-04 15:39 ` Jan Beulich
2026-03-04 16:53 ` Roger Pau Monné
2026-03-05 8:40 ` Jan Beulich
2026-03-05 9:19 ` Roger Pau Monné
2026-03-05 9:00 ` Jan Beulich
2026-03-05 9:22 ` Roger Pau Monné
2026-03-05 9:45 ` Jan Beulich
2026-03-05 10:20 ` Roger Pau Monné [this message]
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=aalY8t_2F0Pt5i3j@macbook.local \
--to=roger.pau@citrix.com \
--cc=jbeulich@suse.com \
--cc=stewart.hildebrand@amd.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.