qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Srujana Challa <schalla@marvell.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Vamsi Krishna Attunuru <vattunuru@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>
Subject: Re: [EXT] Re: [PATCH] virtio-pci: correctly set virtio pci queue mem multiplier
Date: Tue, 13 Feb 2024 07:03:30 -0500	[thread overview]
Message-ID: <20240213070100-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <DS0PR18MB5368A9931C4B4E8E8E866066A04F2@DS0PR18MB5368.namprd18.prod.outlook.com>

On Tue, Feb 13, 2024 at 11:50:34AM +0000, Srujana Challa wrote:
> > Subject: [EXT] Re: [PATCH] virtio-pci: correctly set virtio pci queue mem
> > multiplier
> > 
> > External Email
> > 
> > ----------------------------------------------------------------------
> > On Mon, Feb 12, 2024 at 01:22:33PM +0530, Srujana Challa wrote:
> > > Currently, virtio_pci_queue_mem_mult function returns 4K when
> > > VIRTIO_PCI_FLAG_PAGE_PER_VQ is set. But this is not correct when host
> > > has page size as 64K.
> > > This patch fixes the same.
> > >
> > > Signed-off-by: Srujana Challa <schalla@marvell.com>
> > 
> > You can't tweak guest visible values like this without compat machinery. It's
> > also going to consume a ton more phys memory - can this break any configs?
> > Why is this a problem? Just with vdpa?
> 
> We are observing the issue with vdpa when host has page size of 64K. We haven't
> verified any other backends. I think, any backend that uses below API would fail
> if host has page size other than 4K right?
> And also as per VIRTIO_PCI_FLAG_PAGE_PER_VQ, it should be equal to
> page_size right?
> 
> static int virtio_pci_set_host_notifier_mr(DeviceState *d, int n,
>                                            MemoryRegion *mr, bool assign)
> {
>     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
>     int offset;
> 
>     if (n >= VIRTIO_QUEUE_MAX || !virtio_pci_modern(proxy) ||
>         virtio_pci_queue_mem_mult(proxy) != memory_region_size(mr)) {
>         return -1;
>     }

Yes but not everyone uses that right? Plain virtio in software with
no tricks doesn't care?


> > 
> > > ---
> > >  hw/virtio/virtio-pci.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index
> > > e433879542..028df99991 100644
> > > --- a/hw/virtio/virtio-pci.c
> > > +++ b/hw/virtio/virtio-pci.c
> > > @@ -316,12 +316,10 @@ static bool
> > virtio_pci_ioeventfd_enabled(DeviceState *d)
> > >      return (proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) != 0;  }
> > >
> > > -#define QEMU_VIRTIO_PCI_QUEUE_MEM_MULT 0x1000
> > > -
> > >  static inline int virtio_pci_queue_mem_mult(struct VirtIOPCIProxy
> > > *proxy)  {
> > >      return (proxy->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ) ?
> > > -        QEMU_VIRTIO_PCI_QUEUE_MEM_MULT : 4;
> > > +        qemu_real_host_page_size()  : 4;
> > >  }
> > >
> > >  static int virtio_pci_ioeventfd_assign(DeviceState *d, EventNotifier
> > > *notifier,
> > > --
> > > 2.25.1



  reply	other threads:[~2024-02-13 12:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  7:52 [PATCH] virtio-pci: correctly set virtio pci queue mem multiplier Srujana Challa
2024-02-13 10:47 ` Michael S. Tsirkin
2024-02-13 11:50   ` [EXT] " Srujana Challa
2024-02-13 12:03     ` Michael S. Tsirkin [this message]
2024-02-13 12:37       ` Srujana Challa
2024-02-13 15:53         ` Michael S. Tsirkin
2024-02-19 18:15           ` Srujana Challa

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=20240213070100-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jerinj@marvell.com \
    --cc=qemu-devel@nongnu.org \
    --cc=schalla@marvell.com \
    --cc=vattunuru@marvell.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).