Skip to contentSkip to conversation

arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bitfie

PATCH In review [email protected] 2 participants 2 messages Jul 6, 2012 – Jul 9, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 86/90 arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bitfie

Hi Peter,

Should we make the bits "unsigned"?

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head:   6a67943a18c264d5f3df436da38edb3e59adc905
commit: 3e0091e2b6f8cd59e567f247e345a3a6ad1f6e7e [86/90] perf/x86: Save a few bytes in 'struct x86_pmu'

All sparse warnings:

+ arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:378:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:379:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:380:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:381:43: sparse: dubious one-bit signed bitfield

vim +377 arch/x86/kernel/cpu/perf_event.h
374 /*
375 * Intel DebugStore bits
376 */

Quoted 1 line

377 int bts :1,

378 bts_active :1,
379 pebs :1,
380 pebs_active :1,

---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <[email protected]> Intel Corporation

#1 lore raw

Re: [tip:perf/core 86/90] arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bi

Quoted 16 lines · On Sat, 2012-07-07 at 01:52 +0800, [email protected] wrote:

Hi Peter,

Should we make the bits "unsigned"?

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head:   6a67943a18c264d5f3df436da38edb3e59adc905
commit: 3e0091e2b6f8cd59e567f247e345a3a6ad1f6e7e [86/90] perf/x86: Save a few bytes in 'struct x86_pmu'

All sparse warnings:

+ arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:378:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:379:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:380:43: sparse: dubious one-bit signed bitfield arch/x86/kernel/cpu/perf_event.h:381:43: sparse: dubious one-bit signed bitfield

Quoted 8 lines

vim +377 arch/x86/kernel/cpu/perf_event.h
374 /*
375 * Intel DebugStore bits
376 */

Quoted 1 line

377 int bts :1,

378 bts_active :1,
379 pebs :1,
380 pebs_active :1,

Ha! yes I guess so. Thanks!

---
Subject: perf,x86: Make bitfield unsigned
From: Peter Zijlstra <[email protected]>
Date: Mon Jul 09 13:50:23 CEST 2012

arch/x86/kernel/cpu/perf_event.h:377:43: sparse: dubious one-bit signed bitfield

---
 arch/x86/kernel/cpu/perf_event.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event.h +1 -1
@@ -374,7 +374,7 @@ struct x86_pmu {
 	/*
 	 * Intel DebugStore bits
 	 */
-	int		bts		:1,
+	unsigned int	bts		:1,
 			bts_active	:1,
 			pebs		:1,
 			pebs_active	:1,