From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Wanpeng Li <kernellwp@gmail.com>, David Matlack <dmatlack@google.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm list" <kvm@vger.kernel.org>,
"Wanpeng Li" <wanpeng.li@hotmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Yang Zhang" <yang.zhang.wz@gmail.com>
Subject: Re: [PATCH v3] KVM: halt-polling: poll if emulated lapic timer will fire soon
Date: Tue, 24 May 2016 08:59:17 +0200 [thread overview]
Message-ID: <5743FBC5.8080204@de.ibm.com> (raw)
In-Reply-To: <CANRm+CyRS883Ne1XEX_dO=GKAN5vZZZ0HDZx4e5rB32c1s8Zow@mail.gmail.com>
On 05/24/2016 04:25 AM, Wanpeng Li wrote:
> 2016-05-24 10:19 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
>> 2016-05-24 2:01 GMT+08:00 David Matlack <dmatlack@google.com>:
>>> On Sun, May 22, 2016 at 5:42 PM, Wanpeng Li <kernellwp@gmail.com> wrote:
>>>> From: Wanpeng Li <wanpeng.li@hotmail.com>
>>>
>>> I'm ok with this patch, but I'd like to better understand the target
>>> workloads. What type of workloads do you expect to benefit from this?
>>
>> dynticks guests I think is one of workloads which can get benefit,
>> there are lots of upcoming fire timers captured by my feature. Even
>> during TCP testing. And also the workload of Yang's.
>
> Do you think I should add an module parameter to enable/disable it
> during module insmod or current patch is fine?
What about getting rid of this hunk
- val = 10000;
+ val = halt_poll_ns_base;
and then rename "halt_poll_ns_base" into "halt_poll_ns_timer" that
can be changed as module parameter?
I also experimented with an s390 implementation, which seems pretty straightforward.
It is probably something like the following (whitespace damaged due to pcopy/paste)
and needs more testing.
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 38bbc98..a97739d 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -682,6 +682,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
struct kvm_async_pf *work);
extern int sie64a(struct kvm_s390_sie_block *, u64 *);
+extern u64 kvm_s390_timer_remaining(struct kvm_vcpu *vcpu);
extern char sie_exit;
static inline void kvm_arch_hardware_disable(void) {}
@@ -699,7 +700,7 @@ static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
static inline u64 kvm_arch_timer_remaining(struct kvm_vcpu *vcpu)
{
- return -1ULL;
+ return kvm_s390_timer_remaining(vcpu);
}
void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu);
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 5a80af7..5b209a2 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -936,6 +936,17 @@ static u64 __calculate_sltime(struct kvm_vcpu *vcpu)
return sltime;
}
+
+u64 kvm_s390_timer_remaining(struct kvm_vcpu *vcpu)
+{
+ u64 result;
+
+ preempt_disable();
+ result = __calculate_sltime(vcpu);
+ preempt_enable();
+ return result;
+}
+
int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
{
u64 sltime;
next prev parent reply other threads:[~2016-05-24 6:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 0:42 [PATCH v3] KVM: halt-polling: poll if emulated lapic timer will fire soon Wanpeng Li
2016-05-23 18:01 ` David Matlack
2016-05-24 2:19 ` Wanpeng Li
2016-05-24 2:25 ` Wanpeng Li
2016-05-24 6:59 ` Christian Borntraeger [this message]
2016-05-24 7:10 ` Wanpeng Li
2016-05-24 7:14 ` Wanpeng Li
2016-05-24 7:05 ` Wanpeng Li
2016-05-26 8:04 ` Wanpeng Li
2016-05-27 6:40 ` David Hildenbrand
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=5743FBC5.8080204@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=dmatlack@google.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.com \
--cc=yang.zhang.wz@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).