From patchwork Tue Feb 11 11:45:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 3626421 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9BBB8BF418 for ; Tue, 11 Feb 2014 11:45:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0B1F201EF for ; Tue, 11 Feb 2014 11:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4956201F2 for ; Tue, 11 Feb 2014 11:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbaBKLpW (ORCPT ); Tue, 11 Feb 2014 06:45:22 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:42031 "EHLO e06smtp15.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbaBKLpQ (ORCPT ); Tue, 11 Feb 2014 06:45:16 -0500 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Feb 2014 11:45:15 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 11 Feb 2014 11:45:12 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3B01117D805C; Tue, 11 Feb 2014 11:45:38 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1BBj0aq66322486; Tue, 11 Feb 2014 11:45:00 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1BBjBeL022694; Tue, 11 Feb 2014 04:45:11 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s1BBjAZK022683; Tue, 11 Feb 2014 04:45:10 -0700 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id C261D122443D; Tue, 11 Feb 2014 12:45:10 +0100 (CET) From: Christian Borntraeger To: Gleb Natapov , Paolo Bonzini Cc: KVM , linux-s390 , Cornelia Huck , Michael Mueller , Christian Borntraeger Subject: [PATCH/RFC 2/3] s390/kvm: Platform specific kvm_arch_vcpu_dont_yield Date: Tue, 11 Feb 2014 12:45:31 +0100 Message-Id: <1392119132-50182-3-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1392119132-50182-1-git-send-email-borntraeger@de.ibm.com> References: <1392119132-50182-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14021111-0342-0000-0000-000007C12862 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Mueller Commit "s390/kvm: Use common waitqueue" caused a performance regression on s390. It turned out that a yield candidate was missed by just a simple test on its non-empty waitqueue. If an interrupt is outstanding, the candidate might be suitable. kvm_arch_vcpu_dont_yield is extended by a test that additionally tests for not yet delivered interrupts. Significant performance measurement work and code analysis to solve this issue was provided by Mao Chuan Li and his team in Beijing. Signed-off-by: Michael Mueller Reviewed-by: Christian Borntraeger Signed-off-by: Christian Borntraeger --- arch/s390/kvm/Kconfig | 1 + arch/s390/kvm/kvm-s390.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig index c8bacbc..e44adef 100644 --- a/arch/s390/kvm/Kconfig +++ b/arch/s390/kvm/Kconfig @@ -25,6 +25,7 @@ config KVM select HAVE_KVM_EVENTFD select KVM_ASYNC_PF select KVM_ASYNC_PF_SYNC + select HAVE_KVM_ARCH_VCPU_DONT_YIELD ---help--- Support hosting paravirtualized guest machines using the SIE virtualization capability on the mainframe. This should work diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index a5da2cc..1a33e1e 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1231,6 +1231,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf) return VM_FAULT_SIGBUS; } +#ifdef CONFIG_HAVE_KVM_ARCH_VCPU_DONT_YIELD +bool kvm_arch_vcpu_dont_yield(struct kvm_vcpu *vcpu) +{ + return waitqueue_active(&vcpu->wq) && !kvm_cpu_has_interrupt(vcpu); +} +#endif + void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free, struct kvm_memory_slot *dont) {