x86/pmu: Disable inlining of measure()
PATCH 1/1 x86/pmu: Disable inlining of measure()
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to measure(). This can mess with the counter overflow check. To set up the PMC overflow, check_counter_overflow() first records the number of instructions retired in an invocation of measure() and checks to see that subsequent calls to measure() retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.
FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3
Disabling inlining of measure() keeps the assumption that all calls to measure() retire the same number of instructions.
--- x86/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
x86/pmu.c +1 -1
@@ -211,7 +211,7 @@ static void stop_event(pmu_counter_t *evt) evt->count =rdmsr (evt->ctr); } -static void measure (pmu_counter_t *evt,int count) +static noinline void measure(pmu_counter_t *evt, int count) {int i;for (i =0 ; i < count; i++)
Signature · 1 line
2.36.1.255.ge46751e96f-goog
Quoted 28 lines · Bill Wendling
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to
measure(). This can mess with the counter overflow check. To set up the PMC overflow,check_counter_overflow()first records the number of instructions retired in an invocation ofmeasure()and checks to see that subsequent calls tomeasure()retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3
Quoted 5 lines
Disabling inlining of
measure()keeps the assumption that all calls tomeasure()retire the same number of instructions.Cc Jim Mattson <[email protected]>Signed-off-by Bill Wendling <[email protected]>
Quoted 30 lines · Jim Mattson
Quoted 28 lines · Bill Wendling
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to
measure(). This can mess with the counter overflow check. To set up the PMC overflow,check_counter_overflow()first records the number of instructions retired in an invocation ofmeasure()and checks to see that subsequent calls tomeasure()retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3
Quoted 6 lines
Quoted 5 lines
Disabling inlining of
measure()keeps the assumption that all calls tomeasure()retire the same number of instructions.Cc Jim Mattson <[email protected]>Signed-off-by Bill Wendling <[email protected]>Reviewed-by Jim Mattson <[email protected]>
Bumping for visibility.
-bw
Sean Christopherson
reviewerQuoted 31 lines · Bill Wendling
Quoted 30 lines · Jim Mattson
Quoted 28 lines · Bill Wendling
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to
measure(). This can mess with the counter overflow check. To set up the PMC overflow,check_counter_overflow()first records the number of instructions retired in an invocation ofmeasure()and checks to see that subsequent calls tomeasure()retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Disabling inlining of
measure()keeps the assumption that all calls tomeasure()retire the same number of instructions.Cc Jim Mattson <[email protected]>Signed-off-by Bill Wendling <[email protected]>Reviewed-by Jim Mattson <[email protected]>Bumping for visibility.
Heh, make sure kvm-unit-tests is in the subject, i.e. [kvm-unit-tests PATCH]. This slipped by on my end because I didn't realize at a quick glance that it was touching KVM-unit-tests and not kernel code.
PATCH 1/1 x86/pmu: Disable inlining of measure()
Quoted 38 lines · Sean Christopherson
Quoted 36 lines · Bill Wendling
Quoted 35 lines · Jim Mattson
Quoted 33 lines · Bill Wendling
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to
measure(). This can mess with the counter overflow check. To set up the PMC overflow,check_counter_overflow()first records the number of instructions retired in an invocation ofmeasure()and checks to see that subsequent calls tomeasure()retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3Disabling inlining of
measure()keeps the assumption that all calls tomeasure()retire the same number of instructions.Cc Jim Mattson <[email protected]>Signed-off-by Bill Wendling <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Jim Mattson <[email protected]>Bumping for visibility.
Heh, make sure kvm-unit-tests is in the subject, i.e. [kvm-unit-tests PATCH]. This slipped by on my end because I didn't realize at a quick glance that it was touching KVM-unit-tests and not kernel code.
Doh! I'm not sure why I forgot that. Added. Thanks. :)
-bw
Sean Christopherson
reviewerQuoted 8 lines · Bill Wendling
Quoted 7 lines · Sean Christopherson
Quoted 5 lines · Bill Wendling
Quoted 4 lines · Jim Mattson
Quoted 2 lines · Bill Wendling
From: Bill Wendling <[email protected]>
This "From:" should not exist. It causes your @gmail.com account be to credited as the author, whereas your SOB suggests you intended this to be credited to your @google.com address.
Let me know if this should indeed list [email protected] as the author, I can fix it up when applying.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Bill Wendling <[email protected]>Reviewed-by Jim Mattson <[email protected]>
Quoted 9 lines · Sean Christopherson
Quoted 7 lines · Bill Wendling
Quoted 6 lines · Sean Christopherson
Quoted 4 lines · Bill Wendling
Quoted 3 lines · Jim Mattson
Quoted 1 line · Bill Wendling
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
From: Bill Wendling <[email protected]>
This "From:" should not exist. It causes your @gmail.com account be to credited as the author, whereas your SOB suggests you intended this to be credited to your @google.com address.
Let me know if this should indeed list [email protected] as the author, I can fix it up when applying.
Please use [email protected]. Sorry about this mixup.
-bw
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Bill Wendling <[email protected]>Reviewed-by Jim Mattson <[email protected]>
Quoted 41 lines · Bill Wendling
From: Bill Wendling <[email protected]>
Clang can be more aggressive at inlining than GCC and will fully inline calls to
measure(). This can mess with the counter overflow check. To set up the PMC overflow,check_counter_overflow()first records the number of instructions retired in an invocation ofmeasure()and checks to see that subsequent calls tomeasure()retire the same number of instructions. If inlining occurs, those numbers can be different and the overflow test fails.FAIL: overflow: cntr-0
PASS: overflow: status-0
PASS: overflow: status clear-0
PASS: overflow: irq-0
FAIL: overflow: cntr-1
PASS: overflow: status-1
PASS: overflow: status clear-1
PASS: overflow: irq-1
FAIL: overflow: cntr-2
PASS: overflow: status-2
PASS: overflow: status clear-2
PASS: overflow: irq-2
FAIL: overflow: cntr-3
PASS: overflow: status-3
PASS: overflow: status clear-3
PASS: overflow: irq-3Disabling inlining of
measure()keeps the assumption that all calls tomeasure()retire the same number of instructions.Cc Jim Mattson <[email protected]>Signed-off-by Bill Wendling <[email protected]>--- x86/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)x86/pmu.c +0
-0
x86/pmu.c static void stop_event(pmu_counter_t *evt) · line 217
Quoted 8 lines
x86/pmu.c +1
-1@@ -211,7 +211,7 @@ static void stop_event(pmu_counter_t *evt) evt->count =rdmsr (evt->ctr); } -static void measure (pmu_counter_t *evt,int count) +static noinline void measure(pmu_counter_t *evt, int count) {int i;for (i =0 ; i < count; i++)
Queued, thanks.
Paolo