From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
Stewart Hildebrand <stewart.hildebrand@amd.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v6 2/3] xen/pci: introduce PF<->VF links
Date: Tue, 5 Nov 2024 10:08:15 +0100 [thread overview]
Message-ID: <ZyngfwQYZTFfwqlp@macbook> (raw)
In-Reply-To: <D5DDABNKHN42.1HD2T6NV99J51@cloud.com>
On Mon, Nov 04, 2024 at 11:45:05AM +0000, Alejandro Vallejo wrote:
> On Sat Nov 2, 2024 at 3:18 PM GMT, Daniel P. Smith wrote:
> > On 11/1/24 16:16, Stewart Hildebrand wrote:
> > > +Daniel (XSM mention)
> > >
> > > On 10/28/24 13:02, Jan Beulich wrote:
> > >> On 18.10.2024 22:39, Stewart Hildebrand wrote:
> > >>> Add links between a VF's struct pci_dev and its associated PF struct
> > >>> pci_dev. Move the calls to pci_get_pdev()/pci_add_device() down to avoid
> > >>> dropping and re-acquiring the pcidevs_lock().
> > >>>
> > >>> During PF removal, unlink VF from PF and mark the VF broken. As before,
> > >>> VFs may exist without a corresponding PF, although now only with
> > >>> pdev->broken = true.
> > >>>
> > >>> The hardware domain is expected to remove the associated VFs before
> > >>> removing the PF. Print a warning in case a PF is removed with associated
> > >>> VFs still present.
> > >>>
> > >>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> > >>> ---
> > >>> Candidate for backport to 4.19 (the next patch depends on this one)
> > >>>
> > >>> v5->v6:
> > >>> * move printk() before ASSERT_UNREACHABLE()
> > >>> * warn about PF removal with VFs still present
> > >>
> > >> Hmm, maybe I didn't make this clear enough when commenting on v5: I wasn't
> > >> just after an adjustment to the commit message. I'm instead actively
> > >> concerned of the resulting behavior. Question is whether we can reasonably
> > >> do something about that.
> > >>
> > >> Jan
> > >
> > > Right. My suggestion then is to go back to roughly how it was done in
> > > v4 [0]:
> > >
> > > * Remove the VFs right away during PF removal, so that we don't end up
> > > with stale VFs. Regarding XSM, assume that a domain with permission to
> > > remove the PF is also allowed to remove the VFs. We should probably also
> > > return an error from pci_remove_device in the case of removing the PF
> > > with VFs still present (and still perform the removals despite returning
> > > an error). Subsequent attempts by a domain to remove the VFs would
> > > return an error (as they have already been removed), but that's expected
> > > since we've taken a stance that PF-then-VF removal order is invalid
> > > anyway.
> >
> > I am not confident this is a safe assumption. It will likely be safe for
> > probably 99% of the implementations. Apologies for not following
> > closely, and correct me if I am wrong here, but from a resource
> > perspective each VF can appear to the system as its own unique BDF and
> > so I am fairly certain it would be possible to uniquely label each VF.
> > For instance in the SVP architecture, the VF may be labeled to restrict
> > control to a hardware domain within a Guest Virtual Platform while the
> > PF may be restricted to the Supervisor Virtual Platform. In this
> > scenario, the Guest would be torn down before the Supervisor so the VF
> > should get released before the PF. But it's all theoretical, so I have
> > no real implementation to point at that this could be checked/confirmed.
> >
> > I am only raising this for awareness and not as an objection. If people
> > want to punt that theoretical use case down the road until someone
> > actually attempts it, I would not be opposed.
>
> Wouldn't it stand to reason then to act conditionally on the authority of the
> caller?
>
> i.e: If the caller has the (XSM-checked) authority to remove _BOTH_ PF and
> VFs, remove all. If it doesn't have authority to remove the VFs then early exit
> with an error, leaving the PF behind as well.
I'm unsure if it makes sense to have an entity that's allowed to issue
a pci_remove_device() against a PF, but not against the VFs of the
device.
The owner of the PF should be capable of disabling SR-IOV, at which
point all the VFs disappear from the PCI config space. If such entity
is capable of controlling the SR-IOV capability, it should also be
able to issue pci_remove_device() calls against the VFs.
Thanks, Roger.
next prev parent reply other threads:[~2024-11-05 9:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 20:39 [PATCH v6 0/3] xen: SR-IOV fixes Stewart Hildebrand
2024-10-18 20:39 ` [PATCH v6 1/3] x86/msi: harden stale pdev handling Stewart Hildebrand
2024-10-28 16:58 ` Jan Beulich
2024-10-28 17:53 ` Roger Pau Monné
2024-10-31 11:29 ` Jan Beulich
2024-10-18 20:39 ` [PATCH v6 2/3] xen/pci: introduce PF<->VF links Stewart Hildebrand
2024-10-28 17:02 ` Jan Beulich
2024-11-01 20:16 ` Stewart Hildebrand
2024-11-02 15:18 ` Daniel P. Smith
2024-11-04 11:45 ` Alejandro Vallejo
2024-11-05 9:08 ` Roger Pau Monné [this message]
2024-11-06 16:20 ` Daniel P. Smith
2024-11-06 17:04 ` Daniel P. Smith
2024-11-05 9:03 ` Roger Pau Monné
2024-11-06 16:31 ` Daniel P. Smith
2024-11-04 7:44 ` Jan Beulich
2024-11-07 14:32 ` Stewart Hildebrand
2024-11-08 12:42 ` Alejandro Vallejo
2024-11-08 13:17 ` Jan Beulich
2024-11-08 15:19 ` Roger Pau Monné
2024-11-08 16:29 ` Stewart Hildebrand
2024-11-11 6:40 ` Jan Beulich
2024-11-12 9:05 ` Roger Pau Monné
2024-10-28 18:41 ` Roger Pau Monné
2024-11-11 20:07 ` Stewart Hildebrand
2024-11-12 9:02 ` Roger Pau Monné
2024-11-12 9:39 ` Jan Beulich
2024-11-12 17:41 ` Stewart Hildebrand
2024-11-12 9:42 ` Jan Beulich
2024-10-18 20:39 ` [PATCH v6 3/3] x86/msi: fix locking for SR-IOV devices Stewart Hildebrand
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=ZyngfwQYZTFfwqlp@macbook \
--to=roger.pau@citrix.com \
--cc=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=dpsmith@apertussolutions.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--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.