From: Anthony Liguori <aliguori@us.ibm.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: amit.shah@redhat.com, Alon Levy <alevy@redhat.com>,
qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] char: add qemu_chr_be_is_fe_connected
Date: Fri, 22 Mar 2013 08:50:48 -0500 [thread overview]
Message-ID: <87wqszv8zr.fsf@codemonkey.ws> (raw)
In-Reply-To: <514C0EC3.3090202@redhat.com>
Hans de Goede <hdegoede@redhat.com> writes:
> Hi,
>
> On 03/21/2013 07:18 PM, Anthony Liguori wrote:
>> Alon Levy <alevy@redhat.com> writes:
>>
>>> Note that the handler is called chr_is_guest_connected and not
>>> chr_is_fe_connected, consistent with other members of CharDriverState.
>>
>> Sorry, I don't get it.
>>
>> There isn't a notion of "connected" for the front-ends in the char
>> layer.
>
> And that is simply completely and utterly wrong. We've tried to explain
> this to you a number of times already. Yet you claim we've not explained
> it. Or we've not explained it properly. I must say however that I'm
> getting the feeling the problem is not us not explaining, but that you
> are not listening.
As usual, you make way too many assumptions without stopping to actually
think about what I'm saying.
> Still let me try to explain it 1 more time, in 2 different ways:
>
> 1) At an abstract level a chardev fe + be is a pipe between somewhere
> and where-ever. Both ends of the pipe can be opened or closed, not just
> one.
No, this is not the case in reality. The notion of the front-end being
open or closed only exists for virtio-serial, usb-redir, and spice-*.
For every other aspect of the character device layer, the concept
doesn't exist. We should have never allowed that in the first place and
I object strongly to extending the concept without making it make sense
for everything else.
> Frontends end inside the guest usually in the form of some piece of
> virtual hardware inside the guest. Just because the virtual hardware
> is there does not mean the guest has a driver,
Okay, let's use your example here with a standard UART. In the
following sequence, I should receive:
1) Starts guest
2) When guest initializes the UART, qemu_chr_fe_open()
3) Reboot guest
4) Receive qemu_chr_fe_close()
5) Boot new guest without a UART driver
6) Nothing is received
But this doesn't happen today because the only backend that cares
(spice-*) assumes qemu_chr_fe_open() on the first qemu_chr_fe_write().
So it will certainly approximate steps 1-3 but will not behave correct
with steps 4-6.
Likewise, if you are dealing with something like a PCI hotpluggable UART
and the card is ejected (but the CDS isn't deleted), you won't receive a
close() event either.
Even just in the world of spice-* which is all ya'll seem to care about,
the behavior is broken today.
So before we go adding more hacks just for virtio-serial/spice-*, let's
consider how this applies to all character devices and do what makes
sense for all of them.
And for me, the most logical thing is to call qemu_chr_fe_open() in
post_load for the device.
Regards,
Anthony Liguori
> if the guest has
> a driver that creates a device-node for it, that does not mean there
> is a userspace process inside the guest which actually has the
> device-node open. So you see the front-end device-node inside the guest
> can be opened and closed. Most frontends cannot signal this to the
> backend but virtio-console can, and we want to know about it since
> we want to know if the user-space agent is there.
>
> 2) At the code level it clearly is there too, backend open-close
> is signalled to the frontend by means of the backend calling
> qemu_chr_be_event with an event of CHR_EVENT_OPENED and
> CHR_EVENT_CLOSED. Frontend open-close is signalled by the
> frontend calling qemu_chr_fe_open and qemu_chr_fe_close.
>
> Now the problem we have is that after migration the CHR_EVENT_OPENED
> gets replayed on the destination side but the qemu_chr_fe_open call
> does not.
>
> The logical place to replay the qemu_chr_fe_open would be in the
> frontend's migration handling code, as suggested here:
> http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg02721.html
>
> But Amit did not like this approach, suggesting that instead we
> took care of this inside spice-qemu-char.c. Which is what we're
> trying to do now, but this requires spice-qemu-char.c being
> able to query the open state of the frontend, which is already
> being migrate by the virtio-console code in the form of the
> guest_connected variable, we just need to be able to get to that
> variable from the backend.
>
> Regards,
>
> Hans
next prev parent reply other threads:[~2013-03-22 13:51 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-20 9:55 [Qemu-devel] [PATCH v2 0/4] for spice post load char device hook Alon Levy
2013-03-20 9:55 ` [Qemu-devel] [PATCH 1/4] char: add a post_load callback Alon Levy
2013-03-20 13:08 ` Anthony Liguori
2013-03-20 16:59 ` Alon Levy
2013-03-21 6:53 ` Gerd Hoffmann
2013-03-21 8:54 ` Alon Levy
2013-03-20 17:05 ` Alon Levy
2013-03-20 18:59 ` Anthony Liguori
2013-03-21 8:27 ` Hans de Goede
2013-03-21 8:36 ` Hans de Goede
2013-03-21 16:35 ` [Qemu-devel] [PATCH v3 0/2] spice-qemu-char fix agent mouse after migration Alon Levy
2013-03-21 16:35 ` [Qemu-devel] [PATCH 1/2] char: add qemu_chr_be_is_fe_connected Alon Levy
2013-03-21 18:18 ` Anthony Liguori
2013-03-21 18:35 ` Alon Levy
2013-03-21 19:24 ` Anthony Liguori
2013-03-21 21:55 ` Alon Levy
2013-03-21 22:05 ` Alon Levy
2013-03-22 7:56 ` Hans de Goede
2013-03-22 13:50 ` Anthony Liguori [this message]
2013-03-22 15:53 ` Gerd Hoffmann
2013-03-22 16:50 ` Hans de Goede
2013-03-22 17:11 ` Anthony Liguori
2013-03-24 12:37 ` Hans de Goede
2013-03-22 8:25 ` Gerd Hoffmann
2013-03-22 8:58 ` Hans de Goede
2013-03-22 13:33 ` Anthony Liguori
2013-03-21 16:35 ` [Qemu-devel] [PATCH 2/2] spice-qemu-char: register interface on post load Alon Levy
2013-03-22 8:07 ` Hans de Goede
2013-03-22 8:16 ` Alon Levy
2013-03-22 8:55 ` Hans de Goede
2013-03-20 9:55 ` [Qemu-devel] [PATCH 2/4] virtio-serial: add a post_load callback implemented by port Alon Levy
2013-03-20 9:55 ` [Qemu-devel] [PATCH 3/4] virtio-console: implement post_load to call to qemu_chr_fe_post_load Alon Levy
2013-03-20 9:55 ` [Qemu-devel] [PATCH 4/4] spice-qemu-char: register interface on post load Alon Levy
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=87wqszv8zr.fsf@codemonkey.ws \
--to=aliguori@us.ibm.com \
--cc=alevy@redhat.com \
--cc=amit.shah@redhat.com \
--cc=hdegoede@redhat.com \
--cc=kraxel@redhat.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).