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

Re: [PATCH 1/2] x86: move arch_generic_hweightl() to arch-specific library


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 26 Nov 2025 14:05:15 +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=3ZfwpcTQurA766ntXImfDf3eH9Y0z6qHEQfGaKSaKkE=; b=eTiTxLETmo83mNFBLy7ltzGzVmeenIbQ2qeP1PJt7iuHl9GQehEsyZfWhAE6nGy52wwdKkp0P7rVuZLF4NRQYZM/P8XxfuENlsl+r5Nxe1GuwCJxU9xClgO8CYheKJInoJ3/Q5iv5L1KlnwpnPb/IedFebwTsUnHSf+JAY5tA258DQcXTA0Gj4ub7KNfmM2G50KUim93+4PDDoVIyCGZoejwnXsjzoW9OhhS8BINmGP/qZtHmov8SGN584CjR3OpAjFyFoG/fndZjl0/X8uQUirtRBkoM2S+oriIkikJ5PyYxivWEbwJIuU1eiCBqYbQV9GyBxReeP7ZGbVEHTXg/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HsqFfkzrm082+uF7ucepYiB3BNvVDuDFFNqojioEtZ5QFzs80ph8NVTW0scbU5VKolPeV2rBGxfHHXbDsmQn6hgRS/RZxm91PykekiSMqneWiwiZsR5M/v/wh/vjipqtKvqi1GSBP2yRbI/AEETxcpC4Pb0LECFtAUCQFSOFUofjyI5ToeTn0FrAxjxrSnY98CpWI+b9A/EJV96MUvvt6/HmaEfAlxthjyJ8Fd0UfGcnobOTQXChcuh6InPnLYkY7vcKyMcM/Xr/dPcCaXCAUd4euW4GndpSm2lGwhe7N8UgeGSOvT3DBrlqil4ZtgxvcVJhq3GiAvJitvY+ZTfjjQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 26 Nov 2025 14:05:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26/11/2025 1:58 pm, Jan Beulich wrote:
> On 26.11.2025 14:51, Andrew Cooper wrote:
>> On 26/11/2025 1:24 pm, Jan Beulich wrote:
>>> diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
>>> index 16368a498bb7..a0ee050c931b 100644
>>> --- a/xen/arch/x86/arch.mk
>>> +++ b/xen/arch/x86/arch.mk
>>> @@ -3,6 +3,8 @@
>>>  
>>>  export XEN_IMG_OFFSET := 0x200000
>>>  
>>> +ALL_LIBS-y += arch/x86/lib/lib.a
>>> +
>> Oh, I'd realised it was this easy, I'd have done so straight away when
>> adding x86's custom arch_generic_hweightl().
>>
>> I assumed it was going to be more complicated getting the order of the
>> arch specific lib correct with the generic lib.
>>
>> More concretely.  Given an x86 lib, we should move things like
>> arch/x86/memcpy.S to it.
>>
>> Therefore, when we have common/lib.a and arch/lib.a, do we guarantee to
>> have arch/lib.a with higher precedence so for matching functions the
>> arch specific one guarantees to be taken?
> Not with the change above, it would need to become
>
> ALL_LIBS-y := arch/x86/lib/lib.a $(ALL_LIBS-y)
>
> to achieve that, requiring that ALL_LIBS-y won't change into a lazy-expansion
> variable. If that's okay (please confirm), I can adjust the patch.
>
> Things would be yet easier if every arch had a lib/lib.a, as then in
> xen/Makefile we could simply have
>
> ALL_LIBS-y                := arch/$(SRCARCH)/lib/lib.a
> ALL_LIBS-y                += lib/lib.a
>
> Alternatively we could move the setting of ALL_LIBS-y in xen/Makefile to
> after the arch/$(SRCARCH)/arch.mk inclusion. I'd be a little wary of that,
> though, as it would then be different from ALL_OBJS-y.

I think this would be better handled by common code.

Arches are going to want a lib.a eventually.  ARM even has
arch/arm/arm{32,64}/lib/ but like x86 they're just simple obj-y += at
the moment.

However, arches shouldn't be forced to make an empty one simply to build.

Does this work:

ALL_LIBS-y                := $(wildcard arch/$(SRCARCH)/lib/lib.a)
ALL_LIBS-y                += lib/lib.a

?  If so, I think it's the nicest option.

~Andrew



 


Rackspace

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