Skip to content

Commit 7e90b5c

Browse files
committed
Merge tag 'trace-tools-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing tooling fixes from Steven Rostedt: "RTLA: - rtla tools are exiting with a positive value when usage() is called. Make them return 0 if the usage was called via -h/--help - the -P priority sets the sched priority for rtla workload. When the SCHED_OTHER scheduler is selected, it sets the rt_priority instead of the nice parameter. Setting the nice value is the correct thing, so fix it - rtla is failing to compile with clang due to unsupported options from gcc. Adjusting the compiler/linker options makes clang work properly - Remove the sched_getattr() unused function on utils.c - Fixes for variable initialization and size, reported by clang Verification: - rv is failing to compile with clang due to unsupported options from gcc. Adjusting the compiler/linker options makes clang work properly - Fix an uninitialized variable on in_kernel.c reported by clang" * tag 'trace-tools-v6.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tools/rtla: Exit with EXIT_SUCCESS when help is invoked tools/rtla: Replace setting prio with nice for SCHED_OTHER tools/rv: Fix curr_reactor uninitialized variable tools/rv: Fix Makefile compiler options for clang tools/rtla: Remove unused sched_getattr() function tools/rtla: Fix clang warning about mount_point var size tools/rtla: Fix uninitialized bucket/data->bucket_size warning tools/rtla: Fix Makefile compiler options for clang
2 parents c664e16 + b5f3193 commit 7e90b5c

9 files changed

Lines changed: 41 additions & 21 deletions

File tree

tools/tracing/rtla/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
2828
-fasynchronous-unwind-tables -fstack-clash-protection
2929
WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
3030

31+
ifeq ($(CC),clang)
32+
FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS))
33+
WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS))
34+
endif
35+
3136
TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs)
3237

3338
CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS)
34-
LDFLAGS := -ggdb $(EXTRA_LDFLAGS)
39+
LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS)
3540
LIBS := $$($(PKG_CONFIG) --libs libtracefs)
3641

3742
SRC := $(wildcard src/*.c)

tools/tracing/rtla/src/osnoise_hist.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ static void osnoise_hist_update_multiple(struct osnoise_tool *tool, int cpu,
135135
if (params->output_divisor)
136136
duration = duration / params->output_divisor;
137137

138-
if (data->bucket_size)
139-
bucket = duration / data->bucket_size;
138+
bucket = duration / data->bucket_size;
140139

141140
total_duration = duration * count;
142141

@@ -480,7 +479,11 @@ static void osnoise_hist_usage(char *usage)
480479

481480
for (i = 0; msg[i]; i++)
482481
fprintf(stderr, "%s\n", msg[i]);
483-
exit(1);
482+
483+
if (usage)
484+
exit(EXIT_FAILURE);
485+
486+
exit(EXIT_SUCCESS);
484487
}
485488

486489
/*

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,11 @@ static void osnoise_top_usage(struct osnoise_top_params *params, char *usage)
331331

332332
for (i = 0; msg[i]; i++)
333333
fprintf(stderr, "%s\n", msg[i]);
334-
exit(1);
334+
335+
if (usage)
336+
exit(EXIT_FAILURE);
337+
338+
exit(EXIT_SUCCESS);
335339
}
336340

337341
/*

tools/tracing/rtla/src/timerlat_hist.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ timerlat_hist_update(struct osnoise_tool *tool, int cpu,
178178
if (params->output_divisor)
179179
latency = latency / params->output_divisor;
180180

181-
if (data->bucket_size)
182-
bucket = latency / data->bucket_size;
181+
bucket = latency / data->bucket_size;
183182

184183
if (!context) {
185184
hist = data->hist[cpu].irq;
@@ -546,7 +545,11 @@ static void timerlat_hist_usage(char *usage)
546545

547546
for (i = 0; msg[i]; i++)
548547
fprintf(stderr, "%s\n", msg[i]);
549-
exit(1);
548+
549+
if (usage)
550+
exit(EXIT_FAILURE);
551+
552+
exit(EXIT_SUCCESS);
550553
}
551554

552555
/*

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ static void timerlat_top_usage(char *usage)
375375

376376
for (i = 0; msg[i]; i++)
377377
fprintf(stderr, "%s\n", msg[i]);
378-
exit(1);
378+
379+
if (usage)
380+
exit(EXIT_FAILURE);
381+
382+
exit(EXIT_SUCCESS);
379383
}
380384

381385
/*

tools/tracing/rtla/src/utils.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,6 @@ static inline int sched_setattr(pid_t pid, const struct sched_attr *attr,
238238
return syscall(__NR_sched_setattr, pid, attr, flags);
239239
}
240240

241-
static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
242-
unsigned int size, unsigned int flags)
243-
{
244-
return syscall(__NR_sched_getattr, pid, attr, size, flags);
245-
}
246-
247241
int __set_sched_attr(int pid, struct sched_attr *attr)
248242
{
249243
int flags = 0;
@@ -479,13 +473,13 @@ int parse_prio(char *arg, struct sched_attr *sched_param)
479473
if (prio == INVALID_VAL)
480474
return -1;
481475

482-
if (prio < sched_get_priority_min(SCHED_OTHER))
476+
if (prio < MIN_NICE)
483477
return -1;
484-
if (prio > sched_get_priority_max(SCHED_OTHER))
478+
if (prio > MAX_NICE)
485479
return -1;
486480

487481
sched_param->sched_policy = SCHED_OTHER;
488-
sched_param->sched_priority = prio;
482+
sched_param->sched_nice = prio;
489483
break;
490484
default:
491485
return -1;
@@ -536,7 +530,7 @@ int set_cpu_dma_latency(int32_t latency)
536530
*/
537531
static const int find_mount(const char *fs, char *mp, int sizeof_mp)
538532
{
539-
char mount_point[MAX_PATH];
533+
char mount_point[MAX_PATH+1];
540534
char type[100];
541535
int found = 0;
542536
FILE *fp;

tools/tracing/rtla/src/utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010
#define BUFF_U64_STR_SIZE 24
1111
#define MAX_PATH 1024
12+
#define MAX_NICE 20
13+
#define MIN_NICE -19
1214

1315
#define container_of(ptr, type, member)({ \
1416
const typeof(((type *)0)->member) *__mptr = (ptr); \

tools/verification/rv/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
2828
-fasynchronous-unwind-tables -fstack-clash-protection
2929
WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
3030

31+
ifeq ($(CC),clang)
32+
FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS))
33+
WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS))
34+
endif
35+
3136
TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs)
3237

3338
CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -I include
34-
LDFLAGS := -ggdb $(EXTRA_LDFLAGS)
39+
LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS)
3540
LIBS := $$($(PKG_CONFIG) --libs libtracefs)
3641

3742
SRC := $(wildcard src/*.c)

tools/verification/rv/src/in_kernel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ static char *ikm_read_reactor(char *monitor_name)
210210
static char *ikm_get_current_reactor(char *monitor_name)
211211
{
212212
char *reactors = ikm_read_reactor(monitor_name);
213+
char *curr_reactor = NULL;
213214
char *start;
214215
char *end;
215-
char *curr_reactor;
216216

217217
if (!reactors)
218218
return NULL;

0 commit comments

Comments
 (0)