perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period()
Subsystems (3)
PATCH 1/1 perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period()
We intended to clear the lowest 6 bits but because of a type bug we clear the high 32 bits as well. Andi says that periods are rarely more than U32_MAX so this bug probably doesn't have a huge runtime impact.
arch/x86/events/intel/core.c +1 -1
@@ -3210,7 +3210,7 @@ static u64 bdw_limit_period(struct perf_event *event, u64 left) X86_CONFIG(.event=0xc0, .umask=0x01)) {if (left <128 ) left =128 ; - left &= ~0x3fu ; + left &= ~0x3fULL ; }return left; }
Peter Zijlstra
maintainerQuoted 3 lines · Dan Carpenter
We intended to clear the lowest 6 bits but because of a type bug we clear the high 32 bits as well. Andi says that periods are rarely more than
U32_MAXso this bug probably doesn't have a huge runtime impact.
Thanks Dan!
tip-bot for Dan Carpenter
merge botperf/x86/intel: Don't accidentally clear high bits in bdw_limit_period()
Commit-ID: e5ea9b54a055619160bbfe527ebb7d7191823d66 Gitweb: https://git.kernel.org/tip/e5ea9b54a055619160bbfe527ebb7d7191823d66 Author: Dan Carpenter <[email protected]> AuthorDate: Sat, 17 Mar 2018 14:52:16 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 20 Mar 2018 08:53:31 +0100
perf/x86/intel: Don't accidentally clear high bits in bdw_limit_period()
We intended to clear the lowest 6 bits but because of a type bug we clear the high 32 bits as well. Andi says that periods are rarely more than U32_MAX so this bug probably doesn't have a huge runtime impact.
--- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/core.c +1 -1
@@ -3194,7 +3194,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left) X86_CONFIG(.event=0xc0, .umask=0x01)) {if (left <128 ) left =128 ; - left &= ~0x3fu ; + left &= ~0x3fULL ; }return left; }