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

Re: [PATCH v2 2/4] x86: allow Kconfig control over psABI level


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 14:28:34 +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=2nbtjm3If5eDSy+y56CW1wRtxXW938WDjfFg+QN6FgU=; b=T0Kt+4T8lizEEJxUd/uXJugS6xqg6KyfSNn6yimeaj7COjNDHD29mnkTMouzgM21T38i161QPHtmv0Xq9v5U6a5F7jjxVZ+XJnzqMKSjwSBnzMpcKJklngNo3RuO90BN7O3rTENmg26YYfvDYifsP2phW71eTP+GPiAipNnMzw8XqnoMpan0nY7HXqwaBkV9Do+uhwADssRZ3WSZHYQ7+t07TI/19L74YKDVFrZug34XnRqUe8+riPYwtiE+kALhFCmFdzAnEbLzIFM24mC9entNlpe/Ob0RZJm16Dk596T+XPZ66r4K3TvvQrs+lnQP8vjDTqi7EbF8tAnw8RVMww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JvstOa7anT9pniV7cmL5KlFaQIARlMY3ecC7BJl3pY7XTAJSUHTbMCe1+k8DwDD3evz1sQLZcqwUZKQVIyT3UCHk103/NantKebYq7RoF7v0rYeEFrAPRGx9L0eOCvNxAOvbc/zFjY19szgWzpggHAv53PKtZu/p+WYObYLEvjoGk8BrH+CMH7zK8BZjTrs6Y3evJ5LM0oiOPC6H8IsS043NThNOJwp/4/8sAWFbbsFyqeMe/DiDN5vILQQcNUzxiQlrHTSqEOycdfXTmypXPutaecpYUUEDBSmK0R5dwn+2LB7ZvOzARR+7aTjeg5oQzqIvvvLVelbzS13A4Wk4eg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 12:28:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2023 12:04, Andrew Cooper wrote:
> On 19/07/2023 10:44 am, Jan Beulich wrote:
>> --- 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, MOVBE, and XSAVE, 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)
> 
> I know we're having severe disagreements over Kconfig compiler checking,
> but this patch cannot cannot go in in this form.
> 
> You're asking the user unconditionally for the psABI level, then
> ignoring the answer on toolchains which don't understand it.
> 
> The makefile needs to be unconditional, and the Kconfig options need to
> depend on suitable toolchain support.  This is the only way we don't get
> a false statement written into the .config, and embedded in hypfs.

I was tempted to base this on "x86: convert CET tool chain feature checks
to mixed Kconfig/Makefile model", but then it likely wouldn't have stood
a chance to go in either. The technical issues aside that need solving in
that other patch, I still haven't had any feedback on the conceptual
aspects. Yet as said in other contexts, without having the conceptual
side (largely) settled, there's no incentive for me to invest time in
dealing with the technical issues (which surely are solvable).

When raising this aspect, did you pay attention to the first of the TBDs
in the patch? If we were to force build errors (for no real reason, see
below), we should first try those fallbacks, to limit the possible
damage. As mentioned there, support for these -march= forms isn't all
that old.

As to forcing build errors in the first place, that goes against the
intentions with the mixed Kconfig / Makefile checking model. There we
would only issue warnings. Albeit as mentioned in that patch, that's up
for discussion, and a majority may view things differently than I do.
Especially here there's no reason to outright fail builds, though:
.config / hypfs wouldn't really state anything wrong - the binary merely
wouldn't make use of newer insns despite being permitted to.

Jan



 


Rackspace

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