Skip to content
Commit 73d9d850 authored by Bill Wendling's avatar Bill Wendling Committed by Paolo Bonzini
Browse files

x86/pmu: Disable inlining of measure()



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.

Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: default avatarBill Wendling <morbo@google.com>
Message-Id: <20220601163012.3404212-1-morbo@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 8b260385
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment