All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-23 11:42 ` Li kunyu
  0 siblings, 0 replies; 12+ messages in thread
From: Li kunyu @ 2022-09-23 11:42 UTC (permalink / raw)
  To: kys, haiyangz, sthemmin, wei.liu, decui, catalin.marinas, will,
	tglx, mingo, bp, dave.hansen, hpa, arnd
  Cc: x86, linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, Li kunyu

The generate_guest_id function is more suitable for use after the
following modifications.
1. Modify the type of the guest_id variable to u64, which is compatible
with the caller.
2. Remove all parameters from the function, and write the parameter
(LINUX_VERSION_CODE) passed in by the actual call into the function
implementation.
3. Rename the function to make it clearly a Hyper-V related function,
and modify it to hv_generate_guest_id.

Signed-off-by: Li kunyu <kunyu@nfschina.com>

--------
 v2: Fix generate_guest_id to hv_generate_guest_id.
 v3: Fix [PATCH v2] asm-generic: Remove the ... to [PATCH v3] hyperv: simp
     lify ... and remove extra spaces 
---
 arch/arm64/hyperv/mshyperv.c   |  2 +-
 arch/x86/hyperv/hv_init.c      |  2 +-
 include/asm-generic/mshyperv.h | 12 +++++-------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
index bbbe351e9045..3863fd226e0e 100644
--- a/arch/arm64/hyperv/mshyperv.c
+++ b/arch/arm64/hyperv/mshyperv.c
@@ -38,7 +38,7 @@ static int __init hyperv_init(void)
 		return 0;
 
 	/* Setup the guest ID */
-	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
+	guest_id = hv_generate_guest_id();
 	hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id);
 
 	/* Get the features and hints from Hyper-V */
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 3de6d8b53367..93770791b858 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -426,7 +426,7 @@ void __init hyperv_init(void)
 	 * 1. Register the guest ID
 	 * 2. Enable the hypercall and register the hypercall page
 	 */
-	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
+	guest_id = hv_generate_guest_id();
 	wrmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id);
 
 	/* Hyper-V requires to write guest os id via ghcb in SNP IVM. */
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index c05d2ce9b6cd..7f4a23cee56f 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -25,6 +25,7 @@
 #include <linux/nmi.h>
 #include <asm/ptrace.h>
 #include <asm/hyperv-tlfs.h>
+#include <linux/version.h>
 
 struct ms_hyperv_info {
 	u32 features;
@@ -105,15 +106,12 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
 }
 
 /* Generate the guest OS identifier as described in the Hyper-V TLFS */
-static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
-				       __u64 d_info2)
+static inline u64 hv_generate_guest_id(void)
 {
-	__u64 guest_id = 0;
+	u64 guest_id;
 
-	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
-	guest_id |= (d_info1 << 48);
-	guest_id |= (kernel_version << 16);
-	guest_id |= d_info2;
+	guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
+	guest_id |= (((u64)LINUX_VERSION_CODE) << 16);
 
 	return guest_id;
 }
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-23 11:42 ` Li kunyu
  0 siblings, 0 replies; 12+ messages in thread
From: Li kunyu @ 2022-09-23 11:42 UTC (permalink / raw)
  To: kys, haiyangz, sthemmin, wei.liu, decui, catalin.marinas, will,
	tglx, mingo, bp, dave.hansen, hpa, arnd
  Cc: x86, linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch, Li kunyu

The generate_guest_id function is more suitable for use after the
following modifications.
1. Modify the type of the guest_id variable to u64, which is compatible
with the caller.
2. Remove all parameters from the function, and write the parameter
(LINUX_VERSION_CODE) passed in by the actual call into the function
implementation.
3. Rename the function to make it clearly a Hyper-V related function,
and modify it to hv_generate_guest_id.

Signed-off-by: Li kunyu <kunyu@nfschina.com>

--------
 v2: Fix generate_guest_id to hv_generate_guest_id.
 v3: Fix [PATCH v2] asm-generic: Remove the ... to [PATCH v3] hyperv: simp
     lify ... and remove extra spaces 
---
 arch/arm64/hyperv/mshyperv.c   |  2 +-
 arch/x86/hyperv/hv_init.c      |  2 +-
 include/asm-generic/mshyperv.h | 12 +++++-------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
index bbbe351e9045..3863fd226e0e 100644
--- a/arch/arm64/hyperv/mshyperv.c
+++ b/arch/arm64/hyperv/mshyperv.c
@@ -38,7 +38,7 @@ static int __init hyperv_init(void)
 		return 0;
 
 	/* Setup the guest ID */
-	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
+	guest_id = hv_generate_guest_id();
 	hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id);
 
 	/* Get the features and hints from Hyper-V */
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 3de6d8b53367..93770791b858 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -426,7 +426,7 @@ void __init hyperv_init(void)
 	 * 1. Register the guest ID
 	 * 2. Enable the hypercall and register the hypercall page
 	 */
-	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
+	guest_id = hv_generate_guest_id();
 	wrmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id);
 
 	/* Hyper-V requires to write guest os id via ghcb in SNP IVM. */
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index c05d2ce9b6cd..7f4a23cee56f 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -25,6 +25,7 @@
 #include <linux/nmi.h>
 #include <asm/ptrace.h>
 #include <asm/hyperv-tlfs.h>
+#include <linux/version.h>
 
 struct ms_hyperv_info {
 	u32 features;
@@ -105,15 +106,12 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
 }
 
 /* Generate the guest OS identifier as described in the Hyper-V TLFS */
-static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
-				       __u64 d_info2)
+static inline u64 hv_generate_guest_id(void)
 {
-	__u64 guest_id = 0;
+	u64 guest_id;
 
-	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
-	guest_id |= (d_info1 << 48);
-	guest_id |= (kernel_version << 16);
-	guest_id |= d_info2;
+	guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
+	guest_id |= (((u64)LINUX_VERSION_CODE) << 16);
 
 	return guest_id;
 }
-- 
2.18.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
  2022-09-23 11:42 ` Li kunyu
@ 2022-09-23 20:18   ` Michael Kelley (LINUX)
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-23 20:18 UTC (permalink / raw)
  To: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd
  Cc: x86, linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch

From: Li kunyu <kunyu@nfschina.com> Sent: Friday, September 23, 2022 4:43 AM
> 
> The generate_guest_id function is more suitable for use after the
> following modifications.
> 1. Modify the type of the guest_id variable to u64, which is compatible
> with the caller.
> 2. Remove all parameters from the function, and write the parameter
> (LINUX_VERSION_CODE) passed in by the actual call into the function
> implementation.
> 3. Rename the function to make it clearly a Hyper-V related function,
> and modify it to hv_generate_guest_id.
> 
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> 
> --------
>  v2: Fix generate_guest_id to hv_generate_guest_id.
>  v3: Fix [PATCH v2] asm-generic: Remove the ... to [PATCH v3] hyperv: simp
>      lify ... and remove extra spaces
> ---
>  arch/arm64/hyperv/mshyperv.c   |  2 +-
>  arch/x86/hyperv/hv_init.c      |  2 +-
>  include/asm-generic/mshyperv.h | 12 +++++-------
>  3 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
> index bbbe351e9045..3863fd226e0e 100644
> --- a/arch/arm64/hyperv/mshyperv.c
> +++ b/arch/arm64/hyperv/mshyperv.c
> @@ -38,7 +38,7 @@ static int __init hyperv_init(void)
>  		return 0;
> 
>  	/* Setup the guest ID */
> -	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
> +	guest_id = hv_generate_guest_id();
>  	hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id);
> 
>  	/* Get the features and hints from Hyper-V */
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 3de6d8b53367..93770791b858 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -426,7 +426,7 @@ void __init hyperv_init(void)
>  	 * 1. Register the guest ID
>  	 * 2. Enable the hypercall and register the hypercall page
>  	 */
> -	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
> +	guest_id = hv_generate_guest_id();
>  	wrmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id);
> 
>  	/* Hyper-V requires to write guest os id via ghcb in SNP IVM. */
> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index c05d2ce9b6cd..7f4a23cee56f 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -25,6 +25,7 @@
>  #include <linux/nmi.h>
>  #include <asm/ptrace.h>
>  #include <asm/hyperv-tlfs.h>
> +#include <linux/version.h>

