1. 13 Nov, 2010 1 commit
    • Steven Rostedt's avatar
      tracing: Fix recursive user stack trace · 91e86e56
      Steven Rostedt authored
      The user stack trace can fault when examining the trace. Which
      would call the do_page_fault handler, which would trace again,
      which would do the user stack trace, which would fault and call
      do_page_fault again ...
      
      Thus this is causing a recursive bug. We need to have a recursion
      detector here.
      
      [ Resubmitted by Jiri Olsa ]
      
      [ Eric Dumazet recommended using __this_cpu_* instead of __get_cpu_* ]
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <1289390172-9730-3-git-send-email-jolsa@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      91e86e56
  2. 11 Nov, 2010 2 commits
    • Steven Rostedt's avatar
      tracing: Force arch_local_irq_* notrace for paravirt · b5908548
      Steven Rostedt authored
      When running ktest.pl randconfig tests, I would sometimes trigger
      a lockdep annotation bug (possible reason: unannotated irqs-on).
      
      This triggering happened right after function tracer self test was
      executed. After doing a config bisect I found that this was caused with
      having function tracer, paravirt guest, prove locking, and rcu torture
      all enabled.
      
      The rcu torture just enhanced the likelyhood of triggering the bug.
      Prove locking was needed, since it was the thing that was bugging.
      Function tracer would trace and disable interrupts in all sorts
      of funny places.
      paravirt guest would turn arch_local_irq_* into functions that would
      be traced.
      
      Besides the fact that tracing arch_local_irq_* is just a bad idea,
      this is what is happening.
      
      The bug happened simply in the local_irq_restore() code:
      
      		if (raw_irqs_disabled_flags(flags)) {	\
      			raw_local_irq_restore(flags);	\
      			trace_hardirqs_off();		\
      		} else {				\
      			trace_hardirqs_on();		\
      			raw_local_irq_restore(flags);	\
      		}					\
      
      The raw_local_irq_restore() was defined as arch_local_irq_restore().
      
      Now imagine, we are about to enable interrupts. We go into the else
      case and call trace_hardirqs_on() which tells lockdep that we are enabling
      interrupts, so it sets the current->hardirqs_enabled = 1.
      
      Then we call raw_local_irq_restore() which calls arch_local_irq_restore()
      which gets traced!
      
      Now in the function tracer we disable interrupts with local_irq_save().
      This is fine, but flags is stored that we have interrupts disabled.
      
      When the function tracer calls local_irq_restore() it does it, but this
      time with flags set as disabled, so we go into the if () path.
      This keeps interrupts disabled and calls trace_hardirqs_off() which
      sets current->hardirqs_enabled = 0.
      
      When the tracer is finished and proceeds with the original code,
      we enable interrupts but leave current->hardirqs_enabled as 0. Which
      now breaks lockdeps internal processing.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b5908548
    • Steven Rostedt's avatar
      tracing: Fix module use of trace_bprintk() · 13b9b6e7
      Steven Rostedt authored
      On use of trace_printk() there's a macro that determines if the format
      is static or a variable. If it is static, it defaults to __trace_bprintk()
      otherwise it uses __trace_printk().
      
      A while ago, Lai Jiangshan added __trace_bprintk(). In that patch, we
      discussed a way to allow modules to use it. The difference between
      __trace_bprintk() and __trace_printk() is that for faster processing,
      just the format and args are stored in the trace instead of running
      it through a sprintf function. In order to do this, the format used
      by the __trace_bprintk() had to be persistent.
      
      See commit 1ba28e02
      
      The problem comes with trace_bprintk() where the module is unloaded.
      The pointer left in the buffer is still pointing to the format.
      
      To solve this issue, the formats in the module were copied into kernel
      core. If the same format was used, they would use the same copy (to prevent
      memory leak). This all worked well until we tried to merge everything.
      
      At the time this was written, Lai Jiangshan, Frederic Weisbecker,
      Ingo Molnar and myself were all touching the same code. When this was
      merged, we lost the part of it that was in module.c. This kept out the
      copying of the formats and unloading the module could cause bad pointers
      left in the ring buffer.
      
      This patch adds back (with updates required for current kernel) the
      module code that sets up the necessary pointers.
      
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      13b9b6e7
  3. 10 Nov, 2010 11 commits
    • Peter Zijlstra's avatar
      perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation · 034c6efa
      Peter Zijlstra authored
      Jasper suggested we use the zeroing capability of the allocators
      instead of calling memset ourselves. Add node affinity while we're at
      it.
      Reported-by: default avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      034c6efa
    • Stephane Eranian's avatar
      perf_events: Fix time tracking in samples · eed01528
      Stephane Eranian authored
      This patch corrects time tracking in samples. Without this patch
      both time_enabled and time_running are bogus when user asks for
      PERF_SAMPLE_READ.
      
      One uses PERF_SAMPLE_READ to sample the values of other counters
      in each sample. Because of multiplexing, it is necessary to know
      both time_enabled, time_running to be able to scale counts correctly.
      
      In this second version of the patch, we maintain a shadow
      copy of ctx->time which allows us to compute ctx->time without
      calling update_context_time() from NMI context. We avoid the
      issue that update_context_time() must always be called with
      ctx->lock held.
      
      We do not keep shadow copies of the other event timings
      because if the lead event is overflowing then it is active
      and thus it's been scheduled in via event_sched_in() in
      which case neither tstamp_stopped, tstamp_running can be modified.
      
      This timing logic only applies to samples when PERF_SAMPLE_READ
      is used.
      
      Note that this patch does not address timing issues related
      to sampling inheritance between tasks. This will be addressed
      in a future patch.
      
      With this patch, the libpfm4 example task_smpl now reports
      correct counts (shown on 2.4GHz Core 2):
      
      $ task_smpl -p 2400000000 -e unhalted_core_cycles:u,instructions_retired:u,baclears  noploop 5
      noploop for 5 seconds
      IIP:0x000000004006d6 PID:5596 TID:5596 TIME:466,210,211,430 STREAM_ID:33 PERIOD:2,400,000,000 ENA=1,010,157,814 RUN=1,010,157,814 NR=3
      	2,400,000,254 unhalted_core_cycles:u (33)
      	2,399,273,744 instructions_retired:u (34)
      	53,340 baclears (35)
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4cc6e14b.1e07e30a.256e.5190@mx.google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      eed01528
    • Tom Zanussi's avatar
      perf trace: update usage · 7e55055e
      Tom Zanussi authored
      Update usage to reflect the different perf trace variants.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      7e55055e
    • Tom Zanussi's avatar
      perf trace: update Documentation with new perf trace variants · d3c4f798
      Tom Zanussi authored
      Add documentation describing new 'perf trace' command changes
      e.g. <command> handling and live-mode/top variants.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      d3c4f798
    • Tom Zanussi's avatar
      perf trace: live-mode command-line cleanup · b5b87312
      Tom Zanussi authored
      This patch attempts to make the perf trace command-line for live-mode
      commands more user-friendly and consistent with other perf commands.
      
      The main change it makes is to allow <commands> to be run as part of
      perf trace live-mode commands, as other perf commands do, instead of
      the system-wide traces they're currently hard-coded to by the shell
      scripts.
      
      With this patch, the following live-mode trace now works as expected:
      
       $ perf trace rw-by-pid ls -al
      
      The previous system-wide behavior for this command would still be
      available by explicitly specifying -a:
      
       $ perf trace rw-by-pid -a ls -al
      
      and if no <command> is specified, the output is also system-wide:
      
       $ perf trace rw-by-pid
      
      Because live-mode requires both record and report steps to be invoked,
      it isn't always possible to know which args to send to the report and
      which to send to the record steps - mainly this is the case for report
      scripts with optional args - in those cases it would be necessary to
      use separate 'perf trace record' and 'perf trace report' steps.
      
      For example:
      
       $ perf trace syscall-counts ls
      
      Here we can't decide whether ls should be passed as a param to the
      syscall-counts script or whether we should invoke ls as a <command>.
      In these cases, we just say that we'll ignore optional script params
      and always interpret the extra arguments as a <command>.
      
      If the user instead wants the other interpretation, that can be
      accomplished by using separate record and report commands explicitly:
      
       $ perf trace record syscall-counts
       $ perf trace report syscall-counts ls
      
      So the rules that this patch implements, which seem to make the most
      intuitive sense for live-mode commands:
      
      - for commands with optional args and commands with no args, no args
        are sent to the report script, all are sent to the record step
      
      - for 'top' commands i.e. that end with 'top', <commands> can't be
        used - all extra args are send to the report script as params
      
      - for commands with required args, the n required args are taken to be
        the first n args after the script name and sent to the report
        script, and the rest are sent to the record step
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      b5b87312
    • Tom Zanussi's avatar
      perf trace record: handle commands correctly · 34c86ea9
      Tom Zanussi authored
      Because the perf-trace shell scripts hard-coded the use of the
      perf-record system-wide param, a perf trace record session was always
      system wide, even if it was given a command.
      
      If given a command, perf trace record now only records the events for
      the command, as users expect.
      
      If no command is given, or if the '-a' option is used, the recorded
      events are system-wide, as before.
      
      root@tropicana:~# perf trace record syscall-counts ls -al
      root@tropicana:~# perf trace
                    ls-23152 [000] 39984.890387: sys_enter: NR 12 (0, 0, 0, 0, 0, 0)
                    ls-23152 [000] 39984.890404: sys_enter: NR 9 (0, 0, 0, 0, 0, 0)
      
      root@tropicana:~# perf trace record syscall-counts -a ls -al
      root@tropicana:~# perf trace
          npviewer.bin-22297 [000] 39831.102709: sys_enter: NR 168 (0, 0, 0, 0, 0, 0)
                    ls-23111 [000] 39831.107679: sys_enter: NR 59 (0, 0, 0, 0, 0, 0)
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      34c86ea9
    • Tom Zanussi's avatar
      perf record: make the record options available outside perf record · bca647aa
      Tom Zanussi authored
      Other perf commands that invoke perf record, such as perf trace, may
      want to reuse the options used by perf record.
      
      This makes them non-static and renames them to avoid clashes with
      other 'options' variables.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      bca647aa
    • Tom Zanussi's avatar
      perf trace scripting: remove system-wide param from shell scripts · b0b6d914
      Tom Zanussi authored
      Including -a unconditionally when recording doesn't allow for the
      option of running scripts without it.  Future patches will add add it
      back if needed at run-time.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      b0b6d914
    • Tom Zanussi's avatar
      perf trace scripting: fix some small memory leaks and missing error checks · e8719adf
      Tom Zanussi authored
      Free the other two fields of script_desc which somehow got overlooked,
      free malloc'ed args in case exec fails, and add missing checks for
      failed mallocs.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
      e8719adf
    • Corey Ashford's avatar
      perf: Fix usages of profile_cpu in builtin-top.c to use cpu_list · 01797c59
      Corey Ashford authored
      profile_cpu was left over from an earlier implementation that
      supported running perf top on a single CPU.  profile_cpu was no
      longer set by any switch and usages of it resulted in dead code.
      
      Instead, convert the code to use cpu_list, which is set by the
      -C <cpu_list> option.
      
      Also improved the printing of nr_cpus and cpu_list by correcting
      the plurals.
      Signed-off-by: default avatarCorey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: a.p.zijlstra@chello.nl
      Cc: acme@redhat.com
      LKML-Reference: <1289269245-9388-1-git-send-email-cjashfor@linux.vnet.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      01797c59
    • Cyrill Gorcunov's avatar
      perf, ui: Eliminate stack-smashing protection compiler complaint · a3da8e45
      Cyrill Gorcunov authored
      The gcc complains about small auto-var strings being allocated from stack space.
      Make them const to avoid this:
      
       | CC util/ui/util.o
       | cc1: warnings being treated as errors
       | util/ui/util.c: In function ‘ui__dialog_yesno’:
       | util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
       | make: *** [util/ui/util.o] Error 1
      
      The real bug is in the newtWinChoice() ABI - but that's an
      externality we cannot fix here, so we use this workaround.
      Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
      Acked-by: default avatarFrédéric Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20101106084724.GA5956@lenovo>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a3da8e45
  4. 09 Nov, 2010 5 commits
  5. 08 Nov, 2010 17 commits
  6. 06 Nov, 2010 4 commits
    • Greg Kroah-Hartman's avatar
      Staging: ath6kl: remove empty files that mess with 'distclean' · 557a3dac
      Greg Kroah-Hartman authored
      These two .h files would get removed from the tree when doing
      	make distclean
      
      It turns out they are not needed at all, so just delete them which fixes
      people's git trees when doing development.
      Reported-by: default avatarAndi Kleen <andi@firstfloor.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      557a3dac
    • Vivek Goyal's avatar
      floppy: fix another use-after-free · d017bf6b
      Vivek Goyal authored
      While scanning the floopy code due to c093ee4f ("floppy: fix
      use-after-free in module load failure path"), I found one more instance
      of trying to access disk->queue pointer after doing put_disk() on
      gendisk.  For some reason , floppy moule still loads/unloads fine.  The
      object is probably still around with right pointer values.
      
       o There seems to be one more instance of trying to cleanup the request
         queue after we have called put_disk() on associated gendisk.
      
       o This fix is more out of code inspection.  Even without this fix for
         some reason I am able to load/unload floppy module without any
         issues.
      
       o Floppy module loads/unloads fine after the fix.
      Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d017bf6b
    • Greg Kroah-Hartman's avatar
      TTY: move .gitignore from drivers/char/ to drivers/tty/vt/ · 1db01135
      Greg Kroah-Hartman authored
      The autogenerated files (consolemap_deftbl.c and defkeymap.c) need to
      be ignored by git, so move the .gitignore file that was doing it to the
      properly location now that the files have moved as well.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1db01135
    • Linus Torvalds's avatar
      ipw2x00: remove the right /proc/net entry · 151f52f0
      Linus Torvalds authored
      Commit 27ae60f8 ("ipw2x00: replace "ieee80211" with "libipw" where
      appropriate") changed DRV_NAME to be "libipw", but didn't properly fix
      up the places where it was used to specify the name for the /proc/net/
      directory.
      
      For backwards compatibility reasons, that directory name remained
      "ieee80211", but due to the DRV_NAME change, the error case printouts
      and the cleanup functions now used "libipw" instead.  Which made it all
      fail badly.
      
      For example, on module unload as reported by Randy:
      
        WARNING: at fs/proc/generic.c:816 remove_proc_entry+0x156/0x35e()
        name 'libipw'
      
      because it's trying to unregister a /proc directory that obviously
      doesn't even exist.
      
      Clean it all up to use DRV_PROCNAME for the actual /proc directory name.
      Reported-and-tested-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Pavel Roskin <proski@gnu.org>
      Cc: John W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      151f52f0