Commit 89fec742 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 0f4022a4 89529d8b
...@@ -2198,9 +2198,6 @@ struct saved_cmdlines_buffer { ...@@ -2198,9 +2198,6 @@ struct saved_cmdlines_buffer {
}; };
static struct saved_cmdlines_buffer *savedcmd; static struct saved_cmdlines_buffer *savedcmd;
/* temporary disable recording */
static atomic_t trace_record_taskinfo_disabled __read_mostly;
static inline char *get_saved_cmdlines(int idx) static inline char *get_saved_cmdlines(int idx)
{ {
return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN]; return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
...@@ -2486,8 +2483,6 @@ static bool tracing_record_taskinfo_skip(int flags) ...@@ -2486,8 +2483,6 @@ static bool tracing_record_taskinfo_skip(int flags)
{ {
if (unlikely(!(flags & (TRACE_RECORD_CMDLINE | TRACE_RECORD_TGID)))) if (unlikely(!(flags & (TRACE_RECORD_CMDLINE | TRACE_RECORD_TGID))))
return true; return true;
if (atomic_read(&trace_record_taskinfo_disabled) || !tracing_is_on())
return true;
if (!__this_cpu_read(trace_taskinfo_save)) if (!__this_cpu_read(trace_taskinfo_save))
return true; return true;
return false; return false;
...@@ -3998,9 +3993,6 @@ static void *s_start(struct seq_file *m, loff_t *pos) ...@@ -3998,9 +3993,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
#endif #endif
if (!iter->snapshot)
atomic_inc(&trace_record_taskinfo_disabled);
if (*pos != iter->pos) { if (*pos != iter->pos) {
iter->ent = NULL; iter->ent = NULL;
iter->cpu = 0; iter->cpu = 0;
...@@ -4043,9 +4035,6 @@ static void s_stop(struct seq_file *m, void *p) ...@@ -4043,9 +4035,6 @@ static void s_stop(struct seq_file *m, void *p)
return; return;
#endif #endif
if (!iter->snapshot)
atomic_dec(&trace_record_taskinfo_disabled);
trace_access_unlock(iter->cpu_file); trace_access_unlock(iter->cpu_file);
trace_event_read_unlock(); trace_event_read_unlock();
} }
......
...@@ -115,9 +115,9 @@ u64 notrace trace_clock_global(void) ...@@ -115,9 +115,9 @@ u64 notrace trace_clock_global(void)
prev_time = READ_ONCE(trace_clock_struct.prev_time); prev_time = READ_ONCE(trace_clock_struct.prev_time);
now = sched_clock_cpu(this_cpu); now = sched_clock_cpu(this_cpu);
/* Make sure that now is always greater than prev_time */ /* Make sure that now is always greater than or equal to prev_time */
if ((s64)(now - prev_time) < 0) if ((s64)(now - prev_time) < 0)
now = prev_time + 1; now = prev_time;
/* /*
* If in an NMI context then dont risk lockups and simply return * If in an NMI context then dont risk lockups and simply return
...@@ -131,7 +131,7 @@ u64 notrace trace_clock_global(void) ...@@ -131,7 +131,7 @@ u64 notrace trace_clock_global(void)
/* Reread prev_time in case it was already updated */ /* Reread prev_time in case it was already updated */
prev_time = READ_ONCE(trace_clock_struct.prev_time); prev_time = READ_ONCE(trace_clock_struct.prev_time);
if ((s64)(now - prev_time) < 0) if ((s64)(now - prev_time) < 0)
now = prev_time + 1; now = prev_time;
trace_clock_struct.prev_time = now; trace_clock_struct.prev_time = now;
......
...@@ -192,15 +192,20 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab, ...@@ -192,15 +192,20 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab,
Elf32_Word const *symtab_shndx) Elf32_Word const *symtab_shndx)
{ {
unsigned long offset; unsigned long offset;
unsigned short shndx = w2(sym->st_shndx);
int index; int index;
if (sym->st_shndx != SHN_XINDEX) if (shndx > SHN_UNDEF && shndx < SHN_LORESERVE)
return w2(sym->st_shndx); return shndx;
if (shndx == SHN_XINDEX) {
offset = (unsigned long)sym - (unsigned long)symtab; offset = (unsigned long)sym - (unsigned long)symtab;
index = offset / sizeof(*sym); index = offset / sizeof(*sym);
return w(symtab_shndx[index]); return w(symtab_shndx[index]);
}
return 0;
} }
static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment