From patchwork Mon Feb 20 18:36:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 9583475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7095604A0 for ; Mon, 20 Feb 2017 18:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4FC0284E7 for ; Mon, 20 Feb 2017 18:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 999A228820; Mon, 20 Feb 2017 18:38:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49745284E7 for ; Mon, 20 Feb 2017 18:38:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfsot-0006kP-EI; Mon, 20 Feb 2017 18:36:19 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfsos-0006kB-39 for xen-devel@lists.xenproject.org; Mon, 20 Feb 2017 18:36:18 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id AB/BC-30596-1273BA85; Mon, 20 Feb 2017 18:36:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRWlGSWpSXmKPExsVysWW7jK6C+eo Igwt9Vhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aMvlVMBY+EKu6cNm5g3C7QxcjFISQwl0li /aGbLF2MnEDOMkaJb3uSQWw2ATWJP7c6WUGKRATWMUlMuPCHEcRhFtjJLHHqwiRmkCphgQCJI ysa2boYOThYBFQlJk3XBwnzCjhKNK98zghicwo4SWz+/IYFpEQIKL5smilIWEJAW+LY+adsIC MlBPoYJQ5NvcM8gZFnASPDKkaN4tSistQiXSNDvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKR iveT83E2MQL/XMzAw7mDs2et3iFGSg0lJlPfOklURQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4 Oc1WRwgJFqWmp1akZeYAAxAmLcHBoyTCKwCS5i0uSMwtzkyHSJ1i1OU4deP0SyYhlrz8vFQpc d5OU6AiAZCijNI8uBGwaLjEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZh3DsgUnsy8ErhNr4 COYAI64qbHSpAjShIRUlINjCZqsWV6xxqYd2abpS9Y/NZLTTNT/hKvuMM1hXc/mrOMbuyIFN5 2cL+JSGf/Gc/SdVveTni4b2fD4wfqvNHTTv4Tanqr/qF6qarP+vKoGT86zZ/H7tLZdDTwY/hF azGBZ0/Cb7GpTArQZdjKnB65ifuK0bOTX7x/n50d17v70e3bRo7vwxZLxSuxFGckGmoxFxUnA gB/e1hYgQIAAA== X-Env-Sender: longman@redhat.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1487615775!55667268!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35294 invoked from network); 20 Feb 2017 18:36:16 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Feb 2017 18:36:16 -0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6DB2C01B14F; Mon, 20 Feb 2017 18:36:14 +0000 (UTC) Received: from llong.com (dhcp-17-80.bos.redhat.com [10.18.17.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0926516A7C; Mon, 20 Feb 2017 18:36:11 +0000 (UTC) From: Waiman Long To: Jeremy Fitzhardinge , Chris Wright , Alok Kataria , Rusty Russell , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" Date: Mon, 20 Feb 2017 13:36:03 -0500 Message-Id: <1487615764-1343-2-git-send-email-longman@redhat.com> In-Reply-To: <1487615764-1343-1-git-send-email-longman@redhat.com> References: <1487615764-1343-1-git-send-email-longman@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 Feb 2017 18:36:16 +0000 (UTC) Cc: linux-arch@vger.kernel.org, Juergen Gross , kvm@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Pan Xinhui , x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Waiman Long , Paolo Bonzini , xen-devel@lists.xenproject.org, Boris Ostrovsky Subject: [Xen-devel] [PATCH v5 1/2] x86/paravirt: Change vcp_is_preempted() arg type to long X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The cpu argument in the function prototype of vcpu_is_preempted() is changed from int to long. That makes it easier to provide a better optimized assembly version of that function. For Xen, vcpu_is_preempted(long) calls xen_vcpu_stolen(int), the downcast from long to int is not a problem as vCPU number won't exceed 32 bits. Signed-off-by: Waiman Long --- arch/x86/include/asm/paravirt.h | 2 +- arch/x86/include/asm/qspinlock.h | 2 +- arch/x86/kernel/kvm.c | 2 +- arch/x86/kernel/paravirt-spinlocks.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 1eea6ca..f75fbfe 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -673,7 +673,7 @@ static __always_inline void pv_kick(int cpu) PVOP_VCALL1(pv_lock_ops.kick, cpu); } -static __always_inline bool pv_vcpu_is_preempted(int cpu) +static __always_inline bool pv_vcpu_is_preempted(long cpu) { return PVOP_CALLEE1(bool, pv_lock_ops.vcpu_is_preempted, cpu); } diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index c343ab5..48a706f 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -34,7 +34,7 @@ static inline void queued_spin_unlock(struct qspinlock *lock) } #define vcpu_is_preempted vcpu_is_preempted -static inline bool vcpu_is_preempted(int cpu) +static inline bool vcpu_is_preempted(long cpu) { return pv_vcpu_is_preempted(cpu); } diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 099fcba..85ed343 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -589,7 +589,7 @@ static void kvm_wait(u8 *ptr, u8 val) local_irq_restore(flags); } -__visible bool __kvm_vcpu_is_preempted(int cpu) +__visible bool __kvm_vcpu_is_preempted(long cpu) { struct kvm_steal_time *src = &per_cpu(steal_time, cpu); diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c index 6259327..8f2d1c9 100644 --- a/arch/x86/kernel/paravirt-spinlocks.c +++ b/arch/x86/kernel/paravirt-spinlocks.c @@ -20,7 +20,7 @@ bool pv_is_native_spin_unlock(void) __raw_callee_save___native_queued_spin_unlock; } -__visible bool __native_vcpu_is_preempted(int cpu) +__visible bool __native_vcpu_is_preempted(long cpu) { return false; }