qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Hrdina <phrdina@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Kirill Batuzov <batuzovk@ispras.ru>
Subject: Re: [Qemu-devel] [PULL 3/5] serial: change retry logic to avoid concurrency
Date: Thu, 24 Jul 2014 14:57:53 +0200	[thread overview]
Message-ID: <53D102D1.3050704@redhat.com> (raw)
In-Reply-To: <1405352968-3155-4-git-send-email-pbonzini@redhat.com>

On 14.7.2014 17:49, Paolo Bonzini wrote:
> From: Kirill Batuzov <batuzovk@ispras.ru>
> 
> Whenever serial_xmit fails to transmit a byte it adds a watch that would
> call it again when the "line" becomes ready. This results in a retry
> chain:
>   serial_xmit -> add_watch -> serial_xmit
> Each chain is able to transmit one character, and for every character
> passed to serial by the guest driver a new chain is spawned.
> 
> The problem lays with the fact that a new chain is spawned even when
> there is one already waiting on the watch. So there can be several retry
> chains waiting concurrently on one "line". Every chain tries to transmit
> current character, so character order is not messed up. But also every
> chain increases retry counter (tsr_retry). If there are enough
> concurrent chains this counter will hit MAX_XMIT_RETRY value and
> the character will be dropped.
> 
> To reproduce this bug you need to feed serial output to some program
> consuming it slowly enough. A python script from bug #1335444
> description is an example of such program.
> 
> This commit changes retry logic in the following way to avoid
> concurrency: instead of spawning a new chain for each character being
> transmitted spawn only one and make it transmit characters until FIFO is
> empty.
> 
> The change consists of two parts:
>  - add a do {} while () loop in serial_xmit (diff is a bit erratic
>    for this part, diff -w will show actual change),
>  - do not call serial_xmit from serial_ioport_write if there is one
>    waiting on the watch already.
> 
> This should fix another issue causing bug #1335444.
> 
> Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


Hi, this commit introduced a regression with serial console. The issue
is that if you start a guest with serial console:

-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0

the guest hang during boot for a long time and I'm not even sure it
it ever boot up. The last message printed out by kernel is:

"[   0.000000] console [tty0] enabled"

If you connect to the serial console than the guest continue
booting immediately.

Pavel

  reply	other threads:[~2014-07-24 12:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 15:49 [Qemu-devel] [PULL for-2.1 0/5] Serial + SCSI fixes for 2014-07-14 Paolo Bonzini
2014-07-14 15:49 ` [Qemu-devel] [PULL 1/5] scsi: Report error when lun number is in use Paolo Bonzini
2014-07-14 15:49 ` [Qemu-devel] [PULL 2/5] qemu-char: fix deadlock with "-monitor pty" Paolo Bonzini
2014-07-14 15:49 ` [Qemu-devel] [PULL 3/5] serial: change retry logic to avoid concurrency Paolo Bonzini
2014-07-24 12:57   ` Pavel Hrdina [this message]
2014-07-24 14:10     ` Paolo Bonzini
2014-07-14 15:49 ` [Qemu-devel] [PULL 4/5] virtio-scsi: fix with -M pc-i440fx-2.0 Paolo Bonzini
2014-07-14 15:49 ` [Qemu-devel] [PULL 5/5] serial-pci: remove memory regions from BAR before destroying them Paolo Bonzini
2014-07-15 13:14 ` [Qemu-devel] [PULL for-2.1 0/5] Serial + SCSI fixes for 2014-07-14 Peter Maydell

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=53D102D1.3050704@redhat.com \
    --to=phrdina@redhat.com \
    --cc=batuzovk@ispras.ru \
    --cc=pbonzini@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).