qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: Fwd: VirtioSound device emulation implementation
Date: Mon, 11 Jan 2021 11:59:52 +0000	[thread overview]
Message-ID: <878s8zptrf.fsf@linaro.org> (raw)
In-Reply-To: <CAAQ-SiMkJGBnxWSnybJqMD0LSASMtvA_wbrPDQcg-S+Y1ddjJA@mail.gmail.com>


Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com> writes:

> ---------- Forwarded message ---------
> From: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
> Date: Mon, 11 Jan 2021 at 11:59
> Subject: Re: VirtioSound device emulation implementation
> To: Gerd Hoffmann <kraxel@redhat.com>
>
>
>
>
> On Sun, 10 Jan 2021 at 13:55, Shreyansh Chouhan <
> chouhan.shreyansh2702@gmail.com> wrote:
>
>> Hi,
>>
>> I have been reading about the virtio and vhost specifications, however I
>> have a few doubts. I tried looking for them but I still
>> do not understand them clearly enough. From what I understand, there are
>> two protocols:
>>
>> The virtio protocol: The one that specifies how we can have common
>> emulation for virtual devices. The front end drivers
>> interact with these devices, and these devices could then process the
>> information that they have received either in QEMU,
>> or somewhere else. From what I understand the front driver uses mmaps to
>> communicate with the virtio device.
>>
>> The vhost protocol: The one that specifies how we can _offload_ the
>> processing from QEMU to a separate process. We
>> want to offload so that we do not have to stop the guest when we are
>> processing information passed to a virtio device. This
>> service could either be implemented in the host kernel or the host
>> userspace. Now when we offload the processing, we map the
>> memory of the device to this vhost service, so that this service has all
>> the information that it should process.
>>   Also, this process can generate the vCPU interrupts, and this process
>> responds to the ioeventfd notifications.
>>
>> What I do not understand is, once we have this vhost service, either in
>> userspace or in kernel space, which does the information processing,
>> why do we need a virtio device still emulated in QEMU? Is it only to pass
>> on the configurations between the driver and the
>> vhost service? I know that the vhost service doesn't emulate anything, but
>> then what is the difference between "processing" the
>> information and "emulating" a device?
>>
>> Also, from article[3], moving the vhost-net service to userspace was
>> faster somehow. I am assuming this was only the case for
>> networking devices, and would not be true in general. Since there would be
>> more context switches between user and kernel space?
>> (KVM receives the irq/ioevent notification and then transfers control back
>> to user space, as opposed to when vhost was in kernel
>> space.)
>>
>> For context, I've been reading the following:
>> [1]
>> https://www.redhat.com/en/blog/introduction-virtio-networking-and-vhost-net
>> [2]
>> https://www.redhat.com/en/blog/deep-dive-virtio-networking-and-vhost-net
>> [3] https://www.redhat.com/en/blog/journey-vhost-users-realm
>>
>>
> Found the answers in this blog:
> http://blog.vmsplice.net/2011/09/qemu-internals-vhost-architecture.html
> In short, yes, the configuration plane still remains with QEMU. The
> frontend driver interacts with the PCI
> adapter emulated in QEMU, for configurations and memory map setup. Only the
> data plane is forwarded
> to the vhost service. This makes sense since we would only want to
> configure the device once, and hence
> having that emulated in QEMU is not a performance issue, as much as having
> the data plane was.

Also if you are running a pure TCG emulation QEMU can pass along the
signalled events from the guest to the vhost-user daemon as well.

> There is still a little confusion in my mind regarding a few things, but I
> think looking at the source code
> of the already implemented drivers will clear that up for me. So that is
> what I will be doing next.
>
> I will start looking at the source code for in-QEMU and vhost
> implementations of other virtio drivers, and then decide which one I'd like
> to
> go with. I will probably follow that decision with an implementation
> plan/timeline so that everyone can follow the progress on the
> development of this project.


-- 
Alex Bennée


  reply	other threads:[~2021-01-11 12:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 10:00 VirtioSound device emulation implementation Shreyansh Chouhan
2021-01-06 11:40 ` Alex Bennée
2021-01-07 14:58   ` Shreyansh Chouhan
2021-01-07 15:58     ` Gerd Hoffmann
2021-01-07 17:17     ` Alex Bennée
2021-01-08  7:53       ` Shreyansh Chouhan
2021-01-08  8:34       ` Gerd Hoffmann
2021-01-10  8:25         ` Shreyansh Chouhan
     [not found]           ` <CAAQ-SiPiq5NQN=2mvP3isZ9PtYO2Bu64kVEvE6T+3OJd5B-U5A@mail.gmail.com>
2021-01-11  6:29             ` Fwd: " Shreyansh Chouhan
2021-01-11 11:59               ` Alex Bennée [this message]
2021-01-14 15:00                 ` Shreyansh Chouhan
2021-01-14 17:41                   ` Alex Bennée
2021-01-15  8:00                     ` Shreyansh Chouhan
2021-01-17 10:30                       ` Shreyansh Chouhan
2021-01-18 18:53                         ` Shreyansh Chouhan
2021-01-20 11:41                           ` Shreyansh Chouhan
2021-01-25  6:02                             ` Shreyansh Chouhan
2021-01-25 11:23                               ` Alex Bennée
2021-01-28  4:28                                 ` Shreyansh Chouhan
2021-01-28 10:42                                   ` Alex Bennée
2021-01-28 15:40                                     ` Shreyansh Chouhan
2021-01-28 11:25                                   ` Gerd Hoffmann
2021-01-28 15:50                                     ` Shreyansh Chouhan
2021-01-28 16:30                                       ` Gerd Hoffmann
2021-01-28 17:34                                         ` Shreyansh Chouhan
2021-02-11  4:59                                           ` Shreyansh Chouhan
2021-02-15 14:39                                             ` Gerd Hoffmann
2021-04-04 13:55                                               ` Shreyansh Chouhan
2021-04-16 11:32                                                 ` Gerd Hoffmann
2021-04-19 12:30                                                   ` Shreyansh Chouhan
2021-04-19 12:33                                                     ` Shreyansh Chouhan
2021-04-19 13:10                                                     ` Gerd Hoffmann
     [not found]                                                       ` <CAAQ-SiMf=BV-HUudRayZkRPJjmkYWuiBuKqYHHLzYjcFnPOgLQ@mail.gmail.com>
     [not found]                                                         ` <20210419135627.dlerwnswhfxt6ciz@sirius.home.kraxel.org>
     [not found]                                                           ` <CAAQ-SiM6uWUgHTS5PQ-hSkuXNOoKC7fw6Y1ZHhJ0MCUE3oaBqg@mail.gmail.com>
     [not found]                                                             ` <20210420071304.gmndase3r6mwp5yt@sirius.home.kraxel.org>
     [not found]                                                               ` <CAAQ-SiPPNK0xqnPPSjNZgwQCs+Vj0_A5koq5xK8HzhZKDgqVJw@mail.gmail.com>
2021-12-29  5:52                                                                 ` Shreyansh Chouhan
2022-01-20 10:39                                                                   ` Laurent Vivier
2022-02-07  4:06                                                                     ` Shreyansh Chouhan
2022-02-08 17:26                                                                       ` Shreyansh Chouhan

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=878s8zptrf.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=chouhan.shreyansh2702@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).