1. 20 Mar, 2009 3 commits
  2. 19 Mar, 2009 15 commits
    • Jeff Moyer's avatar
      aio: lookup_ioctx can return the wrong value when looking up a bogus context · 65c24491
      Jeff Moyer authored
      The libaio test harness turned up a problem whereby lookup_ioctx on a
      bogus io context was returning the 1 valid io context from the list
      (harness/cases/3.p).
      
      Because of that, an extra put_iocontext was done, and when the process
      exited, it hit a BUG_ON in the put_iocontext macro called from exit_aio
      (since we expect a users count of 1 and instead get 0).
      
      The problem was introduced by "aio: make the lookup_ioctx() lockless"
      (commit abf137dd).
      
      Thanks to Zach for pointing out that hlist_for_each_entry_rcu will not
      return with a NULL tpos at the end of the loop, even if the entry was
      not found.
      Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Acked-by: default avatarZach Brown <zach.brown@oracle.com>
      Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      65c24491
    • Davide Libenzi's avatar
      eventfd: remove fput() call from possible IRQ context · 87c3a86e
      Davide Libenzi authored
      Remove a source of fput() call from inside IRQ context.  Myself, like Eric,
      wasn't able to reproduce an fput() call from IRQ context, but Jeff said he was
      able to, with the attached test program.  Independently from this, the bug is
      conceptually there, so we might be better off fixing it.  This patch adds an
      optimization similar to the one we already do on ->ki_filp, on ->ki_eventfd.
      Playing with ->f_count directly is not pretty in general, but the alternative
      here would be to add a brand new delayed fput() infrastructure, that I'm not
      sure is worth it.
      Signed-off-by: default avatarDavide Libenzi <davidel@xmailserver.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: Eric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Cc: Zach Brown <zach.brown@oracle.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      87c3a86e
    • Linus Torvalds's avatar
      Move cc-option to below arch-specific setup · d0115552
      Linus Torvalds authored
      Sam Ravnborg says:
       "We have several architectures that plays strange games with $(CC) and
        $(CROSS_COMPILE).
      
        So we need to postpone any use of $(call cc-option..) until we have
        included the arch specific Makefile so we try with the correct $(CC)
        version."
      Requested-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d0115552
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 · caa81d67
      Linus Torvalds authored
      * 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
        [S390] make page table upgrade work again
        [S390] make page table walking more robust
        [S390] Dont check for pfn_valid() in uaccess_pt.c
        [S390] ftrace/mcount: fix kernel stack backchain
        [S390] topology: define SD_MC_INIT to fix performance regression
        [S390] __div64_31 broken for CONFIG_MARCH_G5
      caa81d67
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid · 2d8620cb
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
        HID: fix waitqueue usage in hiddev
        HID: fix incorrect free in hiddev
      2d8620cb
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable · fe2fd6cc
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
        Btrfs: Clear space_info full when adding new devices
        Btrfs: Fix locking around adding new space_info
      fe2fd6cc
    • Steven Rostedt's avatar
      function-graph: show binary events as comments · 5087f8d2
      Steven Rostedt authored
      With the added TRACE_EVENT macro, the events no longer appear in
      the function graph tracer. This was because the function graph
      did not know how to display the entries. The graph tracer was
      only aware of its own entries and the printk entries.
      
      By using the event call back feature, the graph tracer can now display
      the events.
      
       # echo irq > /debug/tracing/set_event
      
      Which can show:
      
       0)               |          handle_IRQ_event() {
       0)               |            /* irq_handler_entry: irq=48 handler=eth0 */
       0)               |            e1000_intr() {
       0)   0.926 us    |              __napi_schedule();
       0)   3.888 us    |            }
       0)               |            /* irq_handler_exit: irq=48 return=handled */
       0)   0.655 us    |            runqueue_is_locked();
       0)               |            __wake_up() {
       0)   0.831 us    |              _spin_lock_irqsave();
      
      The irq entry and exit events show up as comments.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5087f8d2
    • Steven Rostedt's avatar
      tracing: remove recording function depth from trace_printk · 40ce74f1
      Steven Rostedt authored
      The function depth in trace_printk was to facilitate the function
      graph output. Now that the function graph calculates the depth within
      the trace output, we no longer need to record the depth when the
      trace_printk is called.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      40ce74f1
    • Steven Rostedt's avatar
      function-graph: calculate function depth within function graph tracer · 2fbcdb35
      Steven Rostedt authored
      Currently, the function graph tracer depends on the trace_printk
      to record the depth. All the information is already there in the trace
      to calculate function depth, with the exception of having the printk
      be the first item. But as soon as a entry or exit is reached, then
      we know the depth.
      
      This patch changes the iter->private data from recording a per cpu
      last_pid, to a structure that holds both the last_pid and the current
      depth. This data is used to determine the function depth for the
      printks.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      2fbcdb35
    • Steven Rostedt's avatar
      tracing: make print_(b)printk_msg_only global · 5ef841f6
      Steven Rostedt authored
      This patch makes print_printk_msg_only and print_bprintk_msg_only
      global for other functions to use. It also renames them by adding
      a "trace_" to the beginning to avoid namespace collisions.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5ef841f6
    • Linus Torvalds's avatar
      Fix race in create_empty_buffers() vs __set_page_dirty_buffers() · a8e7d49a
      Linus Torvalds authored
      Nick Piggin noticed this (very unlikely) race between setting a page
      dirty and creating the buffers for it - we need to hold the mapping
      private_lock until we've set the page dirty bit in order to make sure
      that create_empty_buffers() might not build up a set of buffers without
      the dirty bits set when the page is dirty.
      
      I doubt anybody has ever hit this race (and it didn't solve the issue
      Nick was looking at), but as Nick says: "Still, it does appear to solve
      a real race, which we should close."
      Acked-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a8e7d49a
    • Linus Torvalds's avatar
      Add '-fwrapv' to gcc CFLAGS · 68df3755
      Linus Torvalds authored
      This makes sure that gcc doesn't try to optimize away wrapping
      arithmetic, which the kernel occasionally uses for overflow testing, ie
      things like
      
      	if (ptr + offset < ptr)
      
      which technically is undefined for non-unsigned types. See
      
      	http://bugzilla.kernel.org/show_bug.cgi?id=12597
      
      for details.
      
      Not all versions of gcc support it, so we need to make it conditional
      (it looks like it was introduced in gcc-3.4).
      Reminded-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      68df3755
    • Frederic Weisbecker's avatar
      tracing/ring-buffer: fix non cpu hotplug case · 3bf832ce
      Frederic Weisbecker authored
      Impact: fix warning with irqsoff tracer
      
      The ring buffer allocates its buffers on pre-smp time (early_initcall).
      It means that, at first, only the boot cpu buffer is allocated and
      the ring-buffer cpumask only has the boot cpu set (cpu_online_mask).
      
      Later, the secondary cpu will show up and the ring-buffer will be notified
      about this event: the appropriate buffer will be allocated and the cpumask
      will be updated.
      
      Unfortunately, if !CONFIG_CPU_HOTPLUG, the ring-buffer will not be
      notified about the secondary cpus, meaning that the cpumask will have
      only the cpu boot set, and only one cpu buffer allocated.
      
      We fix that by using cpu_possible_mask if !CONFIG_CPU_HOTPLUG.
      
      This patch fixes the following warning with irqsoff tracer running:
      
      [  169.317794] WARNING: at kernel/trace/trace.c:466 update_max_tr_single+0xcc/0xf3()
      [  169.318002] Hardware name: AMILO Li 2727
      [  169.318002] Modules linked in:
      [  169.318002] Pid: 5624, comm: bash Not tainted 2.6.29-rc8-tip-02636-g6aafa6c #11
      [  169.318002] Call Trace:
      [  169.318002]  [<ffffffff81036182>] warn_slowpath+0xea/0x13d
      [  169.318002]  [<ffffffff8100b9d6>] ? ftrace_call+0x5/0x2b
      [  169.318002]  [<ffffffff8100b9d6>] ? ftrace_call+0x5/0x2b
      [  169.318002]  [<ffffffff8100b9d1>] ? ftrace_call+0x0/0x2b
      [  169.318002]  [<ffffffff8101ef10>] ? ftrace_modify_code+0xa9/0x108
      [  169.318002]  [<ffffffff8106e27f>] ? trace_hardirqs_off+0x25/0x27
      [  169.318002]  [<ffffffff8149afe7>] ? _spin_unlock_irqrestore+0x1f/0x2d
      [  169.318002]  [<ffffffff81064f52>] ? ring_buffer_reset_cpu+0xf6/0xfb
      [  169.318002]  [<ffffffff8106637c>] ? ring_buffer_reset+0x36/0x48
      [  169.318002]  [<ffffffff8106aeda>] update_max_tr_single+0xcc/0xf3
      [  169.318002]  [<ffffffff8100bc17>] ? sysret_check+0x22/0x5d
      [  169.318002]  [<ffffffff8106e3ea>] stop_critical_timing+0x142/0x204
      [  169.318002]  [<ffffffff8106e4cf>] trace_hardirqs_on_caller+0x23/0x25
      [  169.318002]  [<ffffffff8149ac28>] trace_hardirqs_on_thunk+0x3a/0x3c
      [  169.318002]  [<ffffffff8100bc17>] ? sysret_check+0x22/0x5d
      [  169.318002] ---[ end trace db76cbf775a750cf ]---
      
      Because this tracer may try to swap two cpu ring buffers for an
      unregistered cpu on the ring buffer.
      
      This patch might also fix a fair loss of traces due to unallocated buffers
      for secondary cpus.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-b: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1237470453-5427-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3bf832ce
    • Steven Rostedt's avatar
      function-graph: consolidate prologues for output · ac5f6c96
      Steven Rostedt authored
      Impact: clean up
      
      The prologue of the function graph entry, return and comments all
      start out pretty much the same. Each of these duplicate code and
      do so slightly differently.
      
      This patch consolidates the printing of the pid, absolute time,
      cpu and proc (and for entry, the interrupt).
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      ac5f6c96
    • Lai Jiangshan's avatar
      ftrace: protect running nmi (V3) · e9d9df44
      Lai Jiangshan authored
      When I review the sensitive code ftrace_nmi_enter(), I found
      the atomic variable nmi_running does protect NMI VS do_ftrace_mod_code(),
      but it can not protects NMI(entered nmi) VS NMI(ftrace_nmi_enter()).
      
      cpu#1                   | cpu#2                 | cpu#3
      ftrace_nmi_enter()      | do_ftrace_mod_code()  |
        not modify            |                       |
      ------------------------|-----------------------|--
      executing               | set mod_code_write = 1|
      executing             --|-----------------------|--------------------
      executing               |                       | ftrace_nmi_enter()
      executing               |                       |    do modify
      ------------------------|-----------------------|-----------------
      ftrace_nmi_exit()       |                       |
      
      cpu#3 may be being modified the code which is still being executed on cpu#1,
      it will have undefined results and possibly take a GPF, this patch
      prevents it occurred.
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      LKML-Reference: <49C0B411.30003@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e9d9df44
  3. 18 Mar, 2009 22 commits
    • Ingo Molnar's avatar
      tracepoints: dont update zero-sized tracepoint sections · ec625cb2
      Ingo Molnar authored
      Zero-sized tracepoint sections can occur if tracing is enabled but
      no tracepoint is defined. Do not emit a warning in that case.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
      LKML-Reference: <1237394936.3132.1.camel@localhost.localdomain>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ec625cb2
    • Jaswinder Singh Rajput's avatar
      tracing: fix oops in tracepoint_update_probe_range() · 09933a10
      Jaswinder Singh Rajput authored
      Change this crash:
      
       BUG: unable to handle kernel NULL pointer dereference at (null)
       IP: [<ffffffff8107d4de>] tracepoint_update_probe_range+0x1f/0x9b
       PGD 13d5fb067 PUD 13d688067 PMD 0
       Oops: 0000 [#1] SMP
      
      To a more debuggable WARN_ONCE().
      Signed-off-by: default avatarJaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1237394936.3132.1.camel@localhost.localdomain>
      [ moved the check outside the lock and added a WARN_ON(). ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      09933a10
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6 · a1e4ee22
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6:
        Staging: benet: remove driver now that it is merged in drivers/net/
      a1e4ee22
    • Linus Torvalds's avatar
      Merge branch 'for-2.6.29' of git://linux-nfs.org/~bfields/linux · 85bff885
      Linus Torvalds authored
      * 'for-2.6.29' of git://linux-nfs.org/~bfields/linux:
        nfsd: nfsd should drop CAP_MKNOD for non-root
        NFSD: provide encode routine for OP_OPENATTR
      85bff885
    • Greg Kroah-Hartman's avatar
      Staging: benet: remove driver now that it is merged in drivers/net/ · d0573fac
      Greg Kroah-Hartman authored
      The benet driver is now in the proper place in drivers/net/benet, so we
      can remove the staging version.
      Acked-by: default avatarSathya Perla <sathyap@serverengines.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d0573fac
    • Linus Torvalds's avatar
      Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc · d941d0ed
      Linus Torvalds authored
      * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
        powerpc/ps3: ps3_defconfig updates
        powerpc/mm: Respect _PAGE_COHERENT on classic ppc32 SW
        powerpc/5200: Enable CPU_FTR_NEED_COHERENT for MPC52xx
        ps3/block: Replace mtd/ps3vram by block/ps3vram
      d941d0ed
    • Linus Torvalds's avatar
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 · 99dbe109
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
        USB: storage: Unusual USB device Prolific 2507 variation added
        USB: Add device id for Option GTM380 to option driver
        USB: Add Vendor/Product ID for new CDMA U727 to option driver
        USB: Updated unusual-devs entry for USB mass storage on Nokia 6233
        USB: Option: let cdc-acm handle Sony Ericsson F3507g / Dell 5530
        USB: EHCI: expedite unlinks when the root hub is suspended
        USB: EHCI: Fix isochronous URB leak
        USB: option.c: add ZTE 622 modem device
        USB: wusbcore/wa-xfer, fix lock imbalance
        USB: misc/vstusb, fix lock imbalance
        USB: misc/adutux, fix lock imbalance
        USB: image/mdc800, fix lock imbalance
        USB: atm/cxacru, fix lock imbalance
        USB: unusual_devs: Add support for GI 0431 SD-Card interface
        USB: serial: new cp2101 device id
        USB: serial: ftdi: enable UART detection on gnICE JTAG adaptors blacklist interface0
        USB: serial: add FTDI USB/Serial converter devices
        USB: usbfs: keep async URBs until the device file is closed
        USB: usbtmc: add protocol 1 support
        USB: usbtmc: fix stupid bug in open()
      99dbe109
    • Steven Rostedt's avatar
      tracing: give easy way to clear trace buffer · 4acd4d00
      Steven Rostedt authored
      There is currently no easy way to clear the trace buffer. Currently
      the only way is to change the current tracer.
      
      This patch lets the user clear the trace buffer by simply writing
      into the trace files.
      
       echo > /debug/tracing/trace
      
      or to clear a single cpu (i.e. for CPU 1):
      
       echo > /debug/tracing/per_cpu/cpu1/trace
      Requested-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      4acd4d00
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 · bd27e6d3
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
        ALSA: Fix vunmap and free order in snd_free_sgbuf_pages()
        ALSA: mixart, fix lock imbalance
        ALSA: pcm_oss, fix locking typo
        ALSA: oss-mixer - Fixes recording gain control
        ALSA: hda - Workaround for buggy DMA position on ATI controllers
        ALSA: hda - Fix DMA mask for ATI controllers
        ALSA: opl3sa2 - Fix NULL dereference when suspending snd_opl3sa2
      bd27e6d3
    • Martin Schwidefsky's avatar
      [S390] make page table upgrade work again · 0fb1d9bc
      Martin Schwidefsky authored
      After TASK_SIZE now gives the current size of the address space the
      upgrade of a 64 bit process from 3 to 4 levels of page table  needs
      to use the arch_mmap_check hook to catch large mmap lengths. The
      get_unmapped_area* functions need to check for -ENOMEM from the
      arch_get_unmapped_area*, upgrade the page table and retry.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      0fb1d9bc
    • Martin Schwidefsky's avatar
      [S390] make page table walking more robust · f481bfaf
      Martin Schwidefsky authored
      Make page table walking on s390 more robust. The current code requires
      that the pgd/pud/pmd/pte loop is only done for address ranges that are
      below the end address of the last vma of the address space. But this
      is not always true, e.g. the generic page table walker does not guarantee
      this. Change TASK_SIZE/TASK_SIZE_OF to reflect the current size of the
      address space. This makes the generic page table walker happy but it
      breaks the upgrade of a 3 level page table to a 4 level page table.
      To make the upgrade work again another fix is required.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      f481bfaf
    • Gerald Schaefer's avatar
      [S390] Dont check for pfn_valid() in uaccess_pt.c · 2887fc5a
      Gerald Schaefer authored
      pfn_valid() actually checks for a valid struct page and not for a
      valid pfn. Using xip mappings w/o struct pages, this will result in
      -EFAULT returned by the (page table walk) user copy functions,
      even though there is valid memory. Those user copy functions don't
      need a struct page, so this patch just removes the pfn_valid() check.
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      2887fc5a
    • Heiko Carstens's avatar
      [S390] ftrace/mcount: fix kernel stack backchain · cf087343
      Heiko Carstens authored
      With packed stack the backchain is at a different location.
      Just use __SF_BACKCHAIN as an offset to store the backchain.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      cf087343
    • Heiko Carstens's avatar
      [S390] topology: define SD_MC_INIT to fix performance regression · f55d6385
      Heiko Carstens authored
      The default values for SD_MC_INIT cause an additional cpu usage of up
      to 40% on some network benchmarks compared to the plain SD_CPU_INIT
      values. So just define SD_MC_INIT to SD_CPU_INIT.
      More tuning needs to be done.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      f55d6385
    • Martin Schwidefsky's avatar
      [S390] __div64_31 broken for CONFIG_MARCH_G5 · 4fa81ed2
      Martin Schwidefsky authored
      The implementation of __div64_31 for G5 machines is broken. The comments
      in __div64_31 are correct, only the code does not do what the comments
      say. The part "If the remainder has overflown subtract base and increase
      the quotient" is only partially realized, the base is subtracted correctly
      but the quotient is only increased if the dividend had the last bit set.
      Using the correct instruction fixes the problem.
      
      Cc: stable@kernel.org
      Reported-by: default avatarFrans Pop <elendil@planet.nl>
      Tested-by: default avatarFrans Pop <elendil@planet.nl>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      4fa81ed2
    • Ananth N Mavinakayanahalli's avatar
      kprobes: Fix locking imbalance in kretprobes · f02b8624
      Ananth N Mavinakayanahalli authored
      Fix locking imbalance in kretprobes:
      
      =====================================
      [ BUG: bad unlock balance detected! ]
      -------------------------------------
      kthreadd/2 is trying to release lock (&rp->lock) at:
      [<c06b3080>] pre_handler_kretprobe+0xea/0xf4
      but there are no more locks to release!
      
      other info that might help us debug this:
      1 lock held by kthreadd/2:
       #0:  (rcu_read_lock){..--}, at: [<c06b2b24>] __atomic_notifier_call_chain+0x0/0x5a
      
      stack backtrace:
      Pid: 2, comm: kthreadd Not tainted 2.6.29-rc8 #1
      Call Trace:
       [<c06ae498>] ? printk+0xf/0x17
       [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4
       [<c044ce6c>] print_unlock_inbalance_bug+0xc3/0xce
       [<c0444d4b>] ? clocksource_read+0x7/0xa
       [<c04450a4>] ? getnstimeofday+0x5f/0xf6
       [<c044a9ca>] ? register_lock_class+0x17/0x293
       [<c044b72c>] ? mark_lock+0x1e/0x30b
       [<c0448956>] ? tick_dev_program_event+0x4a/0xbc
       [<c0498100>] ? __slab_alloc+0xa5/0x415
       [<c06b2fbe>] ? pre_handler_kretprobe+0x28/0xf4
       [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4
       [<c044cf1b>] lock_release_non_nested+0xa4/0x1a5
       [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4
       [<c044d15d>] lock_release+0x141/0x166
       [<c06b07dd>] _spin_unlock_irqrestore+0x19/0x50
       [<c06b3080>] pre_handler_kretprobe+0xea/0xf4
       [<c06b20b5>] kprobe_exceptions_notify+0x1c9/0x43e
       [<c06b2b02>] notifier_call_chain+0x26/0x48
       [<c06b2b5b>] __atomic_notifier_call_chain+0x37/0x5a
       [<c06b2b24>] ? __atomic_notifier_call_chain+0x0/0x5a
       [<c06b2b8a>] atomic_notifier_call_chain+0xc/0xe
       [<c0442d0d>] notify_die+0x2d/0x2f
       [<c06b0f9c>] do_int3+0x1f/0x71
       [<c06b0e84>] int3+0x2c/0x34
       [<c042d476>] ? do_fork+0x1/0x288
       [<c040221b>] ? kernel_thread+0x71/0x79
       [<c043ed1b>] ? kthread+0x0/0x60
       [<c043ed1b>] ? kthread+0x0/0x60
       [<c04040b8>] ? kernel_thread_helper+0x0/0x10
       [<c043ec7f>] kthreadd+0xac/0x148
       [<c043ebd3>] ? kthreadd+0x0/0x148
       [<c04040bf>] kernel_thread_helper+0x7/0x10
      Signed-off-by: default avatarAnanth N Mavinakayanahalli <ananth@in.ibm.com>
      Tested-by: default avatarBharata B Rao <bharata@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: <stable@kernel.org> [2.6.29.x, 2.6.28.x, 2.6.27.x]
      LKML-Reference: <20090318113621.GB4129@in.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f02b8624
    • Frederic Weisbecker's avatar
      tracing/ftrace: stop {irqs, preempt}soff tracers when tracing is stopped · 49036200
      Frederic Weisbecker authored
      Impact: fix a selftest warning
      
      In some cases, it's possible to see the following warning on irqsoff
      tracer selftest:
      
      [    4.640003] Testing tracer irqsoff: <4>------------[ cut here ]------------
      [    4.653562] WARNING: at kernel/trace/trace.c:458 update_max_tr_single+0x9a/0xc4()
      [    4.660000] Hardware name: System Product Name
      [    4.660000] Modules linked in:
      [    4.660000] Pid: 301, comm: kstop/1 Not tainted 2.6.29-rc8-tip #35837
      [    4.660000] Call Trace:
      [    4.660000]  [<4014b588>] warn_slowpath+0x79/0x8f
      [    4.660000]  [<402d6949>] ? put_dec+0x64/0x6b
      [    4.660000]  [<40162b56>] ? getnstimeofday+0x58/0xdd
      [    4.660000]  [<40162210>] ? clocksource_read+0x3/0xf
      [    4.660000]  [<4015eb44>] ? ktime_set+0x8/0x34
      [    4.660000]  [<4014101a>] ? balance_runtime+0x8/0x56
      [    4.660000]  [<405f6f11>] ? _spin_lock+0x3/0x10
      [    4.660000]  [<4011f643>] ? ftrace_call+0x5/0x8
      [    4.660000]  [<4015d0f1>] ? task_cputime_zero+0x3/0x27
      [    4.660000]  [<40190ee7>] ? cpupri_set+0x90/0xcb
      [    4.660000]  [<405f7208>] ? _spin_lock_irqsave+0x22/0x34
      [    4.660000]  [<40190f12>] ? cpupri_set+0xbb/0xcb
      [    4.660000]  [<405f7151>] ? _spin_unlock_irqrestore+0x23/0x35
      [    4.660000]  [<4018493f>] ? ring_buffer_reset_cpu+0x27/0x51
      [    4.660000]  [<405f7208>] ? _spin_lock_irqsave+0x22/0x34
      [    4.660000]  [<40184962>] ? ring_buffer_reset_cpu+0x4a/0x51
      [    4.660000]  [<405f7151>] ? _spin_unlock_irqrestore+0x23/0x35
      [    4.660000]  [<4018cc29>] ? trace_hardirqs_off+0x1a/0x1c
      [    4.660000]  [<405f7151>] ? _spin_unlock_irqrestore+0x23/0x35
      [    4.660000]  [<40184962>] ? ring_buffer_reset_cpu+0x4a/0x51
      [    4.660000]  [<401850f3>] ? cpumask_next+0x15/0x18
      [    4.660000]  [<4018a41f>] update_max_tr_single+0x9a/0xc4
      [    4.660000]  [<4014e5fe>] ? exit_notify+0x16/0xf2
      [    4.660000]  [<4018cd13>] check_critical_timing+0xcc/0x11e
      [    4.660000]  [<4014e5fe>] ? exit_notify+0x16/0xf2
      [    4.660000]  [<4014e5fe>] ? exit_notify+0x16/0xf2
      [    4.660000]  [<4018cdf1>] stop_critical_timing+0x8c/0x9f
      [    4.660000]  [<4014e5c4>] ? forget_original_parent+0xac/0xd0
      [    4.660000]  [<4018ce3a>] trace_hardirqs_on+0x1a/0x1c
      [    4.660000]  [<4014e5c4>] forget_original_parent+0xac/0xd0
      [    4.660000]  [<4014e5fe>] exit_notify+0x16/0xf2
      [    4.660000]  [<4014e8a5>] do_exit+0x1cb/0x225
      [    4.660000]  [<4015c72b>] ? kthread+0x0/0x69
      [    4.660000]  [<4011f61d>] kernel_thread_helper+0xd/0x10
      [    4.660000] ---[ end trace a7919e7f17c0a725 ]---
      [    4.660164] .. no entries found ..FAILED!
      
      During the selftest of irqsoff tracer, we do that:
      
      	/* disable interrupts for a bit */
      	local_irq_disable();
      	udelay(100);
      	local_irq_enable();
      	/* stop the tracing. */
      	tracing_stop();
      	/* check both trace buffers */
      	ret = trace_test_buffer(tr, NULL);
      
      If a callsite performs a new max delay with irqs off just after
      tracing_stop, update_max_tr_single() -> ring_buffer_swap_cpu()
      will be called with the buffers disabled by tracing_stop(), hence
      the warning, then ring_buffer_swap_cpu() return -EAGAIN and
      update_max_tr_single() complains.
      
      Fix it by also stopping the tracer before stopping the tracing globally.
      A similar situation can happen with preemptoff and preemptirqsoff tracers
      where we apply the same fix.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1237325938-5240-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      49036200
    • Carsten Emde's avatar
      tracing: fix command line to pid reverse map · a635cf04
      Carsten Emde authored
      Impact: fix command line to pid mapping
      
      map_cmdline_to_pid[] is checked in trace_save_cmdline(), but never
      updated. This results in stale pid to command line mappings and the
      tracer output will associate the wrong comm string.
      Signed-off-by: default avatarCarsten Emde <Carsten.Emde@osadl.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a635cf04
    • Thomas Gleixner's avatar
      tracing: fix trace_find_cmdline() · 50d88758
      Thomas Gleixner authored
      Impact: prevent stale command line output
      
      In case there is no valid command line mapping for a pid
      trace_find_cmdline() returns without updating the comm buffer. The
      trace dump keeps the previous entry which results in confusing trace
      output:
      
           <idle>-0     [000]   280.702056 ....
           <idle>-23456 [000]   280.702080 ....
      
      Update the comm buffer with "<...>" when no mapping is found.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      50d88758
    • Thomas Gleixner's avatar
      tracing: replace the crude (unsigned) -1 hackery · 2c7eea4c
      Thomas Gleixner authored
      Impact: cleanup
      
      The command line recorder uses (unsigned) -1 to mark non mapped
      entries in the pid to command line maps. The validity check is
      completely unintuitive: idx >= SAVED_CMDLINES
      
      There is no need for such casting games. Use a constant to mark
      unmapped entries and check for that constant to make the code readable
      and understandable.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2c7eea4c
    • Thomas Gleixner's avatar
      tracing: stop command line recording when tracing is disabled · 18aecd36
      Thomas Gleixner authored
      Impact: prevent overwrite of command line entries
      
      When the tracer is stopped the command line recording continues to
      record. The check for tracing_is_on() is not sufficient here as the
      ringbuffer status is not affected by setting
      debug/tracing/tracing_enabled to 0. On a non idle system this can
      result in the loss of the command line information for the stopped
      trace, which makes the trace harder to read and analyse.
      
      Check tracer_enabled to allow further recording.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      18aecd36