qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"marcandre.lureau@redhat.com" <marcandre.lureau@redhat.com>,
	"thuth@redhat.com" <thuth@redhat.com>,
	"bleal@redhat.com" <bleal@redhat.com>,
	"berrange@redhat.com" <berrange@redhat.com>,
	"eduardo@habkost.net" <eduardo@habkost.net>,
	"marcel.apfelbaum@gmail.com" <marcel.apfelbaum@gmail.com>,
	"eblake@redhat.com" <eblake@redhat.com>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>,
	"john.levon@nutanix.com" <john.levon@nutanix.com>,
	"thanos.makatos@nutanix.com" <thanos.makatos@nutanix.com>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"John Johnson" <john.g.johnson@oracle.com>,
	"Kanth Ghatraju" <kanth.ghatraju@oracle.com>,
	"Jag Raman" <jag.raman@oracle.com>
Subject: Re: [PATCH v8 15/17] vfio-user: handle device interrupts
Date: Thu, 5 May 2022 10:22:07 -0600	[thread overview]
Message-ID: <20220505102207.4aef06f6.alex.williamson@redhat.com> (raw)
In-Reply-To: <YmpkPIlq/V4rXSWj@stefanha-x1.localdomain>

On Thu, 28 Apr 2022 10:54:04 +0100
Stefan Hajnoczi <stefanha@redhat.com> wrote:

> On Mon, Apr 25, 2022 at 05:40:01PM +0000, Jag Raman wrote:
> > > On Apr 25, 2022, at 6:27 AM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> > > 
> > > On Tue, Apr 19, 2022 at 04:44:20PM -0400, Jagannathan Raman wrote:  
> > >> +static MSIMessage vfu_object_msi_prepare_msg(PCIDevice *pci_dev,
> > >> +                                             unsigned int vector)
> > >> +{
> > >> +    MSIMessage msg;
> > >> +
> > >> +    msg.address = 0;
> > >> +    msg.data = vector;
> > >> +
> > >> +    return msg;
> > >> +}
> > >> +
> > >> +static void vfu_object_msi_trigger(PCIDevice *pci_dev, MSIMessage msg)
> > >> +{
> > >> +    vfu_ctx_t *vfu_ctx = pci_dev->irq_opaque;
> > >> +
> > >> +    vfu_irq_trigger(vfu_ctx, msg.data);
> > >> +}  
> > > 
> > > Why did you switch to vfu_object_msi_prepare_msg() +
> > > vfu_object_msi_trigger() in this revision?  
> > 
> > We previously did not do this switch because the server didn’t get updates
> > to the MSIx table & PBA.
> > 
> > The latest client version (which is not part of this series) forwards accesses
> > to the MSIx table & PBA over to the server. It also reads the PBA set by the
> > server. These change make it possible for the server to make this switch.  
> 
> Interesting. That's different from kernel VFIO. Before vfio-user commits
> to a new approach it would be worth checking with Alex that he agrees
> with the design.
> 
> I remember sending an email asking about why VFIO MSI-X PBA does not
> offer the full semantics described in the PCIe spec but didn't get a
> response from Alex (Message-Id:
> YkMWp0lUJAHhivJA@stefanha-x1.localdomain).

IIUC, the question is why we redirect the MSI-X interrupt from the KVM
irqfd to be handled in QEMU when the vector is masked.  This is largely
to work around the fact that we haven't had a means to implement mask
and unmask in the kernel, therefore we leave the vector enabled and
only enable the emulated PBA if a masked vector fires.  This works
because nobody really cares about the PBA, nor operates in a mode where
vectors are masked and the PBA is polled.  Drivers that understand the
device likely have better places to poll for service requests than the
PBA.

Ideally, masking a vector would make use of the existing mask and
unmask uAPI via the SET_IRQS ioctl, but we haven't been able to
implement this due to lack of internal kernel APIs to support it.  We
may have those interfaces now, but lacking bandwidth, I haven't checked
recently and we seem to be getting by ok as is.  Thanks,

