Skip to contentSkip to conversation

s390/protvirt: fix compilation issue

PATCH Applied Claudio Imbrenda 5 participants 8 messages Apr 23, 2020 – Apr 25, 2020

Subsystems (3)
lore
Share & tools
lore

Claudio Imbrenda

author maintainer
#0 lore raw

PATCH 1/1 s390/protvirt: fix compilation issue

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/boot/uv.c +0 -2
index 8fde561f1d07..f887a479cdc7 100644
@@ -7,9 +7,7 @@
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
 int __bootdata_preserved(prot_virt_guest);
 #endif
-#if IS_ENABLED(CONFIG_KVM)
 struct uv_info __bootdata_preserved(uv_info);
-#endif
 
 void uv_query_info(void)
 {
arch/s390/kernel/uv.c +2 -1
index c86d654351d1..4c0677fc8904 100644
@@ -23,10 +23,11 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif
 
+struct uv_info __bootdata_preserved(uv_info);
+
 #if IS_ENABLED(CONFIG_KVM)
 int prot_virt_host;
 EXPORT_SYMBOL(prot_virt_host);
-struct uv_info __bootdata_preserved(uv_info);
 EXPORT_SYMBOL(uv_info);
 
 static int __init prot_virt_setup(char *val)
Signature · 1 line
2.25.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Claudio Imbrenda

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/boot/uv.c +0 -2
index 8fde561f1d07..f887a479cdc7 100644
@@ -7,9 +7,7 @@
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
 int __bootdata_preserved(prot_virt_guest);
 #endif
-#if IS_ENABLED(CONFIG_KVM)
 struct uv_info __bootdata_preserved(uv_info);
-#endif
 
 void uv_query_info(void)
 {
arch/s390/kernel/uv.c +0 -0
index c86d654351d1..4c0677fc8904 100644
@@ -23,10 +23,11 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif

arch/s390/kernel/uv.c line 33

Quoted 10 lines
arch/s390/kernel/uv.c +2 -1
 
+struct uv_info __bootdata_preserved(uv_info);
+
 #if IS_ENABLED(CONFIG_KVM)
 int prot_virt_host;
 EXPORT_SYMBOL(prot_virt_host);
-struct uv_info __bootdata_preserved(uv_info);
 EXPORT_SYMBOL(uv_info);
 
 static int __init prot_virt_setup(char *val)
Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by on v1 1/1
#2 lore raw
In reply to Claudio Imbrenda
Quoted 11 lines · On Thu, 23 Apr 2020 14:01:14 +0200 Claudio Imbrenda <[email protected]>…

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
Quoted 5 lines
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Claudio Imbrenda
Quoted 4 lines · Claudio Imbrenda

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

This statement confuses me a bit.

It's worth to mention that both arch/s390/boot/uv.c (for the decompressor) and arch/s390/kernel/uv.c (for the main kernel) are only built when either CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM is enabled.
Both arch/s390/boot/Makefile and arch/s390/kernel/Makefile contain:
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o

So this makes the variable available when CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM (expressed via CONFIG_PGSTE) is enabled. Hence no need for extra conditions for variable declaration.

Quoted 30 lines
Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/boot/uv.c +0 -2
index 8fde561f1d07..f887a479cdc7 100644
@@ -7,9 +7,7 @@
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
 int __bootdata_preserved(prot_virt_guest);
 #endif
-#if IS_ENABLED(CONFIG_KVM)
 struct uv_info __bootdata_preserved(uv_info);
-#endif
 
 void uv_query_info(void)
 {
arch/s390/kernel/uv.c +0 -0
index c86d654351d1..4c0677fc8904 100644

arch/s390/kernel/uv.c line 31

Quoted 10 lines
arch/s390/kernel/uv.c +2 -1
@@ -23,10 +23,11 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif
 
+struct uv_info __bootdata_preserved(uv_info);
+
 #if IS_ENABLED(CONFIG_KVM)
 int prot_virt_host;
 EXPORT_SYMBOL(prot_virt_host);
-struct uv_info __bootdata_preserved(uv_info);
 EXPORT_SYMBOL(uv_info);

hm, EXPORT_SYMBOL(uv_info) is not needed without CONFIG_KVM and this saves 1 symbol export, but I'd still made EXPORT_SYMBOL follow the declaration immediately. Documentation/process/coding-style.rst mentions that only for function declarations though.

author maintainer
#4 lore raw
Quoted 17 lines · On Thu, 23 Apr 2020 14:54:22 +0200 Vasily Gorbik <[email protected]> wrote:
Quoted 5 lines · Claudio Imbrenda

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

This statement confuses me a bit.

It's worth to mention that both arch/s390/boot/uv.c (for the decompressor) and arch/s390/kernel/uv.c (for the main kernel) are only built when either CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM is enabled.
Both arch/s390/boot/Makefile and arch/s390/kernel/Makefile contain:
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST)
$(CONFIG_PGSTE)) += uv.o

Quoted 4 lines

So this makes the variable available when CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM (expressed via CONFIG_PGSTE) is enabled. Hence no need for extra conditions for variable declaration.

yes, "always available" when the file is compiled at all, obviously.

in fact, there are some probably useless ifdefs in that file too, but this patch should only address the bug

Quoted 33 lines
Quoted 33 lines
Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware

interface for Ultravisor information") Reported-by: kbuild test robot <[email protected]> Reported-by: Philipp Rudo <[email protected]> Suggested-by: Philipp Rudo <[email protected]> CC: Vasily Gorbik <[email protected]>

---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/boot/uv.c +0 -2
index 8fde561f1d07..f887a479cdc7 100644
@@ -7,9 +7,7 @@
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
 int __bootdata_preserved(prot_virt_guest);
 #endif
-#if IS_ENABLED(CONFIG_KVM)
 struct uv_info __bootdata_preserved(uv_info);
-#endif
 
 void uv_query_info(void)
 {
arch/s390/kernel/uv.c +0 -0
index c86d654351d1..4c0677fc8904 100644
@@ -23,10 +23,11 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif
 
Quoted 12 lines

arch/s390/kernel/uv.c line 31

Quoted 7 lines
arch/s390/kernel/uv.c +2 -1
+struct uv_info __bootdata_preserved(uv_info);
+
 #if IS_ENABLED(CONFIG_KVM)
 int prot_virt_host;
 EXPORT_SYMBOL(prot_virt_host);
-struct uv_info __bootdata_preserved(uv_info);
 EXPORT_SYMBOL(uv_info);  

hm, EXPORT_SYMBOL(uv_info) is not needed without CONFIG_KVM and this saves 1 symbol export, but I'd still made EXPORT_SYMBOL follow the declaration immediately. Documentation/process/coding-style.rst mentions that only for function declarations though.

I was wondering the same regarding the export.

I don't have any strong opinions, so if anyone has a preference, speak up and I can fix it.

Quoted 1 line
#5 lore raw
In reply to Vasily Gorbik
Quoted 66 lines · Vasily Gorbik
Quoted 4 lines · Claudio Imbrenda

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

This statement confuses me a bit.

It's worth to mention that both arch/s390/boot/uv.c (for the decompressor) and arch/s390/kernel/uv.c (for the main kernel) are only built when either CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM is enabled.
Both arch/s390/boot/Makefile and arch/s390/kernel/Makefile contain:
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o

So this makes the variable available when CONFIG_PROTECTED_VIRTUALIZATION_GUEST or CONFIG_KVM (expressed via CONFIG_PGSTE) is enabled. Hence no need for extra conditions for variable declaration.

Quoted 30 lines
Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/boot/uv.c +0 -2
index 8fde561f1d07..f887a479cdc7 100644
@@ -7,9 +7,7 @@
 #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
 int __bootdata_preserved(prot_virt_guest);
 #endif
-#if IS_ENABLED(CONFIG_KVM)
 struct uv_info __bootdata_preserved(uv_info);
-#endif
 
 void uv_query_info(void)
 {
arch/s390/kernel/uv.c +0 -0
index c86d654351d1..4c0677fc8904 100644

arch/s390/kernel/uv.c line 31

Quoted 10 lines
arch/s390/kernel/uv.c +2 -1
@@ -23,10 +23,11 @@
 int __bootdata_preserved(prot_virt_guest);
 #endif
 
+struct uv_info __bootdata_preserved(uv_info);
+
 #if IS_ENABLED(CONFIG_KVM)
 int prot_virt_host;
 EXPORT_SYMBOL(prot_virt_host);
-struct uv_info __bootdata_preserved(uv_info);
 EXPORT_SYMBOL(uv_info);

hm, EXPORT_SYMBOL(uv_info) is not needed without CONFIG_KVM and this saves 1 symbol export, but I'd still made EXPORT_SYMBOL follow the declaration immediately. Documentation/process/coding-style.rst mentions that only for function declarations though.

Quoted 1 line

Vasily, I guess you have a pull request soon? Do you want to pick this?

maintainer Applied
#7 lore raw
In reply to Claudio Imbrenda
Quoted 11 lines · Claudio Imbrenda

The kernel fails to compile with CONFIG_PROTECTED_VIRTUALIZATION_GUEST set but CONFIG_KVM unset.

This patch fixes the issue by making the needed variable always available.

Fixes a0f60f8431999bf5 ("s390/protvirt: Add sysfs firmware interface for Ultravisor information")
CC Vasily Gorbik <[email protected]>
Quoted 5 lines
---
 arch/s390/boot/uv.c   | 2 --
 arch/s390/kernel/uv.c | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

Applied, thanks