Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1201003pxb; Tue, 17 Aug 2021 06:19:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFBu2v4CdCNfysPX3jkIJLnk0+3cKlyPj9n3iCgOM+EYtl543rmKzUMjs/QXB4Ahn9Dpm0 X-Received: by 2002:a05:600c:3656:: with SMTP id y22mr3258247wmq.58.1629206339826; Tue, 17 Aug 2021 06:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629206339; cv=none; d=google.com; s=arc-20160816; b=DNfa6BPZgml/Fppp+jlcGIECYqTe/6wvsvuMLSHQDKSUjSGXzpssWXlkFmTrGBTquz f8HWjIkbzsJyvq/fVUXWexTyittydOxGozXfIYQaXXHdT5M4YnhtJhzCMzc48pCnftdX sCV5PuqlgJrHXFU4/uhJeNwFH2PCKxU1rWPIxC0ltvRTZEMdlH8MKfzsNlNuQF4BvJI8 HNeszBXHXCvlnBakMRDS+9xncJL94VLnVxIPon/+0UYMsE2YmPNPHcWYjA3OECKBv/BZ Q8TS8Yk/RN+7f4ral+L0s1gQ0cRvCjGAs8jNIpU+GM2sfgkzuqYc1mHXAkKB1St6NANQ QPuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=xJ9FmFCN/kc9ZKbxTIyoyaQtRvUDmehAzJr/pZ4DacM=; b=X7nr2HW8e60blD4gm0VYc6hNpf4VZJ9HQhJa7oAkZH2xEZ9vuF6qc1cbJi2fjEoqY4 CiSV1bKeuN9j8DlsDbF78sqvX0u7aHVD9L39LBXcp51NMQKwCAe2XbXDGp8KppF1RmLh 5/qdukogzBc2bO7t/CPUVkwbziHOuIa1pqoMeihXOIwfZHPmGNNKlnYjR2EWHLEcuodi 3totwaWqJF4fzNCldLi0M+/ZXifE1o5n/nZ6163e6F1uPl/FSyGFbcP/gpBt4J51lANY 6ANCUJAmMQKTkTuWKVWyqwFu0nkYzFRGhqjeZtLq4ZsQVyKTigUXTjP5DC8Q8gb7dIBP ccuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si2585283edv.441.2021.08.17.06.18.35; Tue, 17 Aug 2021 06:18:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237407AbhHQNRY (ORCPT + 99 others); Tue, 17 Aug 2021 09:17:24 -0400 Received: from mga12.intel.com ([192.55.52.136]:5872 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237156AbhHQNRW (ORCPT ); Tue, 17 Aug 2021 09:17:22 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="195666339" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="195666339" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 06:16:26 -0700 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="510467254" Received: from favalosr-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.164.120]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 06:16:26 -0700 Subject: Re: [PATCH v5 01/12] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT To: Juergen Gross , Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , x86@kernel.org, linux-kernel@vger.kernel.org, Deep Shah , "VMware, Inc." References: <20210804181329.2899708-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210804181329.2899708-2-sathyanarayanan.kuppuswamy@linux.intel.com> <057170db-9382-eb40-7bcb-4ec1de4aae62@suse.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Tue, 17 Aug 2021 06:16:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <057170db-9382-eb40-7bcb-4ec1de4aae62@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/17/21 5:50 AM, Juergen Gross wrote: > On 12.08.21 09:18, Borislav Petkov wrote: >> On Wed, Aug 04, 2021 at 11:13:18AM -0700, Kuppuswamy Sathyanarayanan wrote: >>> From: "Kirill A. Shutemov" >>> >>> CONFIG_PARAVIRT_XXL is mainly defined/used by XEN PV guests. For >>> other VM guest types, features supported under CONFIG_PARAVIRT >>> are self sufficient. CONFIG_PARAVIRT mainly provides support for >>> TLB flush operations and time related operations. >>> >>> For TDX guest as well, paravirt calls under CONFIG_PARVIRT meets >>> most of its requirement except the need of HLT and SAFE_HLT >>> paravirt calls, which is currently defined under >>> COFNIG_PARAVIRT_XXL. >>> >>> Since enabling CONFIG_PARAVIRT_XXL is too bloated for TDX guest >>> like platforms, move HLT and SAFE_HLT paravirt calls under >>> CONFIG_PARAVIRT. >>> >>> Moving HLT and SAFE_HLT paravirt calls are not fatal and should not >>> break any functionality for current users of CONFIG_PARAVIRT. >>> >>> Co-developed-by: Kuppuswamy Sathyanarayanan >>> Signed-off-by: Kuppuswamy Sathyanarayanan >>> Signed-off-by: Kirill A. Shutemov >>> Reviewed-by: Andi Kleen >>> Reviewed-by: Tony Luck >>> --- >> >> You need to do this before sending your patches: >> >> ./scripts/get_maintainer.pl /tmp/tdx.01 >> Thomas Gleixner (maintainer:X86 ARCHITECTURE (32-BIT AND >> 64-BIT),commit_signer:1/6=17%) >> Ingo Molnar (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) >> Borislav Petkov (maintainer:X86 ARCHITECTURE (32-BIT AND >> 64-BIT),commit_signer:6/6=100%) >> x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) >> "H. Peter Anvin" (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) >> Juergen Gross (supporter:PARAVIRT_OPS >> INTERFACE,commit_signer:5/6=83%,authored:5/6=83%,added_lines:15/16=94%,removed_lines:38/39=97%) >> Deep Shah (supporter:PARAVIRT_OPS INTERFACE) >> "VMware, Inc." (supporter:PARAVIRT_OPS INTERFACE) >> ... >> >> and CC also the supporters - I'm pretty sure at least Juergen would like >> to be kept up-to-date on pv changes. I'll CC him and the others now and >> leave in the whole diff but make sure you do that in the future please. >> >>>   arch/x86/include/asm/irqflags.h       | 40 +++++++++++++++------------ >>>   arch/x86/include/asm/paravirt.h       | 20 +++++++------- >>>   arch/x86/include/asm/paravirt_types.h |  3 +- >>>   arch/x86/kernel/paravirt.c            |  4 ++- >>>   4 files changed, 36 insertions(+), 31 deletions(-) >>> >>> diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h >>> index c5ce9845c999..f3bb33b1715d 100644 >>> --- a/arch/x86/include/asm/irqflags.h >>> +++ b/arch/x86/include/asm/irqflags.h >>> @@ -59,6 +59,28 @@ static inline __cpuidle void native_halt(void) >>>   #endif >>> +#ifndef CONFIG_PARAVIRT >>> +#ifndef __ASSEMBLY__ >>> +/* >>> + * Used in the idle loop; sti takes one instruction cycle >>> + * to complete: >>> + */ >>> +static inline __cpuidle void arch_safe_halt(void) >>> +{ >>> +    native_safe_halt(); >>> +} >>> + >>> +/* >>> + * Used when interrupts are already enabled or to >>> + * shutdown the processor: >>> + */ >>> +static inline __cpuidle void halt(void) >>> +{ >>> +    native_halt(); >>> +} >>> +#endif /* __ASSEMBLY__ */ >>> +#endif /* CONFIG_PARAVIRT */ >>> + >>>   #ifdef CONFIG_PARAVIRT_XXL >>>   #include > > Did you test this with CONFIG_PARAVIRT enabled and CONFIG_PARAVIRT_XXL > disabled? > > I'm asking because in this case I don't see where halt() and > arch_safe_halt() would be defined in case someone is including > asm/irqflags.h and not asm/paravirt.h. We have tested both cases and did not hit any issues. 1. CONFIG_PARAVIRT=y and CONFIG_PARAVIRT_XXL=y 2. CONFIG_PARAVIRT=y and CONFIG_PARAVIRT_XXL=n >>> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c >>> index 04cafc057bed..124e0f6c5d1c 100644 >>> --- a/arch/x86/kernel/paravirt.c >>> +++ b/arch/x86/kernel/paravirt.c >>> @@ -283,9 +283,11 @@ struct paravirt_patch_template pv_ops = { >>>       .irq.save_fl        = __PV_IS_CALLEE_SAVE(native_save_fl), >>>       .irq.irq_disable    = __PV_IS_CALLEE_SAVE(native_irq_disable), >>>       .irq.irq_enable        = __PV_IS_CALLEE_SAVE(native_irq_enable), >>> +#endif /* CONFIG_PARAVIRT_XXL */ >>> + >>> +    /* Irq HLT ops. */ >> >> What's that comment for? > > I agree, please drop it. Yes. I will drop it. > > > Juergen -- Sathyanarayanan Kuppuswamy Linux Kernel Developer