1. 19 Mar, 2009 5 commits
    • 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
    • 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
  2. 18 Mar, 2009 9 commits
    • 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
    • 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
    • Ingo Molnar's avatar
      Merge branch 'tip/tracing/ftrace' of... · 327019b0
      Ingo Molnar authored
      Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
      327019b0
    • Ingo Molnar's avatar
    • Steven Rostedt's avatar
      tracing: make power tracer start/stop methods lighter weight · 62524d55
      Steven Rostedt authored
      The start/stop methods of a tracer should be able to be executed
      in all contexts. This patch converts the power tracer to do so.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      62524d55
    • Steven Rostedt's avatar
      tracing: make sched_switch stop/start light weight · 5fec6ddc
      Steven Rostedt authored
      The stopping and starting of a tracer should be light weight and
      be able to be called in all contexts. The sched_switch grabbed
      mutexes in the start/stop functions. This patch changes it to a
      simple variable, on/off.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5fec6ddc
    • Witold Baryluk's avatar
      tracing: optimization of branch tracer · 97e7e4f3
      Witold Baryluk authored
      Impact: better performance for if branch tracer
      
      Use an array to count the hit and misses of a conditional instead
      of using another conditional. This cuts down on saturation of branch
      predictions and increases performance of modern pipelined architectures.
      Signed-off-by: default avatarWitold Baryluk <baryluk@smp.if.uj.edu.pl>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      97e7e4f3
    • Steven Rostedt's avatar
      tracing: add global-clock option to provide cross CPU clock to traces · af4617bd
      Steven Rostedt authored
      Impact: feature to allow better serialized clock
      
      This patch adds an option called "global-clock" that will allow
      the tracer to switch to a slower but more accurate (across CPUs)
      clock.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      af4617bd
    • Steven Rostedt's avatar
      ring-buffer: add api to allow a tracer to change clock source · 37886f6a
      Steven Rostedt authored
      This patch adds a new function called ring_buffer_set_clock that
      allows a tracer to assign its own clock source to the buffer.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      37886f6a
  3. 17 Mar, 2009 11 commits
    • Linus Torvalds's avatar
      Avoid 64-bit "switch()" statements on 32-bit architectures · ee568b25
      Linus Torvalds authored
      Commit ee6f779b ("filp->f_pos not
      correctly updated in proc_task_readdir") changed the proc code to use
      filp->f_pos directly, rather than through a temporary variable.  In the
      process, that caused the operations to be done on the full 64 bits, even
      though the offset is never that big.
      
      That's all fine and dandy per se, but for some unfathomable reason gcc
      generates absolutely horrid code when using 64-bit values in switch()
      statements.  To the point of actually calling out to gcc helper
      functions like __cmpdi2 rather than just doing the trivial comparisons
      directly the way gcc does for normal compares.  At which point we get
      link failures, because we really don't want to support that kind of
      crazy code.
      
      Fix this by just casting the f_pos value to "unsigned long", which
      is plenty big enough for /proc, and avoids the gcc code generation issue.
      Reported-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Zhang Le <r0bertz@gentoo.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ee568b25
    • Masami Hiramatsu's avatar
      prevent boosting kprobes on exception address · 30390880
      Masami Hiramatsu authored
      Don't boost at the addresses which are listed on exception tables,
      because major page fault will occur on those addresses.  In that case,
      kprobes can not ensure that when instruction buffer can be freed since
      some processes will sleep on the buffer.
      
      kprobes-ia64 already has same check.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      30390880
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm · 18439c39
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
        dm crypt: wait for endio to complete before destruction
        dm crypt: fix kcryptd_async_done parameter
        dm io: respect BIO_MAX_PAGES limit
        dm table: rework reference counting fix
        dm ioctl: validate name length when renaming
      18439c39
    • Linus Torvalds's avatar
      Fast TSC calibration: calculate proper frequency error bounds · 9e8912e0
      Linus Torvalds authored
      In order for ntpd to correctly synchronize the clocks, the frequency of
      the system clock must not be off by more than 500 ppm (or, put another
      way, 1:2000), or ntpd will end up giving up on trying to synchronize
      properly, and ends up reseting the clock in jumps instead.
      
      The fast TSC PIT calibration sometimes failed this test - it was
      assuming that the PIT reads always took about one microsecond each (2us
      for the two reads to get a 16-bit timer), and that calibrating TSC to
      the PIT over 15ms should thus be sufficient to get much closer than
      500ppm (max 2us error on both sides giving 4us over 15ms: a 270 ppm
      error value).
      
      However, that assumption does not always hold: apparently some hardware
      is either very much slower at reading the PIT registers, or there was
      other noise causing at least one machine to get 700+ ppm errors.
      
      So instead of using a fixed 15ms timing loop, this changes the fast PIT
      calibration to read the TSC delta over the individual PIT timer reads,
      and use the result to calculate the error bars on the PIT read timing
      properly.  We then successfully calibrate the TSC only if the maximum
      error bars fall below 500ppm.
      
      In the process, we also relax the timing to allow up to 25ms for the
      calibration, although it can happen much faster depending on hardware.
      Reported-and-tested-by: default avatarJesper Krogh <jesper@krogh.cc>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9e8912e0
    • Linus Torvalds's avatar
      Fix potential fast PIT TSC calibration startup glitch · a6a80e1d
      Linus Torvalds authored
      During bootup, when we reprogram the PIT (programmable interval timer)
      to start counting down from 0xffff in order to use it for the fast TSC
      calibration, we should also make sure to delay a bit afterwards to allow
      the PIT hardware to actually start counting with the new value.
      
      That will happens at the next CLK pulse (1.193182 MHz), so the easiest
      way to do that is to just wait at least one microsecond after
      programming the new PIT counter value.  We do that by just reading the
      counter value back once - which will take about 2us on PC hardware.
      Reported-and-tested-by: default avatarjohn stultz <johnstul@us.ibm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a6a80e1d
    • Ingo Molnar's avatar
      Merge branch 'tip/tracing/ftrace' of... · 4176935b
      Ingo Molnar authored
      Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
      4176935b
    • Tom Zanussi's avatar
      tracing: fix leak in event_format_read() · c269fc8c
      Tom Zanussi authored
      Impact: fix memory leak
      
      If event_format_read() exits early due to nonzero ppos, the
      previous kmalloc doesn't get freed - might as well do the
      check before the kmalloc and avoid the problem.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237270859.8033.141.camel@charm-linux>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c269fc8c
    • Ingo Molnar's avatar
      e4106133
    • Steven Rostedt's avatar
      tracing: stop comm recording on tracing off · 6adaad14
      Steven Rostedt authored
      Impact: fix for losing comms in trace
      
      The command lines of tasks are cached at sched switch to not need
      to record them at every trace point.  Disabling the tracing on stops
      the recording of traces, but does not stop the caching of command lines.
      When the tracing is off the cache may overflow and cause the tracing
      to show incorrect tasks matching the PIDs.
      
      This patch disables prevents updates to the comm cache when the ring buffer
      is off.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      6adaad14
    • Steven Rostedt's avatar
      tracing: protect reader of cmdline output · 4ca53085
      Steven Rostedt authored
      Impact: fix to one cause of incorrect comm outputs in trace
      
      The spinlock only protected the creation of a comm <=> pid pair.
      But it was possible that a reader could look up a pid, and get the
      wrong comm because it had no locking.
      
      This also required changing trace_find_cmdline to copy the comm cache
      and not just send back a pointer to it.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      4ca53085
    • Frederic Weisbecker's avatar
      tracing/ftrace: fix the check on nopped sites · 03303549
      Frederic Weisbecker authored
      Impact: fix a dynamic tracing failure
      
      Recently, the function and function graph tracers failed to use dynamic
      tracing after the following commit:
      
      fa9d13cf
      (ftrace: don't try to __ftrace_replace_code on !FTRACE_FL_CONVERTED rec)
      
      The patch is right except a mistake on the check for the FTRACE_FL_CONVERTED
      flag. The code patching is aborted in case of successfully nopped sites.
      What we want is the opposite: ignore the callsites that haven't been nopped.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      03303549
  4. 16 Mar, 2009 15 commits
    • Linus Torvalds's avatar
      Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 · 19695ec0
      Linus Torvalds authored
      * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
        acpi-wmi: unsigned cannot be less than 0
        thinkpad-acpi: fix module autoloading for older models
        acer-wmi: Unmark as 'experimental'
        acpi-wmi: Unmark as 'experimental'
        acer-wmi: double free in acer_rfkill_exit()
        platform/x86: depends instead of select for laptop platform drivers
        asus-laptop: use select instead of depends on
        eeepc-laptop: restore acpi_generate_proc_event()
        asus-laptop: restore acpi_generate_proc_event()
        acpi: check for pxm_to_node_map overflow
        ACPI: remove doubled status checking
        ACPI suspend: Blacklist Toshiba Satellite L300 that requires to set SCI_EN directly on resume
        Revert "ACPI: make some IO ports off-limits to AML"
        suspend: switch the Asus Pundit P1-AH2 to old ACPI sleep ordering
      19695ec0
    • Milan Broz's avatar
      dm crypt: wait for endio to complete before destruction · b35f8caa
      Milan Broz authored
      The following oops has been reported when dm-crypt runs over a loop device.
      
      ...
      [   70.381058] Process loop0 (pid: 4268, ti=cf3b2000 task=cf1cc1f0 task.ti=cf3b2000)
      ...
      [   70.381058] Call Trace:
      [   70.381058]  [<d0d76601>] ? crypt_dec_pending+0x5e/0x62 [dm_crypt]
      [   70.381058]  [<d0d767b8>] ? crypt_endio+0xa2/0xaa [dm_crypt]
      [   70.381058]  [<d0d76716>] ? crypt_endio+0x0/0xaa [dm_crypt]
      [   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
      [   70.381058]  [<d0806530>] ? dec_pending+0x224/0x23b [dm_mod]
      [   70.381058]  [<d08066e4>] ? clone_endio+0x79/0xa4 [dm_mod]
      [   70.381058]  [<d080666b>] ? clone_endio+0x0/0xa4 [dm_mod]
      [   70.381058]  [<c01a2f24>] ? bio_endio+0x2b/0x2e
      [   70.381058]  [<c02bad86>] ? loop_thread+0x380/0x3b7
      [   70.381058]  [<c02ba8a1>] ? do_lo_send_aops+0x0/0x165
      [   70.381058]  [<c013754f>] ? autoremove_wake_function+0x0/0x33
      [   70.381058]  [<c02baa06>] ? loop_thread+0x0/0x3b7
      
      When a table is being replaced, it waits for I/O to complete
      before destroying the mempool, but the endio function doesn't
      call mempool_free() until after completing the bio.
      
      Fix it by swapping the order of those two operations.
      
      The same problem occurs in dm.c with md referenced after dec_pending.
      Again, we swap the order.
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      b35f8caa
    • Huang Ying's avatar
      dm crypt: fix kcryptd_async_done parameter · b2174eeb
      Huang Ying authored
      In the async encryption-complete function (kcryptd_async_done), the
      crypto_async_request passed in may be different from the one passed to
      crypto_ablkcipher_encrypt/decrypt.  Only crypto_async_request->data is
      guaranteed to be same as the one passed in.  The current
      kcryptd_async_done uses the passed-in crypto_async_request directly
      which may cause the AES-NI-based AES algorithm implementation to panic.
      
      This patch fixes this bug by only using crypto_async_request->data,
      which points to dm_crypt_request, the crypto_async_request passed in.
      The original data (convert_context) is gotten from dm_crypt_request.
      
      [mbroz@redhat.com: reworked]
      Cc: stable@kernel.org
      Signed-off-by: default avatarHuang Ying <ying.huang@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      b2174eeb
    • Mikulas Patocka's avatar
      dm io: respect BIO_MAX_PAGES limit · d659e6cc
      Mikulas Patocka authored
      dm-io calls bio_get_nr_vecs to get the maximum number of pages to use
      for a given device.  It allocates one additional bio_vec to use
      internally but failed to respect BIO_MAX_PAGES, so fix this.
      
      This was the likely cause of:
        https://bugzilla.redhat.com/show_bug.cgi?id=173153
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      d659e6cc
    • Mikulas Patocka's avatar
      dm table: rework reference counting fix · f80a5570
      Mikulas Patocka authored
      Fix an error introduced in dm-table-rework-reference-counting.patch.
      
      When there is failure after table initialization, we need to use
      dm_table_destroy, not dm_table_put, to free the table.
      
      dm_table_put may be used only after dm_table_get.
      
      Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Reviewed-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      f80a5570
    • Milan Broz's avatar
      dm ioctl: validate name length when renaming · bc0fd67f
      Milan Broz authored
      When renaming a mapped device validate the length of the new name.
      
      The rename ioctl accepted any correctly-terminated string enclosed
      within the data passed from userspace.  The other ioctls enforce a
      size limit of DM_NAME_LEN.  If the name is changed and becomes longer
      than that, the device can no longer be addressed by name.
      
      Fix it by properly checking for device name length (including
      terminating zero).
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Reviewed-by: default avatarJonathan Brassow <jbrassow@redhat.com>
      Reviewed-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      bc0fd67f
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 8e91f178
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits)
        r8169: revert "r8169: read MAC address from EEPROM on init (2nd attempt)"
        r8169: use hardware auto-padding.
        igb: remove ASPM L0s workaround
        netxen: remove old flash check.
        mv643xx_eth: fix unicast address filter corruption on mtu change
        xfrm: Fix xfrm_state_find() wrt. wildcard source address.
        emac: Fix clock control for 405EX and 405EXr chips
        ixgbe: fix multiple unicast address support
        via-velocity: Fix DMA mapping length errors on transmit.
        qlge: bugfix: Pad outbound frames smaller than 60 bytes.
        qlge: bugfix: Move netif_napi_del() to common call point.
        qlge: bugfix: Tell hw to strip vlan header.
        qlge: bugfix: Increase filter on inbound csum.
        dnet: replace obsolete *netif_rx_* functions with *napi_*
        net: Add be2net driver.
        dnet: Fix warnings on 64-bit.
        dnet: Dave DNET ethernet controller driver (updated)
        ipv6:  Fix BUG when disabled ipv6 module is unloaded
        bnx2x: Using DMAE to initialize the chip
        bnx2x: Casting page alignment
        ...
      8e91f178
    • Rusty Russell's avatar
      linux.conf.au 2009: Tuz · 8032b526
      Rusty Russell authored
      Impact: help prevent extinction of species
      
      The Tasmanian Devil is a shy iconic Australian creature named for its
      spine-chilling screech.  It is threatened with extinction due to a
      scientifically interesting but horrific transmissible facial cancer.
      
      This one is standing in for Tux for one release using the far less-known
      Devil Facial Tux Disguise.
      
      	Save The Tasmanian Devil http://tassiedevil.com.auSigned-off-by: default avatarLinux.conf.au Hobart Team <contact@marchsouth.org>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8032b526
    • Zhang Le's avatar
      filp->f_pos not correctly updated in proc_task_readdir · ee6f779b
      Zhang Le authored
      filp->f_pos only get updated at the end of the function. Thus d_off of those
      dirents who are in the middle will be 0, and this will cause a problem in
      glibc's readdir implementation, specifically endless loop. Because when overflow
      occurs, f_pos will be set to next dirent to read, however it will be 0, unless
      the next one is the last one. So it will start over again and again.
      
      There is a sample program in man 2 gendents. This is the output of the program
      running on a multithread program's task dir before this patch is applied:
      
        $ ./a.out /proc/3807/task
        --------------- nread=128 ---------------
        i-node#  file type  d_reclen  d_off   d_name
          506442  directory    16          1  .
          506441  directory    16          0  ..
          506443  directory    16          0  3807
          506444  directory    16          0  3809
          506445  directory    16          0  3812
          506446  directory    16          0  3861
          506447  directory    16          0  3862
          506448  directory    16          8  3863
      
      This is the output after this patch is applied
      
        $ ./a.out /proc/3807/task
        --------------- nread=128 ---------------
        i-node#  file type  d_reclen  d_off   d_name
          506442  directory    16          1  .
          506441  directory    16          2  ..
          506443  directory    16          3  3807
          506444  directory    16          4  3809
          506445  directory    16          5  3812
          506446  directory    16          6  3861
          506447  directory    16          7  3862
          506448  directory    16          8  3863
      Signed-off-by: default avatarZhang Le <r0bertz@gentoo.org>
      Acked-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ee6f779b
    • Frederic Weisbecker's avatar
      tracing/core: fix early free of cpumasks · 2fc1dfbe
      Frederic Weisbecker authored
      Impact: fix crashes when tracing cpumasks
      
      While ring-buffer allocation, the cpumasks are allocated too,
      including the tracing cpumask and the per-cpu file mask handler.
      But these cpumasks are freed accidentally just after.
      Fix it.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237164303-11476-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2fc1dfbe
    • Frederic Weisbecker's avatar
      tracing/ftrace: fix double calls to tracing_start() · ac1d52d0
      Frederic Weisbecker authored
      Impact: fix a warning during preemptirqsoff selftests
      
      When the preemptirqsoff selftest fails, we see the following
      warning:
      
      [    6.050000] Testing tracer preemptirqsoff: .. no entries found ..
      ------------[ cut here ]------------
      [    6.060000] WARNING: at kernel/trace/trace.c:688 tracing_start+0x67/0xd3()
      [    6.060000] Modules linked in:
      [    6.060000] Pid: 1, comm: swapper Tainted: G
      [    6.060000] Call Trace:
      [    6.060000]  [<ffffffff802460ff>] warn_slowpath+0xb1/0x100
      [    6.060000]  [<ffffffff802a8f5b>] ? trace_preempt_on+0x35/0x4b
      [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
      [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
      [    6.060000]  [<ffffffff80271e0b>] ? __lock_acquired+0xe6/0x1f2
      [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
      [    6.060000]  [<ffffffff802a3831>] tracing_start+0x67/0xd3
      [    6.060000]  [<ffffffff802a8ace>] ? irqsoff_tracer_reset+0x2d/0x57
      [    6.060000]  [<ffffffff802a4d1c>] trace_selftest_startup_preemptirqsoff+0x1c8/0x1f1
      [    6.060000]  [<ffffffff802a4798>] register_tracer+0x12f/0x241
      [    6.060000]  [<ffffffff810250d0>] ? init_irqsoff_tracer+0x0/0x53
      [    6.060000]  [<ffffffff8102510b>] init_irqsoff_tracer+0x3b/0x53
      
      This is because in fail case, the preemptirqsoff tracer selftest calls twice
      the tracing_start() function:
      
      int
      trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *tr)
      {
              if (!ret && !count) {
                      printk(KERN_CONT ".. no entries found ..");
                      ret = -1;
                      tracing_start(); <-----
                      goto out;
              }
              [...]
      out:
              trace->reset(tr);
              tracing_start(); <------
              tracing_max_latency = save_max;
      
              return ret;
      }
      
      Since it is well handled in the out path, we don't need the conditional one.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237159961-7447-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ac1d52d0
    • Frederic Weisbecker's avatar
      tracing/core: fix missing mutex unlock on tracing_set_tracer() · 59f586db
      Frederic Weisbecker authored
      Impact: fix possible locking imbalance
      
      In case of ring buffer resize failure, tracing_set_tracer forgot to
      release trace_types_lock. Fix it.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237151439-6755-5-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      59f586db
    • Frederic Weisbecker's avatar
      tracing/syscalls: select kallsysms · 0ea1c415
      Frederic Weisbecker authored
      Syscall tracing must select kallsysms.
      
      The arch code builds a table to find the syscall metadata by syscall
      number. It needs the syscalls names resolution from the symbol table
      to know which name found on the syscalls metadatas match a function
      pointer from the arch sys_call_table.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237151439-6755-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0ea1c415
    • Frederic Weisbecker's avatar
      tracing/syscalls: protect thread flag toggling from races · 5be71b61
      Frederic Weisbecker authored
      Impact: fix syscall tracer enable/disable race
      
      The current thread flag toggling is racy as shown in the following
      scenario:
      
      - task A is the last user of syscall tracing, it releases the
        TIF_SYSCALL_FTRACE on each tasks
      
      - at the same time task B start syscall tracing. refcount == 0 so
        it sets up TIF_SYSCALL_FTRACE on each tasks.
      
      The effect of the mixup is unpredictable.
      So this fix adds a mutex on {start,stop}_syscall_tracing().
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      LKML-Reference: <1237151439-6755-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5be71b61
    • Frederic Weisbecker's avatar
      tracing/syscalls: various cleanups · 64044345
      Frederic Weisbecker authored
      Impact: cleanup
      
      - Drop unused cpu variable
      - Fix some errors on comments
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1237151439-6755-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      64044345