All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: "ryanh@linux.vnet.ibm.com" <ryanh@linux.vnet.ibm.com>,
	"aliguori@us.ibm.com" <aliguori@us.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Avi Kivity <avi@redhat.com>, Eric B Munson <emunson@mgebm.net>
Subject: Re: [PATCH V3] Guest stop notification
Date: Sat, 3 Dec 2011 09:19:35 -0200	[thread overview]
Message-ID: <20111203111935.GA25573@amt.cnet> (raw)
In-Reply-To: <4ED9E6B0.2000903@web.de>

On Sat, Dec 03, 2011 at 10:06:56AM +0100, Jan Kiszka wrote:
> On 2011-12-02 22:27, Eric B Munson wrote:
> > On Fri, 02 Dec 2011, Jan Kiszka wrote:
> > 
> >> On 2011-12-02 20:19, Eric B Munson wrote:
> >>> Often when a guest is stopped from the qemu console, it will report spurious
> >>> soft lockup warnings on resume.  There are kernel patches being discussed that
> >>> will give the host the ability to tell the guest that it is being stopped and
> >>> should ignore the soft lockup warning that generates.
> >>>
> >>> Signed-off-by: Eric B Munson <emunson@mgebm.net>
> >>> Cc: Avi Kivity <avi@redhat.com>
> >>> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> >>> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> >>> Cc: ryanh@linux.vnet.ibm.com
> >>> Cc: aliguori@us.ibm.com
> >>> Cc: kvm@vger.kernel.org
> >>>
> >>> ---
> >>> Changes from V2:
> >>>  Move ioctl into hw/kvmclock.c so as other arches can use it as it is
> >>> implemented
> >>>
> >>> Changes from V1:
> >>>  Remove unnecessary encapsulating function
> >>>
> >>>  hw/kvmclock.c |   24 ++++++++++++++++++++++++
> >>>  1 files changed, 24 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/hw/kvmclock.c b/hw/kvmclock.c
> >>> index 5388bc4..756839f 100644
> >>> --- a/hw/kvmclock.c
> >>> +++ b/hw/kvmclock.c
> >>> @@ -16,6 +16,7 @@
> >>>  #include "sysbus.h"
> >>>  #include "kvm.h"
> >>>  #include "kvmclock.h"
> >>> +#include "cpu-all.h"
> >>>  
> >>>  #include <linux/kvm.h>
> >>>  #include <linux/kvm_para.h>
> >>> @@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, int running,
> >>>      }
> >>>  }
> >>>  
> >>> +static void kvmclock_vm_state_change_vcpu(void *opaque, int running,
> >>> +                                          RunState state)
> >>> +{
> >>> +    int ret;
> >>> +    CPUState *penv = first_cpu;
> >>> +
> >>> +    if (running) {
> >>> +	while (penv) {
> >>
> >> or: for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
> >>
> > 
> > Functionally equivalent and I see both in the code, is there a standard?
> 
> Not really. I once tried to introduce an iterator macro, but it was
> refused. The above is just more compact.
> 
> But this is only a minor nit.
> 
> > 
> >>> +            ret = kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0);
> >>> +            if (ret) {
> >>> +                if (ret != ENOSYS) {
> >>> +                    fprintf(stderr,
> >>> +                            "kvmclock_vm_state_change_vcpu: %s\n",
> >>> +                            strerror(-ret));
> >>> +                }
> >>> +                return;
> >>> +            }
> >>> +            penv = (CPUState *)penv->next_cpu;
> >>
> >> Unneeded cast.
> >>
> > 
> > Also following an example seen elsewhere.
> 
> Generally, we try to avoid those pointless casts.
> 
> > 
> >>> +        }
> >>> +    }
> >>> +}
> >>> +
> >>
> >> Again: please use checkpatch.pl.
> >>
> > 
> > Sorry, tough to get used to hitting space bar that many times...
> > 
> >>>  static int kvmclock_init(SysBusDevice *dev)
> >>>  {
> >>>      KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
> >>>  
> >>>      qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
> >>> +    qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NULL);
> >>>      return 0;
> >>>  }
> >>>  
> >>
> >> Why not extend the existing handler?
> > 
> > Because the new handler doesn't touch the KVMClockState object.  If this is
> > preferred, I have no objection.
> 
> The separate registration looks strange to me. And the fact that you
> don't need to object doesn't justify a callback of its own.
> 
> > 
> >>
> >> I still wonder if the IOCTL interface is actually kvmclock specific. But
> >> Marcello asked for this, and we could still change it when some arch
> >> comes around that provides it independent of kvmclock.
> > 
> > The flag itself is stored in the pvclock_vcpu_time_info structure, and anything
> > else that touches that structure uses ioctls.
> 
> That's the host-guest interface. But I'm talking about the kvm-qemu
> interface here which has no relation to how the "was paused" information
> is transferred to the guest.
> 
> Jan

It is one simple, rarely used command. I don't see why another interface
such as kvm_run would be beneficial for this case.

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: "ryanh@linux.vnet.ibm.com" <ryanh@linux.vnet.ibm.com>,
	"aliguori@us.ibm.com" <aliguori@us.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Avi Kivity <avi@redhat.com>, Eric B Munson <emunson@mgebm.net>
Subject: Re: [Qemu-devel] [PATCH V3] Guest stop notification
Date: Sat, 3 Dec 2011 09:19:35 -0200	[thread overview]
Message-ID: <20111203111935.GA25573@amt.cnet> (raw)
In-Reply-To: <4ED9E6B0.2000903@web.de>

