Skip to contentSkip to conversation

x86/oprof: fix !HVM && !PV32 build

PATCH In review Jan Beulich 3 participants 9 messages Apr 16, 2021 – Apr 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/oprof: fix !HVM && !PV32 build

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")
xen/arch/x86/oprofile/backtrace.c +2 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))
@@ -50,6 +51,7 @@ static inline int is_32bit_vcpu(struct v
     else
         return is_pv_32bit_vcpu(vcpu);
 }
+#endif
 
 static struct frame_head *
 dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
#1 lore raw
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 11 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

~Andrew

Quoted 5 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -50,6 +51,7 @@ static inline int is_32bit_vcpu(struct v
     else
         return is_pv_32bit_vcpu(vcpu);
 }
+#endif
#2 lore raw
Quoted 26 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 11 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Jan

#3 lore raw
Quoted 27 lines · Jan Beulich
Quoted 26 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 11 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 6 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

Thanks, Roger.

#4 lore raw
Quoted 30 lines · Roger Pau Monné
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 10 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 5 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Quoted 6 lines

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

I disagree.  Fixing this less effort than the time wasted arguing about fixing it.

But if you are going to insist on not fixing it, and putting in a patch like this, then at a minimum, it needs to include a TODO comment stating that the use of CONFIG_COMPAT is bogus and needs fixing.

~Andrew

#5 lore raw
Quoted 38 lines · Andrew Cooper
Quoted 30 lines · Roger Pau Monné
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 10 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 5 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Quoted 6 lines

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

Quoted 6 lines

I disagree.  Fixing this less effort than the time wasted arguing about fixing it.

But if you are going to insist on not fixing it, and putting in a patch like this, then at a minimum, it needs to include a TODO comment stating that the use of CONFIG_COMPAT is bogus and needs fixing.

I disagree: It is (for now) just you saying this is bogus. The (ab)use of the handle infrastructure was there before. You could have sent a fix long ago, therefore, if you were thinking this needs fixing. I can see that you have good intentions, but orthogonal issues shouldn't be used to block necessary adjustments (and this applies to other pending build fixes as well).

Jan

#6 lore raw
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Andrew Cooper
Quoted 30 lines · Roger Pau Monné
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 10 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 5 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Quoted 6 lines

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

I disagree.  Fixing this less effort than the time wasted arguing about fixing it.

Quoted 6 lines
Quoted 3 lines

But if you are going to insist on not fixing it, and putting in a patch like this, then at a minimum, it needs to include a TODO comment stating that the use of CONFIG_COMPAT is bogus and needs fixing.

I disagree: It is (for now) just you saying this is bogus. The (ab)use of the handle infrastructure was there before. You could have sent a fix long ago, therefore, if you were thinking this needs fixing.

I only know it needed fixing because you didn't build test your change in CI.  Don't make it out to be my fault I didn't spot this 6 months ago.

Quoted 4 lines

I can
see that you have good intentions, but orthogonal issues shouldn't be used to block necessary adjustments (and this applies to other pending build fixes as well).

You genuinely regressed things for 32bit HVM guests, with the CONFIG_COMPAT change.

The code may have been using inappropriate interfaces to perform its job before, but its actually broken now.

~Andrew

#7 lore raw
Quoted 57 lines · Andrew Cooper
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Andrew Cooper
Quoted 30 lines · Roger Pau Monné
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 10 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 5 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Quoted 6 lines

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

I disagree.  Fixing this less effort than the time wasted arguing about fixing it.

Quoted 6 lines
Quoted 3 lines

But if you are going to insist on not fixing it, and putting in a patch like this, then at a minimum, it needs to include a TODO comment stating that the use of CONFIG_COMPAT is bogus and needs fixing.

I disagree: It is (for now) just you saying this is bogus. The (ab)use of the handle infrastructure was there before. You could have sent a fix long ago, therefore, if you were thinking this needs fixing.

I only know it needed fixing because you didn't build test your change in CI.  Don't make it out to be my fault I didn't spot this 6 months ago.

Quoted 4 lines

I can
see that you have good intentions, but orthogonal issues shouldn't be used to block necessary adjustments (and this applies to other pending build fixes as well).

Quoted 5 lines

You genuinely regressed things for 32bit HVM guests, with the CONFIG_COMPAT change.

The code may have been using inappropriate interfaces to perform its job before, but its actually broken now.

In which way? COMPAT gets selected by both PV32 and HVM.

Jan

#8 lore raw
Quoted 56 lines · Jan Beulich
Quoted 55 lines · Andrew Cooper
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Andrew Cooper
Quoted 30 lines · Roger Pau Monné
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

clang, at the very least, doesn't like unused inline functions, unless their definitions live in a header.

Fixes d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")

I agree this will fix the build.  However, looking at the code, I'm not sure the original CONFIG_COMPAT was correct.  In particular, ...

xen/arch/x86/oprofile/backtrace.c dump_hypervisor_backtrace(struct vcpu *v · line 49

Quoted 10 lines
xen/arch/x86/oprofile/backtrace.c +1 -0
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *v
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))

... this chunk of logic demonstrates that what oprofile is doing isn't related to the Xen ABI in the slightest.

Quoted 5 lines
Quoted 2 lines

I think OProfile is misusing the guest handle infrastructure, and shouldn't be using it for this task.

I'm afraid I consider this something for another day. Both the original #ifdef and the one getting added here are merely measures to get things to build.

Quoted 6 lines

Without entering on the debate whether CONFIG_COMPAT is the correct conditional to use it's not making the issue any worse, and it will allow to unblock the build. We can discuss about the CONFIG_COMPAT stuff later.

I disagree.  Fixing this less effort than the time wasted arguing about fixing it.

Quoted 6 lines
Quoted 3 lines

But if you are going to insist on not fixing it, and putting in a patch like this, then at a minimum, it needs to include a TODO comment stating that the use of CONFIG_COMPAT is bogus and needs fixing.

I disagree: It is (for now) just you saying this is bogus. The (ab)use of the handle infrastructure was there before. You could have sent a fix long ago, therefore, if you were thinking this needs fixing.

I only know it needed fixing because you didn't build test your change in CI.  Don't make it out to be my fault I didn't spot this 6 months ago.

Quoted 4 lines

I can
see that you have good intentions, but orthogonal issues shouldn't be used to block necessary adjustments (and this applies to other pending build fixes as well).

Quoted 6 lines
Quoted 5 lines

You genuinely regressed things for 32bit HVM guests, with the CONFIG_COMPAT change.

The code may have been using inappropriate interfaces to perform its job before, but its actually broken now.

In which way? COMPAT gets selected by both PV32 and HVM.

Hmm ok - with the select in place, I accept that it is only a problem in principle.

~Andrew