Re: [PATCH] pciehp: fast unplug for virtual machines

Michael S. Tsirkin
2021-11-14T22:37:48Z

On Sun, Nov 14, 2021 at 07:06:04PM +0100, Lukas Wunner wrote:
> On Sun, Nov 14, 2021 at 12:24:43PM -0500, Michael S. Tsirkin wrote:
> > On Sun, Nov 14, 2021 at 05:39:58PM +0100, Lukas Wunner wrote:
> > > Why does virtual hardware implement the Attention Button if it's
> > > perceived as annoying? Just amend qemu so that it doesn't advertise
> > > presence of an Attention Button to get rid of the delay. (Clear the
> > > Attention Button Present bit in the Slot Capabilities register.)
> >
> > Because we want ability to request device removal from outside the
> > guest.
>
> Please elaborate. Does "outside the guest" mean on the host?
> How do you represent the Attention Button outside the guest
> and route events through to the guest?

The usual way, using kvm ioctls.

>
> > > An Attention Button doesn't make any sense for virtual hardware
> > > except to test or debug support for it in the kernel. Just make
> > > presence of the Attention Button optional and be done with it.
> > >
> > > You'll still be able to bring down the slot in software via the
> > > "remove" attribute in sysfs.
> >
> > This requires guest specific code though. Emulating the attention button
> > works in a guest independent way.
>
> It sounds like you're using the Attention Button because it does
> almost, but not quite what you want for your specific use case.
> Now you're trying to change its behavior in a way that deviates
> from the spec to align it with your use case.
>
> Why don't you just trigger surprise-removal from outside the guest?
>
> Thanks,
>
> Lukas

Because linux does not handle it well for all devices. Fixing that
requires fixing all drivers.

--
MST