All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, bcketchum@gmail.com
Subject: Re: [Qemu-devel] [PATCH 2/6] serial: reinstate watch after migration
Date: Wed, 22 Jun 2016 16:41:14 +0100	[thread overview]
Message-ID: <20160622154114.GH6604@work-vm> (raw)
In-Reply-To: <5485a609-f1ff-e147-64bc-1def08621561@redhat.com>

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> 
> 
> On 22/06/2016 17:05, Dr. David Alan Gilbert wrote:
> > * Paolo Bonzini (pbonzini@redhat.com) wrote:
> >> Otherwise, a serial port can get stuck if it is migrated while flow control
> >> is in effect.
> >>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >>  hw/char/serial.c         | 16 ++++++++++++++--
> >>  include/hw/char/serial.h |  1 +
> >>  2 files changed, 15 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/hw/char/serial.c b/hw/char/serial.c
> >> index e65e9e0..6f0a49e 100644
> >> --- a/hw/char/serial.c
> >> +++ b/hw/char/serial.c
> >> @@ -639,8 +639,20 @@ static int serial_post_load(void *opaque, int version_id)
> >>      if (s->thr_ipending == -1) {
> >>          s->thr_ipending = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
> >>      }
> >> -    if (s->tsr_retry > MAX_XMIT_RETRY) {
> >> -        s->tsr_retry = MAX_XMIT_RETRY;
> > 
> > Why remove the check you just added?
> 
> Because I'm dumb. :)
> 
> >> +
> >> +    if (s->tsr_retry > 0) {
> >> +        /* tsr_retry > 0 implies LSR.TEMT = 0 (transmitter not empty).  */
> >> +        if (s->lsr & UART_LSR_TEMT) {
> >> +            return -1;
> >> +        }
> >> +
> >> +        assert(s->watch_tag == 0);
> >> +        s->watch_tag = qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s);
> >> +    } else {
> >> +        /* tsr_retry == 0 implies LSR.TEMT = 1 (transmitter empty).  */
> >> +        if (!(s->lsr & UART_LSR_TEMT)) {
> >> +            return -1;
> > 
> > If you're failing migration (-1) then please error_report to say why
> > so when someone hits it I can immediately see why.
> 
> Ok, something like
> 
>     error_report("inconsistent state in serial device");
> 
> ?

Yeh, feel free to add tsr_retry and lsr to the message as well so that if you're
looking at it you can figure out what happened.

Dave

> 
> Paolo
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-06-22 15:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 14:28 [Qemu-devel] [PATCH 0/6] serial: flow control fixes Paolo Bonzini
2016-06-20 14:29 ` [Qemu-devel] [PATCH 1/6] serial: make tsr_retry unsigned Paolo Bonzini
2016-06-22 14:44   ` Dr. David Alan Gilbert
2016-06-20 14:29 ` [Qemu-devel] [PATCH 2/6] serial: reinstate watch after migration Paolo Bonzini
2016-06-22 15:05   ` Dr. David Alan Gilbert
2016-06-22 15:11     ` Paolo Bonzini
2016-06-22 15:41       ` Dr. David Alan Gilbert [this message]
2016-06-20 14:29 ` [Qemu-devel] [PATCH 3/6] serial: separate serial_xmit and serial_watch_cb Paolo Bonzini
2016-06-22 15:09   ` Dr. David Alan Gilbert
2016-06-22 15:14     ` Paolo Bonzini
2016-06-20 14:29 ` [Qemu-devel] [PATCH 4/6] serial: simplify tsr_retry reset Paolo Bonzini
2016-06-22 15:12   ` Dr. David Alan Gilbert
2016-06-20 14:29 ` [Qemu-devel] [PATCH 5/6] char: change qemu_chr_fe_add_watch to return unsigned Paolo Bonzini
2016-06-22 15:22   ` Dr. David Alan Gilbert
2016-06-20 14:29 ` [Qemu-devel] [PATCH 6/6] serial: remove watch on reset Paolo Bonzini
2016-06-22 14:04   ` Bret Ketchum
2016-06-22 15:38   ` Dr. David Alan Gilbert

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=20160622154114.GH6604@work-vm \
    --to=dgilbert@redhat.com \
    --cc=bcketchum@gmail.com \
    --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 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.