]> Git Repo - linux.git/commitdiff
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <[email protected]>
Sun, 14 Apr 2013 18:10:44 +0000 (11:10 -0700)
committerLinus Torvalds <[email protected]>
Sun, 14 Apr 2013 18:10:44 +0000 (11:10 -0700)
Pull perf fixes from Ingo Molnar:
 "Misc fixlets"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf: Fix error return code
  ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()
  perf: Fix strncpy() use, use strlcpy() instead of strncpy()
  perf: Fix strncpy() use, always make sure it's NUL terminated
  perf: Fix ring_buffer perf_output_space() boundary calculation
  perf/x86: Fix uninitialized pt_regs in intel_pmu_drain_bts_buffer()

1  2 
arch/x86/kernel/cpu/perf_event_intel_ds.c
kernel/trace/ftrace.c
kernel/trace/trace.c

index b05a575d56f42f4543504b999a3b4875de110772,f71c9f09fd4befbc63a4e5b4370148c17d57c897..26830f3af0df70eebb438ddc82f74240b49d618e
@@@ -314,10 -314,11 +314,11 @@@ int intel_pmu_drain_bts_buffer(void
        if (top <= at)
                return 0;
  
+       memset(&regs, 0, sizeof(regs));
        ds->bts_index = ds->bts_buffer_base;
  
        perf_sample_data_init(&data, 0, event->hw.last_period);
-       regs.ip     = 0;
  
        /*
         * Prepare a generic sample, i.e. fill in the invariant fields.
@@@ -729,13 -730,3 +730,13 @@@ void intel_ds_init(void
                }
        }
  }
 +
 +void perf_restore_debug_store(void)
 +{
 +      struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds);
 +
 +      if (!x86_pmu.bts && !x86_pmu.pebs)
 +              return;
 +
 +      wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds);
 +}
diff --combined kernel/trace/ftrace.c
index 2461ede45a8d92f562f170d6625aaed7c9012258,db143742704b4c36b60f7c296d7f79dc1d1ed057..b3fde6d7b7fc47683244a5a432ab35a543551499
@@@ -66,7 -66,7 +66,7 @@@
  
  static struct ftrace_ops ftrace_list_end __read_mostly = {
        .func           = ftrace_stub,
 -      .flags          = FTRACE_OPS_FL_RECURSION_SAFE,
 +      .flags          = FTRACE_OPS_FL_RECURSION_SAFE | FTRACE_OPS_FL_STUB,
  };
  
  /* ftrace_enabled is a method to turn ftrace on or off */
@@@ -694,6 -694,7 +694,6 @@@ int ftrace_profile_pages_init(struct ft
                free_page(tmp);
        }
  
 -      free_page((unsigned long)stat->pages);
        stat->pages = NULL;
        stat->start = NULL;
  
@@@ -1052,19 -1053,6 +1052,19 @@@ static __init void ftrace_profile_debug
  
  static struct pid * const ftrace_swapper_pid = &init_struct_pid;
  
 +loff_t
 +ftrace_filter_lseek(struct file *file, loff_t offset, int whence)
 +{
 +      loff_t ret;
 +
 +      if (file->f_mode & FMODE_READ)
 +              ret = seq_lseek(file, offset, whence);
 +      else
 +              file->f_pos = ret = 1;
 +
 +      return ret;
 +}
 +
  #ifdef CONFIG_DYNAMIC_FTRACE
  
  #ifndef CONFIG_FTRACE_MCOUNT_RECORD
@@@ -2625,7 -2613,7 +2625,7 @@@ static void ftrace_filter_reset(struct 
   * routine, you can use ftrace_filter_write() for the write
   * routine if @flag has FTRACE_ITER_FILTER set, or
   * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set.
 - * ftrace_regex_lseek() should be used as the lseek routine, and
 + * ftrace_filter_lseek() should be used as the lseek routine, and
   * release must call ftrace_regex_release().
   */
  int
@@@ -2709,6 -2697,19 +2709,6 @@@ ftrace_notrace_open(struct inode *inode
                                 inode, file);
  }
  
 -loff_t
 -ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
 -{
 -      loff_t ret;
 -
 -      if (file->f_mode & FMODE_READ)
 -              ret = seq_lseek(file, offset, whence);
 -      else
 -              file->f_pos = ret = 1;
 -
 -      return ret;
 -}
 -
  static int ftrace_match(char *str, char *regex, int len, int type)
  {
        int matched = 0;
@@@ -3440,14 -3441,14 +3440,14 @@@ static char ftrace_filter_buf[FTRACE_FI
  
  static int __init set_ftrace_notrace(char *str)
  {
-       strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
+       strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
        return 1;
  }
  __setup("ftrace_notrace=", set_ftrace_notrace);
  
  static int __init set_ftrace_filter(char *str)
  {
-       strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
+       strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
        return 1;
  }
  __setup("ftrace_filter=", set_ftrace_filter);
@@@ -3570,7 -3571,7 +3570,7 @@@ static const struct file_operations ftr
        .open = ftrace_filter_open,
        .read = seq_read,
        .write = ftrace_filter_write,
 -      .llseek = ftrace_regex_lseek,
 +      .llseek = ftrace_filter_lseek,
        .release = ftrace_regex_release,
  };
  
@@@ -3578,7 -3579,7 +3578,7 @@@ static const struct file_operations ftr
        .open = ftrace_notrace_open,
        .read = seq_read,
        .write = ftrace_notrace_write,
 -      .llseek = ftrace_regex_lseek,
 +      .llseek = ftrace_filter_lseek,
        .release = ftrace_regex_release,
  };
  
@@@ -3783,8 -3784,8 +3783,8 @@@ static const struct file_operations ftr
        .open           = ftrace_graph_open,
        .read           = seq_read,
        .write          = ftrace_graph_write,
 +      .llseek         = ftrace_filter_lseek,
        .release        = ftrace_graph_release,
 -      .llseek         = seq_lseek,
  };
  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
  