On Sat, Dec 03, 2011 at 10:06:56AM +0100, Jan Kiszka wrote:
> On 2011-12-02 22:27, Eric B Munson wrote:
> > On Fri, 02 Dec 2011, Jan Kiszka wrote:
> > 
> >> On 2011-12-02 20:19, Eric B Munson wrote:
> >>> Often when a guest is stopped from the qemu console, it will report spurious
> >>> soft lockup warnings on resume.  There are kernel patches being discussed that
> >>> will give the host the ability to tell the guest that it is being stopped and
> >>> should ignore the soft lockup warning that generates.
> >>>
> >>> Signed-off-by: Eric B Munson <emunson@mgebm.net>
> >>> Cc: Avi Kivity <avi@redhat.com>
> >>> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> >>> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> >>> Cc: ryanh@linux.vnet.ibm.com
> >>> Cc: aliguori@us.ibm.com
> >>> Cc: kvm@vger.kernel.org
> >>>
> >>> ---
> >>> Changes from V2:
> >>>  Move ioctl into hw/kvmclock.c so as other arches can use it as it is
> >>> implemented
> >>>
> >>> Changes from V1:
> >>>  Remove unnecessary encapsulating function
> >>>
> >>>  hw/kvmclock.c |   24 ++++++++++++++++++++++++
> >>>  1 files changed, 24 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/hw/kvmclock.c b/hw/kvmclock.c
> >>> index 5388bc4..756839f 100644
> >>> --- a/hw/kvmclock.c
> >>> +++ b/hw/kvmclock.c
> >>> @@ -16,6 +16,7 @@
> >>>  #include "sysbus.h"
> >>>  #include "kvm.h"
> >>>  #include "kvmclock.h"
> >>> +#include "cpu-all.h"
> >>>  
> >>>  #include <linux/kvm.h>
> >>>  #include <linux/kvm_para.h>
> >>> @@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, int running,
> >>>      }
> >>>  }
> >>>  
> >>> +static void kvmclock_vm_state_change_vcpu(void *opaque, int running,
> >>> +                                          RunState state)
> >>> +{
> >>> +    int ret;
> >>> +    CPUState *penv = first_cpu;
> >>> +
> >>> +    if (running) {
> >>> +	while (penv) {
> >>
> >> or: for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
> >>
> > 
> > Functionally equivalent and I see both in the code, is there a standard?
> 
> Not really. I once tried to introduce an iterator macro, but it was
> refused. The above is just more compact.
> 
> But this is only a minor nit.
> 
> > 
> >>> +            ret = kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0);
> >>> +            if (ret) {
> >>> +                if (ret != ENOSYS) {
> >>> +                    fprintf(stderr,
> >>> +                            "kvmclock_vm_state_change_vcpu: %s\n",
> >>> +                            strerror(-ret));
> >>> +                }
> >>> +                return;
> >>> +            }
> >>> +            penv = (CPUState *)penv->next_cpu;
> >>
> >> Unneeded cast.
> >>
> > 
> > Also following an example seen elsewhere.
> 
> Generally, we try to avoid those pointless casts.
> 
> > 
> >>> +        }
> >>> +    }
> >>> +}
> >>> +
> >>
> >> Again: please use checkpatch.pl.
> >>
> > 
> > Sorry, tough to get used to hitting space bar that many times...
> > 
> >>>  static int kvmclock_init(SysBusDevice *dev)
> >>>  {
> >>>      KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
> >>>  
> >>>      qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
> >>> +    qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NULL);
> >>>      return 0;
> >>>  }
> >>>  
> >>
> >> Why not extend the existing handler?
> > 
> > Because the new handler doesn't touch the KVMClockState object.  If this is
> > preferred, I have no objection.
> 
> The separate registration looks strange to me. And the fact that you
> don't need to object doesn't justify a callback of its own.
> 
> > 
> >>
> >> I still wonder if the IOCTL interface is actually kvmclock specific. But
> >> Marcello asked for this, and we could still change it when some arch
> >> comes around that provides it independent of kvmclock.
> > 
> > The flag itself is stored in the pvclock_vcpu_time_info structure, and anything
> > else that touches that structure uses ioctls.
> 
> That's the host-guest interface. But I'm talking about the kvm-qemu
> interface here which has no relation to how the "was paused" information
> is transferred to the guest.
> 
> Jan

It is one simple, rarely used command. I don't see why another interface
such as kvm_run would be beneficial for this case.

  reply	other threads:[~2011-12-03 11:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 19:19 [PATCH V3] Guest stop notification Eric B Munson
2011-12-02 19:19 ` [Qemu-devel] " Eric B Munson
2011-12-02 20:20 ` Jan Kiszka
2011-12-02 20:20   ` [Qemu-devel] " Jan Kiszka
2011-12-02 21:27   ` Eric B Munson
2011-12-02 21:27     ` [Qemu-devel] " Eric B Munson
2011-12-03  9:06     ` Jan Kiszka
2011-12-03  9:06       ` [Qemu-devel] " Jan Kiszka
2011-12-03 11:19       ` Marcelo Tosatti [this message]
2011-12-03 11:19         ` Marcelo Tosatti
2011-12-03 11:25         ` Jan Kiszka
2011-12-03 11:25           ` Jan Kiszka
2011-12-03 11:42           ` Marcelo Tosatti
2011-12-03 11:42             ` [Qemu-devel] " Marcelo Tosatti
2011-12-03 11:45             ` Jan Kiszka
2011-12-05 13:35               ` Marcelo Tosatti
2011-12-05 13:46                 ` Jan Kiszka
2011-12-05 13:46                   ` Jan Kiszka
2011-12-05 12:58       ` Eric B Munson
2011-12-05 12:58         ` [Qemu-devel] " Eric B Munson

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=20111203111935.GA25573@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=emunson@mgebm.net \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@linux.vnet.ibm.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 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.