Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp399284pxt; Thu, 12 Aug 2021 00:44:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyADWo4SLtZyfLdVcdwnaDQwJhdFB/e7yvKCsY77EkkICGv0RlKFFHtKIU9dy5H4FWbnrsP X-Received: by 2002:a17:906:2dc5:: with SMTP id h5mr2469058eji.515.1628754251417; Thu, 12 Aug 2021 00:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628754251; cv=none; d=google.com; s=arc-20160816; b=ZRJ9mZlVuGlgoxv2au4ltDvXXiAz5n6HWD97CsdCEvCAc0KjDC6PPE7zWrfNgyJM7f rbSR4oxzaEvbR8Pd/4yz3kndFKBepY484choQcelyrkN7K20BCHn01Yotp8MPb5Q0LPI 9wN1lE2W7Lib7OhoguP1d/WowXjyjXDlzE5+Xr3lcxTDz7iO+r4KomGB/f8Ny3MzO6z4 vxA8St6BmR5emgr+vXz8vmhaqPAN3cx6iHXsfCjydv4dv4ZNE9Vz+8H152CpAu0WDCVQ fZPbRG20Dxr2qhbDBhSLEvSoslRlXvD1GrItdADIK1g1X4i1/7mwc1zmD1OtV6qy+wmj 8Xaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rlbGUby7rx2QkiCySEi6WXCyifPvfBthfPyCaUrpaLc=; b=Bpqzzgr9JjG50eT6GVpjFSlukl2rlui9ts5Vu1Y142I3ful0yPl6Sh+b4k+4smcSmx UqouDDjSK4zkPToz1426H25fUP6KrCtNnrgDo6NHXOp0iIxa3EJll1LrfoGuNgGW3d7q HTckRMznkrwc9SSxLediavFkgSA4W/1cXS3XYhLwmniiM/kqfw4vhdEPeQcW8WZVwN5h 8S61DOAk8I81EFxdMAwj+tIF51zis4Dye0AHSeJfLk+skcS1x/FMicxXN6/SWo0oywiU ipYOSxpoJ+XqNO1gbXIvetzW4va8LJL30pHpSI6v1iy3TEcMoYE30C8SEO+uUzoOtp09 oqNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=VGj+6MDY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn3si1986370edb.298.2021.08.12.00.43.47; Thu, 12 Aug 2021 00:44:11 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=VGj+6MDY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234566AbhHLHSM (ORCPT + 99 others); Thu, 12 Aug 2021 03:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbhHLHSL (ORCPT ); Thu, 12 Aug 2021 03:18:11 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C041C061765 for ; Thu, 12 Aug 2021 00:17:46 -0700 (PDT) Received: from zn.tnic (p200300ec2f0f8300af8ada8aa61ab0b3.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:8300:af8a:da8a:a61a:b0b3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4001A1EC0345; Thu, 12 Aug 2021 09:17:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1628752660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=rlbGUby7rx2QkiCySEi6WXCyifPvfBthfPyCaUrpaLc=; b=VGj+6MDYHJpXuXWHYk7AbYhv8P/p0nJRCed4SL5osKyvLByiTm+fk+MxeJwXltxWkfNSJ3 72bGBHOMSbgzr3u1az3vO7cvHfYmTo/bApWKHci0va1dcAB/5LvWtqxHDB6OXwyNjIqaUU c+kuxJ7dQ5xfQsdwP6t8VfOV4FHHBKA= Date: Thu, 12 Aug 2021 09:18:19 +0200 From: Borislav Petkov To: Kuppuswamy Sathyanarayanan 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, Juergen Gross , Deep Shah , "VMware, Inc." Subject: Re: [PATCH v5 01/12] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT Message-ID: References: <20210804181329.2899708-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210804181329.2899708-2-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210804181329.2899708-2-sathyanarayanan.kuppuswamy@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > #else > @@ -80,24 +102,6 @@ static __always_inline void arch_local_irq_enable(void) > native_irq_enable(); > } > > -/* > - * 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(); > -} > - > /* > * For spinlocks, etc: > */ > diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h > index da3a1ac82be5..d323a626c7a8 100644 > --- a/arch/x86/include/asm/paravirt.h > +++ b/arch/x86/include/asm/paravirt.h > @@ -97,6 +97,16 @@ static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) > PVOP_VCALL1(mmu.exit_mmap, mm); > } > > +static inline void arch_safe_halt(void) > +{ > + PVOP_VCALL0(irq.safe_halt); > +} > + > +static inline void halt(void) > +{ > + PVOP_VCALL0(irq.halt); > +} > + > #ifdef CONFIG_PARAVIRT_XXL > static inline void load_sp0(unsigned long sp0) > { > @@ -162,16 +172,6 @@ static inline void __write_cr4(unsigned long x) > PVOP_VCALL1(cpu.write_cr4, x); > } > > -static inline void arch_safe_halt(void) > -{ > - PVOP_VCALL0(irq.safe_halt); > -} > - > -static inline void halt(void) > -{ > - PVOP_VCALL0(irq.halt); > -} > - > static inline void wbinvd(void) > { > PVOP_ALT_VCALL0(cpu.wbinvd, "wbinvd", ALT_NOT(X86_FEATURE_XENPV)); > diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h > index d9d6b0203ec4..40082847f314 100644 > --- a/arch/x86/include/asm/paravirt_types.h > +++ b/arch/x86/include/asm/paravirt_types.h > @@ -150,10 +150,9 @@ struct pv_irq_ops { > struct paravirt_callee_save save_fl; > struct paravirt_callee_save irq_disable; > struct paravirt_callee_save irq_enable; > - > +#endif > void (*safe_halt)(void); > void (*halt)(void); > -#endif > } __no_randomize_layout; > > struct pv_mmu_ops { > 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? > .irq.safe_halt = native_safe_halt, > .irq.halt = native_halt, > -#endif /* CONFIG_PARAVIRT_XXL */ > > /* Mmu ops. */ > .mmu.flush_tlb_user = native_flush_tlb_local, > -- > 2.25.1 > -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette