qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: amit.shah@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
	quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] Migration compatibility for serial
Date: Wed, 17 Jun 2015 10:09:06 +0100	[thread overview]
Message-ID: <20150617090905.GB2122@work-vm> (raw)
In-Reply-To: <20150616224007-mutt-send-email-mst@redhat.com>

* Michael S. Tsirkin (mst@redhat.com) wrote:
> On Tue, Jun 16, 2015 at 07:54:09PM +0100, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > Older QEMUs dont understand the new (sub)sections that
> > may be generated in the serial device.   Limit their generation
> > to newer machine types.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> 
> I don't see a problem with this, but the specific
> interface is unfortunate: this spreads versioning
> info around which we don't normally do.
> Instead, please add specific flags, e.g.
> 	serial_has_recv_fifo

Yes, I could do; although note that they are all added
at the same time, and the 'serial_migrate_pre_2_2' name does
make it clear it's a compatibility thing rather than
a functional one.

> Also, is it really enough to just skip a bunch of
> stuff on load? For example, I notice that before
> 	7385b275d9ae8bdf3c012bc4e2ae9779fcea6312
> we used to generate interrupts on loadvm -
> isn't that needed in this compat mode?

Can you point me at the change in there?  I can see that
afer 7385b27 it's better at regenerating thr_ipending
even in the case where the section wasn't present;
but that seems to be the opposite of what you're pointing
out.

Dave

