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

Re: [PATCH 2/2] x86/cpu-policy: move copy-in/-out functions to arch library


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 29 Dec 2025 11:22:50 +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=Flr+Yy4BdWQZEEB9Qi+QM49ScYRPaLKnbW5GK8JuaiE=; b=uNENIOw8tZnLA8swYJbMkyJ6Tp2pIsbPp68LGeWeWMj78BJ2ezUWXcroftXTuauDaHoTnjK98Iiua1rqtudCW+hm7+L2tTrYnLzdNFw3ioUovo8PuD/nNNVJQ+zx6rNc0Wdsoad9Qrg19PJXv9S02zokbnOLXoGzQnTqpl2BqG06fRZmez7duXRSPlJIB4UL3ZA4Dg05cyptCqxXwr07W0t4xMCihZJ6b4a/JqRQS07nYh6jEewm5MLBq0abxWCZw44k2r3cZXiyS6TtV+R3UeUpsOJNQ1hI1YoW/pj6v0OVmR4eouNXjgiFq7y19pYiWXPB6CxXQokAS+vQyKLGiQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=djcVfb1kX16wbg3FARs1kiDMQHycwdPgPWIi29NBA9kp+dnzLMQhZSXYnb2fklQdDRL3S0eiIj5XjWf1LXVfdl5ydSuFxdkOl4+RV3zoDLqeaXyKUu4pXlQEJSy6KKyM+ajjYljCJ6Da0UhLll0h6lA1k+clUTQ/uwmcQ0ELVsW5S5Q9pUK5SoXEwsup4QY5GbxV3bgsiUs7VDB/R6ht+dsXmyHbPXgQ/E71Q9X+RcgsQhNUH5yc3mA0c1nAZx/Chiwy+dSuZyJDnGJqqSjpQw53lZF15Xxu6GUj7+xXINj9bHc/prMx7HtC/qPUEfLHLhntFY3ZQMA7exi7TIOXRQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 29 Dec 2025 11:23:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/12/2025 4:54 pm, Jan Beulich wrote:
> --- a/tools/tests/cpu-policy/Makefile
> +++ b/tools/tests/cpu-policy/Makefile
> @@ -42,11 +42,15 @@ CFLAGS += $(APPEND_CFLAGS)
>  
>  LDFLAGS += $(APPEND_LDFLAGS)
>  
> -vpath %.c ../../../xen/lib/x86
> +vpath %.c $(XEN_ROOT)/xen/lib/x86
> +vpath %.c $(XEN_ROOT)/xen/arch/x86/lib
> +
> +lib-y :=
> +include $(XEN_ROOT)/xen/arch/x86/lib/Makefile.cpu-policy
>  
>  %.o: Makefile
>  
> -test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o
> +test-cpu-policy: test-cpu-policy.o cpuid.o policy.o $(lib-y)
>       $(CC) $^ -o $@ $(LDFLAGS)
>  
>  -include $(DEPS_INCLUDE)
> --- a/xen/arch/x86/lib/Makefile
> +++ b/xen/arch/x86/lib/Makefile
> @@ -6,3 +6,5 @@ lib-y += generic-hweightl.o
>  lib-y += memcpy.o
>  lib-y += memset.o
>  lib-y += scrub-page.o
> +
> +include $(srcdir)/Makefile.cpu-policy
> --- /dev/null
> +++ b/xen/arch/x86/lib/Makefile.cpu-policy
> @@ -0,0 +1,2 @@
> +lib-y += cp-copy-from-buffer.o
> +lib-y += cp-copy-to-buffer.o

cp works as a name in source code because it's used by a type called
cpu_policy.

In this case, cp with it's UNIX association makes the file name very weird.


If we're going to be properly lib-ing the whole thing, then we're going
to have enough TUs for a directory anyway.

So, I think we want xen/arch/x86/lib/cpu-policy/copy-{to,from}-buffer.o
right from the outset.

Also, I'd really prefer not to have things split between the old and new
locations.  Everything wants to move in one go.

I'd suggest having one patch doing a wholesale move of xen/lib/x86 into
xen/arch/x86/lib/cpu-policy and fixing up the vpath's, then a subsequent
patch splitting copy-{to,from}-buffer.o out.

> --- /dev/null
> +++ b/xen/arch/x86/lib/cp-copy-from-buffer.c
> @@ -0,0 +1,238 @@
> +#ifdef __XEN__

Hmm.  I should sort out SPDX tags.  Defaults would say GPL-2-only, but
libxenguest is LGPL-2.1 so it probably ought to be LGPL.

~Andrew



 


Rackspace

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