From: Paolo Bonzini <pbonzini@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
riel@redhat.com, mtosatti@redhat.com, jan.kiszka@siemens.com,
dmatlack@google.com
Subject: Re: [PATCH] kvm: add halt_poll_ns module parameter
Date: Mon, 09 Feb 2015 17:10:38 +0100 [thread overview]
Message-ID: <54D8DBFE.1070508@redhat.com> (raw)
In-Reply-To: <20150209152111.GB1693@potion.brq.redhat.com>
On 09/02/2015 16:21, Radim Krčmář wrote:
> 2015-02-06 13:48+0100, Paolo Bonzini:
> [...]
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>
> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
>
> Noticed changes since RFC:
> - polling is used in more situations
> - new tracepoint
> - module parameter in nanoseconds
> - properly handled time
> - no polling with overcommit
Yup, pretty much what came in from Marcelo and David.
>> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
>> @@ -148,6 +148,7 @@ struct kvm_vm_stat {
>> };
>>
>> struct kvm_vcpu_stat {
>> + u32 halt_successful_poll;
>> u32 halt_wakeup;
>> };
>
> We don't expose it in arch/arm/kvm/guest.c,
> struct kvm_stats_debugfs_item debugfs_entries[] = {
> { NULL }
> };
Yes. Too late for 3.20.
>> +TRACE_EVENT(kvm_vcpu_wakeup,
>> + TP_PROTO(__u64 ns, bool waited),
>
> (__u64 is preferred here?)
Preferred to what?
>> @@ -1813,29 +1816,60 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
>> void kvm_vcpu_block(struct kvm_vcpu *vcpu)
>> {
>> + ktime_t start, cur;
>> DEFINE_WAIT(wait);
>> + bool waited = false;
>> +
>> + start = cur = ktime_get();
>> + if (halt_poll_ns) {
>> + ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns);
>> + do {
>> + /*
>> + * This sets KVM_REQ_UNHALT if an interrupt
>> + * arrives.
>> + */
>> + if (kvm_vcpu_check_block(vcpu) < 0) {
>> + ++vcpu->stat.halt_successful_poll;
>> + goto out;
>> + }
>> + cur = ktime_get();
>> + } while (single_task_running() && ktime_before(cur, stop));
>
> After reading a bunch of code, I'm still not sure ...
> - need_resched() can't be true when single_task_running()?
> (I think it could happen -- balancing comes into mind.)
Single_task_running is per-CPU; for a task to relinquish control to
another task, you first need to have multiple tasks running. In other
words, I think it cannot.
> - is it ok to ignore need_resched() when single_task_running()?
> (Most likely not.)
Paolo
next prev parent reply other threads:[~2015-02-09 16:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 12:48 [PATCH] kvm: add halt_poll_ns module parameter Paolo Bonzini
2015-02-09 8:22 ` Xiao Guangrong
2015-02-09 9:06 ` Paolo Bonzini
2015-02-09 10:12 ` Xiao Guangrong
2015-02-09 15:21 ` Radim Krčmář
2015-02-09 16:10 ` Paolo Bonzini [this message]
2015-02-09 17:28 ` Radim Krčmář
2015-02-09 19:52 ` David Matlack
2015-02-09 21:00 ` Christian Borntraeger
2015-02-10 7:50 ` Paolo Bonzini
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=54D8DBFE.1070508@redhat.com \
--to=pbonzini@redhat.com \
--cc=dmatlack@google.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=riel@redhat.com \
--cc=rkrcmar@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.