> 
> 
> 
> > ---
> >  hw/char/serial.c         | 19 +++++++++++++------
> >  hw/i386/pc_piix.c        |  2 ++
> >  hw/i386/pc_q35.c         |  2 ++
> >  hw/ppc/spapr.c           |  2 ++
> >  include/hw/char/serial.h |  3 +++
> >  5 files changed, 22 insertions(+), 6 deletions(-)
> > 
> > diff --git a/hw/char/serial.c b/hw/char/serial.c
> > index 513d73c..ef31df3 100644
> > --- a/hw/char/serial.c
> > +++ b/hw/char/serial.c
> > @@ -103,6 +103,9 @@ do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
> >  do {} while (0)
> >  #endif
> >  
> > +/* Force migration compatibility of pre-2.2 machine types */
> > +bool serial_migrate_pre_2_2;
> > +
> >  static void serial_receive1(void *opaque, const uint8_t *buf, int size);
> >  
> >  static inline void recv_fifo_put(SerialState *s, uint8_t chr)
> > @@ -646,6 +649,10 @@ static bool serial_thr_ipending_needed(void *opaque)
> >  {
> >      SerialState *s = opaque;
> >  
> > +    if (serial_migrate_pre_2_2) {
> > +        return false;
> > +    }
> > +
> >      if (s->ier & UART_IER_THRI) {
> >          bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
> >          return s->thr_ipending != expected_value;
> > @@ -672,7 +679,7 @@ static const VMStateDescription vmstate_serial_thr_ipending = {
> >  static bool serial_tsr_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return s->tsr_retry != 0;
> > +    return !serial_migrate_pre_2_2 && s->tsr_retry != 0;
> >  }
> >  
> >  static const VMStateDescription vmstate_serial_tsr = {
> > @@ -691,7 +698,7 @@ static const VMStateDescription vmstate_serial_tsr = {
> >  static bool serial_recv_fifo_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return !fifo8_is_empty(&s->recv_fifo);
> > +    return !serial_migrate_pre_2_2 && !fifo8_is_empty(&s->recv_fifo);
> >  
> >  }
> >  
> > @@ -709,7 +716,7 @@ static const VMStateDescription vmstate_serial_recv_fifo = {
> >  static bool serial_xmit_fifo_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return !fifo8_is_empty(&s->xmit_fifo);
> > +    return !serial_migrate_pre_2_2 && !fifo8_is_empty(&s->xmit_fifo);
> >  }
> >  
> >  static const VMStateDescription vmstate_serial_xmit_fifo = {
> > @@ -726,7 +733,7 @@ static const VMStateDescription vmstate_serial_xmit_fifo = {
> >  static bool serial_fifo_timeout_timer_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return timer_pending(s->fifo_timeout_timer);
> > +    return !serial_migrate_pre_2_2 && timer_pending(s->fifo_timeout_timer);
> >  }
> >  
> >  static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
> > @@ -743,7 +750,7 @@ static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
> >  static bool serial_timeout_ipending_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return s->timeout_ipending != 0;
> > +    return !serial_migrate_pre_2_2 && s->timeout_ipending != 0;
> >  }
> >  
> >  static const VMStateDescription vmstate_serial_timeout_ipending = {
> > @@ -760,7 +767,7 @@ static const VMStateDescription vmstate_serial_timeout_ipending = {
> >  static bool serial_poll_needed(void *opaque)
> >  {
> >      SerialState *s = (SerialState *)opaque;
> > -    return s->poll_msl >= 0;
> > +    return !serial_migrate_pre_2_2 && s->poll_msl >= 0;
> >  }
> >  
> >  static const VMStateDescription vmstate_serial_poll = {
> > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > index e142f75..d6d596c 100644
> > --- a/hw/i386/pc_piix.c
> > +++ b/hw/i386/pc_piix.c
> > @@ -39,6 +39,7 @@
> >  #include "hw/kvm/clock.h"
> >  #include "sysemu/sysemu.h"
> >  #include "hw/sysbus.h"
> > +#include "hw/char/serial.h"
> >  #include "hw/cpu/icc_bus.h"
> >  #include "sysemu/arch_init.h"
> >  #include "sysemu/block-backend.h"
> > @@ -344,6 +345,7 @@ static void pc_compat_2_1(MachineState *machine)
> >      x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
> >      x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
> >      pcms->enforce_aligned_dimm = false;
> > +    serial_migrate_pre_2_2 = true;
> >  }
> >  
> >  static void pc_compat_2_0(MachineState *machine)
> > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> > index b68263d..a211f21 100644
> > --- a/hw/i386/pc_q35.c
> > +++ b/hw/i386/pc_q35.c
> > @@ -32,6 +32,7 @@
> >  #include "sysemu/arch_init.h"
> >  #include "hw/i2c/smbus.h"
> >  #include "hw/boards.h"
> > +#include "hw/char/serial.h"
> >  #include "hw/timer/mc146818rtc.h"
> >  #include "hw/xen/xen.h"
> >  #include "sysemu/kvm.h"
> > @@ -328,6 +329,7 @@ static void pc_compat_2_1(MachineState *machine)
> >      x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
> >      x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
> >      x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
> > +    serial_migrate_pre_2_2 = true;
> >  }
> >  
> >  static void pc_compat_2_0(MachineState *machine)
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 01f8da8..f2673da 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -39,6 +39,7 @@
> >  #include "qom/cpu.h"
> >  
> >  #include "hw/boards.h"
> > +#include "hw/char/serial.h"
> >  #include "hw/ppc/ppc.h"
> >  #include "hw/loader.h"
> >  
> > @@ -1863,6 +1864,7 @@ static void spapr_compat_2_2(Object *obj)
> >  static void spapr_compat_2_1(Object *obj)
> >  {
> >      spapr_compat_2_2(obj);
> > +    serial_migrate_pre_2_2 = true;
> >  }
> >  
> >  static void spapr_machine_2_3_instance_init(Object *obj)
> > diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
> > index 15beb6b..527d728 100644
> > --- a/include/hw/char/serial.h
> > +++ b/include/hw/char/serial.h
> > @@ -94,4 +94,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
> >  #define TYPE_ISA_SERIAL "isa-serial"
> >  void serial_hds_isa_init(ISABus *bus, int n);
> >  
> > +/* Force migration compatibility of pre-2.2 machine types */
> > +extern bool serial_migrate_pre_2_2;
> > +
> >  #endif
> > -- 
> > 2.4.3
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-06-17  9:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 18:54 [Qemu-devel] [PATCH] Migration compatibility for serial Dr. David Alan Gilbert (git)
2015-06-16 20:49 ` Michael S. Tsirkin
2015-06-17  9:09   ` Dr. David Alan Gilbert [this message]
2015-06-17  6:52 ` Markus Armbruster
2015-06-17  6:58   ` Michael S. Tsirkin
2015-06-17  7:11     ` Markus Armbruster
2015-06-17  7:25       ` Michael S. Tsirkin
2015-06-17  7:41 ` Paolo Bonzini
2015-06-17  7:52   ` Michael S. Tsirkin
2015-06-17  8:11     ` Paolo Bonzini
2015-06-17 10:13       ` Michael S. Tsirkin
2015-06-17 10:48         ` Juan Quintela
2015-06-17 10:51           ` Dr. David Alan Gilbert
2015-06-17 10:56             ` Michael S. Tsirkin
2015-06-17 10:59               ` Dr. David Alan Gilbert
2015-06-17 11:36                 ` Michael S. Tsirkin
2015-06-17 10:55           ` Michael S. Tsirkin
2015-06-17 11:33         ` Paolo Bonzini
2015-06-17 11:40           ` Dr. David Alan Gilbert
2015-06-17 11:44             ` Paolo Bonzini
2015-06-17 11:48               ` Michael S. Tsirkin
2015-06-17 12:07               ` Dr. David Alan Gilbert
2015-06-17 12:20                 ` Paolo Bonzini
2015-06-17 14:44                   ` Michael S. Tsirkin
2015-06-17 16:34                     ` Juan Quintela
2015-06-17 16:39                       ` Michael S. Tsirkin
2015-06-17 16:40                         ` Paolo Bonzini
2015-06-17 11:45           ` Michael S. Tsirkin
2015-06-17 11:53             ` Paolo Bonzini
2015-06-17 11:54               ` Michael S. Tsirkin
2015-06-17 11:55                 ` Paolo Bonzini
2015-06-17 11:58                   ` Michael S. Tsirkin
2015-06-17 12:20                     ` Paolo Bonzini
2015-06-17 14:50                       ` Michael S. Tsirkin
2015-06-17 16:16                         ` Paolo Bonzini
2015-06-17 16:34                           ` Michael S. Tsirkin
2015-06-17 16:35                             ` Paolo Bonzini
2015-06-17  9:26     ` Juan Quintela
2015-06-17 10:37       ` Michael S. Tsirkin
2015-06-17  8:37   ` Dr. David Alan Gilbert
2015-06-17  8:49     ` Paolo Bonzini
2015-06-17  9: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=20150617090905.GB2122@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).