From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 905C7C3A5A9 for ; Mon, 4 May 2020 15:25:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71416206EB for ; Mon, 4 May 2020 15:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729255AbgEDPZV (ORCPT ); Mon, 4 May 2020 11:25:21 -0400 Received: from mga01.intel.com ([192.55.52.88]:54713 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729217AbgEDPZV (ORCPT ); Mon, 4 May 2020 11:25:21 -0400 IronPort-SDR: KXKsBcF2PTe9aqYYS1HW2f4HLq+ZcXssb1rbjKABGWXW5qEgQhlAEnEax4c76ietUHVXNgjB5j H22vr1NeebIg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2020 08:25:20 -0700 IronPort-SDR: Oz75ZeQHnctQQzLc23r9N2oYgoc0ARf1BAVA2t59kRZhHaXovh0EkPk+9fXiAJqDmcyrgHLJ3l DARvYyW1WPKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,352,1583222400"; d="scan'208";a="294653947" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga002.fm.intel.com with ESMTP; 04 May 2020 08:25:19 -0700 Date: Mon, 4 May 2020 08:25:19 -0700 From: Sean Christopherson To: Uros Bizjak Cc: kvm@vger.kernel.org, Paolo Bonzini Subject: Re: [PATCH v4] KVM: VMX: Improve handle_external_interrupt_irqoff inline assembly Message-ID: <20200504152519.GC16949@linux.intel.com> References: <20200503230545.442042-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200503230545.442042-1-ubizjak@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, May 04, 2020 at 01:05:45AM +0200, Uros Bizjak wrote: > Improve handle_external_interrupt_irqoff inline assembly in several ways: > - use "re" operand constraint instead of "i" and remove > unneeded %c operand modifiers and "$" prefixes > - use %rsp instead of _ASM_SP, since we are in CONFIG_X86_64 part > - use $-16 immediate to align %rsp > - remove unneeded use of __ASM_SIZE macro > - define "ss" named operand only for X86_64 > > The patch introduces no functional changes. Hmm, for handcoded assembly I would argue that the switch from "i" to "re" is a functional change of sorts. The switch also needs explicit justification to explain why it's correct/desirable. Maybe make it a separate patch? > Cc: Paolo Bonzini > Cc: Sean Christopherson > Signed-off-by: Uros Bizjak > --- > arch/x86/kvm/vmx/vmx.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index c2c6335a998c..56c742effb30 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6283,13 +6283,13 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu) > > asm volatile( > #ifdef CONFIG_X86_64 > - "mov %%" _ASM_SP ", %[sp]\n\t" > - "and $0xfffffffffffffff0, %%" _ASM_SP "\n\t" > - "push $%c[ss]\n\t" > + "mov %%rsp, %[sp]\n\t" > + "and $-16, %%rsp\n\t" > + "push %[ss]\n\t" > "push %[sp]\n\t" > #endif > "pushf\n\t" > - __ASM_SIZE(push) " $%c[cs]\n\t" > + "push %[cs]\n\t" > CALL_NOSPEC > : > #ifdef CONFIG_X86_64 > @@ -6298,8 +6298,10 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu) > ASM_CALL_CONSTRAINT > : > [thunk_target]"r"(entry), > - [ss]"i"(__KERNEL_DS), > - [cs]"i"(__KERNEL_CS) > +#ifdef CONFIG_X86_64 > + [ss]"re"(__KERNEL_DS), > +#endif > + [cs]"re"(__KERNEL_CS) > ); > > kvm_after_interrupt(vcpu); > -- > 2.25.4 >