qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/6] vhost-user: support registering external ho


From: Tiwei Bie
Subject: Re: [Qemu-devel] [PATCH 4/6] vhost-user: support registering external host notifiers
Date: Fri, 25 May 2018 00:25:19 +0800
User-agent: Mutt/1.9.5 (2018-04-13)

On Thu, May 24, 2018 at 07:15:24PM +0300, Michael S. Tsirkin wrote:
> On Fri, May 25, 2018 at 12:05:50AM +0800, Tiwei Bie wrote:
> > On Thu, May 24, 2018 at 06:49:47PM +0300, Michael S. Tsirkin wrote:
> > > On Thu, May 24, 2018 at 06:33:34PM +0800, Tiwei Bie wrote:
> > > > This patch introduces VHOST_USER_PROTOCOL_F_HOST_NOTIFIER.
> > > > With this feature negotiated, vhost-user backend can register
> > > > memory region based host notifiers. And it will allow the guest
> > > > driver in the VM to notify the hardware accelerator at the
> > > > vhost-user backend directly.
> > > > 
> > > > Signed-off-by: Tiwei Bie <address@hidden>
> > > 
> > > So maybe we don't need a new VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD?
> > > Let's check VHOST_USER_PROTOCOL_F_HOST_NOTIFIER instead?
> > 
> > Yeah. I think it would be the best choice!
> > 
> > If this feature (HOST NOTIFIER) is negotiated, it means
> > the QEMU is able to safely receive (the expected number
> > of) file descriptors.
> > 
> > > 
> > > > ---
> > [...]
> > > > +typedef struct VhostUserHostNotifier {
> > > > +    MemoryRegion mr;
> > > > +    void *addr;
> > > > +    bool set;
> > > > +} VhostUserHostNotifier;
> > > >  
> > > >  typedef struct VhostUserState {
> > > >      CharBackend *chr;
> > > > +    VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX];
> > > >  } VhostUserState;
> > > 
> > > So this notifier is per-queue. Can't we maintain it in
> > > NetVhostUserState then?
> > 
> > This notifier is per virtio-queue. But NetVhostUserState
> > is per net-queue-pair.
> > 
> > And ideally, I think this structure shouldn't be visible
> > to net/vhost-user, vhost-user-scsi, vhost-user-crypto, etc.
> > 
> > Best regards,
> > Tiwei Bie
> 
> I wonder whether we can create a new per vq structure.

Maybe something like:

typedef struct VhostUserStatePerVQ {
    VhostUserHostNotifier notifier;
} VhostUserStatePerVQ;

typedef struct VhostUserState {
    CharBackend *chr;
    VhostUserStatePerVQ queue[VIRTIO_QUEUE_MAX];
} VhostUserState;

Best regards,
Tiwei Bie



reply via email to

[Prev in Thread] Current Thread [Next in Thread]