Having added the #include of linux/version.h here, you should remove it
from arch/arm64/hyperv/mshyperv.c and arch/x86/hyperv/hv_init.c.
It shouldn't be needed any longer in those two files.

Michael

> 
>  struct ms_hyperv_info {
>  	u32 features;
> @@ -105,15 +106,12 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
>  }
> 
>  /* Generate the guest OS identifier as described in the Hyper-V TLFS */
> -static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
> -				       __u64 d_info2)
> +static inline u64 hv_generate_guest_id(void)
>  {
> -	__u64 guest_id = 0;
> +	u64 guest_id;
> 
> -	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
> -	guest_id |= (d_info1 << 48);
> -	guest_id |= (kernel_version << 16);
> -	guest_id |= d_info2;
> +	guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
> +	guest_id |= (((u64)LINUX_VERSION_CODE) << 16);
> 
>  	return guest_id;
>  }
> --
> 2.18.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-23 20:18   ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-23 20:18 UTC (permalink / raw)
  To: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd
  Cc: x86, linux-hyperv, linux-arm-kernel, linux-kernel, linux-arch

From: Li kunyu <kunyu@nfschina.com> Sent: Friday, September 23, 2022 4:43 AM
> 
> The generate_guest_id function is more suitable for use after the
> following modifications.
> 1. Modify the type of the guest_id variable to u64, which is compatible
> with the caller.
> 2. Remove all parameters from the function, and write the parameter
> (LINUX_VERSION_CODE) passed in by the actual call into the function
> implementation.
> 3. Rename the function to make it clearly a Hyper-V related function,
> and modify it to hv_generate_guest_id.
> 
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> 
> --------
>  v2: Fix generate_guest_id to hv_generate_guest_id.
>  v3: Fix [PATCH v2] asm-generic: Remove the ... to [PATCH v3] hyperv: simp
>      lify ... and remove extra spaces
> ---
>  arch/arm64/hyperv/mshyperv.c   |  2 +-
>  arch/x86/hyperv/hv_init.c      |  2 +-
>  include/asm-generic/mshyperv.h | 12 +++++-------
>  3 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
> index bbbe351e9045..3863fd226e0e 100644
> --- a/arch/arm64/hyperv/mshyperv.c
> +++ b/arch/arm64/hyperv/mshyperv.c
> @@ -38,7 +38,7 @@ static int __init hyperv_init(void)
>  		return 0;
> 
>  	/* Setup the guest ID */
> -	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
> +	guest_id = hv_generate_guest_id();
>  	hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id);
> 
>  	/* Get the features and hints from Hyper-V */
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 3de6d8b53367..93770791b858 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -426,7 +426,7 @@ void __init hyperv_init(void)
>  	 * 1. Register the guest ID
>  	 * 2. Enable the hypercall and register the hypercall page
>  	 */
> -	guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0);
> +	guest_id = hv_generate_guest_id();
>  	wrmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id);
> 
>  	/* Hyper-V requires to write guest os id via ghcb in SNP IVM. */
> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index c05d2ce9b6cd..7f4a23cee56f 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -25,6 +25,7 @@
>  #include <linux/nmi.h>
>  #include <asm/ptrace.h>
>  #include <asm/hyperv-tlfs.h>
> +#include <linux/version.h>

Having added the #include of linux/version.h here, you should remove it
from arch/arm64/hyperv/mshyperv.c and arch/x86/hyperv/hv_init.c.
It shouldn't be needed any longer in those two files.

Michael

