Commit e66c33d579ea566d10e8c8695a7168aae3e02992
Committed by
Steven Rostedt
1 parent
102c9323c3
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
rcu: Add const annotation to char * for RCU tracepoints and functions
All the RCU tracepoints and functions that reference char pointers do so with just 'char *' even though they do not modify the contents of the string itself. This will cause warnings if a const char * is used in one of these functions. The RCU tracepoints store the pointer to the string to refer back to them when the trace output is displayed. As this can be minutes, hours or even days later, those strings had better be constant. This change also opens the door to allow the RCU tracepoint strings and their addresses to be exported so that userspace tracing tools can translate the contents of the pointers of the RCU tracepoints. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Showing 9 changed files with 54 additions and 54 deletions Side-by-side Diff
include/linux/rcupdate.h
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) |
53 | 53 | extern void rcutorture_record_test_transition(void); |
54 | 54 | extern void rcutorture_record_progress(unsigned long vernum); |
55 | -extern void do_trace_rcu_torture_read(char *rcutorturename, | |
55 | +extern void do_trace_rcu_torture_read(const char *rcutorturename, | |
56 | 56 | struct rcu_head *rhp, |
57 | 57 | unsigned long secs, |
58 | 58 | unsigned long c_old, |
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | { |
66 | 66 | } |
67 | 67 | #ifdef CONFIG_RCU_TRACE |
68 | -extern void do_trace_rcu_torture_read(char *rcutorturename, | |
68 | +extern void do_trace_rcu_torture_read(const char *rcutorturename, | |
69 | 69 | struct rcu_head *rhp, |
70 | 70 | unsigned long secs, |
71 | 71 | unsigned long c_old, |
include/trace/events/rcu.h
... | ... | @@ -19,12 +19,12 @@ |
19 | 19 | */ |
20 | 20 | TRACE_EVENT(rcu_utilization, |
21 | 21 | |
22 | - TP_PROTO(char *s), | |
22 | + TP_PROTO(const char *s), | |
23 | 23 | |
24 | 24 | TP_ARGS(s), |
25 | 25 | |
26 | 26 | TP_STRUCT__entry( |
27 | - __field(char *, s) | |
27 | + __field(const char *, s) | |
28 | 28 | ), |
29 | 29 | |
30 | 30 | TP_fast_assign( |
31 | 31 | |
32 | 32 | |
... | ... | @@ -51,14 +51,14 @@ |
51 | 51 | */ |
52 | 52 | TRACE_EVENT(rcu_grace_period, |
53 | 53 | |
54 | - TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent), | |
54 | + TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent), | |
55 | 55 | |
56 | 56 | TP_ARGS(rcuname, gpnum, gpevent), |
57 | 57 | |
58 | 58 | TP_STRUCT__entry( |
59 | - __field(char *, rcuname) | |
59 | + __field(const char *, rcuname) | |
60 | 60 | __field(unsigned long, gpnum) |
61 | - __field(char *, gpevent) | |
61 | + __field(const char *, gpevent) | |
62 | 62 | ), |
63 | 63 | |
64 | 64 | TP_fast_assign( |
65 | 65 | |
66 | 66 | |
67 | 67 | |
... | ... | @@ -89,21 +89,21 @@ |
89 | 89 | */ |
90 | 90 | TRACE_EVENT(rcu_future_grace_period, |
91 | 91 | |
92 | - TP_PROTO(char *rcuname, unsigned long gpnum, unsigned long completed, | |
92 | + TP_PROTO(const char *rcuname, unsigned long gpnum, unsigned long completed, | |
93 | 93 | unsigned long c, u8 level, int grplo, int grphi, |
94 | - char *gpevent), | |
94 | + const char *gpevent), | |
95 | 95 | |
96 | 96 | TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent), |
97 | 97 | |
98 | 98 | TP_STRUCT__entry( |
99 | - __field(char *, rcuname) | |
99 | + __field(const char *, rcuname) | |
100 | 100 | __field(unsigned long, gpnum) |
101 | 101 | __field(unsigned long, completed) |
102 | 102 | __field(unsigned long, c) |
103 | 103 | __field(u8, level) |
104 | 104 | __field(int, grplo) |
105 | 105 | __field(int, grphi) |
106 | - __field(char *, gpevent) | |
106 | + __field(const char *, gpevent) | |
107 | 107 | ), |
108 | 108 | |
109 | 109 | TP_fast_assign( |
110 | 110 | |
... | ... | @@ -132,13 +132,13 @@ |
132 | 132 | */ |
133 | 133 | TRACE_EVENT(rcu_grace_period_init, |
134 | 134 | |
135 | - TP_PROTO(char *rcuname, unsigned long gpnum, u8 level, | |
135 | + TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level, | |
136 | 136 | int grplo, int grphi, unsigned long qsmask), |
137 | 137 | |
138 | 138 | TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask), |
139 | 139 | |
140 | 140 | TP_STRUCT__entry( |
141 | - __field(char *, rcuname) | |
141 | + __field(const char *, rcuname) | |
142 | 142 | __field(unsigned long, gpnum) |
143 | 143 | __field(u8, level) |
144 | 144 | __field(int, grplo) |
145 | 145 | |
... | ... | @@ -168,12 +168,12 @@ |
168 | 168 | */ |
169 | 169 | TRACE_EVENT(rcu_preempt_task, |
170 | 170 | |
171 | - TP_PROTO(char *rcuname, int pid, unsigned long gpnum), | |
171 | + TP_PROTO(const char *rcuname, int pid, unsigned long gpnum), | |
172 | 172 | |
173 | 173 | TP_ARGS(rcuname, pid, gpnum), |
174 | 174 | |
175 | 175 | TP_STRUCT__entry( |
176 | - __field(char *, rcuname) | |
176 | + __field(const char *, rcuname) | |
177 | 177 | __field(unsigned long, gpnum) |
178 | 178 | __field(int, pid) |
179 | 179 | ), |
180 | 180 | |
... | ... | @@ -195,12 +195,12 @@ |
195 | 195 | */ |
196 | 196 | TRACE_EVENT(rcu_unlock_preempted_task, |
197 | 197 | |
198 | - TP_PROTO(char *rcuname, unsigned long gpnum, int pid), | |
198 | + TP_PROTO(const char *rcuname, unsigned long gpnum, int pid), | |
199 | 199 | |
200 | 200 | TP_ARGS(rcuname, gpnum, pid), |
201 | 201 | |
202 | 202 | TP_STRUCT__entry( |
203 | - __field(char *, rcuname) | |
203 | + __field(const char *, rcuname) | |
204 | 204 | __field(unsigned long, gpnum) |
205 | 205 | __field(int, pid) |
206 | 206 | ), |
207 | 207 | |
... | ... | @@ -224,14 +224,14 @@ |
224 | 224 | */ |
225 | 225 | TRACE_EVENT(rcu_quiescent_state_report, |
226 | 226 | |
227 | - TP_PROTO(char *rcuname, unsigned long gpnum, | |
227 | + TP_PROTO(const char *rcuname, unsigned long gpnum, | |
228 | 228 | unsigned long mask, unsigned long qsmask, |
229 | 229 | u8 level, int grplo, int grphi, int gp_tasks), |
230 | 230 | |
231 | 231 | TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks), |
232 | 232 | |
233 | 233 | TP_STRUCT__entry( |
234 | - __field(char *, rcuname) | |
234 | + __field(const char *, rcuname) | |
235 | 235 | __field(unsigned long, gpnum) |
236 | 236 | __field(unsigned long, mask) |
237 | 237 | __field(unsigned long, qsmask) |
238 | 238 | |
239 | 239 | |
... | ... | @@ -268,15 +268,15 @@ |
268 | 268 | */ |
269 | 269 | TRACE_EVENT(rcu_fqs, |
270 | 270 | |
271 | - TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent), | |
271 | + TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent), | |
272 | 272 | |
273 | 273 | TP_ARGS(rcuname, gpnum, cpu, qsevent), |
274 | 274 | |
275 | 275 | TP_STRUCT__entry( |
276 | - __field(char *, rcuname) | |
276 | + __field(const char *, rcuname) | |
277 | 277 | __field(unsigned long, gpnum) |
278 | 278 | __field(int, cpu) |
279 | - __field(char *, qsevent) | |
279 | + __field(const char *, qsevent) | |
280 | 280 | ), |
281 | 281 | |
282 | 282 | TP_fast_assign( |
283 | 283 | |
... | ... | @@ -308,12 +308,12 @@ |
308 | 308 | */ |
309 | 309 | TRACE_EVENT(rcu_dyntick, |
310 | 310 | |
311 | - TP_PROTO(char *polarity, long long oldnesting, long long newnesting), | |
311 | + TP_PROTO(const char *polarity, long long oldnesting, long long newnesting), | |
312 | 312 | |
313 | 313 | TP_ARGS(polarity, oldnesting, newnesting), |
314 | 314 | |
315 | 315 | TP_STRUCT__entry( |
316 | - __field(char *, polarity) | |
316 | + __field(const char *, polarity) | |
317 | 317 | __field(long long, oldnesting) |
318 | 318 | __field(long long, newnesting) |
319 | 319 | ), |
320 | 320 | |
... | ... | @@ -352,12 +352,12 @@ |
352 | 352 | */ |
353 | 353 | TRACE_EVENT(rcu_prep_idle, |
354 | 354 | |
355 | - TP_PROTO(char *reason), | |
355 | + TP_PROTO(const char *reason), | |
356 | 356 | |
357 | 357 | TP_ARGS(reason), |
358 | 358 | |
359 | 359 | TP_STRUCT__entry( |
360 | - __field(char *, reason) | |
360 | + __field(const char *, reason) | |
361 | 361 | ), |
362 | 362 | |
363 | 363 | TP_fast_assign( |
364 | 364 | |
... | ... | @@ -376,13 +376,13 @@ |
376 | 376 | */ |
377 | 377 | TRACE_EVENT(rcu_callback, |
378 | 378 | |
379 | - TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy, | |
379 | + TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy, | |
380 | 380 | long qlen), |
381 | 381 | |
382 | 382 | TP_ARGS(rcuname, rhp, qlen_lazy, qlen), |
383 | 383 | |
384 | 384 | TP_STRUCT__entry( |
385 | - __field(char *, rcuname) | |
385 | + __field(const char *, rcuname) | |
386 | 386 | __field(void *, rhp) |
387 | 387 | __field(void *, func) |
388 | 388 | __field(long, qlen_lazy) |
389 | 389 | |
... | ... | @@ -412,13 +412,13 @@ |
412 | 412 | */ |
413 | 413 | TRACE_EVENT(rcu_kfree_callback, |
414 | 414 | |
415 | - TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset, | |
415 | + TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset, | |
416 | 416 | long qlen_lazy, long qlen), |
417 | 417 | |
418 | 418 | TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen), |
419 | 419 | |
420 | 420 | TP_STRUCT__entry( |
421 | - __field(char *, rcuname) | |
421 | + __field(const char *, rcuname) | |
422 | 422 | __field(void *, rhp) |
423 | 423 | __field(unsigned long, offset) |
424 | 424 | __field(long, qlen_lazy) |
425 | 425 | |
... | ... | @@ -447,12 +447,12 @@ |
447 | 447 | */ |
448 | 448 | TRACE_EVENT(rcu_batch_start, |
449 | 449 | |
450 | - TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit), | |
450 | + TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit), | |
451 | 451 | |
452 | 452 | TP_ARGS(rcuname, qlen_lazy, qlen, blimit), |
453 | 453 | |
454 | 454 | TP_STRUCT__entry( |
455 | - __field(char *, rcuname) | |
455 | + __field(const char *, rcuname) | |
456 | 456 | __field(long, qlen_lazy) |
457 | 457 | __field(long, qlen) |
458 | 458 | __field(long, blimit) |
459 | 459 | |
... | ... | @@ -477,12 +477,12 @@ |
477 | 477 | */ |
478 | 478 | TRACE_EVENT(rcu_invoke_callback, |
479 | 479 | |
480 | - TP_PROTO(char *rcuname, struct rcu_head *rhp), | |
480 | + TP_PROTO(const char *rcuname, struct rcu_head *rhp), | |
481 | 481 | |
482 | 482 | TP_ARGS(rcuname, rhp), |
483 | 483 | |
484 | 484 | TP_STRUCT__entry( |
485 | - __field(char *, rcuname) | |
485 | + __field(const char *, rcuname) | |
486 | 486 | __field(void *, rhp) |
487 | 487 | __field(void *, func) |
488 | 488 | ), |
489 | 489 | |
... | ... | @@ -506,12 +506,12 @@ |
506 | 506 | */ |
507 | 507 | TRACE_EVENT(rcu_invoke_kfree_callback, |
508 | 508 | |
509 | - TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset), | |
509 | + TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset), | |
510 | 510 | |
511 | 511 | TP_ARGS(rcuname, rhp, offset), |
512 | 512 | |
513 | 513 | TP_STRUCT__entry( |
514 | - __field(char *, rcuname) | |
514 | + __field(const char *, rcuname) | |
515 | 515 | __field(void *, rhp) |
516 | 516 | __field(unsigned long, offset) |
517 | 517 | ), |
518 | 518 | |
... | ... | @@ -539,13 +539,13 @@ |
539 | 539 | */ |
540 | 540 | TRACE_EVENT(rcu_batch_end, |
541 | 541 | |
542 | - TP_PROTO(char *rcuname, int callbacks_invoked, | |
542 | + TP_PROTO(const char *rcuname, int callbacks_invoked, | |
543 | 543 | bool cb, bool nr, bool iit, bool risk), |
544 | 544 | |
545 | 545 | TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), |
546 | 546 | |
547 | 547 | TP_STRUCT__entry( |
548 | - __field(char *, rcuname) | |
548 | + __field(const char *, rcuname) | |
549 | 549 | __field(int, callbacks_invoked) |
550 | 550 | __field(bool, cb) |
551 | 551 | __field(bool, nr) |
552 | 552 | |
... | ... | @@ -577,13 +577,13 @@ |
577 | 577 | */ |
578 | 578 | TRACE_EVENT(rcu_torture_read, |
579 | 579 | |
580 | - TP_PROTO(char *rcutorturename, struct rcu_head *rhp, | |
580 | + TP_PROTO(const char *rcutorturename, struct rcu_head *rhp, | |
581 | 581 | unsigned long secs, unsigned long c_old, unsigned long c), |
582 | 582 | |
583 | 583 | TP_ARGS(rcutorturename, rhp, secs, c_old, c), |
584 | 584 | |
585 | 585 | TP_STRUCT__entry( |
586 | - __field(char *, rcutorturename) | |
586 | + __field(const char *, rcutorturename) | |
587 | 587 | __field(struct rcu_head *, rhp) |
588 | 588 | __field(unsigned long, secs) |
589 | 589 | __field(unsigned long, c_old) |
590 | 590 | |
... | ... | @@ -623,13 +623,13 @@ |
623 | 623 | */ |
624 | 624 | TRACE_EVENT(rcu_barrier, |
625 | 625 | |
626 | - TP_PROTO(char *rcuname, char *s, int cpu, int cnt, unsigned long done), | |
626 | + TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done), | |
627 | 627 | |
628 | 628 | TP_ARGS(rcuname, s, cpu, cnt, done), |
629 | 629 | |
630 | 630 | TP_STRUCT__entry( |
631 | - __field(char *, rcuname) | |
632 | - __field(char *, s) | |
631 | + __field(const char *, rcuname) | |
632 | + __field(const char *, s) | |
633 | 633 | __field(int, cpu) |
634 | 634 | __field(int, cnt) |
635 | 635 | __field(unsigned long, done) |
kernel/rcu.h
kernel/rcupdate.c
... | ... | @@ -377,7 +377,7 @@ |
377 | 377 | #endif /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ |
378 | 378 | |
379 | 379 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) || defined(CONFIG_RCU_TRACE) |
380 | -void do_trace_rcu_torture_read(char *rcutorturename, struct rcu_head *rhp, | |
380 | +void do_trace_rcu_torture_read(const char *rcutorturename, struct rcu_head *rhp, | |
381 | 381 | unsigned long secs, |
382 | 382 | unsigned long c_old, unsigned long c) |
383 | 383 | { |
kernel/rcutiny.c
kernel/rcutiny_plugin.h
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | RCU_TRACE(unsigned long gp_start); /* Start time for stalls. */ |
37 | 37 | RCU_TRACE(unsigned long ticks_this_gp); /* Statistic for stalls. */ |
38 | 38 | RCU_TRACE(unsigned long jiffies_stall); /* Jiffies at next stall. */ |
39 | - RCU_TRACE(char *name); /* Name of RCU type. */ | |
39 | + RCU_TRACE(const char *name); /* Name of RCU type. */ | |
40 | 40 | }; |
41 | 41 | |
42 | 42 | /* Definition for rcupdate control block. */ |
kernel/rcutorture.c
... | ... | @@ -267,7 +267,7 @@ |
267 | 267 | * Absorb kthreads into a kernel function that won't return, so that |
268 | 268 | * they won't ever access module text or data again. |
269 | 269 | */ |
270 | -static void rcutorture_shutdown_absorb(char *title) | |
270 | +static void rcutorture_shutdown_absorb(const char *title) | |
271 | 271 | { |
272 | 272 | if (ACCESS_ONCE(fullstop) == FULLSTOP_SHUTDOWN) { |
273 | 273 | pr_notice( |
... | ... | @@ -337,7 +337,7 @@ |
337 | 337 | } |
338 | 338 | |
339 | 339 | static void |
340 | -rcu_stutter_wait(char *title) | |
340 | +rcu_stutter_wait(const char *title) | |
341 | 341 | { |
342 | 342 | while (stutter_pause_test || !rcutorture_runnable) { |
343 | 343 | if (rcutorture_runnable) |
... | ... | @@ -366,7 +366,7 @@ |
366 | 366 | int (*stats)(char *page); |
367 | 367 | int irq_capable; |
368 | 368 | int can_boost; |
369 | - char *name; | |
369 | + const char *name; | |
370 | 370 | }; |
371 | 371 | |
372 | 372 | static struct rcu_torture_ops *cur_ops; |
... | ... | @@ -1364,7 +1364,7 @@ |
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | static inline void |
1367 | -rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, char *tag) | |
1367 | +rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) | |
1368 | 1368 | { |
1369 | 1369 | pr_alert("%s" TORTURE_FLAG |
1370 | 1370 | "--- %s: nreaders=%d nfakewriters=%d " |
kernel/rcutree.c
... | ... | @@ -1032,7 +1032,7 @@ |
1032 | 1032 | * rcu_nocb_wait_gp(). |
1033 | 1033 | */ |
1034 | 1034 | static void trace_rcu_future_gp(struct rcu_node *rnp, struct rcu_data *rdp, |
1035 | - unsigned long c, char *s) | |
1035 | + unsigned long c, const char *s) | |
1036 | 1036 | { |
1037 | 1037 | trace_rcu_future_grace_period(rdp->rsp->name, rnp->gpnum, |
1038 | 1038 | rnp->completed, c, rnp->level, |
... | ... | @@ -2720,7 +2720,7 @@ |
2720 | 2720 | * Helper function for _rcu_barrier() tracing. If tracing is disabled, |
2721 | 2721 | * the compiler is expected to optimize this away. |
2722 | 2722 | */ |
2723 | -static void _rcu_barrier_trace(struct rcu_state *rsp, char *s, | |
2723 | +static void _rcu_barrier_trace(struct rcu_state *rsp, const char *s, | |
2724 | 2724 | int cpu, unsigned long done) |
2725 | 2725 | { |
2726 | 2726 | trace_rcu_barrier(rsp->name, s, cpu, |
kernel/rcutree.h
... | ... | @@ -445,7 +445,7 @@ |
445 | 445 | /* for CPU stalls. */ |
446 | 446 | unsigned long gp_max; /* Maximum GP duration in */ |
447 | 447 | /* jiffies. */ |
448 | - char *name; /* Name of structure. */ | |
448 | + const char *name; /* Name of structure. */ | |
449 | 449 | char abbr; /* Abbreviated name. */ |
450 | 450 | struct list_head flavors; /* List of RCU flavors. */ |
451 | 451 | struct irq_work wakeup_work; /* Postponed wakeups */ |