All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: mdroth <mdroth@linux.vnet.ibm.com>,
	s.priebe@profihost.ag, qemu-devel@nongnu.org,
	qemu-stable@nongnu.org, hdegoede@redhat.com, kraxel@redhat.com,
	amit.shah@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4] qemu-char: don't issue CHR_EVENT_OPEN in a BH
Date: Fri, 7 Jun 2013 17:03:53 -0400	[thread overview]
Message-ID: <20130607170353.5dca597f@redhat.com> (raw)
In-Reply-To: <87fvwtab4h.fsf@codemonkey.ws>

On Fri, 07 Jun 2013 16:01:34 -0500
Anthony Liguori <aliguori@us.ibm.com> wrote:

> Luiz Capitulino <lcapitulino@redhat.com> writes:
> 
> > On Fri, 7 Jun 2013 09:56:00 -0500
> > mdroth <mdroth@linux.vnet.ibm.com> wrote:
> >
> >> On Fri, Jun 07, 2013 at 09:50:39AM -0400, Luiz Capitulino wrote:
> >> > On Tue,  4 Jun 2013 16:35:09 -0500
> >> > Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> >> > 
> >> > > When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
> >> > > and it was issued as a bottom-half:
> >> > > 
> >> > > 86e94dea5b740dad65446c857f6959eae43e0ba6
> >> > > 
> >> > > Which we basically used to print out a greeting/prompt for the
> >> > > monitor.
> >> > > 
> >> > > AFAICT the only reason this was ever done in a BH was because in
> >> > > some cases we'd modify the chr_write handler for a new chardev
> >> > > backend *after* the site where we issued the reset (see:
> >> > > 86e94d:qemu_chr_open_stdio())
> >> > > 
> >> > > At some point this event was renamed to CHR_EVENT_OPENED, and we've
> >> > > maintained the use of this BH ever since.
> >> > > 
> >> > > However, due to 9f939df955a4152aad69a19a77e0898631bb2c18, we schedule
> >> > > the BH via g_idle_add(), which is causing events to sometimes be
> >> > > delivered after we've already begun processing data from backends,
> >> > > leading to:
> >> > > 
> >> > >  known bugs:
> >> > > 
> >> > >   QMP:
> >> > >     session negotation resets with OPENED event, in some cases this
> >> > >     is causing new sessions to get sporadically reset
> >> > > 
> >> > >  potential bugs:
> >> > > 
> >> > >   hw/usb/redirect.c:
> >> > >     can_read handler checks for dev->parser != NULL, which may be
> >> > >     true if CLOSED BH has not been executed yet. In the past, OPENED
> >> > >     quiesced outstanding CLOSED events prior to us reading client
> >> > >     data. If it's delayed, our check may allow reads to occur even
> >> > >     though we haven't processed the OPENED event yet, and when we
> >> > >     do finally get the OPENED event, our state may get reset.
> >> > > 
> >> > >   qtest.c:
> >> > >     can begin session before OPENED event is processed, leading to
> >> > >     a spurious reset of the system and irq_levels
> >> > > 
> >> > >   gdbstub.c:
> >> > >     may start a gdb session prior to the machine being paused
> >> > > 
> >> > > To fix these, let's just drop the BH.
> >> > > 
> >> > > Since the initial reasoning for using it still applies to an extent,
> >> > > work around that by deferring the delivery of CHR_EVENT_OPENED until
> >> > > after the chardevs have been fully initialized, toward the end of
> >> > > qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
> >> > > defers delivery long enough that we can be assured a CharDriverState
> >> > > is fully initialized before CHR_EVENT_OPENED is sent.
> >> > > 
> >> > > Also, rather than requiring each chardev to do an explicit open, do it
> >> > > automatically, and allow the small few who don't desire such behavior to
> >> > > suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
> >> > > flag.
> >> > > 
> >> > > We additionally add missing OPENED events for stdio backends on w32,
> >> > > which were previously not being issued, causing us to not recieve the
> >> > > banner and initial prompts for qmp/hmp.
> >> > > 
> >> > > Reported-by: Stefan Priebe <s.priebe@profihost.ag>
> >> > > Cc: qemu-stable@nongnu.org
> >> > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> >> > 
> >> > I don't know if the QMP queue is the ideal queue for this patch, but
> >> > I'd happily apply it if I get at least one Reviewed-by from the CC'ed
> >> > people.
> >> 
> >> Anthony actually added his Reviewed-by for v3, but I forgot to roll it
> >> in the commit. If you do take it in through your tree can you add that?
> >
> > Sorry for the bureaucracy, but I don't like to add other people's tags
> > when the patch changes. Even when I'm sure they would be OK with the
> > new version.
> >
> > Anthony, can you please add your Reviewed-by again?
> 
> I'll apply this patch directly since it's really a chardev patch more
> than a QMP patch.

ACK

      reply	other threads:[~2013-06-07 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 21:35 [Qemu-devel] [PATCH v4] qemu-char: don't issue CHR_EVENT_OPEN in a BH Michael Roth
2013-06-07 13:50 ` Luiz Capitulino
2013-06-07 14:56   ` mdroth
2013-06-07 15:36     ` Luiz Capitulino
2013-06-07 20:08       ` mdroth
2013-06-07 21:01       ` Anthony Liguori
2013-06-07 21:03         ` Luiz Capitulino [this message]

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=20130607170353.5dca597f@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=s.priebe@profihost.ag \
    /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.