xen: Add macro for version number string
PATCH 1/1 xen: Add macro for version number string
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "xen/compile.h" is missed so that XEN_VERSION and XEN_SUBVERSION are not defined, __stringify() wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".
This patch introduces a string macro XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of __stringify() to make the code more readable.
The change has been tested on Ampere AVA Arm64 platform.
--- xen/arch/arm/acpi/domain_build.c | 3 ++- xen/arch/arm/domain_build.c | 2 +- xen/common/efi/boot.c | 4 ++-- xen/include/xen/compile.h.in | 1 + 4 files changed, 6 insertions(+), 4 deletions(-)
xen/arch/arm/acpi/domain_build.c +2 -1
@@ -9,6 +9,7 @@* GNU General Public License for more details. */ +#include <xen/compile.h> #include <xen/mm.h> #include <xen/sched.h> #include <xen/acpi.h>
@@ -91,7 +92,7 @@ static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, struct membank tbl_add[]) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" "xen,xen" ;int res;/* Convenience alias */
xen/arch/arm/domain_build.c +1 -1
@@ -1367,7 +1367,7 @@ static int __init make_hypervisor_node(struct domain *d, int addrcells, int sizecells) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" "xen,xen" ;__be32 *reg, *cells;gic_interrupt_t intr;
xen/common/efi/boot.c +2 -2
@@ -1341,8 +1341,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)efi_console_set_mode (); } - PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION) -XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n" ); +PrintStr (L"Xen " XEN_VERSION_STRING XEN_EXTRAVERSION +" (c/s " XEN_CHANGESET ") EFI loader\r\n" );efi_arch_relocate_image (0 );
xen/include/xen/compile.h.in +1 -0
@@ -7,6 +7,7 @@ #define XEN_VERSION @@version@@ #define XEN_SUBVERSION @@subversion@@ +#define XEN_VERSION_STRING "@@version@@.@@subversion@@" #define XEN_EXTRAVERSION "@@extraversion@@" #define XEN_CHANGESET "@@changeset@@"
Signature · 1 line
2.34.1
Quoted 12 lines · Leo Yan
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "
xen/compile.h" is missed so thatXEN_VERSIONandXEN_SUBVERSIONare not defined,__stringify()wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".This patch introduces a string macro
XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of__stringify()to make the code more readable.
Quoted 5 lines
The change has been tested on Ampere AVA Arm64 platform.
Fixes 5d797ee199b3 ("xen/arm: split domain_build.c")Suggested-by Bertrand Marquis <[email protected]>Signed-off-by Leo Yan <[email protected]>
with perhaps a small adjustment (but it'll be the Arm maintainers to judge):
xen/arch/arm/acpi/domain_build.c static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, · line 95
Quoted 6 lines
xen/arch/arm/acpi/domain_build.c +1
-1@@ -91,7 +92,7 @@ static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, struct membank tbl_add[]) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0"
I think readability would benefit here from adding blanks around XEN_VERSION_STRING here and ...
xen/arch/arm/domain_build.c static int __init make_hypervisor_node(struct domain *d, · line 1370
Quoted 8 lines
xen/arch/arm/domain_build.c +1
-1@@ -1367,7 +1367,7 @@ static int __init make_hypervisor_node(struct domain *d, int addrcells, int sizecells) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0"
... here (as an aside I wonder why these variables aren't static __initconst), just like ...
xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 1345
Quoted 10 lines
xen/common/efi/boot.c +2
-2@@ -1341,8 +1341,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)efi_console_set_mode (); } - PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION) -XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n" ); +PrintStr (L"Xen " XEN_VERSION_STRING XEN_EXTRAVERSION +" (c/s " XEN_CHANGESET ") EFI loader\r\n" );
... it is here in particular for XEN_CHANGESET.
The other general remark I have: Please follow patch submission guidelines and send To: the list with maintainers on Cc:.
Jan
Hi Jan,
Quoted 22 lines · Jan Beulich
Quoted 12 lines · Leo Yan
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "
xen/compile.h" is missed so thatXEN_VERSIONandXEN_SUBVERSIONare not defined,__stringify()wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".This patch introduces a string macro
XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of__stringify()to make the code more readable.Quoted 5 lines
The change has been tested on Ampere AVA Arm64 platform.
Fixes 5d797ee199b3 ("xen/arm: split domain_build.c")Suggested-by Bertrand Marquis <[email protected]>Signed-off-by Leo Yan <[email protected]>Reviewed-by Jan Beulich <[email protected]>with perhaps a small adjustment (but it'll be the Arm maintainers to judge):
Quoted 9 lines
xen/arch/arm/acpi/domain_build.c static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, · line 95
Quoted 6 lines
xen/arch/arm/acpi/domain_build.c +1
-1@@ -91,7 +92,7 @@ static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, struct membank tbl_add[]) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" I think readability would benefit here from adding blanks around
XEN_VERSION_STRINGhere and ...
Agree that adding blanks is better. Will do.
Quoted 12 lines
xen/arch/arm/domain_build.c static int __init make_hypervisor_node(struct domain *d, · line 1370
Quoted 9 lines
xen/arch/arm/domain_build.c +1
-1@@ -1367,7 +1367,7 @@ static int __init make_hypervisor_node(struct domain *d, int addrcells, int sizecells) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" ... here (as an aside I wonder why these variables aren't static
__initconst), just like ...
Will add blanks.
Quoted 13 lines
xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 1345
Quoted 10 lines
xen/common/efi/boot.c +2
-2@@ -1341,8 +1341,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)efi_console_set_mode (); } - PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION) -XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n" ); +PrintStr (L"Xen " XEN_VERSION_STRING XEN_EXTRAVERSION +" (c/s " XEN_CHANGESET ") EFI loader\r\n" );... it is here in particular for
XEN_CHANGESET.
Quoted 2 lines
The other general remark I have: Please follow patch submission guidelines and send To: the list with maintainers on Cc:.
Ah, just now quickly went through docs/process/sending-patches.pandoc, thanks for reminding.
A question, since commit 5d797ee199b3 was merged in 4.11.0-rc6, for fixing it, should I explictly add backport tag as below?
Backport: 4.11+
Thanks,
Leo
Quoted 4 lines · Leo Yan
A question, since commit
5d797ee199b3was merged in 4.11.0-rc6, for fixing it, should I explictly add backport tag as below?Backport: 4.11+
That's up to you, I would say. We don't really use that tag all that much, the Fixes: tag is more relevant at least based on recent observations.
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines · Leo Yan
A question, since commit
5d797ee199b3was merged in 4.11.0-rc6, for fixing it, should I explictly add backport tag as below?Backport: 4.11+
That's up to you, I would say. We don't really use that tag all that much, the Fixes: tag is more relevant at least based on recent observations.
Thanks a lot for confirmation. If so, I will just use Fixes tag.
Leo
Hi Leo,
Thanks a lot for the quick handling here.
Quoted 14 lines · Leo Yan
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "
xen/compile.h" is missed so thatXEN_VERSIONandXEN_SUBVERSIONare not defined,__stringify()wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".This patch introduces a string macro
XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of__stringify()to make the code more readable.
Quoted 5 lines
The change has been tested on Ampere AVA Arm64 platform.
Fixes 5d797ee199b3 ("xen/arm: split domain_build.c")Suggested-by Bertrand Marquis <[email protected]>Signed-off-by Leo Yan <[email protected]>
Regarding the change suggested by Jan to add spaces, I think it is a good idea so if the commiter agrees to do on it on commit please do, otherwise we can keep this as is.
Cheers
Bertrand
Quoted 71 lines
---
xen/arch/arm/acpi/domain_build.c | 3 ++- xen/arch/arm/domain_build.c | 2 +- xen/common/efi/boot.c | 4 ++-- xen/include/xen/compile.h.in | 1 + 4 files changed, 6 insertions(+), 4 deletions(-)xen/arch/arm/acpi/domain_build.c +2
-1@@ -9,6 +9,7 @@* GNU General Public License for more details. */ +#include <xen/compile.h> #include <xen/mm.h> #include <xen/sched.h> #include <xen/acpi.h> @@ -91,7 +92,7 @@ static int __init acpi_make_hypervisor_node(const struct kernel_info *kinfo, struct membank tbl_add[]) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" "xen,xen" ;int res;/* Convenience alias */ xen/arch/arm/domain_build.c +1
-1@@ -1367,7 +1367,7 @@ static int __init make_hypervisor_node(struct domain *d, int addrcells, int sizecells) {const char compat[] = - "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0" +"xen,xen-" XEN_VERSION_STRING "\0" "xen,xen" ;__be32 *reg, *cells;gic_interrupt_t intr;xen/common/efi/boot.c +2
-2@@ -1341,8 +1341,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)efi_console_set_mode (); } - PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION) -XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n" ); +PrintStr (L"Xen " XEN_VERSION_STRING XEN_EXTRAVERSION +" (c/s " XEN_CHANGESET ") EFI loader\r\n" );efi_arch_relocate_image (0 );xen/include/xen/compile.h.in +1
-0@@ -7,6 +7,7 @@ #define XEN_VERSION @@version@@ #define XEN_SUBVERSION @@subversion@@ +#define XEN_VERSION_STRING "@@version@@.@@subversion@@" #define XEN_EXTRAVERSION "@@extraversion@@" #define XEN_CHANGESET "@@changeset@@"Signature · 1 line
2.34.1
Quoted 20 lines · Bertrand Marquis
Hi Leo,
Thanks a lot for the quick handling here.
Quoted 16 lines · Leo Yan
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "
xen/compile.h" is missed so thatXEN_VERSIONandXEN_SUBVERSIONare not defined,__stringify()wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".This patch introduces a string macro
XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of__stringify()to make the code more readable.The change has been tested on Ampere AVA Arm64 platform.
Quoted 8 lines
Quoted 3 lines
Fixes 5d797ee199b3 ("xen/arm: split domain_build.c")Suggested-by Bertrand Marquis <[email protected]>Signed-off-by Leo Yan <[email protected]>Reviewed-by Bertrand Marquis <[email protected]>Regarding the change suggested by Jan to add spaces, I think it is a good idea so if the commiter agrees to do on it on commit please do, otherwise we can keep this as is.
If I end up committing this, I'd be happy to add the blanks, and therefore I'm inclined to say no need for a re-send.
Jan
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Bertrand Marquis
Hi Leo,
Thanks a lot for the quick handling here.
Quoted 19 lines · Leo Yan
On Arm64 Linux kernel prints log for Xen version number:
Xen XEN_VERSION.XEN_SUBVERSION support found
The header file "
xen/compile.h" is missed so thatXEN_VERSIONandXEN_SUBVERSIONare not defined,__stringify()wrongly converts them as strings and concatenate to string "XEN_VERSION.XEN_SUBVERSION".This patch introduces a string macro
XEN_VERSION_STRING, we can directly use it as version number string, as a result it drops to use of__stringify()to make the code more readable.The change has been tested on Ampere AVA Arm64 platform.
Fixes 5d797ee199b3 ("xen/arm: split domain_build.c")Suggested-by Bertrand Marquis <[email protected]>Signed-off-by Leo Yan <[email protected]>
Quoted 8 lines
Quoted 5 lines
Reviewed-by Bertrand Marquis <[email protected]>Regarding the change suggested by Jan to add spaces, I think it is a good idea so if the commiter agrees to do on it on commit please do, otherwise we can keep this as is.
If I end up committing this, I'd be happy to add the blanks, and therefore I'm inclined to say no need for a re-send.
For easier for maintainers, have sent patch v2 with adding blank and adding review tags. Thanks!
Leo