Skip to content

Commit 89fec74

Browse files
committed
Merge tag 'trace-v5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: - Have recordmcount check for valid st_shndx otherwise some archs may have invalid references for the mcount location. - Two fixes done for mapping pids to task names. Traces were not showing the names of tasks when they should have. - Fix to trace_clock_global() to prevent it from going backwards * tag 'trace-v5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Do no increment trace_clock_global() by one tracing: Do not stop recording comms if the trace file is being read tracing: Do not stop recording cmdlines when tracing is off recordmcount: Correct st_shndx handling
2 parents 0f4022a + 89529d8 commit 89fec74

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

kernel/trace/trace.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,9 +2198,6 @@ struct saved_cmdlines_buffer {
21982198
};
21992199
static struct saved_cmdlines_buffer *savedcmd;
22002200

2201-
/* temporary disable recording */
2202-
static atomic_t trace_record_taskinfo_disabled __read_mostly;
2203-
22042201
static inline char *get_saved_cmdlines(int idx)
22052202
{
22062203
return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
@@ -2486,8 +2483,6 @@ static bool tracing_record_taskinfo_skip(int flags)
24862483
{
24872484
if (unlikely(!(flags & (TRACE_RECORD_CMDLINE | TRACE_RECORD_TGID))))
24882485
return true;
2489-
if (atomic_read(&trace_record_taskinfo_disabled) || !tracing_is_on())
2490-
return true;
24912486
if (!__this_cpu_read(trace_taskinfo_save))
24922487
return true;
24932488
return false;
@@ -3998,9 +3993,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
39983993
return ERR_PTR(-EBUSY);
39993994
#endif
40003995

4001-
if (!iter->snapshot)
4002-
atomic_inc(&trace_record_taskinfo_disabled);
4003-
40043996
if (*pos != iter->pos) {
40053997
iter->ent = NULL;
40063998
iter->cpu = 0;
@@ -4043,9 +4035,6 @@ static void s_stop(struct seq_file *m, void *p)
40434035
return;
40444036
#endif
40454037

4046-
if (!iter->snapshot)
4047-
atomic_dec(&trace_record_taskinfo_disabled);
4048-
40494038
trace_access_unlock(iter->cpu_file);
40504039
trace_event_read_unlock();
40514040
}

kernel/trace/trace_clock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ u64 notrace trace_clock_global(void)
115115
prev_time = READ_ONCE(trace_clock_struct.prev_time);
116116
now = sched_clock_cpu(this_cpu);
117117

118-
/* Make sure that now is always greater than prev_time */
118+
/* Make sure that now is always greater than or equal to prev_time */
119119
if ((s64)(now - prev_time) < 0)
120-
now = prev_time + 1;
120+
now = prev_time;
121121

122122
/*
123123
* If in an NMI context then dont risk lockups and simply return
@@ -131,7 +131,7 @@ u64 notrace trace_clock_global(void)
131131
/* Reread prev_time in case it was already updated */
132132
prev_time = READ_ONCE(trace_clock_struct.prev_time);
133133
if ((s64)(now - prev_time) < 0)
134-
now = prev_time + 1;
134+
now = prev_time;
135135

136136
trace_clock_struct.prev_time = now;
137137

scripts/recordmcount.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,20 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab,
192192
Elf32_Word const *symtab_shndx)
193193
{
194194
unsigned long offset;
195+
unsigned short shndx = w2(sym->st_shndx);
195196
int index;
196197

197-
if (sym->st_shndx != SHN_XINDEX)
198-
return w2(sym->st_shndx);
198+
if (shndx > SHN_UNDEF && shndx < SHN_LORESERVE)
199+
return shndx;
199200

200-
offset = (unsigned long)sym - (unsigned long)symtab;
201-
index = offset / sizeof(*sym);
201+
if (shndx == SHN_XINDEX) {
202+
offset = (unsigned long)sym - (unsigned long)symtab;
203+
index = offset / sizeof(*sym);
202204

203-
return w(symtab_shndx[index]);
205+
return w(symtab_shndx[index]);
206+
}
207+
208+
return 0;
204209
}
205210

206211
static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0)

0 commit comments

Comments
 (0)