[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] x86: allow Kconfig control over psABI level


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jul 2023 08:08:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vBP945K6cV1Bfs2/WNmVrWUT6t1IWGcRBzEU6qkqe9A=; b=TNJJEXfrugxfmXTkNXDAr3Q+1hqRqTEcgm5NDtjYmhg+8RcedW6tItekPZHH05iNySTRAGlKviRdR1Vljvlve5zPA2M4jCwF1w/oyGDhwLb93COcphE0gCh8Ifk3A1LKrXUFr8vyT7LwJcoDlJpjO46JEcMUzHq+f/pPeVO651IiaE7LDAUtb3MCoLQGPEJDu8KXoYjhgEJyEhjoYe4Cv2tUtTLHdsv2WtDRygO7pCBFjEgelBAySivFY4XWt7M2j+OmYyFywCcseR0TvmFjGZmYQ3rIPEXyoa6jxAfiOJ+qwNHEjJPhUxrZgwwESgxEwCgLTfSJ3vbIM78s8FwMkA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVP/OsEc4uNAt9CVHXgkHnvWGhJn9WKYk9q2mB+j/vRcmF4hjoPWxCAlCnUWsgQ/V3/MYyS4FXE03Vst/kJ7MfzyBpogfPCOzuE5EwXSug6FdGRpUbboEVWAAf6x6EQsjshmUasZ0GguhLnYSesrTrWrQrsaEFeMQ471lJwwHGmZN0jFuR8QUSTOjDL06pDLWbZa5VEpR9ZOfS2o1Tdz3NHXOjVwEtr6GrjYpNd9e8hiav5x8Qvhb0LzkhxcyOL7sbSgxzur4x5h/55CmgXX7sWlZSjwEaiCKlQz3D3Pjskejet1rB8XhmzJePE17hNnuNTDjMoDrCUFd1yBmyG16g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 18 Jul 2023 06:09:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.07.2023 14:33, Jan Beulich wrote:
> Newer hardware offers more efficient and/or flexible and/or capable
> instructions, some of which we can make good use of in the hypervisor
> as well. Allow a basic way (no alternatives patching) of enabling their
> use. Of course this means that hypervisors thus built won't work
> anymore on older, less capable hardware.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> TBD: Should we, just like for NX, add an early check in assembly code,
>      to have a "clean" failure rather than a random crash?

TBD: While older compilers (apparently gcc10 and older; not sure about
     clang) won't recognize -march=x86-64-v2 etc, we could fall back to
     passing -mpopcnt and alike explicitly.

Jan

> Whereas the baseline -> v2 step isn't much of a difference (we'll gain
> more there by a subsequent patch), v2 -> v3, while presumably (or shall
> I say hopefully) faster, yields an overall growth of .text size by (in
> my build) about 2k. The primary reason for this appear to be conversions
> of SHL-by-immediate to SHLX.
> 
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -118,6 +118,36 @@ config HVM
>  
>         If unsure, say Y.
>  
> +choice
> +     prompt "base psABI level"
> +     default X86_64_BASELINE
> +     help
> +       The psABI defines 4 levels of ISA extension sets as a coarse granular
> +       way of identifying advanced functionality that would be uniformly
> +       available in respectively newer hardware.  While v4 is not really of
> +       interest for Xen, the others can be selected here, making the
> +       resulting Xen no longer work on older hardware.  This option won't
> +       have any effect if the toolchain doesn't support the distinction.
> +
> +       If unsure, stick to the default.
> +
> +config X86_64_BASELINE
> +     bool "baseline"
> +
> +config X86_64_V2
> +     bool "v2"
> +     help
> +       This enables POPCNT and CX16, besides other extensions which are of
> +       no interest here.
> +
> +config X86_64_V3
> +     bool "v3"
> +     help
> +       This enables BMI, BMI2, LZCNT, and MOVBE, besides other extensions
> +       which are of no interest here.
> +
> +endchoice
> +
>  config XEN_SHSTK
>       bool "Supervisor Shadow Stacks"
>       depends on HAS_AS_CET_SS
> --- a/xen/arch/x86/arch.mk
> +++ b/xen/arch/x86/arch.mk
> @@ -36,6 +36,10 @@ CFLAGS += -mno-red-zone -fpic
>  # the SSE setup for variadic function calls.
>  CFLAGS += -mno-mmx -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
>  
> +# Enable the selected baseline ABI, if supported by the compiler.
> +CFLAGS-$(CONFIG_X86_64_V2) += $(call cc-option,$(CC),-march=x86-64-v2)
> +CFLAGS-$(CONFIG_X86_64_V3) += $(call cc-option,$(CC),-march=x86-64-v3)
> +
>  ifeq ($(CONFIG_INDIRECT_THUNK),y)
>  # Compile with gcc thunk-extern, indirect-branch-register if available.
>  CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch=thunk-extern
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.