@@@ -4130,8 -4131,7 +4130,8 @@@ ftrace_ops_control_func(unsigned long i
        preempt_disable_notrace();
        trace_recursion_set(TRACE_CONTROL_BIT);
        do_for_each_ftrace_op(op, ftrace_control_list) {
 -              if (!ftrace_function_local_disabled(op) &&
 +              if (!(op->flags & FTRACE_OPS_FL_STUB) &&
 +                  !ftrace_function_local_disabled(op) &&
                    ftrace_ops_test(op, ip))
                        op->func(ip, parent_ip, op, regs);
        } while_for_each_ftrace_op(op);
@@@ -4439,7 -4439,7 +4439,7 @@@ static const struct file_operations ftr
        .open           = ftrace_pid_open,
        .write          = ftrace_pid_write,
        .read           = seq_read,
 -      .llseek         = seq_lseek,
 +      .llseek         = ftrace_filter_lseek,
        .release        = ftrace_pid_release,
  };
  
@@@ -4555,8 -4555,12 +4555,8 @@@ ftrace_enable_sysctl(struct ctl_table *
                ftrace_startup_sysctl();
  
                /* we are starting ftrace again */
 -              if (ftrace_ops_list != &ftrace_list_end) {
 -                      if (ftrace_ops_list->next == &ftrace_list_end)
 -                              ftrace_trace_function = ftrace_ops_list->func;
 -                      else
 -                              ftrace_trace_function = ftrace_ops_list_func;
 -              }
 +              if (ftrace_ops_list != &ftrace_list_end)
 +                      update_ftrace_function();
  
        } else {
                /* stopping ftrace calls (just send to ftrace_stub) */
diff --combined kernel/trace/trace.c
index 7ba7fc76f9ebc655980b734391613184cbe22da3,3f5046a4d81b23cdcb463e09a1c89dc5971ccf2d..66338c4f7f4bdb6142c2b21a99f14292c708d050
@@@ -132,7 -132,7 +132,7 @@@ static char *default_bootup_tracer
  
  static int __init set_cmdline_ftrace(char *str)
  {
-       strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
+       strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
        default_bootup_tracer = bootup_tracer_buf;
        /* We are using ftrace early, expand it */
        ring_buffer_expanded = 1;
@@@ -162,7 -162,7 +162,7 @@@ static char *trace_boot_options __initd
  
  static int __init set_trace_boot_options(char *str)
  {
-       strncpy(trace_boot_options_buf, str, MAX_TRACER_SIZE);
+       strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE);
        trace_boot_options = trace_boot_options_buf;
        return 0;
  }
@@@ -744,11 -744,8 +744,11 @@@ update_max_tr_single(struct trace_arra
                return;
  
        WARN_ON_ONCE(!irqs_disabled());
 -      if (WARN_ON_ONCE(!current_trace->allocated_snapshot))
 +      if (!current_trace->allocated_snapshot) {
 +              /* Only the nop tracer should hit this when disabling */
 +              WARN_ON_ONCE(current_trace != &nop_trace);
                return;
 +      }
  
        arch_spin_lock(&ftrace_max_lock);
  
This page took 0.072482 seconds and 4 git commands to generate.