> 
>  struct ms_hyperv_info {
>  	u32 features;
> @@ -105,15 +106,12 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
>  }
> 
>  /* Generate the guest OS identifier as described in the Hyper-V TLFS */
> -static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
> -				       __u64 d_info2)
> +static inline u64 hv_generate_guest_id(void)
>  {
> -	__u64 guest_id = 0;
> +	u64 guest_id;
> 
> -	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
> -	guest_id |= (d_info1 << 48);
> -	guest_id |= (kernel_version << 16);
> -	guest_id |= d_info2;
> +	guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
> +	guest_id |= (((u64)LINUX_VERSION_CODE) << 16);
> 
>  	return guest_id;
>  }
> --
> 2.18.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] hyperv: simplify and rename generate_guest_id
  2022-09-23 11:42 ` Li kunyu
@ 2022-09-23 21:09   ` Olaf Hering
  -1 siblings, 0 replies; 12+ messages in thread
From: Olaf Hering @ 2022-09-23 21:09 UTC (permalink / raw)
  To: Li kunyu
  Cc: kys, haiyangz, sthemmin, wei.liu, decui, catalin.marinas, will,
	tglx, mingo, bp, dave.hansen, hpa, arnd, x86, linux-hyperv,
	linux-arm-kernel, linux-kernel, linux-arch