Alex



  reply	other threads:[~2022-05-05 16:48 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 20:44 [PATCH v8 00/17] vfio-user server in QEMU Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 01/17] tests/avocado: Specify target VM argument to helper routines Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 02/17] qdev: unplug blocker for devices Jagannathan Raman
2022-04-21 14:55   ` Markus Armbruster
2022-04-21 17:49     ` Jag Raman
2022-04-22  5:18       ` Markus Armbruster
2022-04-22 14:18         ` Jag Raman
2022-04-19 20:44 ` [PATCH v8 03/17] remote/machine: add HotplugHandler for remote machine Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 04/17] remote/machine: add vfio-user property Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 05/17] configure: require cmake 3.19 or newer Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 06/17] vfio-user: build library Jagannathan Raman
2022-04-25  8:22   ` Stefan Hajnoczi
2022-04-19 20:44 ` [PATCH v8 07/17] vfio-user: define vfio-user-server object Jagannathan Raman
2022-04-25  8:27   ` Stefan Hajnoczi
2022-04-19 20:44 ` [PATCH v8 08/17] vfio-user: instantiate vfio-user context Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 09/17] vfio-user: find and init PCI device Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 10/17] vfio-user: run vfio-user context Jagannathan Raman
2022-04-21 14:59   ` Markus Armbruster
2022-04-21 17:52     ` Jag Raman
2022-04-22  5:14       ` Markus Armbruster
2022-04-22 14:18         ` Jag Raman
2022-04-19 20:44 ` [PATCH v8 11/17] vfio-user: handle PCI config space accesses Jagannathan Raman
2022-04-19 20:44 ` [PATCH v8 12/17] vfio-user: IOMMU support for remote device Jagannathan Raman
2022-04-20 11:15   ` Jag Raman
2022-04-25  9:38     ` Stefan Hajnoczi
2022-04-25 17:30       ` Jag Raman
2022-04-28  9:47         ` Stefan Hajnoczi
2022-04-25  9:31   ` Stefan Hajnoczi
2022-04-25 17:26     ` Jag Raman
2022-04-19 20:44 ` [PATCH v8 13/17] vfio-user: handle DMA mappings Jagannathan Raman
2022-04-25  9:56   ` Stefan Hajnoczi
2022-04-25 17:34     ` Jag Raman
2022-04-26 19:53       ` Jag Raman
2022-04-19 20:44 ` [PATCH v8 14/17] vfio-user: handle PCI BAR accesses Jagannathan Raman
2022-04-25 10:05   ` Stefan Hajnoczi
2022-04-25 17:36     ` Jag Raman
2022-04-19 20:44 ` [PATCH v8 15/17] vfio-user: handle device interrupts Jagannathan Raman
2022-04-25 10:27   ` Stefan Hajnoczi
2022-04-25 17:40     ` Jag Raman
2022-04-28  9:54       ` Stefan Hajnoczi
2022-05-05 16:22         ` Alex Williamson [this message]
2022-04-19 20:44 ` [PATCH v8 16/17] vfio-user: handle reset of remote device Jagannathan Raman
2022-04-25 10:27   ` Stefan Hajnoczi
2022-04-19 20:44 ` [PATCH v8 17/17] vfio-user: avocado tests for vfio-user Jagannathan Raman
2022-04-25 10:32 ` [PATCH v8 00/17] vfio-user server in QEMU Stefan Hajnoczi
2022-04-25 17:40   ` Jag Raman

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=20220505102207.4aef06f6.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=elena.ufimtseva@oracle.com \
    --cc=f4bug@amsat.org \
    --cc=jag.raman@oracle.com \
    --cc=john.g.johnson@oracle.com \
    --cc=john.levon@nutanix.com \
    --cc=kanth.ghatraju@oracle.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=thanos.makatos@nutanix.com \
    --cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).