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

Re: [PATCH v9 09/10] x86: use / "support" UDB


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 5 Dec 2025 13:35:25 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=O3dnK4SontG63cblmXZYr/N+3el9CMuZhe7a2JZBNJU=; b=IIqafiuGh1Gj4tS8HXyNEvr8mb4qZnAgyzJM2WssicNaJfqxEpA6G526Bx8EYbs6JsIeKIPwXGHZQeyw7obvt80pKx8IQsEr3TrdnYJkF+mIjN2UizTs8/vPScOC2EtKifw1knRuvEEHJJWe90CcnAAdChHKEGkLxuHLfnHMxpQ3ZC5Uf8d0KSDFvPEx+1EZtsKdU7z/AC7IaLhGqb81YUcpqrJRrvKvj4mU1zbQwRiP6fPvQ6U4FPzt8FQBReVDkwyeioRwtmEFDlwRWdmaH/F/g7V2qUhcXRJd9OVYA+051KqVHh+JUc1ZpHMusgTyT9gDusdwSToJwZFdQlsnIA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KN+aOQmP93umK3y03EgD75o8zD/zga/nEE/ThQJSo+1rpwjrezgDQwWB2LRQp7xMkT4lHnfwMZGkAKjOoOf5ZWNiDGUQdreCYYiLvVM+3qMXw0csfhvfmEAEKH9oBXXtIJdV03C43L7mnZs2lsPCfyWkuHLE8HWM5gUAPpgSAU2BTLfImnTGFHaS3UZtEfqamW2r/m6DohInV6cQPmBDc3EPJmPERfnMNvLI2Y+tN4EeG6AO40YcBcr/+6zrrb3RzQpMT7rckvvQj61CUiY0E7qoCEZSabZreMNjzK+lC148eWG6v7ZhxF1fc163G2oyO+HYLsVj7ItxYxpUb9qvKA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 05 Dec 2025 13:35:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05/12/2025 1:15 pm, Jan Beulich wrote:
> On 05.12.2025 13:40, Andrew Cooper wrote:
>> On 05/12/2025 12:01 pm, Andrew Cooper wrote:
>>> On 24/11/2025 3:01 pm, Jan Beulich wrote:
>>>> --- a/xen/arch/x86/include/asm/bug.h
>>>> +++ b/xen/arch/x86/include/asm/bug.h
>>>> @@ -21,7 +21,7 @@
>>>>  
>>>>  #ifndef __ASSEMBLY__
>>>>  
>>>> -#define BUG_INSTR       "ud2"
>>>> +#define BUG_INSTR       ".byte 0xd6" /* UDB */
>>>>  #define BUG_ASM_CONST   "c"
>>>>  
>>>>  #else  /* !__ASSEMBLY__ */
>>>> @@ -37,7 +37,7 @@
>>>>          .error "Invalid BUGFRAME index"
>>>>      .endif
>>>>  
>>>> -    .L\@ud: ud2a
>>>> +    .L\@ud: .byte 0xd6 /* UDB */
>> P.S. Presumably binutils is going to learn a udb mnemonic at some
>> point?  Can we include a version number in the comment?
>>
>> I'm trying to organise such comments everywhere so it's less effort to
>> figure out when we can drop it in the future.
> For them to be useful, wouldn't we need to settle on some canonical form
> first? Else how would one locate them (other than by coming across them
> by chance)?

I don't think a canonical form to use.  Some of the (in progress)
examples I've got are:

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 16368a498bb7..870823f7991d 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -14,10 +14,14 @@ CFLAGS-$(CONFIG_CC_IS_GCC) += -malign-data=abi
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM)
+
+# Binutils >= (<=2.34), Clang >= 7
 $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR)
+
+# Binutils >= (<=2.34), Clang >= 9
 $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
 
-# Check to see whether the assembler supports the .nop directive.
+# Binutils >= (<=2.34)
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
diff --git a/xen/arch/x86/include/asm/asm-defns.h 
b/xen/arch/x86/include/asm/asm-defns.h
index 239dc3af096c..b1d5539bdc7c 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -27,6 +27,8 @@
  *
  * With no compiler support, this degrades into a plain indirect call/jmp.
  * With compiler support, dispatch to the correct __x86_indirect_thunk_*
+ *
+ * TODO: Use %V constraint modifier (GCC >= 8).
  */
     .if CONFIG_INDIRECT_THUNK == 1

 
The examples using .byte are easy to find.  It's rather less easy doing
the archaeology on binutils, as gotbolt does not have every release
(unless GCC and Clang), and the release notes are not as great as they
could be for some instruction groups.

Our Kconfig annotations are better (insofar that most are annotated),
but even there there's quite a mix.

~Andrew



 


Rackspace

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