Makefile: 'lvm version' works incorrect. Because CFLAGS can not get sub-make variable $(KVMTOOLS_VERSION)
PATCH 1/1 Makefile: 'lvm version' works incorrect. Because CFLAGS can not get sub-make variable $(KVMTOOLS_VERSION)
From: "haibiao.xiao" <[email protected]>
Command 'lvm version' works incorrect.
It is expected to print:
# ./lvm version
# kvm tool [KVMTOOLS_VERSION]but the KVMTOOLS_VERSION is missed:
# ./lvm version
# kvm toolThe KVMTOOLS_VERSION is defined in the KVMTOOLS-VERSION-FILE file which is included at the end of Makefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion of KVMTOOLS_VERSION at the end of Makefile would not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.
I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=
@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endif
Signature · 1 line
2.32.0
Hi,
Quoted 1 line · haibiao.xiao
From: "haibiao.xiao" <[email protected]>
The subject line should be a summary of what the patch does (and perhaps why it does it), not a description of what is broken. How about this:
Makefile: Calculate the correct kvmtool version
or something else that you prefer. Tested the patch and it works as advertised:
Thanks,
Alex
Quoted 49 lines
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolThe
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endifSignature · 1 line
2.32.0
Hi,
Thanks for your reply. I'd like to changed the subject line as you suggested. But I don't know how to deal with it, should I send another patch mail?
Thanks,
haibiao.xiao
Quoted 67 lines · Alexandru Elisei
Hi,
Quoted 1 line · haibiao.xiao
From: "haibiao.xiao" <[email protected]>
The subject line should be a summary of what the patch does (and perhaps why it does it), not a description of what is broken. How about this:
Makefile: Calculate the correct kvmtool versionor something else that you prefer. Tested the patch and it works as advertised:
Tested-by Alexandru Elisei <[email protected]>Thanks,
AlexQuoted 49 lines
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolThe
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endifSignature · 1 line
2.32.0
Hi,
Quoted 5 lines · haibiao.xiao
Hi,
Thanks for your reply. I'd like to changed the subject line as you suggested. But I don't know how to deal with it, should I send another patch mail?
Yes, please send version 2 of the patch. The subject line for the email should changed to (notice the extra v2):
[PATCH v2 kvmtool] <your summary here>
You can put the Tested-by tag after your Signed-off.
Thanks,
Alex
Quoted 72 lines
Thanks,
haibiao.xiaoQuoted 67 lines · Alexandru Elisei
Hi,
Quoted 1 line · haibiao.xiao
From: "haibiao.xiao" <[email protected]>
The subject line should be a summary of what the patch does (and perhaps why it does it), not a description of what is broken. How about this:
Makefile: Calculate the correct kvmtool versionor something else that you prefer. Tested the patch and it works as advertised:
Tested-by Alexandru Elisei <[email protected]>Thanks,
AlexQuoted 49 lines
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolThe
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endifSignature · 1 line
2.32.0
On Sat, 4 Dec 2021 14:14:36 +0800
"haibiao.xiao" <[email protected]> wrote:
Hi,
Quoted 13 lines
From: "haibiao.xiao" <[email protected]>
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm tool
Quoted 8 lines
The
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
While this is indeed a bug that this patch fixes, I wonder if we should actually get rid of this whole versioning attempt altogether at this point. Originally this was following the containing kernel version, but it is stuck ever since at v3.18, without any change.
So either we introduce proper versioning (not sure it's worth it?), or we just remove all code that pretends to print a version number? Or just hardcode v3.18 into the printf, at least for now? At the very least I think we don't need a KVMTOOLS-VERSION-FILE anymore.
Cheers,
Andre
Quoted 26 lines
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endif
Hi,
Quoted 32 lines · Andre Przywara
On Sat, 4 Dec 2021 14:14:36 +0800
"haibiao.xiao" <[email protected]> wrote:Hi,
Quoted 13 lines
From: "haibiao.xiao" <[email protected]>
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolQuoted 8 lines
The
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
While this is indeed a bug that this patch fixes, I wonder if we should actually get rid of this whole versioning attempt altogether at this point. Originally this was following the containing kernel version, but it is stuck ever since at v3.18, without any change.
Quoted 5 lines
So either we introduce proper versioning (not sure it's worth it?), or we just remove all code that pretends to print a version number? Or just hardcode v3.18 into the printf, at least for now? At the very least I think we don't need a KVMTOOLS-VERSION-FILE anymore.
Thanks for your reply.
The reason I look at this project is tend to learn something about kvm. With the version number I can tell which kernel(kvm) is compatible.
Although it is stuck at v3.18, there still some commits in recent months, which means the kvmtool still changing according to the kvm features. So I think what's kvmtool need is a version control, but not remove/hardcode.
Thanks,
haibiao.xiao
Quoted 29 lines
Cheers,
AndreQuoted 26 lines
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endif
On Fri, 10 Dec 2021 10:55:40 +0800
"haibiao.xiao" <[email protected]> wrote:
Hi,
Quoted 39 lines · Andre Przywara
Quoted 32 lines
On Sat, 4 Dec 2021 14:14:36 +0800
"haibiao.xiao" <[email protected]> wrote:Hi,
Quoted 13 lines
From: "haibiao.xiao" <[email protected]>
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolQuoted 8 lines
The
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
While this is indeed a bug that this patch fixes, I wonder if we should actually get rid of this whole versioning attempt altogether at this point. Originally this was following the containing kernel version, but it is stuck ever since at v3.18, without any change.
Quoted 5 lines
So either we introduce proper versioning (not sure it's worth it?), or we just remove all code that pretends to print a version number? Or just hardcode v3.18 into the printf, at least for now? At the very least I think we don't need a KVMTOOLS-VERSION-FILE anymore.
Quoted 4 lines
Thanks for your reply.
The reason I look at this project is tend to learn something about kvm. With the version number I can tell which kernel(kvm) is compatible.
I am afraid this is not what the version number tells you. The Linux kernel provides a stable interface to userland, that includes KVM. So you should be able to run any kvmtool version on any host kernel (ignoring bugs). Granted, you will only get the features implemented in both parts, but this only applies to new features (like PMU virtualisation), not the main functionality.
Quoted 3 lines
Although it is stuck at v3.18, there still some commits in recent months, which means the kvmtool still changing according to the kvm features.
Sure, we keep it alive, but adapting to new kernel features is only one part of that. Recently we mostly improved functionality (like adding firmware support, emulating later PCIe versions, ...) and were fixing bugs, independent of the kernel version.
Quoted 2 lines
So I think what's kvmtool need is a version control, but not remove/hardcode.
So whether that's really worth it, is the question. If you need some number to compare, distributions tend to use the date of the last commit for that.
Cheers,
Andre
Quoted 32 lines
Thanks,
haibiao.xiaoQuoted 29 lines
Cheers,
AndreQuoted 26 lines
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endif
Hi,
Sorry for getting back to you late.
Quoted 49 lines · Andre Przywara
On Fri, 10 Dec 2021 10:55:40 +0800
"haibiao.xiao" <[email protected]> wrote:Hi,
Quoted 39 lines · Andre Przywara
Quoted 32 lines
On Sat, 4 Dec 2021 14:14:36 +0800
"haibiao.xiao" <[email protected]> wrote:Hi,
Quoted 13 lines
From: "haibiao.xiao" <[email protected]>
Command 'lvm version' works incorrect.
It is expected to print:# ./lvm version # kvm tool [KVMTOOLS_VERSION]but the
KVMTOOLS_VERSIONis missed:# ./lvm version # kvm toolQuoted 8 lines
The
KVMTOOLS_VERSIONis defined in the KVMTOOLS-VERSION-FILE file which is included at the end ofMakefile. Since the CFLAGS is a 'Simply expanded variables' which means CFLAGS is only scanned once. So the definetion ofKVMTOOLS_VERSIONat the end ofMakefilewould not scanned by CFLAGS. So the '-DKVMTOOLS_VERSION=' remains empty.I fixed the bug by moving the '-include $(OUTPUT)KVMTOOLS-VERSION-FILE' before the CFLAGS.
While this is indeed a bug that this patch fixes, I wonder if we should actually get rid of this whole versioning attempt altogether at this point. Originally this was following the containing kernel version, but it is stuck ever since at v3.18, without any change.
Quoted 5 lines
So either we introduce proper versioning (not sure it's worth it?), or we just remove all code that pretends to print a version number? Or just hardcode v3.18 into the printf, at least for now? At the very least I think we don't need a KVMTOOLS-VERSION-FILE anymore.
Quoted 4 lines
Thanks for your reply.
The reason I look at this project is tend to learn something about kvm. With the version number I can tell which kernel(kvm) is compatible.
Quoted 7 lines
I am afraid this is not what the version number tells you. The Linux kernel provides a stable interface to userland, that includes KVM. So you should be able to run any kvmtool version on any host kernel (ignoring bugs). Granted, you will only get the features implemented in both parts, but this only applies to new features (like PMU virtualisation), not the main functionality.
I thought about it again. Yes, you are right.
Quoted 9 lines
Quoted 3 lines
Although it is stuck at v3.18, there still some commits in recent months, which means the kvmtool still changing according to the kvm features.
Sure, we keep it alive, but adapting to new kernel features is only one part of that. Recently we mostly improved functionality (like adding firmware support, emulating later PCIe versions, ...) and were fixing bugs, independent of the kernel version.
Quoted 6 lines
Quoted 2 lines
So I think what's kvmtool need is a version control, but not remove/hardcode.
So whether that's really worth it, is the question. If you need some number to compare, distributions tend to use the date of the last commit for that.
And I reviewed the code about version generation this weekends. I found it was already hardcode to 3.18.0 in kvmtool/util/KVMTOOLS-VERSION-GEN. What's more, it leaves a way to change the version number by getting from git describe.
Quoted 36 lines
Cheers,
AndreQuoted 32 lines
Thanks,
haibiao.xiaoQuoted 29 lines
Cheers,
AndreQuoted 26 lines
Signed-off-by haibiao.xiao <[email protected]>--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Makefile +2
-2@@ -17,6 +17,7 @@ export E Q include config/utilities.mak include config/feature-tests.mak +-include $(OUTPUT)KVMTOOLS-VERSION-FILE CC := $(CROSS_COMPILE)gcc CFLAGS :=@@ -559,5 +560,4 @@ ifneq ($(MAKECMDGOALS),clean) KVMTOOLS-VERSION-FILE: @$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT) --include $(OUTPUT)KVMTOOLS-VERSION-FILE -endif +endif