All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: Mike Cui <cui@nutanix.com>,
	Malcolm Crossley <malcolm@nutanix.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	Felipe Franciosi <felipe@nutanix.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"changchun.ouyang@intel.com" <changchun.ouyang@intel.com>
Subject: Re: [Qemu-devel] Should memory hotplug work with vhost-user backends?
Date: Wed, 3 Jul 2019 14:57:53 -0400	[thread overview]
Message-ID: <20190703031041-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <6EF9E5BE-2FBF-4CC4-BA1F-AE55ADD82A6E@nutanix.com>

On Tue, Jul 02, 2019 at 10:08:54PM +0000, Raphael Norwitz wrote:
> For background I am trying to work around a ram slot limit imposed by the
> vhost-user protocol. We are having trouble reconciling the comment here: https:
> //github.com/qemu/qemu/blob/master/hw/virtio/vhost-user.c#L333  that “For
> non-vring specific requests, like VHOST_USER_SET_MEM_TABLE., we just need to
> send it once the first time” and the high level implementation of memory
> hot-add, which calls set_mem_table every time a VM hot adds memory.

IIUC the comment refers to multiple virtqueue. It is trying to say that
we do not need to send VHOST_USER_SET_MEM_TABLE for each
virtqueue.



>  
> 
> A few questions:
> 
> 1.
> 
> What exactly is the check `if (vhost_user_one_time_request(msg->hdr.request) &&
> dev->vq_index != 0)` for?

Some backends register multiple dev instances per backend: one for each
virtqueue.  This check avoids sending VHOST_USER_SET_MEM_TABLE more than
once in this case.


> In the message for commit
> b931bfbf042983f311b3b09894d8030b2755a638, which introduced the check, I see it
> says “non-vring specific messages[, which should] be sent only once” and gives
> VHOST_USER_SET_MEM_TABLE as an example one such message. The
> `vhost_user_one_time_request()` call clearly checks whether this type of
> message is the kind of message is supposed to be sent once of which
> VHOST_USER_SET_MEM_TABLE is one. Why, then, does this commit add the check if
> `dev->vq_index != 0`? It seems like there is a latent assumption that after the
> first call dev->vq_index should be set to some value greater than one, however
> for many cases such as vhost-user-scsi devices we can see this is clearly not
> the case https://github.com/qemu/qemu/blob/master/hw/scsi/vhost-user-scsi.c#
> L95. Is this check then ‘broken’ for such devices?

I think vhost-scsi has a single instance per backend, that is
why vq_index is 0.

>  
> 
> 2.
> 
> If this check is indeed broken for such devices, and set_mem_table call is only
> supposed to be run once for such devices, is the ability to call it multiple
> times technically a bug for devices such as vhost-user-scsci devices? If so,
> this would imply that the existing ability to hot add memory to vhost-user-scsi
> devices is by extension technically a bug/unintended behavior. Is this the
> case?
> 
>  
> 
> Thanks,
> 
> Raphael

I don't think that is the case. It's possible that memory hotplug has
bugs with vhost-user, but I don't think it's anything fundamental.

-- 
MST


  parent reply	other threads:[~2019-07-03 18:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02 22:08 [Qemu-devel] Should memory hotplug work with vhost-user backends? Raphael Norwitz
2019-07-03 10:04 ` Stefan Hajnoczi
2020-04-10  0:21   ` Raphael Norwitz
2020-04-21 15:48     ` Stefan Hajnoczi
2019-07-03 18:57 ` Michael S. Tsirkin [this message]
2019-07-09 21:54   ` Raphael Norwitz
2020-04-28 14:33 Raphael Norwitz
2020-04-28 15:55 ` Dr. David Alan Gilbert

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=20190703031041-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=changchun.ouyang@intel.com \
    --cc=cui@nutanix.com \
    --cc=felipe@nutanix.com \
    --cc=malcolm@nutanix.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=stefanha@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 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.