All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com, aliguori@us.ibm.com
Subject: Re: [PATCH 2/5] reuse kvm_vm_ioctl
Date: Fri, 17 Jul 2009 13:48:01 -0300	[thread overview]
Message-ID: <20090717164801.GF4019@poweredge.glommer> (raw)
In-Reply-To: <20090717155738.GA5414@amt.cnet>

On Fri, Jul 17, 2009 at 12:57:38PM -0300, Marcelo Tosatti wrote:
> On Fri, Jul 17, 2009 at 12:46:23PM -0300, Marcelo Tosatti wrote:
> > On Fri, Jul 17, 2009 at 12:49:04PM -0300, Glauber Costa wrote:
> > > On Fri, Jul 17, 2009 at 12:39:17PM -0300, Marcelo Tosatti wrote:
> > > > On Wed, Jul 15, 2009 at 12:31:40PM -0400, Glauber Costa wrote:
> > > > > Start using kvm_vm_ioctl's code.
> > > > > For type safety, delete vm_fd from kvm_context entirely, so the
> > > > > compiler can play along with us helping to detect errors I might
> > > > > have made.
> > > > > 
> > > > > Signed-off-by: Glauber Costa <glommer@redhat.com>
> > > > > ---
> > > > >  kvm-all.c      |    2 ++
> > > > >  qemu-kvm-x86.c |   18 +++++++++---------
> > > > >  qemu-kvm.c     |   52 ++++++++++++++++++++++++++--------------------------
> > > > >  qemu-kvm.h     |    6 +++---
> > > > >  4 files changed, 40 insertions(+), 38 deletions(-)
> > > > 
> > > > <snip>
> > > > 
> > > > > @@ -516,7 +516,7 @@ kvm_vcpu_context_t kvm_create_vcpu(CPUState *env, int id)
> > > > >  	vcpu_ctx->kvm = kvm;
> > > > >  	vcpu_ctx->id = id;
> > > > >  
> > > > > -	r = ioctl(kvm->vm_fd, KVM_CREATE_VCPU, id);
> > > > > +	r = kvm_vm_ioctl(kvm_state, KVM_CREATE_VCPU, id);
> > > > >  	if (r == -1) {
> > > > >  		fprintf(stderr, "kvm_create_vcpu: %m\n");
> > > > 
> > > > 
> > > > int kvm_vm_ioctl(KVMState *s, int type, ...)
> > > > {
> > > >     ...
> > > >     if (ret == -1)
> > > >         ret = -errno;
> > > > }
> > > > 
> > > > Is that fine?
> > > I don't see a problem with that.
> > 
> > Problem is the sites in qemu-kvm.c kvm_vm_ioctl to return -1 
> > on error, but kvm_vm_ioctl converts -1 to -errno, no?
> 
> BTW kvm-all.c:
> 
>         if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
>             dprintf("ioctl failed %d\n", errno);
>             ret = -1;
>             break;
>         }
gee, that's a real bug.

Maybe we should in fact change kvm-all to stop doing this altogether.
Anthony?


      reply	other threads:[~2009-07-17 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 16:31 [PATCH 0/5] Further cleanups Glauber Costa
2009-07-15 16:31 ` [PATCH 1/5] remove kvm types from handle unhandled Glauber Costa
2009-07-15 16:31   ` [PATCH 2/5] reuse kvm_vm_ioctl Glauber Costa
2009-07-15 16:31     ` [PATCH 3/5] reuse kvm_ioctl Glauber Costa
2009-07-15 16:31       ` [PATCH 4/5] check extension Glauber Costa
2009-07-15 16:31         ` [PATCH 5/5] use upstream cpuid code Glauber Costa
2009-07-17 13:35     ` [PATCH 2/5] reuse kvm_vm_ioctl Marcelo Tosatti
2009-07-17 14:21       ` Glauber Costa
2009-07-17 15:39     ` Marcelo Tosatti
2009-07-17 15:49       ` Glauber Costa
2009-07-17 15:46         ` Marcelo Tosatti
2009-07-17 15:57           ` Marcelo Tosatti
2009-07-17 16:48             ` Glauber Costa [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=20090717164801.GF4019@poweredge.glommer \
    --to=glommer@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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 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.