Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1967936d authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf options: Check v type in OPT_U?INTEGER



To avoid problems like the one fixed by Stephane Eranian in 3de29cab, now
we'll got this instead:

	bench/sched-messaging.c:259: error: negative width in bit-field ‘<anonymous>’
	bench/sched-messaging.c:261: error: negative width in bit-field ‘<anonymous>’

Which is rather cryptic, but is how BUILD_BUG_ON_ZERO works, so kernel
hackers should be already used to this.

With it in place found some problems, fixed by changing the affected
variables to sensible types or changed some OPT_INTEGER to OPT_UINTEGER.

Next csets will go thru converting each of the remaining OPT_ so that
review can be made easier by grouping changes per type per patch.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c100edbe
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -256,10 +256,8 @@ static const struct option options[] = {
		    "Use pipe() instead of socketpair()"),
	OPT_BOOLEAN('t', "thread", &thread_mode,
		    "Be multi thread instead of multi process"),
	OPT_INTEGER('g', "group", &num_groups,
		    "Specify number of groups"),
	OPT_INTEGER('l', "loop", &loops,
		    "Specify number of loops"),
	OPT_UINTEGER('g', "group", &num_groups, "Specify number of groups"),
	OPT_UINTEGER('l', "loop", &loops, "Specify number of loops"),
	OPT_END()
};

+3 −5
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ static int output;
static int			pipe_output			=      0;
static const char		*output_name			= "perf.data";
static int			group				=      0;
static unsigned int		realtime_prio			=      0;
static int			realtime_prio			=      0;
static bool			raw_samples			=  false;
static bool			system_wide			=  false;
static int			profile_cpu			=     -1;
@@ -822,10 +822,8 @@ static const struct option options[] = {
		    "output file name"),
	OPT_BOOLEAN('i', "no-inherit", &no_inherit,
		    "child tasks do not inherit counters"),
	OPT_INTEGER('F', "freq", &user_freq,
		    "profile at this frequency"),
	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
		    "number of mmap data pages"),
	OPT_UINTEGER('F', "freq", &user_freq, "profile at this frequency"),
	OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"),
	OPT_BOOLEAN('g', "call-graph", &call_graph,
		    "do call-graph (stack chain/backtrace) recording"),
	OPT_INCR('v', "verbose", &verbose,
+3 −3
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ static u64 sum_runtime;
static u64			sum_fluct;
static u64			run_avg;

static unsigned long		replay_repeat = 10;
static unsigned int		replay_repeat = 10;
static unsigned long		nr_timestamps;
static unsigned long		nr_unordered_timestamps;
static unsigned long		nr_state_machine_bugs;
@@ -1816,7 +1816,7 @@ static const char * const replay_usage[] = {
};

static const struct option replay_options[] = {
	OPT_INTEGER('r', "repeat", &replay_repeat,
	OPT_UINTEGER('r', "repeat", &replay_repeat,
		     "repeat the workload replay N times (-1: infinite)"),
	OPT_INCR('v', "verbose", &verbose,
		    "be more verbose (show symbol address, etc)"),
+2 −3
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ static int thread_num = 0;
static bool			inherit				=  false;
static int			profile_cpu			=     -1;
static int			nr_cpus				=      0;
static unsigned int		realtime_prio			=      0;
static int			realtime_prio			=      0;
static bool			group				=  false;
static unsigned int		page_size;
static unsigned int		mmap_pages			=     16;
@@ -1357,8 +1357,7 @@ static const struct option options[] = {
		   "file", "vmlinux pathname"),
	OPT_BOOLEAN('K', "hide_kernel_symbols", &hide_kernel_symbols,
		    "hide kernel symbols"),
	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
		    "number of mmap data pages"),
	OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"),
	OPT_INTEGER('r', "realtime", &realtime_prio,
		    "collect data with this RT SCHED_FIFO priority"),
	OPT_INTEGER('d', "delay", &delay_secs,
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
	(type *)((char *)__mptr - offsetof(type, member)); })
#endif

#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))

#ifndef max
#define max(x, y) ({				\
	typeof(x) _max1 = (x);			\
Loading