[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABUrSUD6hE=h3-Ho7L_J=OYeRUw_Bmg9o4fuw591iw9QyBQv9A@mail.gmail.com>
Date: Wed, 8 Mar 2023 10:45:51 -0800
From: Dominik Behr <dbehr@...omium.org>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: Grzegorz Jaszczyk <jaz@...ihalf.com>, linux-kernel@...r.kernel.org,
dmy@...ihalf.com, tn@...ihalf.com, upstream@...ihalf.com,
dtor@...gle.com, jgg@...pe.ca, kevin.tian@...el.com,
cohuck@...hat.com, abhsahu@...dia.com, yishaih@...dia.com,
yi.l.liu@...el.com, kvm@...r.kernel.org,
Dominik Behr <dbehr@...omium.org>, libvir-list@...hat.com
Subject: Re: [PATCH] vfio/pci: Propagate ACPI notifications to the user-space
On Wed, Mar 8, 2023 at 9:49 AM Alex Williamson
<alex.williamson@...hat.com> wrote:
> Adding libvirt folks. This intentionally designs the interface in a
> way that requires a privileged intermediary to monitor netlink on the
> host, associate messages to VMs based on an attached device, and
> re-inject the event to the VMM. Why wouldn't we use a channel
> associated with the device for such events, such that the VMM has
> direct access? The netlink path seems like it has more moving pieces,
> possibly scalability issues, and maybe security issues?
It is the same interface as other ACPI events like AC adapter LID etc
are forwarded to user-space.
ACPI events are not particularly high frequency like interrupts.
> > > What sort of ACPI events are we expecting to see here and what does user space do with them?
The use we are looking at right now are D-notifier events about the
GPU power available to mobile discrete GPUs.
The firmware notifies the GPU driver and resource daemon to
dynamically adjust the amount of power that can be used by the GPU.
> The proposed interface really has no introspection, how does the VMM
> know which devices need ACPI tables added "upfront"? How do these
> events factor into hotplug device support, where we may not be able to
> dynamically inject ACPI code into the VM?
The VMM can examine PCI IDs and the associated firmware node of the
PCI device to figure out what events to expect and what ACPI table to
generate to support it but that should not be necessary.
A generic GPE based ACPI event forwarder as Grzegorz proposed can be
injected at VM init time and handle any notification that comes later,
even from hotplug devices.
> The acpi_bus_generate_netlink_event() below really only seems to form a
> u8 event type from the u32 event. Is this something that could be
> provided directly from the vfio device uAPI with an ioeventfd, thus
> providing introspection that a device supports ACPI event notifications
> and the ability for the VMM to exclusively monitor those events, and
> only those events for the device, without additional privileges?
>From what I can see these events are 8 bit as they come from ACPI.
They also do not carry any payload and it is up to the receiving
driver to query any additional context/state from the device.
This will work the same in the VM where driver can query the same
information from the passed through PCI device.
There are multiple other netflink based ACPI events forwarders which
do exactly the same thing for other devices like AC adapter, lid/power
button, ACPI thermal notifications, etc.
They all use the same mechanism and can be received by user-space
programs whether VMMs or others.
Powered by blists - more mailing lists