[PATCH v1 4/4] tools: Allow building xen-hptool without CONFIG_MIGRATE

Mykyta Poturai posted 4 patches 2 weeks, 2 days ago
There is a newer version of this series
[PATCH v1 4/4] tools: Allow building xen-hptool without CONFIG_MIGRATE
Posted by Mykyta Poturai 2 weeks, 2 days ago
With CPU hotplug sysctls implemented on Arm it becomes useful to have a tool
for calling them. Introduce new CONFIG_HOTPLUG to allow building hptool
separately from other migration tools and enable it for Arm.

Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
---
 config/arm64.mk                  | 1 +
 config/x86_32.mk                 | 1 +
 config/x86_64.mk                 | 1 +
 tools/libs/guest/Makefile.common | 4 +++-
 tools/misc/Makefile              | 2 +-
 5 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/config/arm64.mk b/config/arm64.mk
index c4662f67d0..d4995c8991 100644
--- a/config/arm64.mk
+++ b/config/arm64.mk
@@ -1,5 +1,6 @@
 CONFIG_ARM := y
 CONFIG_ARM_64 := y
+CONFIG_HOTPLUG := y
 
 CONFIG_XEN_INSTALL_SUFFIX :=
 
diff --git a/config/x86_32.mk b/config/x86_32.mk
index 3cc046d9bc..0c88862ad3 100644
--- a/config/x86_32.mk
+++ b/config/x86_32.mk
@@ -3,6 +3,7 @@ CONFIG_X86_32 := y
 
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
+CONFIG_HOTPLUG := y
 
 CFLAGS += -m32 -march=i686
 
diff --git a/config/x86_64.mk b/config/x86_64.mk
index 8614457b03..25cf965507 100644
--- a/config/x86_64.mk
+++ b/config/x86_64.mk
@@ -3,6 +3,7 @@ CONFIG_X86_64 := y
 
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
+CONFIG_HOTPLUG := y
 
 CONFIG_XEN_INSTALL_SUFFIX := .gz
 
diff --git a/tools/libs/guest/Makefile.common b/tools/libs/guest/Makefile.common
index a026a2f662..96a1141511 100644
--- a/tools/libs/guest/Makefile.common
+++ b/tools/libs/guest/Makefile.common
@@ -7,6 +7,9 @@ OBJS-y += xg_private.o
 OBJS-y += xg_domain.o
 OBJS-y += xg_suspend.o
 OBJS-y += xg_resume.o
+
+OBJS-$(CONFIG_HOTPLUG) += xg_offline_page.o
+
 ifeq ($(CONFIG_MIGRATE),y)
 OBJS-y += xg_sr_common.o
 OBJS-$(CONFIG_X86) += xg_sr_common_x86.o
@@ -17,7 +20,6 @@ OBJS-$(CONFIG_X86) += xg_sr_save_x86_pv.o
 OBJS-$(CONFIG_X86) += xg_sr_save_x86_hvm.o
 OBJS-y += xg_sr_restore.o
 OBJS-y += xg_sr_save.o
-OBJS-y += xg_offline_page.o
 else
 OBJS-y += xg_nomigrate.o
 endif
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index c26e544e83..64b4d77051 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -16,7 +16,7 @@ INSTALL_BIN                    += xencov_split
 INSTALL_BIN += $(INSTALL_BIN-y)
 
 # Everything to be installed in regular sbin/
-INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
+INSTALL_SBIN-$(CONFIG_HOTPLUG) += xen-hptool
 INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmcrash
 INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmctx
 INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
-- 
2.34.1
Re: [PATCH v1 4/4] tools: Allow building xen-hptool without CONFIG_MIGRATE
Posted by Jan Beulich 2 weeks, 2 days ago
On 18.09.2025 14:16, Mykyta Poturai wrote:
> --- a/config/arm64.mk
> +++ b/config/arm64.mk
> @@ -1,5 +1,6 @@
>  CONFIG_ARM := y
>  CONFIG_ARM_64 := y
> +CONFIG_HOTPLUG := y
>  
>  CONFIG_XEN_INSTALL_SUFFIX :=
>  
> --- a/config/x86_32.mk
> +++ b/config/x86_32.mk
> @@ -3,6 +3,7 @@ CONFIG_X86_32 := y
>  
>  CONFIG_MIGRATE := y
>  CONFIG_XCUTILS := y
> +CONFIG_HOTPLUG := y
>  
>  CFLAGS += -m32 -march=i686
>  
> --- a/config/x86_64.mk
> +++ b/config/x86_64.mk
> @@ -3,6 +3,7 @@ CONFIG_X86_64 := y
>  
>  CONFIG_MIGRATE := y
>  CONFIG_XCUTILS := y
> +CONFIG_HOTPLUG := y
>  
>  CONFIG_XEN_INSTALL_SUFFIX := .gz

