From: Matt Evans <matt@ozlabs.org>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: penberg@kernel.org, mingo@elte.hu, gorcunov@gmail.com,
asias.hejun@gmail.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host
Date: Thu, 15 Dec 2011 15:25:42 +1100 [thread overview]
Message-ID: <4EE976C6.4080305@ozlabs.org> (raw)
In-Reply-To: <1323844646-14156-1-git-send-email-levinsasha928@gmail.com>
On 14/12/11 17:37, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> tools/kvm/include/kvm/kvm.h | 2 ++
> tools/kvm/kvm.c | 5 +++++
> 2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h
> index 7159952..d24b70a 100644
> --- a/tools/kvm/include/kvm/kvm.h
> +++ b/tools/kvm/include/kvm/kvm.h
> @@ -79,4 +79,6 @@ static inline void *guest_flat_to_host(struct kvm *kvm, unsigned long offset)
> return kvm->ram_start + offset;
> }
>
> +bool kvm__has_cap(struct kvm *kvm, u32 cap);
> +
> #endif /* KVM__KVM_H */
> diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
> index 35ca2c5..a2f7a89 100644
> --- a/tools/kvm/kvm.c
> +++ b/tools/kvm/kvm.c
> @@ -517,3 +517,8 @@ void kvm__notify_paused(void)
> mutex_lock(&pause_lock);
> mutex_unlock(&pause_lock);
> }
> +
> +bool kvm__has_cap(struct kvm *kvm, u32 cap)
> +{
> + return ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, cap) == 0;
> +}
^^^^
D'oh, this needs to be != 0, not == 0.
Cheers,
Matt
---
From: Matt Evans <matt@ozlabs.org>
Date: Thu, 15 Dec 2011 15:19:47 +1100
Subject: [PATCH] kvm tools: Fix inverted logic bug in kvm__has_cap
Commit 42efb1abf4ebebeedd14af34c073e673923e2898 compared KVM_CHECK_EXTENSION's
result wrong, stating 'has cap' true if 0. Invert the comparison.
Signed-off-by: Matt Evans <matt@ozlabs.org>
---
tools/kvm/kvm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 9583ab2..25f1419 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -523,5 +523,5 @@ void kvm__notify_paused(void)
bool kvm__has_cap(struct kvm *kvm, u32 cap)
{
- return ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, cap) == 0;
+ return ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, cap) != 0;
}
--
1.7.0.4
prev parent reply other threads:[~2011-12-15 4:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 6:37 [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host Sasha Levin
2011-12-14 6:37 ` [PATCH 2/2] kvm tools: Don't use ioeventfds if no KVM_CAP_IOEVENTFD Sasha Levin
2011-12-15 0:52 ` Matt Evans
2011-12-15 4:25 ` Matt Evans [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=4EE976C6.4080305@ozlabs.org \
--to=matt@ozlabs.org \
--cc=asias.hejun@gmail.com \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.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.