From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753901AbcEXG70 (ORCPT ); Tue, 24 May 2016 02:59:26 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:39436 "EHLO e06smtp16.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbcEXG7Y (ORCPT ); Tue, 24 May 2016 02:59:24 -0400 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: borntraeger@de.ibm.com X-IBM-RcptTo: kvm@vger.kernel.org;linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] KVM: halt-polling: poll if emulated lapic timer will fire soon To: Wanpeng Li , David Matlack References: <1463964124-13953-1-git-send-email-wanpeng.li@hotmail.com> Cc: "linux-kernel@vger.kernel.org" , kvm list , Wanpeng Li , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Yang Zhang From: Christian Borntraeger Message-ID: <5743FBC5.8080204@de.ibm.com> Date: Tue, 24 May 2016 08:59:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16052406-0025-0000-0000-000018952446 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/24/2016 04:25 AM, Wanpeng Li wrote: > 2016-05-24 10:19 GMT+08:00 Wanpeng Li : >> 2016-05-24 2:01 GMT+08:00 David Matlack : >>> On Sun, May 22, 2016 at 5:42 PM, Wanpeng Li wrote: >>>> From: Wanpeng Li >>> >>> 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;