From: Juan Quintela <quintela@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
kvm@vger.kernel.org
Subject: Re: [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper
Date: Sun, 05 Feb 2012 21:03:49 +0100 [thread overview]
Message-ID: <87d39tjbdm.fsf@elfo.elfo> (raw)
In-Reply-To: <6776cc5c00f4d06d23c11b68d18fd96e27f71718.1328438750.git.jan.kiszka@web.de> (Jan Kiszka's message of "Sun, 5 Feb 2012 11:46:29 +0100")
Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> To be used for in-kernel PIT emulation.
....
> + int pit_state2;
This is used as a bool.
> int xsave, xcrs;
> int many_ioeventfds;
> int irqchip_inject_ioctl;
> @@ -954,6 +955,10 @@ int kvm_init(void)
> s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
> #endif
>
> +#ifdef KVM_CAP_PIT_STATE2
> + s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
> +#endif
> +
[ this happened to me when I was reviewing this patch, but culprit is
not this patch]
really kvm_check_extension() should also return a bool, but that is a
bigger change that this patch series tend to introduce.
So, I went to "man ioctl"
> RETURN VALUE
> Usually, on success zero is returned. A few ioctl() requests use the
> return value as an output parameter and return a nonnegative value on
> success. On error, -1 is returned, and errno is set appropriately.
Usually is the important word there.
And then went to kvm-all.c
int kvm_check_extension(KVMState *s, unsigned int extension)
{
int ret;
ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, extension);
if (ret < 0) {
ret = 0;
}
return ret;
}
What? it allways return zero? Something should be wrong here. I will
expect kvm_check_extension() to work by now.
Yes, kvm_ioctl() return 1 went the extension is there, just for the
people confused like me.
Later, Juan.
WARNING: multiple messages have this Message-ID (diff)
From: Juan Quintela <quintela@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper
Date: Sun, 05 Feb 2012 21:03:49 +0100 [thread overview]
Message-ID: <87d39tjbdm.fsf@elfo.elfo> (raw)
In-Reply-To: <6776cc5c00f4d06d23c11b68d18fd96e27f71718.1328438750.git.jan.kiszka@web.de> (Jan Kiszka's message of "Sun, 5 Feb 2012 11:46:29 +0100")
Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> To be used for in-kernel PIT emulation.
....
> + int pit_state2;
This is used as a bool.
> int xsave, xcrs;
> int many_ioeventfds;
> int irqchip_inject_ioctl;
> @@ -954,6 +955,10 @@ int kvm_init(void)
> s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
> #endif
>
> +#ifdef KVM_CAP_PIT_STATE2
> + s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
> +#endif
> +
[ this happened to me when I was reviewing this patch, but culprit is
not this patch]
really kvm_check_extension() should also return a bool, but that is a
bigger change that this patch series tend to introduce.
So, I went to "man ioctl"
> RETURN VALUE
> Usually, on success zero is returned. A few ioctl() requests use the
> return value as an output parameter and return a nonnegative value on
> success. On error, -1 is returned, and errno is set appropriately.
Usually is the important word there.
And then went to kvm-all.c
int kvm_check_extension(KVMState *s, unsigned int extension)
{
int ret;
ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, extension);
if (ret < 0) {
ret = 0;
}
return ret;
}
What? it allways return zero? Something should be wrong here. I will
expect kvm_check_extension() to work by now.
Yes, kvm_ioctl() return 1 went the extension is there, just for the
people confused like me.
Later, Juan.
next prev parent reply other threads:[~2012-02-05 20:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-05 10:46 [PATCH 0/4] uq/master: Introduce KVM PIT support Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] " Jan Kiszka
2012-02-05 10:46 ` [PATCH 1/4] i8254: Factor out base class for KVM reuse Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] " Jan Kiszka
2012-02-05 10:46 ` [PATCH 2/4] i8254: Open-code timer restore Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] " Jan Kiszka
2012-02-05 11:23 ` Paolo Bonzini
2012-02-05 11:23 ` [Qemu-devel] " Paolo Bonzini
2012-02-05 11:33 ` Jan Kiszka
2012-02-05 11:33 ` [Qemu-devel] " Jan Kiszka
2012-02-05 12:03 ` [PATCH 2/4 v3] " Jan Kiszka
2012-02-05 12:03 ` [Qemu-devel] " Jan Kiszka
2012-02-05 10:46 ` [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] " Jan Kiszka
2012-02-05 20:03 ` Juan Quintela [this message]
2012-02-05 20:03 ` Juan Quintela
2012-02-05 20:36 ` Jan Kiszka
2012-02-05 20:36 ` [Qemu-devel] " Jan Kiszka
2012-02-05 10:46 ` [PATCH 4/4] kvm: x86: Add user space part for in-kernel i8254 Jan Kiszka
2012-02-05 10:46 ` [Qemu-devel] " Jan Kiszka
2012-02-08 18:24 ` [PATCH 0/4] uq/master: Introduce KVM PIT support Marcelo Tosatti
2012-02-08 18:24 ` [Qemu-devel] " Marcelo Tosatti
-- strict thread matches above, loose matches on Subject: below --
2012-01-31 18:46 Jan Kiszka
2012-01-31 18:46 ` [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper Jan Kiszka
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=87d39tjbdm.fsf@elfo.elfo \
--to=quintela@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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.