[-- Attachment #1.1: Type: text/plain, Size: 391 bytes --]

Fri, 23 Sep 2022 19:42:59 +0800 Li kunyu <kunyu@nfschina.com>:

> +++ b/include/asm-generic/mshyperv.h
> +#include <linux/version.h>

A very long time ago I removed most usage of version.h AFAIR,
so that changing uname -r will dirty just a tiny amount of objects.

But, this header is always coming back, like bad weed.

Please reconsider the suggested approach.

Thanks,
Olaf

[-- Attachment #1.2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-23 21:09   ` Olaf Hering
  0 siblings, 0 replies; 12+ messages in thread
From: Olaf Hering @ 2022-09-23 21:09 UTC (permalink / raw)
  To: Li kunyu
  Cc: kys, haiyangz, sthemmin, wei.liu, decui, catalin.marinas, will,
	tglx, mingo, bp, dave.hansen, hpa, arnd, x86, linux-hyperv,
	linux-arm-kernel, linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

Fri, 23 Sep 2022 19:42:59 +0800 Li kunyu <kunyu@nfschina.com>:

> +++ b/include/asm-generic/mshyperv.h
> +#include <linux/version.h>

A very long time ago I removed most usage of version.h AFAIR,
so that changing uname -r will dirty just a tiny amount of objects.

But, this header is always coming back, like bad weed.

Please reconsider the suggested approach.

Thanks,
Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
  2022-09-23 21:09   ` Olaf Hering
@ 2022-09-24  5:31     ` Michael Kelley (LINUX)
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-24  5:31 UTC (permalink / raw)
  To: Olaf Hering, Li kunyu
  Cc: KY Srinivasan, Haiyang Zhang, Stephen Hemminger, wei.liu,
	Dexuan Cui, catalin.marinas, will, tglx, mingo, bp, dave.hansen,
	hpa, arnd, x86, linux-hyperv, linux-arm-kernel, linux-kernel,
	linux-arch

From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM
> 
> Fri, 23 Sep 2022 19:42:59 +0800 Li kunyu <kunyu@nfschina.com>:
> 
> > +++ b/include/asm-generic/mshyperv.h
> > +#include <linux/version.h>
> 
> A very long time ago I removed most usage of version.h AFAIR,
> so that changing uname -r will dirty just a tiny amount of objects.
> 
> But, this header is always coming back, like bad weed.
> 
> Please reconsider the suggested approach.

Could you elaborate?  This code is getting the Linux kernel version
to pass to the hypervisor for later diagnostic purposes.  In a large
cloud environment like Azure, it's helpful sometimes to be able to
correlate emerging fleet-wide issues to particular kernel versions.
The Hyper-V code in Linux has been using LINUX_VERSION_CODE
this way for the past 10 years, so this isn't new.

Is there a more preferred mechanism for kernel code to get its version? 

Michael

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-24  5:31     ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-24  5:31 UTC (permalink / raw)
  To: Olaf Hering, Li kunyu
  Cc: KY Srinivasan, Haiyang Zhang, Stephen Hemminger, wei.liu,
	Dexuan Cui, catalin.marinas, will, tglx, mingo, bp, dave.hansen,
	hpa, arnd, x86, linux-hyperv, linux-arm-kernel, linux-kernel,
	linux-arch

From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM
> 
> Fri, 23 Sep 2022 19:42:59 +0800 Li kunyu <kunyu@nfschina.com>:
> 
> > +++ b/include/asm-generic/mshyperv.h
> > +#include <linux/version.h>
> 
> A very long time ago I removed most usage of version.h AFAIR,
> so that changing uname -r will dirty just a tiny amount of objects.
> 
> But, this header is always coming back, like bad weed.
> 
> Please reconsider the suggested approach.

Could you elaborate?  This code is getting the Linux kernel version
to pass to the hypervisor for later diagnostic purposes.  In a large
cloud environment like Azure, it's helpful sometimes to be able to
correlate emerging fleet-wide issues to particular kernel versions.
The Hyper-V code in Linux has been using LINUX_VERSION_CODE
this way for the past 10 years, so this isn't new.

Is there a more preferred mechanism for kernel code to get its version? 

Michael

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] hyperv: simplify and rename generate_guest_id
  2022-09-24  5:31     ` Michael Kelley (LINUX)
@ 2022-09-26  7:56       ` Olaf Hering
  -1 siblings, 0 replies; 12+ messages in thread
From: Olaf Hering @ 2022-09-26  7:56 UTC (permalink / raw)
  To: Michael Kelley (LINUX)
  Cc: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd, x86, linux-hyperv, linux-arm-kernel,
	linux-kernel, linux-arch


[-- Attachment #1.1: Type: text/plain, Size: 855 bytes --]

Sat, 24 Sep 2022 05:31:34 +0000 "Michael Kelley (LINUX)" <mikelley@microsoft.com>:

> From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM

> > A very long time ago I removed most usage of version.h AFAIR,
> Could you elaborate?

It is the cost of 'make LOCALVERSION=x' vs. 'make LOCALVERSION=y'.

Too many drivers will be recompiled for no good reason as of today.
I claim no consumer below drivers/ and sound/ has a valid usecase for version.h.
But, someone else has to take the energy and argue them out of the tree.

With the proposed change every consumer of asm-generic/mshyperv.h will be dirty,
see 'touch include/asm-generic/mshyperv.h' for the impact. Therefore I think
only the two existing c files should include this header, in case the provided
information has a true value for the consumer.


Olaf

[-- Attachment #1.2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-26  7:56       ` Olaf Hering
  0 siblings, 0 replies; 12+ messages in thread
From: Olaf Hering @ 2022-09-26  7:56 UTC (permalink / raw)
  To: Michael Kelley (LINUX)
  Cc: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd, x86, linux-hyperv, linux-arm-kernel,
	linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

Sat, 24 Sep 2022 05:31:34 +0000 "Michael Kelley (LINUX)" <mikelley@microsoft.com>:

> From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM

> > A very long time ago I removed most usage of version.h AFAIR,
> Could you elaborate?

It is the cost of 'make LOCALVERSION=x' vs. 'make LOCALVERSION=y'.

Too many drivers will be recompiled for no good reason as of today.
I claim no consumer below drivers/ and sound/ has a valid usecase for version.h.
But, someone else has to take the energy and argue them out of the tree.

With the proposed change every consumer of asm-generic/mshyperv.h will be dirty,
see 'touch include/asm-generic/mshyperv.h' for the impact. Therefore I think
only the two existing c files should include this header, in case the provided
information has a true value for the consumer.


Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
  2022-09-26  7:56       ` Olaf Hering
@ 2022-09-27  4:54         ` Michael Kelley (LINUX)
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-27  4:54 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd, x86, linux-hyperv, linux-arm-kernel,
	linux-kernel, linux-arch

From: Olaf Hering <olaf@aepfle.de> Sent: Monday, September 26, 2022 12:57 AM
> 
> Sat, 24 Sep 2022 05:31:34 +0000 "Michael Kelley (LINUX)" <mikelley@microsoft.com>:
> 
> > From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM
> 
> > > A very long time ago I removed most usage of version.h AFAIR,
> > Could you elaborate?
> 
> It is the cost of 'make LOCALVERSION=x' vs. 'make LOCALVERSION=y'.
> 
> Too many drivers will be recompiled for no good reason as of today.
> I claim no consumer below drivers/ and sound/ has a valid usecase for version.h.
> But, someone else has to take the energy and argue them out of the tree.
> 
> With the proposed change every consumer of asm-generic/mshyperv.h will be dirty,
> see 'touch include/asm-generic/mshyperv.h' for the impact. Therefore I think
> only the two existing c files should include this header, in case the provided
> information has a true value for the consumer.
> 

Thanks, Olaf.  That makes sense and I agree.

Li Kunyu -- that means you should "undo" part of your patch.  Keep the use
of LINUX_VERSION_CODE and the #include of <linux/version.h> in the two
.c files, and pass LINUX_VERSION_CODE as an argument to hv_generate_guest_id().
Remove the #include of <linux/version.h> from include/asm-generic/mshyperv.h.

Michael

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3] hyperv: simplify and rename generate_guest_id
@ 2022-09-27  4:54         ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-27  4:54 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Li kunyu, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, catalin.marinas, will, tglx, mingo, bp,
	dave.hansen, hpa, arnd, x86, linux-hyperv, linux-arm-kernel,
	linux-kernel, linux-arch

From: Olaf Hering <olaf@aepfle.de> Sent: Monday, September 26, 2022 12:57 AM
> 
> Sat, 24 Sep 2022 05:31:34 +0000 "Michael Kelley (LINUX)" <mikelley@microsoft.com>:
> 
> > From: Olaf Hering <olaf@aepfle.de> Sent: Friday, September 23, 2022 2:09 PM
> 
> > > A very long time ago I removed most usage of version.h AFAIR,
> > Could you elaborate?
> 
> It is the cost of 'make LOCALVERSION=x' vs. 'make LOCALVERSION=y'.
> 
> Too many drivers will be recompiled for no good reason as of today.
> I claim no consumer below drivers/ and sound/ has a valid usecase for version.h.
> But, someone else has to take the energy and argue them out of the tree.
> 
> With the proposed change every consumer of asm-generic/mshyperv.h will be dirty,
> see 'touch include/asm-generic/mshyperv.h' for the impact. Therefore I think
> only the two existing c files should include this header, in case the provided
> information has a true value for the consumer.
> 

Thanks, Olaf.  That makes sense and I agree.

Li Kunyu -- that means you should "undo" part of your patch.  Keep the use
of LINUX_VERSION_CODE and the #include of <linux/version.h> in the two
.c files, and pass LINUX_VERSION_CODE as an argument to hv_generate_guest_id().
Remove the #include of <linux/version.h> from include/asm-generic/mshyperv.h.

Michael

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-09-27  4:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23 11:42 [PATCH v3] hyperv: simplify and rename generate_guest_id Li kunyu
2022-09-23 11:42 ` Li kunyu
2022-09-23 20:18 ` Michael Kelley (LINUX)
2022-09-23 20:18   ` Michael Kelley (LINUX)
2022-09-23 21:09 ` Olaf Hering
2022-09-23 21:09   ` Olaf Hering
2022-09-24  5:31   ` Michael Kelley (LINUX)
2022-09-24  5:31     ` Michael Kelley (LINUX)
2022-09-26  7:56     ` Olaf Hering
2022-09-26  7:56       ` Olaf Hering
2022-09-27  4:54       ` Michael Kelley (LINUX)
2022-09-27  4:54         ` Michael Kelley (LINUX)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.