* [PATCH] tools: hv: Fix cross-compilation
@ 2024-12-12 8:28 Saurabh Sengar
2024-12-12 23:06 ` Wei Liu
2024-12-13 18:11 ` Roman Kisel
0 siblings, 2 replies; 6+ messages in thread
From: Saurabh Sengar @ 2024-12-12 8:28 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, linux-hyperv, linux-kernel; +Cc: ssengar, avladu
Use the native ARCH only incase it is not set, this will allow
the cross complilation where ARCH is explicitly set. Add few
info prints as well to know what arch and toolchain is getting
used to build it.
Additionally, simplify the check for ARCH so that fcopy daemon
is build only for x86_64.
Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
tools/hv/Makefile | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index 34ffcec264ab..d29e6be6309b 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -2,7 +2,7 @@
# Makefile for Hyper-V tools
include ../scripts/Makefile.include
-ARCH := $(shell uname -m 2>/dev/null)
+ARCH ?= $(shell uname -m 2>/dev/null)
sbindir ?= /usr/sbin
libexecdir ?= /usr/libexec
sharedstatedir ?= /var/lib
@@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
override CFLAGS += -Wno-address-of-packed-member
ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
-ifneq ($(ARCH), aarch64)
+ifeq ($(ARCH), x86_64)
ALL_TARGETS += hv_fcopy_uio_daemon
endif
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
-all: $(ALL_PROGRAMS)
+all: info $(ALL_PROGRAMS)
export srctree OUTPUT CC LD CFLAGS
include $(srctree)/tools/build/Makefile.include
+info:
+ @echo "---------------------"
+ @echo "Building for:"
+ @echo "CC $(CC)"
+ @echo "LD $(LD)"
+ @echo "ARCH $(ARCH)"
+ @echo "---------------------"
+
HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
$(HV_KVP_DAEMON_IN): FORCE
$(Q)$(MAKE) $(build)=hv_kvp_daemon
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tools: hv: Fix cross-compilation
2024-12-12 8:28 [PATCH] tools: hv: Fix cross-compilation Saurabh Sengar
@ 2024-12-12 23:06 ` Wei Liu
2024-12-13 4:01 ` Saurabh Singh Sengar
2024-12-13 18:11 ` Roman Kisel
1 sibling, 1 reply; 6+ messages in thread
From: Wei Liu @ 2024-12-12 23:06 UTC (permalink / raw)
To: Saurabh Sengar
Cc: kys, haiyangz, wei.liu, decui, linux-hyperv, linux-kernel,
ssengar, avladu
On Thu, Dec 12, 2024 at 12:28:34AM -0800, Saurabh Sengar wrote:
> Use the native ARCH only incase it is not set, this will allow
> the cross complilation where ARCH is explicitly set. Add few
> info prints as well to know what arch and toolchain is getting
> used to build it.
>
> Additionally, simplify the check for ARCH so that fcopy daemon
> is build only for x86_64.
>
> Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
> tools/hv/Makefile | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index 34ffcec264ab..d29e6be6309b 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -2,7 +2,7 @@
> # Makefile for Hyper-V tools
> include ../scripts/Makefile.include
>
> -ARCH := $(shell uname -m 2>/dev/null)
> +ARCH ?= $(shell uname -m 2>/dev/null)
> sbindir ?= /usr/sbin
> libexecdir ?= /usr/libexec
> sharedstatedir ?= /var/lib
> @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> override CFLAGS += -Wno-address-of-packed-member
>
> ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
> -ifneq ($(ARCH), aarch64)
> +ifeq ($(ARCH), x86_64)
Technically speaking, you can also build this for x86 (32bit). Whether
anybody uses it is another question.
> ALL_TARGETS += hv_fcopy_uio_daemon
> endif
> ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
>
> ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
>
> -all: $(ALL_PROGRAMS)
> +all: info $(ALL_PROGRAMS)
>
> export srctree OUTPUT CC LD CFLAGS
> include $(srctree)/tools/build/Makefile.include
>
> +info:
> + @echo "---------------------"
> + @echo "Building for:"
> + @echo "CC $(CC)"
> + @echo "LD $(LD)"
> + @echo "ARCH $(ARCH)"
> + @echo "---------------------"
I don't think this is needed. Anyone who's building the kernel source
should know what tool chain they are using and architecture they're
building for.
Thanks,
Wei.
> +
> HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
> $(HV_KVP_DAEMON_IN): FORCE
> $(Q)$(MAKE) $(build)=hv_kvp_daemon
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools: hv: Fix cross-compilation
2024-12-12 23:06 ` Wei Liu
@ 2024-12-13 4:01 ` Saurabh Singh Sengar
2024-12-17 18:49 ` Wei Liu
0 siblings, 1 reply; 6+ messages in thread
From: Saurabh Singh Sengar @ 2024-12-13 4:01 UTC (permalink / raw)
To: Wei Liu; +Cc: kys, haiyangz, decui, linux-hyperv, linux-kernel, ssengar, avladu
On Thu, Dec 12, 2024 at 11:06:16PM +0000, Wei Liu wrote:
> On Thu, Dec 12, 2024 at 12:28:34AM -0800, Saurabh Sengar wrote:
> > Use the native ARCH only incase it is not set, this will allow
> > the cross complilation where ARCH is explicitly set. Add few
> > info prints as well to know what arch and toolchain is getting
> > used to build it.
> >
> > Additionally, simplify the check for ARCH so that fcopy daemon
> > is build only for x86_64.
> >
> > Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> > Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> > Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> > ---
> > tools/hv/Makefile | 14 +++++++++++---
> > 1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> > index 34ffcec264ab..d29e6be6309b 100644
> > --- a/tools/hv/Makefile
> > +++ b/tools/hv/Makefile
> > @@ -2,7 +2,7 @@
> > # Makefile for Hyper-V tools
> > include ../scripts/Makefile.include
> >
> > -ARCH := $(shell uname -m 2>/dev/null)
> > +ARCH ?= $(shell uname -m 2>/dev/null)
> > sbindir ?= /usr/sbin
> > libexecdir ?= /usr/libexec
> > sharedstatedir ?= /var/lib
> > @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> > override CFLAGS += -Wno-address-of-packed-member
> >
> > ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
> > -ifneq ($(ARCH), aarch64)
> > +ifeq ($(ARCH), x86_64)
>
> Technically speaking, you can also build this for x86 (32bit). Whether
> anybody uses it is another question.
My intention is to allow fcopy daemon build only for the arch it has
been tested. IMO its better than restricting only for arm64/aarch64.
I tried with gcc '-m32' switch which I believe is for 32 bit x86 compilation
I see problems with it on other (kvp daemon) daemons too. I think we never
cared about 32 bit.
saurabh@Saurabh:/work/linux-next/tools/hv$ make ARCH=x86 CFLAGS=-m32
make[1]: Entering directory '/work/linux-next/tools/hv'
CC hv_kvp_daemon.o
hv_kvp_daemon.c:25:10: fatal error: sys/poll.h: No such file or directory
25 | #include <sys/poll.h>
| ^~~~~~~~~~~~
compilation terminated.
make[1]: *** [/work/linux-next/tools/build/Makefile.build:106: hv_kvp_daemon.o] Error 1
make[1]: Leaving directory '/work/linux-next/tools/hv'
make: *** [Makefile:37: hv_kvp_daemon-in.o] Error 2
I don't have any strong opinion here, if you want I can allow x86 compilation
for fcopy daemon as well.
Please let me know what is your preference.
>
> > ALL_TARGETS += hv_fcopy_uio_daemon
> > endif
> > ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
> >
> > ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
> >
> > -all: $(ALL_PROGRAMS)
> > +all: info $(ALL_PROGRAMS)
> >
> > export srctree OUTPUT CC LD CFLAGS
> > include $(srctree)/tools/build/Makefile.include
> >
> > +info:
> > + @echo "---------------------"
> > + @echo "Building for:"
> > + @echo "CC $(CC)"
> > + @echo "LD $(LD)"
> > + @echo "ARCH $(ARCH)"
> > + @echo "---------------------"
>
> I don't think this is needed. Anyone who's building the kernel source
> should know what tool chain they are using and architecture they're
> building for.
I am fine removing it in V2.
- Saurabh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools: hv: Fix cross-compilation
2024-12-12 8:28 [PATCH] tools: hv: Fix cross-compilation Saurabh Sengar
2024-12-12 23:06 ` Wei Liu
@ 2024-12-13 18:11 ` Roman Kisel
2024-12-14 12:06 ` Adrian Vladu
1 sibling, 1 reply; 6+ messages in thread
From: Roman Kisel @ 2024-12-13 18:11 UTC (permalink / raw)
To: Saurabh Sengar, kys, haiyangz, wei.liu, decui, linux-hyperv,
linux-kernel
Cc: ssengar, avladu
Thanks, LGTM!
Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
On 12/12/2024 12:28 AM, Saurabh Sengar wrote:
> Use the native ARCH only incase it is not set, this will allow
> the cross complilation where ARCH is explicitly set. Add few
> info prints as well to know what arch and toolchain is getting
> used to build it.
>
> Additionally, simplify the check for ARCH so that fcopy daemon
> is build only for x86_64.
>
> Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
> tools/hv/Makefile | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index 34ffcec264ab..d29e6be6309b 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -2,7 +2,7 @@
> # Makefile for Hyper-V tools
> include ../scripts/Makefile.include
>
> -ARCH := $(shell uname -m 2>/dev/null)
> +ARCH ?= $(shell uname -m 2>/dev/null)
> sbindir ?= /usr/sbin
> libexecdir ?= /usr/libexec
> sharedstatedir ?= /var/lib
> @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> override CFLAGS += -Wno-address-of-packed-member
>
> ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
> -ifneq ($(ARCH), aarch64)
> +ifeq ($(ARCH), x86_64)
> ALL_TARGETS += hv_fcopy_uio_daemon
> endif
> ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
>
> ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
>
> -all: $(ALL_PROGRAMS)
> +all: info $(ALL_PROGRAMS)
>
> export srctree OUTPUT CC LD CFLAGS
> include $(srctree)/tools/build/Makefile.include
>
> +info:
> + @echo "---------------------"
> + @echo "Building for:"
> + @echo "CC $(CC)"
> + @echo "LD $(LD)"
> + @echo "ARCH $(ARCH)"
> + @echo "---------------------"
> +
> HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
> $(HV_KVP_DAEMON_IN): FORCE
> $(Q)$(MAKE) $(build)=hv_kvp_daemon
--
Thank you,
Roman
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools: hv: Fix cross-compilation
2024-12-13 18:11 ` Roman Kisel
@ 2024-12-14 12:06 ` Adrian Vladu
0 siblings, 0 replies; 6+ messages in thread
From: Adrian Vladu @ 2024-12-14 12:06 UTC (permalink / raw)
To: Roman Kisel, Saurabh Sengar, kys@microsoft.com,
haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ssengar@microsoft.com
Thanks for the refined patch, much appreciated.
For Flatcar Container Linux, we would like to use 6.12 kernel, would be great to have this fix backported to the stable branch 6.12.
________________________________________
From: Roman Kisel <romank@linux.microsoft.com>
Sent: Friday, December 13, 2024 8:11 PM
To: Saurabh Sengar <ssengar@linux.microsoft.com>; kys@microsoft.com <kys@microsoft.com>; haiyangz@microsoft.com <haiyangz@microsoft.com>; wei.liu@kernel.org <wei.liu@kernel.org>; decui@microsoft.com <decui@microsoft.com>; linux-hyperv@vger.kernel.org <linux-hyperv@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Cc: ssengar@microsoft.com <ssengar@microsoft.com>; Adrian Vladu <avladu@cloudbasesolutions.com>
Subject: Re: [PATCH] tools: hv: Fix cross-compilation
Thanks, LGTM!
Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
On 12/12/2024 12:28 AM, Saurabh Sengar wrote:
> Use the native ARCH only incase it is not set, this will allow
> the cross complilation where ARCH is explicitly set. Add few
> info prints as well to know what arch and toolchain is getting
> used to build it.
>
> Additionally, simplify the check for ARCH so that fcopy daemon
> is build only for x86_64.
>
> Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
> tools/hv/Makefile | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index 34ffcec264ab..d29e6be6309b 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -2,7 +2,7 @@
> # Makefile for Hyper-V tools
> include ../scripts/Makefile.include
>
> -ARCH := $(shell uname -m 2>/dev/null)
> +ARCH ?= $(shell uname -m 2>/dev/null)
> sbindir ?= /usr/sbin
> libexecdir ?= /usr/libexec
> sharedstatedir ?= /var/lib
> @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> override CFLAGS += -Wno-address-of-packed-member
>
> ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
> -ifneq ($(ARCH), aarch64)
> +ifeq ($(ARCH), x86_64)
> ALL_TARGETS += hv_fcopy_uio_daemon
> endif
> ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
>
> ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
>
> -all: $(ALL_PROGRAMS)
> +all: info $(ALL_PROGRAMS)
>
> export srctree OUTPUT CC LD CFLAGS
> include $(srctree)/tools/build/Makefile.include
>
> +info:
> + @echo "---------------------"
> + @echo "Building for:"
> + @echo "CC $(CC)"
> + @echo "LD $(LD)"
> + @echo "ARCH $(ARCH)"
> + @echo "---------------------"
> +
> HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
> $(HV_KVP_DAEMON_IN): FORCE
> $(Q)$(MAKE) $(build)=hv_kvp_daemon
--
Thank you,
Roman
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tools: hv: Fix cross-compilation
2024-12-13 4:01 ` Saurabh Singh Sengar
@ 2024-12-17 18:49 ` Wei Liu
0 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2024-12-17 18:49 UTC (permalink / raw)
To: Saurabh Singh Sengar
Cc: Wei Liu, kys, haiyangz, decui, linux-hyperv, linux-kernel,
ssengar, avladu
On Thu, Dec 12, 2024 at 08:01:02PM -0800, Saurabh Singh Sengar wrote:
> On Thu, Dec 12, 2024 at 11:06:16PM +0000, Wei Liu wrote:
> > On Thu, Dec 12, 2024 at 12:28:34AM -0800, Saurabh Sengar wrote:
> > > Use the native ARCH only incase it is not set, this will allow
> > > the cross complilation where ARCH is explicitly set. Add few
> > > info prints as well to know what arch and toolchain is getting
> > > used to build it.
> > >
> > > Additionally, simplify the check for ARCH so that fcopy daemon
> > > is build only for x86_64.
> > >
> > > Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> > > Reported-by: Adrian Vladu <avladu@cloudbasesolutions.com>
> > > Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/
> > > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> > > ---
> > > tools/hv/Makefile | 14 +++++++++++---
> > > 1 file changed, 11 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> > > index 34ffcec264ab..d29e6be6309b 100644
> > > --- a/tools/hv/Makefile
> > > +++ b/tools/hv/Makefile
> > > @@ -2,7 +2,7 @@
> > > # Makefile for Hyper-V tools
> > > include ../scripts/Makefile.include
> > >
> > > -ARCH := $(shell uname -m 2>/dev/null)
> > > +ARCH ?= $(shell uname -m 2>/dev/null)
> > > sbindir ?= /usr/sbin
> > > libexecdir ?= /usr/libexec
> > > sharedstatedir ?= /var/lib
> > > @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> > > override CFLAGS += -Wno-address-of-packed-member
> > >
> > > ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
> > > -ifneq ($(ARCH), aarch64)
> > > +ifeq ($(ARCH), x86_64)
> >
> > Technically speaking, you can also build this for x86 (32bit). Whether
> > anybody uses it is another question.
>
> My intention is to allow fcopy daemon build only for the arch it has
> been tested. IMO its better than restricting only for arm64/aarch64.
>
> I tried with gcc '-m32' switch which I believe is for 32 bit x86 compilation
> I see problems with it on other (kvp daemon) daemons too. I think we never
> cared about 32 bit.
>
> saurabh@Saurabh:/work/linux-next/tools/hv$ make ARCH=x86 CFLAGS=-m32
> make[1]: Entering directory '/work/linux-next/tools/hv'
> CC hv_kvp_daemon.o
> hv_kvp_daemon.c:25:10: fatal error: sys/poll.h: No such file or directory
> 25 | #include <sys/poll.h>
> | ^~~~~~~~~~~~
> compilation terminated.
> make[1]: *** [/work/linux-next/tools/build/Makefile.build:106: hv_kvp_daemon.o] Error 1
> make[1]: Leaving directory '/work/linux-next/tools/hv'
> make: *** [Makefile:37: hv_kvp_daemon-in.o] Error 2
>
>
> I don't have any strong opinion here, if you want I can allow x86 compilation
> for fcopy daemon as well.
>
> Please let me know what is your preference.
We can leave the code as-is. If and when someone wants to build this for
32-bit x86, they can fix the code.
I think the number of people who want to build this for 32-bit x86 is
diminishing by the day -- it there was a large group in the first place.
Thanks,
Wei.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-17 18:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 8:28 [PATCH] tools: hv: Fix cross-compilation Saurabh Sengar
2024-12-12 23:06 ` Wei Liu
2024-12-13 4:01 ` Saurabh Singh Sengar
2024-12-17 18:49 ` Wei Liu
2024-12-13 18:11 ` Roman Kisel
2024-12-14 12:06 ` Adrian Vladu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).