Message ID | 5072EEB7.2070408@redhat.com |
---|---|
State | New |
Headers | show |
On 2012-10-08 17:18, Paolo Bonzini wrote: > Il 08/10/2012 08:52, Jan Kiszka ha scritto: >> On 2012-10-06 04:13, Peter Maydell wrote: >>> On 5 October 2012 19:01, Jan Kiszka <jan.kiszka@siemens.com> wrote: >>>> I'm not a fan of this either, but the alternatives are way more >>>> complicated. We either need to rewrite the chardev subsystem, >>>> specifically how mux'ed devices are registered and how the active one is >>>> selected. Or we need to avoid flushing "unrelated" BHs for block >>>> devices. Not sure of those read requests can be postponed. >>> >>> Is this a regression? If it is then the obvious answer is to back >>> out whatever broke it... >> >> I'm using this machine for the first time, so I cannot answer this from >> the top of my head. However, I don't think it can be a regression. >> >> Mux chardevs work like this: You create the backend, then you register >> the frontend with them, one by one. The last one registered is the first >> one active. It should also receive the open event of chardev. But as >> that open even is issued via a BH and last frontend, the serial device, >> arrives after the first BH flushing, things break. > > Does something like this work instead? > > diff --git a/qemu-char.c b/qemu-char.c > index b082bae..1ed6d49 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -465,6 +465,9 @@ static void > mux_chr_update_read_handler(CharDriverState *chr) > d->focus = d->mux_cnt; > d->mux_cnt++; > mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN); > + if (chr->opened) { > + mux_chr_send_event(d, d->focus, CHR_EVENT_OPENED); > + } It's not (only) about a missing event for the serial frontend, it's also about a spurious open event to the monitor. That generates unwanted output during startup. Jan
On 8 October 2012 16:28, Jan Kiszka <jan.kiszka@siemens.com> wrote: > It's not (only) about a missing event for the serial frontend, it's also > about a spurious open event to the monitor. That generates unwanted > output during startup. Right, so whatever's sending that event needs not to do so until creation of the machine is complete. Sending events randomly halfway through init is a recipe for problems... -- PMM
Il 08/10/2012 18:02, Peter Maydell ha scritto: >> > It's not (only) about a missing event for the serial frontend, it's also >> > about a spurious open event to the monitor. That generates unwanted >> > output during startup. > Right, so whatever's sending that event needs not to do so until > creation of the machine is complete. Sending events randomly > halfway through init is a recipe for problems... So we now have proof that using bottom halves outside the block layer was a bad idea. Thanks Jan. :) If Stefan goes on with the AioContext idea, we can have separate AioContexts for qemu_bh_new on one side and for block devices on the other, so that qemu_bh_new bottom halves won't fire just because something is calling the block layer. In the meanwhile, qemu_char could use a QEMUTimer expiring in the past instead of a bottom half. Paolo
On 2012-10-08 18:28, Paolo Bonzini wrote: > Il 08/10/2012 18:02, Peter Maydell ha scritto: >>>> It's not (only) about a missing event for the serial frontend, it's also >>>> about a spurious open event to the monitor. That generates unwanted >>>> output during startup. >> Right, so whatever's sending that event needs not to do so until >> creation of the machine is complete. Sending events randomly >> halfway through init is a recipe for problems... > > So we now have proof that using bottom halves outside the block layer > was a bad idea. Thanks Jan. :) > > If Stefan goes on with the AioContext idea, we can have separate > AioContexts for qemu_bh_new on one side and for block devices on the > other, so that qemu_bh_new bottom halves won't fire just because > something is calling the block layer. > > In the meanwhile, qemu_char could use a QEMUTimer expiring in the past > instead of a bottom half. Sounds "beautiful", waiting to break when we leave like this and start playing with the timer subsystem ;). But I guess it's best for now. Let me have a look... Jan
diff --git a/qemu-char.c b/qemu-char.c index b082bae..1ed6d49 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -465,6 +465,9 @@ static void mux_chr_update_read_handler(CharDriverState *chr) d->focus = d->mux_cnt; d->mux_cnt++; mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN); + if (chr->opened) { + mux_chr_send_event(d, d->focus, CHR_EVENT_OPENED); + } }