1. 15 Sep, 2009 6 commits
    • Wu Zhangjin's avatar
      mm: Fix the non-RT version of swap_get_cpu_var · edc1a1c3
      Wu Zhangjin authored
      The commit(f8382688) have converted swap to percpu locked, the
      non-RT version of swap_get_cpu_var should be the same as the old
      implementation, but in reality, it not works as the old one:
      
      ...
      +#define swap_get_cpu_var(var, cpu)                     \
      +       ({                                              \
      +               (void)cpu;                              \
      +               &get_cpu_var(var);                      \
      +        })
      ...
       void __lru_cache_add(struct page *page, enum lru_list lru)
       {
      -       struct pagevec *pvec = &get_cpu_var(lru_add_pvecs)[lru];
      +       struct pagevec *pvec;
      +       int cpu;
      
      +       pvec = swap_get_cpu_var(lru_add_pvecs, cpu)[lru];
              page_cache_get(page);
              if (!pagevec_add(pvec, page))
                      ____pagevec_lru_add(pvec, lru);
      -       put_cpu_var(lru_add_pvecs);
      +       swap_put_cpu_var(lru_add_pvecs, cpu);
       }
      
      Here is the point, the old version:
      
            pvec = &get_cpu_var(lru_add_pvecs)[lru];
           	   = & (get_cpu_var(lru_add_pvecs)[lru]);
      
      new version from commit f8382688:
      
            pvec = ({ (void)cpu; &get_cpu_var(lru_add_pvecs); })[lru];
                 = (&get_cpu_var(lru_add_pvecs)) [lru];
      
      so, we can see, these two are really different. and it made the non-RT boot
      fail:
      
      ...
      
      ide-gd driver 1.18
      hda: max request size: 512KiB
      hda: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63
      hda: cache flushes supported
       hda:Unhandled kernel unaligned access[#1]:
      Cpu 0
      $ 0   : 0000000000000000 000000001400c4e1 98000000013699d0 0000000000000000
      $ 4   : 0000000000000000 98000000be04f980 0000000000000010 000000007fd78b57
      $ 8   : 0000000000000001 0000000000200200 0000000000100100 98000000be00f210
      $12   : 000000001400c4e1 000000001000001e ffffffffffffffff 98000000bd0180a8
      $16   : 0000000000000000 98000000be04f998 fffffffb81a72600 ffffffff802d3270
      $20   : 0000000000000000 0000000000000000 ffffffffffffffef ffffffff80667a90
      $24   : 0000000000000228 ffffffff803ded88
      $28   : 98000000be04c000 98000000be04f950 00000000003fffff ffffffff80200404
      Hi    : 0000000000000000
      Lo    : 0000000000000320
      epc   : ffffffff80217194 do_ade+0x298/0x3bc
          Not tainted
      ra    : ffffffff80200404 ret_from_exception+0x0/0x10
      Status: 1400c4e3    KX SX UX KERNEL EXL IE
      Cause : 00000014
      BadVA : fffffffb81a72607
      PrId  : 00006303 (ICT Loongson-2)
      Modules linked in:
      Process swapper (pid: 1, threadinfo=98000000be04c000, task=98000000be04b7d8, tls=0000000000000000)
      Stack : ffffffff80666f60 ffffffff8025165c 98000000013699d0 0000000000000001
              98000000bd00ae30 ffffffff80200404 0000000000000000 000000001400c4e1
              000000007fd78b57 98000000013699d0 ffffffff80638070 0000000000000002
              fffffffb81a72600 000000007fd78b57 0000000000000001 0000000000200200
              0000000000100100 98000000be00f210 98000000be00f220 000000000000001d
              ffffffffffffffff 98000000bd0180a8 98000000013699d0 0000000000000001
              98000000bd00ae30 ffffffff802d3270 0000000000000000 0000000000000000
              ffffffffffffffef ffffffff80667a90 0000000000000228 ffffffff803ded88
              98000000bd00ae30 98000000bd00ae30 98000000be04c000 98000000be04fab0
              00000000003fffff ffffffff80275350 000000001400c4e3 0000000000000000
              ...
      Call Trace:
      [<ffffffff80217194>] do_ade+0x298/0x3bc
      [<ffffffff80200404>] ret_from_exception+0x0/0x10
      [<ffffffff8027fafc>] __lru_cache_add+0x94/0xd8
      [<ffffffff80275350>] add_to_page_cache_lru+0x84/0xa8
      [<ffffffff80275520>] read_cache_page_async+0xa8/0x1dc
      [<ffffffff80275664>] read_cache_page+0x10/0x74
      [<ffffffff802fed34>] read_dev_sector+0x34/0xe0
      [<ffffffff802ff96c>] adfspart_check_ICS+0x44/0x1b0
      [<ffffffff802ff6e4>] rescan_partitions+0x178/0x3a8
      [<ffffffff802d3840>] __blkdev_get+0x238/0x318
      [<ffffffff802feeb0>] register_disk+0xd0/0x15c
      [<ffffffff8037c1e8>] add_disk+0xcc/0x128
      [<ffffffff803fcbc4>] ide_gd_probe+0x170/0x1d0
      [<ffffffff803e6e08>] driver_probe_device+0xbc/0x180
      [<ffffffff803e6f38>] __driver_attach+0x6c/0xa4
      [<ffffffff803e6508>] bus_for_each_dev+0x58/0xa4
      [<ffffffff803e5bbc>] bus_add_driver+0xc8/0x284
      [<ffffffff803e72d8>] driver_register+0xc4/0x17c
      [<ffffffff8020fa5c>] do_one_initcall+0x64/0x18c
      [<ffffffff806701d8>] kernel_init+0xe0/0x14c
      [<ffffffff80212e5c>] kernel_thread_helper+0x10/0x18
      
      Code: 001188f8  00b1882d  de220000 <b2420007> b6420000  24120000  1640000c  00a0202d  8ca20120
      Disabling lock debugging due to kernel taint
      note: swapper[1] exited with preempt_count 1
      Kernel panic - not syncing: Attempted to kill init!
      
      This patch will keep the swap_get_cpu_var as the one before commit f8382688,
      and put "(void)cpu;" to swap_put_cpu_var() to avoid warning about unused
      variable.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      LKML-Reference: <1252034522-32653-1-git-send-email-wuzhangjin@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      edc1a1c3
    • Thomas Gleixner's avatar
      x86: Suppress empty cpumask ipi warning · 9425c8dc
      Thomas Gleixner authored
      We know already which code pathes trigger this so we can safely
      disable it again and just keep the early return when mask == 0.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      9425c8dc
    • Thomas Gleixner's avatar
      kvm: Move get_cpu inside of spinlocked region in make_all_cpus_request() · b079dc12
      Thomas Gleixner authored
      kvm->requests_lock is a sleeping lock in RT, but it's locked inside
      the preempt disabled region of get_cpu(). Move the get_cpu() region
      inside the spinlocked region to avoid the might sleep warning.
      
      BUG: sleeping function called from invalid context at kernel/rtmutex.c:684
      in_atomic(): 1, irqs_disabled(): 0, pid: 10670, name: qemu-kvm
      Pid: 10670, comm: qemu-kvm Not tainted 2.6.31-rc9-rt9.1-32bit #47
      Call Trace:
      [<c022a88a>] __might_sleep+0xcb/0xd0
      [<c0498bd9>] rt_spin_lock+0x29/0x5e
      [<f9161b54>] make_all_cpus_request+0x36/0xb2 [kvm]
      [<f9161bf6>] kvm_flush_remote_tlbs+0x12/0x1f [kvm]
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reported-by: default avatarCarsten Emde <carsten.emde@osadl.org>
      b079dc12
    • Thomas Gleixner's avatar
      rt: Fix rwlocks/rwsem rt_[down_]read_trylock() · 00261a94
      Thomas Gleixner authored
      rt_read_trylock() and rt_down_read_trylock() take the lock / semaphore
      unconditionally when it is write locked. Check read_depth if current
      owns the lock. If it's 0 we know it is write locked and return 0.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      00261a94
    • Xiao Guangrong's avatar
      perf_counter: Fix buffer overflow in perf_copy_attr() · 0188eb59
      Xiao Guangrong authored
      If we pass a big size data over perf_counter_open() syscall,
      the kernel will copy this data to a small buffer, it will
      cause kernel crash.
      
      This bug makes the kernel unsafe and non-root local user can
      trigger it.
      Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Acked-by: default avatarPaul Mackerras <paulus@samba.org>
      Cc: <stable@kernel.org>
      LKML-Reference: <4AAF37D4.5010706@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0188eb59
    • Thomas Gleixner's avatar
      time: Prevent 32 bit overflow with set_normalized_timespec() · f7ada8bf
      Thomas Gleixner authored
      set_normalized_timespec() nsec argument is of type long. The recent
      timekeeping changes of ktime_get_ts() feed
      
      	ts->tv_nsec + tomono.tv_nsec + nsecs
      
      to set_normalized_timespec(). On 32 bit machines that sum can be
      larger than (1 << 31) and therefor result in a negative value which
      screws up the result completely.
      
      Make the nsec argument of set_normalized_timespec() s64 to fix the
      problem at hand. This also prevents similar problems for future users
      of set_normalized_timespec().
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarCarsten Emde <carsten.emde@osadl.org>
      LKML-Reference: <new-submission>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      f7ada8bf
  2. 14 Sep, 2009 13 commits
  3. 13 Sep, 2009 13 commits
  4. 11 Sep, 2009 7 commits
    • jolsa@redhat.com's avatar
      tracing: trace parser support for function and graph · 689fd8b6
      jolsa@redhat.com authored
      Convert the writing to 'set_graph_function', 'set_ftrace_filter'
      and 'set_ftrace_notrace' to use the generic trace_parser
      'trace_get_user' function.
      
      Removed FTRACE_ITER_CONT flag, since it's not needed after this change.
      
      Minor fix in set_graph_function display - g_show function.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <1252682969-3366-4-git-send-email-jolsa@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      689fd8b6
    • jolsa@redhat.com's avatar
      tracing: trace parser support for set_event · 48966364
      jolsa@redhat.com authored
      Convert the parsing of the file 'set_event' to use the generic
      trace_praser 'trace_get_user' function.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <1252682969-3366-3-git-send-email-jolsa@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      48966364
    • jolsa@redhat.com's avatar
      tracing: create generic trace parser · b63f39ea
      jolsa@redhat.com authored
      Create a "trace_parser" that can parse the user space input for
      separate words.
      
      struct trace_parser is the descriptor.
      
      Generic "trace_get_user" function that can be a helper to read multiple
      words passed in by user space.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <1252682969-3366-2-git-send-email-jolsa@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b63f39ea
    • Steven Rostedt's avatar
      tracing: consolidate code between trace_output.c and trace_function_graph.c · f81c972d
      Steven Rostedt authored
      Both trace_output.c and trace_function_graph.c do basically the same
      thing to handle the printing of the latency-format. This patch moves
      the code into one function that both can use.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      f81c972d
    • Steven Rostedt's avatar
      tracing: add lock depth to entries · 637e7e86
      Steven Rostedt authored
      This patch adds the lock depth of the big kernel lock to the generic
      entry header. This way we can see the depth of the lock and help
      in removing the BKL.
      
      Example:
      
       #                  _------=> CPU#
       #                 / _-----=> irqs-off
       #                | / _----=> need-resched
       #                || / _---=> hardirq/softirq
       #                ||| / _--=> preempt-depth
       #                |||| /_--=> lock-depth
       #                |||||/     delay
       #  cmd     pid   |||||| time  |   caller
       #     \   /      ||||||   \   |   /
         <idle>-0       2.N..3 5902255250us+: lock_acquire: read rcu_read_lock
         <idle>-0       2.N..3 5902255253us+: lock_release: rcu_read_lock
         <idle>-0       2dN..3 5902255257us+: lock_acquire: xtime_lock
         <idle>-0       2dN..4 5902255259us : lock_acquire: clocksource_lock
         <idle>-0       2dN..4 5902255261us+: lock_release: clocksource_lock
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      637e7e86
    • Steven Rostedt's avatar
      tracing: move tgid out of generic entry and into userstack · 48659d31
      Steven Rostedt authored
      The userstack trace required the recording of the tgid entry.
      Unfortunately, it was added to the generic entry where it wasted
      4 bytes of every entry and was only used by one entry.
      
      This patch moves it out of the generic field and moves it into the
      only user (userstack_entry).
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      48659d31
    • Steven Rostedt's avatar
      tracing: add latency format to function_graph tracer · 49ff5903
      Steven Rostedt authored
      While debugging something with the function_graph tracer, I found the
      need to see the preempt count of the traces. Unfortunately, since
      the function graph tracer has its own output formatting, it does not
      honor the latency-format option.
      
      This patch makes the function_graph tracer honor the latency-format
      option, but still keeps control of the output. But now we have the
      same details that the latency-format supplies.
      
       # tracer: function_graph
       #
       #      _-----=> irqs-off
       #     / _----=> need-resched
       #    | / _---=> hardirq/softirq
       #    || / _--=> preempt-depth
       #    ||| /
       #    ||||
       # CPU||||  DURATION                  FUNCTION CALLS
       # |  ||||   |   |                     |   |   |   |
        3)  d..1  1.333 us    |        idle_cpu();
        3)  d.h1              |        tick_check_idle() {
        3)  d.h1  0.550 us    |          tick_check_oneshot_broadcast();
        3)  d.h1              |          tick_nohz_stop_idle() {
        3)  d.h1              |            ktime_get() {
        3)  d.h1              |              ktime_get_ts() {
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      49ff5903
  5. 10 Sep, 2009 1 commit