I realize you only do what is already being done, but I question this
way of doing things when the scope is tools-only. Any CONFIG_* put here
cannot have an identically named, but potentially set differently
Kconfig setting in xen/: Any use of such in a Makefile could end up being
wrong, and would pretty surely end up being confusing.

Jan
Re: [PATCH v1 4/4] tools: Allow building xen-hptool without CONFIG_MIGRATE
Posted by Mykyta Poturai 1 week, 4 days ago
On 18.09.25 17:59, Jan Beulich wrote:
> On 18.09.2025 14:16, Mykyta Poturai wrote:
>> --- a/config/arm64.mk
>> +++ b/config/arm64.mk
>> @@ -1,5 +1,6 @@
>>   CONFIG_ARM := y
>>   CONFIG_ARM_64 := y
>> +CONFIG_HOTPLUG := y
>>   
>>   CONFIG_XEN_INSTALL_SUFFIX :=
>>   
>> --- a/config/x86_32.mk
>> +++ b/config/x86_32.mk
>> @@ -3,6 +3,7 @@ CONFIG_X86_32 := y
>>   
>>   CONFIG_MIGRATE := y
>>   CONFIG_XCUTILS := y
>> +CONFIG_HOTPLUG := y
>>   
>>   CFLAGS += -m32 -march=i686
>>   
>> --- a/config/x86_64.mk
>> +++ b/config/x86_64.mk
>> @@ -3,6 +3,7 @@ CONFIG_X86_64 := y
>>   
>>   CONFIG_MIGRATE := y
>>   CONFIG_XCUTILS := y
>> +CONFIG_HOTPLUG := y
>>   
>>   CONFIG_XEN_INSTALL_SUFFIX := .gz
> 
> I realize you only do what is already being done, but I question this
> way of doing things when the scope is tools-only. Any CONFIG_* put here
> cannot have an identically named, but potentially set differently
> Kconfig setting in xen/: Any use of such in a Makefile could end up being
> wrong, and would pretty surely end up being confusing.
> 
> Jan

I have checked the whole codebase and didn't find any other 
CONFIG_HOTPLUG, the only similar thing is CONFIG_HOTPLUG_CPU. Anyway, I 
can change it to something more specific like CONFIG_HPTOOL for example.

-- 
Mykyta
Re: [PATCH v1 4/4] tools: Allow building xen-hptool without CONFIG_MIGRATE
Posted by Jan Beulich 1 week, 4 days ago
On 23.09.2025 15:19, Mykyta Poturai wrote:
> On 18.09.25 17:59, Jan Beulich wrote:
>> On 18.09.2025 14:16, Mykyta Poturai wrote:
>>> --- a/config/arm64.mk
>>> +++ b/config/arm64.mk
>>> @@ -1,5 +1,6 @@
>>>   CONFIG_ARM := y
>>>   CONFIG_ARM_64 := y
>>> +CONFIG_HOTPLUG := y
>>>   
>>>   CONFIG_XEN_INSTALL_SUFFIX :=
>>>   
>>> --- a/config/x86_32.mk
>>> +++ b/config/x86_32.mk
>>> @@ -3,6 +3,7 @@ CONFIG_X86_32 := y
>>>   
>>>   CONFIG_MIGRATE := y
>>>   CONFIG_XCUTILS := y
>>> +CONFIG_HOTPLUG := y
>>>   
>>>   CFLAGS += -m32 -march=i686
>>>   
>>> --- a/config/x86_64.mk
>>> +++ b/config/x86_64.mk
>>> @@ -3,6 +3,7 @@ CONFIG_X86_64 := y
>>>   
>>>   CONFIG_MIGRATE := y
>>>   CONFIG_XCUTILS := y
>>> +CONFIG_HOTPLUG := y
>>>   
>>>   CONFIG_XEN_INSTALL_SUFFIX := .gz
>>
>> I realize you only do what is already being done, but I question this
>> way of doing things when the scope is tools-only. Any CONFIG_* put here
>> cannot have an identically named, but potentially set differently
>> Kconfig setting in xen/: Any use of such in a Makefile could end up being
>> wrong, and would pretty surely end up being confusing.
> 
> I have checked the whole codebase and didn't find any other 
> CONFIG_HOTPLUG, the only similar thing is CONFIG_HOTPLUG_CPU. Anyway, I 
> can change it to something more specific like CONFIG_HPTOOL for example.

Iff no other way (configure?) can be found, then yes, please use this more
specific name. But not extending this legacy way of "configuring" things
would be much preferred.

Jan