arch/x86/entry_fred: don't set up KVM IRQs if KVM is disabled
Subsystems (4)
PATCH 1/1 arch/x86/entry_fred: don't set up KVM IRQs if KVM is disabled
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
--- arch/x86/entry/entry_fred.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/entry/entry_fred.c +2 -0
@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool fred_setup_done__initdata ;
Signature · 1 line
2.39.2
Xin Li
maintainerQuoted 15 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>--- arch/x86/entry/entry_fred.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/entry/entry_fred.c +0
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = {
arch/x86/entry/entry_fred.c static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { · line 124
Quoted 10 lines
arch/x86/entry/entry_fred.c +2
-0SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool fred_setup_done__initdata ;
Hmm, we did test against !CONFIG_KVM.
The POSTED_INTR_* macros are under CONFIG_HAVE_KVM, which is 'selected' under CONFIG_X86.
Can you please send me your kernel config file?
Signature · 2 lines
Thanks!
XinQuoted 2 lines · Xin Li
The POSTED_INTR_* macros are under
CONFIG_HAVE_KVM, which is 'selected' underCONFIG_X86.
Sorry, I should have said that I found this bug on linux-next master, which has this commit:
.. which changes CONFIG_HAVE_KVM to CONFIG_KVM. I was not aware that this commit hadn't been merged upstream yet.
You can easily reproduce with with "defconfig" plus CONFIG_X86_FRED (on linux-next/master).
Max
Sean Christopherson
reviewer+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and tip/x86/fred. The above makes everything happy.
Quoted 27 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>--- arch/x86/entry/entry_fred.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool fred_setup_done__initdata ;Signature · 1 line
2.39.2
Xin Li
maintainerQuoted 30 lines · Sean Christopherson
+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and tip/x86/fred. The above makes everything happy.
Quoted 24 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>--- arch/x86/entry/entry_fred.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };
Quoted 4 lines
Quoted 3 lines
arch/x86/entry/entry_fred.c +0
-0static bool fred_setup_done__initdata ;Signature · 1 line
2.39.2
We want to minimize #ifdeffery (which is why we didn't add any to
sysvec_table[]), would it be better to simply remove "#if IS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the Linux-next tree?
BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).
arch/x86/include/asm/irq_vectors.h +0 -2
@@ -84,11 +84,9 @@#define HYPERVISOR_CALLBACK_VECTOR 0xf3/* Vector for KVM to deliver posted interrupt IPI */ -#if IS_ENABLED (CONFIG_KVM )#define POSTED_INTR_VECTOR 0xf2#define POSTED_INTR_WAKEUP_VECTOR 0xf1#define POSTED_INTR_NESTED_VECTOR 0xf0 -#endif #define MANAGED_IRQ_SHUTDOWN_VECTOR 0xef
Paolo Bonzini
maintainerQuoted 37 lines · Xin Li
Quoted 15 lines · Sean Christopherson
+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and tip/x86/fred. The above makes everything happy.
Quoted 9 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>---
arch/x86/entry/entry_fred.c| 2 ++1 file changed, 2 insertions(+)Quoted 16 lines
Quoted 16 lines
arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM ) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif }; static bool fred_setup_done __initdata;Signature · 1 line
2.39.2We want to minimize #ifdeffery (which is why we didn't add any to
sysvec_table[]), would it be better to simply remove "#ifIS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the Linux-next tree?
Quoted 1 line
BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM), because then it's also not necessary to have
# define fred_sysvec_kvm_posted_intr_ipi NULL # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL # define fred_sysvec_kvm_posted_intr_nested_ipi NULL
in arch/x86/include/asm/idtentry.h. The full conflict resultion is
arch/x86/entry/entry_fred.c +2 -0
@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool fred_setup_done__initdata ;
arch/x86/include/asm/idtentry.h +0 -4
@@ -745,10 +745,6 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_VECTOR , sysvec_kvm_posted_intr_ipi);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_WAKEUP_VECTOR , sysvec_kvm_posted_intr_wakeup_ipi);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_NESTED_VECTOR , sysvec_kvm_posted_intr_nested_ipi); -#else -# define fred_sysvec_kvm_posted_intr_ipi NULL -# define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL -# define fred_sysvec_kvm_posted_intr_nested_ipi NULL#endif #if IS_ENABLED (CONFIG_HYPERV )
and it seems to be a net improvement to me. The #ifs match in the .h and .c files, and there are no unnecessary initializers in the sysvec_table.
Paolo
Xin Li
maintainerQuoted 38 lines · Paolo Bonzini
Quoted 37 lines · Xin Li
Quoted 15 lines · Sean Christopherson
+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and tip/x86/fred. The above makes everything happy.
Quoted 9 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>---
arch/x86/entry/entry_fred.c| 2 ++1 file changed, 2 insertions(+)Quoted 16 lines
Quoted 16 lines
arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM ) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif }; static bool fred_setup_done __initdata;Signature · 1 line
2.39.2We want to minimize #ifdeffery (which is why we didn't add any to
sysvec_table[]), would it be better to simply remove "#ifIS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the Linux-next tree?
Quoted 4 lines
Quoted 1 line
BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM),
In arch/x86/include/asm/irq_vectors.h, most vector definitions are not under any #ifdeffery, e.g., THERMAL_APIC_VECTOR not under CONFIG_X86_THERMAL_VECTOR and IRQ_WORK_VECTOR not under CONFIG_IRQ_WORK.
We'd better make all of them consistent, and the question is that should we add #ifdefs or not.
Quoted 45 lines
because then it's also not necessary to have
# define fred_sysvec_kvm_posted_intr_ipi NULL # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL # define fred_sysvec_kvm_posted_intr_nested_ipi NULLin
arch/x86/include/asm/idtentry.h. The full conflict resultion isarch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS]__ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED(CONFIG_KVM) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool
fred_setup_done__initdata;arch/x86/include/asm/idtentry.h +0
-0@@ -745,10 +745,6 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR, sysvec_kvm_posted_intr_ipi); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup_ipi); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR,
sysvec_kvm_posted_intr_nested_ipi);arch/x86/include/asm/idtentry.h +0
-4-#else -# define fred_sysvec_kvm_posted_intr_ipi NULL -# define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL -# define fred_sysvec_kvm_posted_intr_nested_ipi NULL #endif #if IS_ENABLED(CONFIG_HYPERV)
Quoted 4 lines
and it seems to be a net improvement to me. The #ifs match in the .h and .c files, and there are no unnecessary initializers in the
sysvec_table.
I somehow get an impression that the x86 maintainers don't like #ifs in the .c files, but I could be just wrong.
Thanks!
Xin
Xin Li
maintainerQuoted 93 lines · Xin Li
Quoted 38 lines · Paolo Bonzini
Quoted 37 lines · Xin Li
Quoted 15 lines · Sean Christopherson
+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and tip/x86/fred. The above makes everything happy.
Quoted 9 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>---
arch/x86/entry/entry_fred.c| 2 ++1 file changed, 2 insertions(+)Quoted 16 lines
Quoted 16 lines
arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM ) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif }; static bool fred_setup_done __initdata;Signature · 1 line
2.39.2We want to minimize #ifdeffery (which is why we didn't add any to
sysvec_table[]), would it be better to simply remove "#ifIS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the Linux-next tree?Quoted 4 lines
Quoted 1 line
BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM),
In
arch/x86/include/asm/irq_vectors.h, most vector definitions are not under any #ifdeffery, e.g.,THERMAL_APIC_VECTORnot underCONFIG_X86_THERMAL_VECTORandIRQ_WORK_VECTORnot underCONFIG_IRQ_WORK.We'd better make all of them consistent, and the question is that should we add #ifdefs or not.
Quoted 42 lines
because then it's also not necessary to have
# define fred_sysvec_kvm_posted_intr_ipi NULL # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL # define fred_sysvec_kvm_posted_intr_nested_ipi NULLin
arch/x86/include/asm/idtentry.h. The full conflict resultion isarch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS]__ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED(CONFIG_KVM) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool
fred_setup_done__initdata;arch/x86/include/asm/idtentry.h +0
-4@@ -745,10 +745,6 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR, sysvec_kvm_posted_intr_ipi); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup_ipi); DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR, sysvec_kvm_posted_intr_nested_ipi); -#else -# define fred_sysvec_kvm_posted_intr_ipi NULL -# define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL -# define fred_sysvec_kvm_posted_intr_nested_ipi NULL #endif#if
IS_ENABLED(CONFIG_HYPERV)
Quoted 8 lines
Quoted 4 lines
and it seems to be a net improvement to me. The #ifs match in the .h and .c files, and there are no unnecessary initializers in the
sysvec_table.I somehow get an impression that the x86 maintainers don't like #ifs in the .c files, but I could be just wrong.
Here is an example, but again my interpretation could just be wrong:
#ifdef CONFIG_X86_FRED
void fred_install_sysvec(unsigned int vector, const idtentry_t function); #else
static inline void fred_install_sysvec(unsigned int vector, const idtentry_t function) { } #endif
#define sysvec_install(vector, function) { \
if (cpu_feature_enabled(X86_FEATURE_FRED)) \
fred_install_sysvec(vector, function); \
else \
idt_install_sysvec(vector, asm_##function); \}
Quoted 5 lines · Paolo Bonzini
On 2/16/24 03:10, Xin Li wrote:
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM), because then it's also not necessary to have
That's a matter of taste. In both cases _ALL_ KVM related things are compiled out.
#ifdeffing out the vector numbers is silly to begin with because these vector numbers stay assigned to KVM whether KVM is enabled or not.
And no, I don't think it's a net win to have the #ifdeffery in that table. Look at apic_idts[] in arch/x86/kernel/idt.c how this ends up looking. It's unreadable gunk.
The few NULL defines in a header file next to the real stuff
#if IS_ENABLED(CONFIG_KVM)
.....
#else
# define fred_sysvec_kvm_posted_intr_ipi NULL # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL # define fred_sysvec_kvm_posted_intr_nested_ipi NULL #endif
are not hurting at all and they are at a place where #ifdeffery is required anyway. That's a very common pattern all over the kernel and it limits the #ifdef horror to _ONE_ place.
With your change you propagate the #ifdefffery to the multiple and the very wrong places for absolutely zero practical value. The resulting binary code is exactly the same for the price of tasteless #ifdeffery in places where it matters.
Please get rid of this #ifdef in the vector header and don't inflict bad taste on everyone.
Thanks,
tglx
Borislav Petkov
maintainer+ Arnd for
https://lore.kernel.org/r/[email protected]
Quoted 79 lines · Paolo Bonzini
Quoted 39 lines · Xin Li
Quoted 16 lines · Sean Christopherson
+Paolo and Stephen
FYI, there's a build failure in -next due to a collision between kvm/next and
tip/x86/fred. The above makes everything happy.Quoted 9 lines · Max Kellermann
When KVM is disabled, the POSTED_INTR_* macros do not exist, and the build fails.
Fixes 14619d912b65 ("x86/fred: FRED entry/exit and dispatch code")Signed-off-by Max Kellermann <[email protected]>---
arch/x86/entry/entry_fred.c| 2 ++1 file changed, 2 insertions(+)Quoted 16 lines
Quoted 16 lines
arch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM ) SYSVEC(POSTED_INTR_VECTOR, kvm_posted_intr_ipi), SYSVEC(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif }; static bool fred_setup_done __initdata;Signature · 1 line
2.39.2We want to minimize #ifdeffery (which is why we didn't add any to sysvec_table[]), would it be better to simply remove "#if
IS_ENABLED(CONFIG_KVM)" around the the POSTED_INTR_* macros from the Linux-next tree?Quoted 1 line
BTW, kvm_posted_intr_*() are defined to NULL if !IS_ENABLED(CONFIG_KVM).
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM), because then it's also not necessary to have
# define fred_sysvec_kvm_posted_intr_ipi NULL # define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL # define fred_sysvec_kvm_posted_intr_nested_ipi NULLin
arch/x86/include/asm/idtentry.h. The full conflict resultion isarch/x86/entry/entry_fred.c +2
-0@@ -114,9 +114,11 @@ static idtentry_t sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = { SYSVEC(IRQ_WORK_VECTOR, irq_work), +#if IS_ENABLED (CONFIG_KVM )SYSVEC (POSTED_INTR_VECTOR , kvm_posted_intr_ipi),SYSVEC (POSTED_INTR_WAKEUP_VECTOR , kvm_posted_intr_wakeup_ipi), SYSVEC(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi), +#endif };static bool fred_setup_done__initdata ;arch/x86/include/asm/idtentry.h +0
-4@@ -745,10 +745,6 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_VECTOR , sysvec_kvm_posted_intr_ipi);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_WAKEUP_VECTOR , sysvec_kvm_posted_intr_wakeup_ipi);DECLARE_IDTENTRY_SYSVEC (POSTED_INTR_NESTED_VECTOR , sysvec_kvm_posted_intr_nested_ipi); -#else -# define fred_sysvec_kvm_posted_intr_ipi NULL -# define fred_sysvec_kvm_posted_intr_wakeup_ipi NULL -# define fred_sysvec_kvm_posted_intr_nested_ipi NULL#endif #if IS_ENABLED (CONFIG_HYPERV )
Quoted 3 lines
and it seems to be a net improvement to me. The #ifs match in the .h and .c files, and there are no unnecessary initializers in the
sysvec_table.
Ok, I'll pick up Max' patch tomorrow and we must remember to tell Linus during the merge window about this.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 7 lines · Borislav Petkov
Quoted 3 lines · Paolo Bonzini
and it seems to be a net improvement to me. The #ifs match in the .h and .c files, and there are no unnecessary initializers in the
sysvec_table.Ok, I'll pick up Max' patch tomorrow and we must remember to tell Linus during the merge window about this.
No. Don't.
This pointless #ifdeffery in the vector header needs to vanish from the KVM tree.
Why would you take the #ifdef mess into tasteful code just because someone decided that #ifdeffing out constants in a header which is maintained by other people is a brilliant idea?
The #ifdeffery in the idtentry header is unavoidable and the extra NULL defines are at the right place and not making the actual code unreadable.
Thanks,
tglx
Quoted 2 lines · Thomas Gleixner
#ifdeffing out the vector numbers is silly to begin with because these vector numbers stay assigned to KVM whether KVM is enabled or not.
There could be one non-silly use of this: if the macros are not defined in absence of the feature, any use of it will lead to a compiler error, which is good, because it may reveal certain kinds of bugs.
(Though I agree that this isn't worth the code ugliness. I prefer to avoid the preprocessor whenever possible. I hate how much the kernel uses macros instead of inline functions.)
Quoted 8 lines · Max Kellermann
Quoted 2 lines · Thomas Gleixner
#ifdeffing out the vector numbers is silly to begin with because these vector numbers stay assigned to KVM whether KVM is enabled or not.
There could be one non-silly use of this: if the macros are not defined in absence of the feature, any use of it will lead to a compiler error, which is good, because it may reveal certain kinds of bugs.
I generally agree with this sentiment, but for constants like those in the case at hand I really draw the line.
Quoted 3 lines
(Though I agree that this isn't worth the code ugliness. I prefer to avoid the preprocessor whenever possible. I hate how much the kernel uses macros instead of inline functions.)
No argument about that. I'm urging people to use inlines instead of macros where ever possible, but there are things which can only solved by macros.
I'm well aware that I wrote some of the more ugly ones myself. Though the end justifies the means. If the ugly macro from hell which you verify once safes you from the horrors of copy & pasta error hell then they are making the code better and there are plenty of options to make them reasonably (type) safe if done right.
Thanks,
tglx
Paolo Bonzini
maintainerQuoted 8 lines · Thomas Gleixner
Quoted 5 lines · Paolo Bonzini
On 2/16/24 03:10, Xin Li wrote:
It is intentional that KVM-related things are compiled out completely if !IS_ENABLED(CONFIG_KVM), because then it's also not necessary to have
Quoted 5 lines
That's a matter of taste. In both cases _ALL_ KVM related things are compiled out.
#ifdeffing out the vector numbers is silly to begin with because these vector numbers stay assigned to KVM whether KVM is enabled or not.
No problem---it seems that I misunderstood or read too much into the usage of CONFIG_HAVE_KVM up to 6.8, so I'm happy to follow whatever FRED support did for thermal vector and the like, and remove the #ifdef for the vector numbers.
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 2 lines · Thomas Gleixner
#ifdeffing out the vector numbers is silly to begin with because these vector numbers stay assigned to KVM whether KVM is enabled or not.
No problem---it seems that I misunderstood or read too much into the usage of
CONFIG_HAVE_KVMup to 6.8, so I'm happy to follow whatever FRED support did for thermal vector and the like, and remove the #ifdef for the vector numbers.
Thank you! Appreciated!
tglx