All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Behr <dbehr@chromium.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Grzegorz Jaszczyk <jaz@semihalf.com>,
	linux-kernel@vger.kernel.org, dmy@semihalf.com, tn@semihalf.com,
	upstream@semihalf.com, dtor@google.com, jgg@ziepe.ca,
	kevin.tian@intel.com, cohuck@redhat.com, abhsahu@nvidia.com,
	yishaih@nvidia.com, yi.l.liu@intel.com, kvm@vger.kernel.org,
	Dominik Behr <dbehr@chromium.org>,
	libvir-list@redhat.com
Subject: Re: [PATCH] vfio/pci: Propagate ACPI notifications to the user-space
Date: Wed, 8 Mar 2023 10:45:51 -0800	[thread overview]
Message-ID: <CABUrSUD6hE=h3-Ho7L_J=OYeRUw_Bmg9o4fuw591iw9QyBQv9A@mail.gmail.com> (raw)
In-Reply-To: <20230308104944.578d503c.alex.williamson@redhat.com>

On Wed, Mar 8, 2023 at 9:49 AM Alex Williamson
<alex.williamson@redhat.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.

  reply	other threads:[~2023-03-08 18:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 22:05 [PATCH] vfio/pci: Propagate ACPI notifications to the user-space Grzegorz Jaszczyk
2023-03-07 23:41 ` Alex Williamson
2023-03-08  8:11   ` Tian, Kevin
2023-03-08 11:41   ` Grzegorz Jaszczyk
2023-03-08 17:49     ` Alex Williamson
2023-03-08 18:45       ` Dominik Behr [this message]
2023-03-08 20:06         ` Alex Williamson
2023-03-08 22:44           ` Dominik Behr
2023-03-08 23:38             ` Alex Williamson
2023-03-09  1:51               ` Dominik Behr
2023-03-09 18:25                 ` Jason Gunthorpe
2023-03-09 13:41               ` Grzegorz Jaszczyk
2023-03-22  9:47                 ` Grzegorz Jaszczyk
2023-03-23 17:07                 ` Alex Williamson
2023-03-24 12:29                   ` Grzegorz Jaszczyk
2023-03-08 14:40 ` kernel test robot

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='CABUrSUD6hE=h3-Ho7L_J=OYeRUw_Bmg9o4fuw591iw9QyBQv9A@mail.gmail.com' \
    --to=dbehr@chromium.org \
    --cc=abhsahu@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=dmy@semihalf.com \
    --cc=dtor@google.com \
    --cc=jaz@semihalf.com \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=libvir-list@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tn@semihalf.com \
    --cc=upstream@semihalf.com \
    --cc=yi.l.liu@intel.com \
    --cc=yishaih@nvidia.com \
    /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.