1. 14 10月, 2008 31 次提交
    • P
      mmiotrace: handle TRACE_PRINT entries · fc5e27ae
      Pekka Paalanen 提交于
      Also make trace_seq_print_cont() non-static, and add a newline if the
      seq buffer can't hold all data.
      Signed-off-by: NPekka Paalanen <pq@iki.fi>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fc5e27ae
    • P
      x86 mmiotrace: implement mmiotrace_printk() · 9e57fb35
      Pekka Paalanen 提交于
      Offer mmiotrace users a function to inject markers from inside the kernel.
      This depends on the trace_vprintk() patch.
      Signed-off-by: NPekka Paalanen <pq@iki.fi>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9e57fb35
    • P
      ftrace: add trace_vprintk() · 801fe400
      Pekka Paalanen 提交于
      trace_vprintk() for easier implementation of tracer specific *_printk
      functions. Add check check for no_tracer, and implement
      __ftrace_printk() as a wrapper.
      Signed-off-by: NPekka Paalanen <pq@iki.fi>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      801fe400
    • P
      ftrace: move mmiotrace functions out of trace.c · 45dcd8b8
      Pekka Paalanen 提交于
      Moves the mmiotrace specific functions from trace.c to
      trace_mmiotrace.c. Functions trace_wake_up(), tracing_get_trace_entry(),
      and tracing_generic_entry_update() are therefore made available outside
      trace.c.
      Signed-off-by: NPekka Paalanen <pq@iki.fi>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      45dcd8b8
    • S
      ftrace: fix unlocking of hash · 644f991d
      Steven Rostedt 提交于
      This must be brown paper bag week for Steven Rostedt!
      
      While working on ftrace for PPC, I discovered that the hash locking done
      when CONFIG_FTRACE_MCOUNT_RECORD is not set, is totally incorrect.
      
      With a cut and paste error, I had the hash lock macro to lock for both
      hash_lock _and_ hash_unlock!
      
      This bug did not affect x86 since this bug was introduced when
      CONFIG_FTRACE_MCOUNT_RECORD was added to x86.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      644f991d
    • I
      ftrace: make it depend on DEBUG_KERNEL · d3ee6d99
      Ingo Molnar 提交于
      make most of the tracers depend on DEBUG_KERNEL - that's their intended
      purpose. (most distributions have DEBUG_KERNEL enabled anyway so this is
      not a practical limitation - but it simplifies the tracing menu in the
      normal case)
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d3ee6d99
    • P
      ftrace: sched_switch: show the wakee's cpu · 80b5e940
      Peter Zijlstra 提交于
      While profiling the smp behaviour of the scheduler it was needed to know to
      which cpu a task got woken.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      80b5e940
    • P
      ftrace: make ftrace_printk usable with the other tracers · f09ce573
      Peter Zijlstra 提交于
      Currently ftrace_printk only works with the ftrace tracer, switch it to an
      iter_ctrl setting so we can make us of them with other tracers too.
      
      [rostedt@redhat.com: tweak to the disable condition]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f09ce573
    • S
      ftrace: print continue index fix · 5a90f577
      Steven Rostedt 提交于
      An item in the trace buffer that is bigger than one entry may be split
      up using the TRACE_CONT entry. This makes it a virtual single entry.
      The current code increments the iterator index even while traversing
      TRACE_CONT entries, making it look like the iterator is further than
      it actually is.
      
      This patch adds code to not increment the iterator index while skipping
      over TRACE_CONT entries.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5a90f577
    • S
      ftrace: binary and not logical for continue test · 652567aa
      Steven Rostedt 提交于
      Peter Zijlstra provided me with a nice brown paper bag while letting me know
      that I was doing a logical AND and not a binary one, making a condition
      true more often than it should be.
      
      Luckily, a false true is handled by the calling function and no harm is
      done. But this needs to be fixed regardless.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      652567aa
    • M
      ftrace: make output nicely spaced for up to 999 cpus · a6168353
      Michael Ellerman 提交于
      Currently some of the ftrace output goes skewiff if you have more
      than 9 cpus, and some if you have more than 99.
      
      Twiddle with the headers and format strings to make up to 999 cpus
      display without causing spacing problems.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Acked-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a6168353
    • I
      stack tracer: depends on DEBUG_KERNEL · 2ff01c6a
      Ingo Molnar 提交于
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2ff01c6a
    • S
      ftrace: stack trace add indexes · 1b6cced6
      Steven Rostedt 提交于
      This patch adds indexes into the stack that the functions in the
      stack dump were found at. As an added bonus, I also added a diff
      to show which function is the most notorious consumer of the stack.
      
      The output now looks like this:
      
      # cat /debug/tracing/stack_trace
              Depth   Size      Location    (48 entries)
              -----   ----      --------
        0)     2476     212   blk_recount_segments+0x39/0x59
        1)     2264      12   bio_phys_segments+0x16/0x1d
        2)     2252      20   blk_rq_bio_prep+0x23/0xaf
        3)     2232      12   init_request_from_bio+0x74/0x77
        4)     2220      56   __make_request+0x294/0x331
        5)     2164     136   generic_make_request+0x34f/0x37d
        6)     2028      56   submit_bio+0xe7/0xef
        7)     1972      28   submit_bh+0xd1/0xf0
        8)     1944     112   block_read_full_page+0x299/0x2a9
        9)     1832       8   blkdev_readpage+0x14/0x16
       10)     1824      28   read_cache_page_async+0x7e/0x109
       11)     1796      16   read_cache_page+0x11/0x49
       12)     1780      32   read_dev_sector+0x3c/0x72
       13)     1748      48   read_lba+0x4d/0xaa
       14)     1700     168   efi_partition+0x85/0x61b
       15)     1532      72   rescan_partitions+0x10e/0x266
       16)     1460      40   do_open+0x1c7/0x24e
       17)     1420     292   __blkdev_get+0x79/0x84
       18)     1128      12   blkdev_get+0x12/0x14
       19)     1116      20   register_disk+0xd1/0x11e
       20)     1096      28   add_disk+0x34/0x90
       21)     1068      52   sd_probe+0x2b1/0x366
       22)     1016      20   driver_probe_device+0xa5/0x120
       23)      996       8   __device_attach+0xd/0xf
       24)      988      32   bus_for_each_drv+0x3e/0x68
       25)      956      24   device_attach+0x56/0x6c
       26)      932      16   bus_attach_device+0x26/0x4d
       27)      916      64   device_add+0x380/0x4b4
       28)      852      28   scsi_sysfs_add_sdev+0xa1/0x1c9
       29)      824     160   scsi_probe_and_add_lun+0x919/0xa2a
       30)      664      36   __scsi_add_device+0x88/0xae
       31)      628      44   ata_scsi_scan_host+0x9e/0x21c
       32)      584      28   ata_host_register+0x1cb/0x1db
       33)      556      24   ata_host_activate+0x98/0xb5
       34)      532     192   ahci_init_one+0x9bd/0x9e9
       35)      340      20   pci_device_probe+0x3e/0x5e
       36)      320      20   driver_probe_device+0xa5/0x120
       37)      300      20   __driver_attach+0x3f/0x5e
       38)      280      36   bus_for_each_dev+0x40/0x62
       39)      244      12   driver_attach+0x19/0x1b
       40)      232      28   bus_add_driver+0x9c/0x1af
       41)      204      28   driver_register+0x76/0xd2
       42)      176      20   __pci_register_driver+0x44/0x71
       43)      156       8   ahci_init+0x14/0x16
       44)      148     100   _stext+0x42/0x122
       45)       48      20   kernel_init+0x175/0x1dc
       46)       28      28   kernel_thread_helper+0x7/0x10
      
      The first column is simply an index starting from the inner most function
      and counting down to the outer most.
      
      The next column is the location that the function was found on the stack.
      
      The next column is the size of the stack for that function.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1b6cced6
    • S
      ftrace: remove direct reference to mcount in trace code · 3b47bfc1
      Steven Rostedt 提交于
      The mcount record method of ftrace scans objdump for references to mcount.
      Using mcount as the reference to test if the calls to mcount being replaced
      are indeed calls to mcount, this use of mcount was also caught as a
      location to change. Using a variable that points to the mcount address
      moves this reference into the data section that is not scanned, and
      we do not use a false location to try and modify.
      
      The warn on code was what was used to detect this bug.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3b47bfc1
    • S
      ftrace: add stack tracer · e5a81b62
      Steven Rostedt 提交于
      This is another tracer using the ftrace infrastructure, that examines
      at each function call the size of the stack. If the stack use is greater
      than the previous max it is recorded.
      
      You can always see (and set) the max stack size seen. By setting it
      to zero will start the recording again. The backtrace is also available.
      
      For example:
      
      # cat /debug/tracing/stack_max_size
      1856
      
      # cat /debug/tracing/stack_trace
      [<c027764d>] stack_trace_call+0x8f/0x101
      [<c021b966>] ftrace_call+0x5/0x8
      [<c02553cc>] clocksource_get_next+0x12/0x48
      [<c02542a5>] update_wall_time+0x538/0x6d1
      [<c0245913>] do_timer+0x23/0xb0
      [<c0257657>] tick_do_update_jiffies64+0xd9/0xf1
      [<c02576b9>] tick_sched_timer+0x4a/0xad
      [<c0250fe6>] __run_hrtimer+0x3e/0x75
      [<c02518ed>] hrtimer_interrupt+0xf1/0x154
      [<c022c870>] smp_apic_timer_interrupt+0x71/0x84
      [<c021b7e9>] apic_timer_interrupt+0x2d/0x34
      [<c0238597>] finish_task_switch+0x29/0xa0
      [<c05abd13>] schedule+0x765/0x7be
      [<c05abfca>] schedule_timeout+0x1b/0x90
      [<c05ab4d4>] wait_for_common+0xab/0x101
      [<c05ab5ac>] wait_for_completion+0x12/0x14
      [<c033cfc3>] blk_execute_rq+0x84/0x99
      [<c0402470>] scsi_execute+0xc2/0x105
      [<c040250a>] scsi_execute_req+0x57/0x7f
      [<c043afe0>] sr_test_unit_ready+0x3e/0x97
      [<c043bbd6>] sr_media_change+0x43/0x205
      [<c046b59f>] media_changed+0x48/0x77
      [<c046b5ff>] cdrom_media_changed+0x31/0x37
      [<c043b091>] sr_block_media_changed+0x16/0x18
      [<c02b9e69>] check_disk_change+0x1b/0x63
      [<c046f4c3>] cdrom_open+0x7a1/0x806
      [<c043b148>] sr_block_open+0x78/0x8d
      [<c02ba4c0>] do_open+0x90/0x257
      [<c02ba869>] blkdev_open+0x2d/0x56
      [<c0296a1f>] __dentry_open+0x14d/0x23c
      [<c0296b32>] nameidata_to_filp+0x24/0x38
      [<c02a1c68>] do_filp_open+0x347/0x626
      [<c02967ef>] do_sys_open+0x47/0xbc
      [<c02968b0>] sys_open+0x23/0x2b
      [<c021aadd>] sysenter_do_call+0x12/0x26
      
      I've tested this on both x86_64 and i386.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e5a81b62
    • I
      ftrace: clean up macro usage · ac8825ec
      Ingo Molnar 提交于
      enclose the argument in parenthesis. (especially since we cast it,
      which is a high prio operation)
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ac8825ec
    • S
      ftrace: fix build failure · 2d7da80f
      Stephen Rothwell 提交于
      After disabling FTRACE_MCOUNT_RECORD via a patch, a dormant build
      failure surfaced:
      
       kernel/trace/ftrace.c: In function 'ftrace_record_ip':
       kernel/trace/ftrace.c:416: error: incompatible type for argument 1 of '_spin_lock_irqsave'
       kernel/trace/ftrace.c:433: error: incompatible type for argument 1 of '_spin_lock_irqsave'
      
      Introduced by commit 6dad8e07f4c10b17b038e84d29f3ca41c2e55cd0 ("ftrace:
      add necessary locking for ftrace records").
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2d7da80f
    • S
      ftrace: add necessary locking for ftrace records · 99ecdc43
      Steven Rostedt 提交于
      The new design of pre-recorded mcounts and updating the code outside of
      kstop_machine has changed the way the records themselves are protected.
      
      This patch uses the ftrace_lock to protect the records. Note, the lock
      still does not need to be taken within calls that are only called via
      kstop_machine, since the that code can not run while the spin lock is held.
      
      Also removed the hash_lock needed for the daemon when MCOUNT_RECORD is
      configured. Also did a slight cleanup of an unused variable.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      99ecdc43
    • S
      ftrace: do not init module on ftrace disabled · 00fd61ae
      Steven Rostedt 提交于
      If one of the self tests of ftrace has disabled the function tracer,
      do not run the code to convert the mcount calls in modules.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      00fd61ae
    • F
      ftrace: fix some mistakes in error messages · 98a983aa
      Frédéric Weisbecker 提交于
      This patch fixes some mistakes on the tracer in warning messages when
      debugfs fails to create tracing files.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: srostedt@redhat.com
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      98a983aa
    • S
      ftrace: dump out ftrace buffers to console on panic · 3f5a54e3
      Steven Rostedt 提交于
      At OLS I had a lot of interest to be able to have the ftrace buffers
      dumped on panic.  Usually one would expect to uses kexec and examine
      the buffers after a new kernel is loaded. But sometimes the resources
      do not permit kdump and kexec, so having an option to still see the
      sequence of events up to the crash is very advantageous.
      
      This patch adds the option to have the ftrace buffers dumped to the
      console in the latency_trace format on a panic. When the option is set,
      the default entries per CPU buffer are lowered to 16384, since the writing
      to the serial (if that is the console) may take an awful long time
      otherwise.
      
      [
       Changes since -v1:
        Got alpine to send correctly (as well as spell check working).
        Removed config option.
        Moved the static variables into ftrace_dump itself.
        Gave printk a log level.
      ]
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f5a54e3
    • S
      ftrace: ftrace_printk doc moved · 2f2c99db
      Steven Rostedt 提交于
      Based on Randy Dunlap's suggestion, the ftrace_printk kernel-doc belongs
      with the ftrace_printk macro that should be used. Not with the
      __ftrace_printk internal function.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Acked-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2f2c99db
    • S
      ftrace: printk formatting infrastructure · dd0e545f
      Steven Rostedt 提交于
      This patch adds a feature that can help kernel developers debug their
      code using ftrace.
      
        int ftrace_printk(const char *fmt, ...);
      
      This records into the ftrace buffer using printf formatting. The entry
      size in the buffers are still a fixed length. A new type has been added
      that allows for more entries to be used for a single recording.
      
      The start of the print is still the same as the other entries.
      
      It returns the number of characters written to the ftrace buffer.
      
      For example:
      
      Having a module with the following code:
      
      static int __init ftrace_print_test(void)
      {
              ftrace_printk("jiffies are %ld\n", jiffies);
              return 0;
      }
      
      Gives me:
      
        insmod-5441  3...1 7569us : ftrace_print_test: jiffies are 4296626666
      
      for the latency_trace file and:
      
                insmod-5441  [03]  1959.370498: ftrace_print_test jiffies are 4296626666
      
      for the trace file.
      
      Note: Only the infrastructure should go into the kernel. It is to help
      facilitate debugging for other kernel developers. Calls to ftrace_printk
      is not intended to be left in the kernel, and should be frowned upon just
      like scattering printks around in the code.
      
      But having this easily at your fingertips helps the debugging go faster
      and bugs be solved quicker.
      
      Maybe later on, we can hook this with markers and have their printf format
      be sucked into ftrace output.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      dd0e545f
    • S
      ftrace: new continue entry - separate out from trace_entry · 2e2ca155
      Steven Rostedt 提交于
      Some tracers will need to work with more than one entry. In order to do this
      the trace_entry structure was split into two fields. One for the start of
      all entries, and one to continue an existing entry.
      
      The trace_entry structure now has a "field" entry that consists of the previous
      content of the trace_entry, and a "cont" entry that is just a string buffer
      the size of the "field" entry.
      
      Thanks to Andrew Morton for suggesting this idea.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2e2ca155
    • S
      ftrace: remove old pointers to mcount · fed1939c
      Steven Rostedt 提交于
      When a mcount pointer is recorded into a table, it is used to add or
      remove calls to mcount (replacing them with nops). If the code is removed
      via removing a module, the pointers still exist.  At modifying the code
      a check is always made to make sure the code being replaced is the code
      expected. In-other-words, the code being replaced is compared to what
      it is expected to be before being replaced.
      
      There is a very small chance that the code being replaced just happens
      to look like code that calls mcount (very small since the call to mcount
      is relative). To remove this chance, this patch adds ftrace_release to
      allow module unloading to remove the pointers to mcount within the module.
      
      Another change for init calls is made to not trace calls marked with
      __init. The tracing can not be started until after init is done anyway.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fed1939c
    • S
      ftrace: do not show freed records in available_filter_functions · a9fdda33
      Steven Rostedt 提交于
      Seems that freed records can appear in the available_filter_functions list.
      This patch fixes that.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a9fdda33
    • S
      ftrace: enable mcount recording for modules · 90d595fe
      Steven Rostedt 提交于
      This patch enables the loading of the __mcount_section of modules and
      changing all the callers of mcount into nops.
      
      The modification is done before the init_module function is called, so
      again, we do not need to use kstop_machine to make these changes.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      90d595fe
    • S
      ftrace: mcount call site on boot nops core · 68bf21aa
      Steven Rostedt 提交于
      This is the infrastructure to the converting the mcount call sites
      recorded by the __mcount_loc section into nops on boot. It also allows
      for using these sites to enable tracing as normal. When the __mcount_loc
      section is used, the "ftraced" kernel thread is disabled.
      
      This uses the current infrastructure to record the mcount call sites
      as well as convert them to nops. The mcount function is kept as a stub
      on boot up and not converted to the ftrace_record_ip function. We use the
      ftrace_record_ip to only record from the table.
      
      This patch does not handle modules. That comes with a later patch.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      68bf21aa
    • S
      ftrace: create __mcount_loc section · 8da3821b
      Steven Rostedt 提交于
      This patch creates a section in the kernel called "__mcount_loc".
      This will hold a list of pointers to the mcount relocation for
      each call site of mcount.
      
      For example:
      
      objdump -dr init/main.o
      [...]
      Disassembly of section .text:
      
      0000000000000000 <do_one_initcall>:
         0:   55                      push   %rbp
      [...]
      000000000000017b <init_post>:
       17b:   55                      push   %rbp
       17c:   48 89 e5                mov    %rsp,%rbp
       17f:   53                      push   %rbx
       180:   48 83 ec 08             sub    $0x8,%rsp
       184:   e8 00 00 00 00          callq  189 <init_post+0xe>
                              185: R_X86_64_PC32      mcount+0xfffffffffffffffc
      [...]
      
      We will add a section to point to each function call.
      
         .section __mcount_loc,"a",@progbits
      [...]
         .quad .text + 0x185
      [...]
      
      The offset to of the mcount call site in init_post is an offset from
      the start of the section, and not the start of the function init_post.
      The mcount relocation is at the call site 0x185 from the start of the
      .text section.
      
        .text + 0x185  == init_post + 0xa
      
      We need a way to add this __mcount_loc section in a way that we do not
      lose the relocations after final link.  The .text section here will
      be attached to all other .text sections after final link and the
      offsets will be meaningless.  We need to keep track of where these
      .text sections are.
      
      To do this, we use the start of the first function in the section.
      do_one_initcall.  We can make a tmp.s file with this function as a reference
      to the start of the .text section.
      
         .section __mcount_loc,"a",@progbits
      [...]
         .quad do_one_initcall + 0x185
      [...]
      
      Then we can compile the tmp.s into a tmp.o
      
        gcc -c tmp.s -o tmp.o
      
      And link it into back into main.o.
      
        ld -r main.o tmp.o -o tmp_main.o
        mv tmp_main.o main.o
      
      But we have a problem.  What happens if the first function in a section
      is not exported, and is a static function. The linker will not let
      the tmp.o use it.  This case exists in main.o as well.
      
      Disassembly of section .init.text:
      
      0000000000000000 <set_reset_devices>:
         0:   55                      push   %rbp
         1:   48 89 e5                mov    %rsp,%rbp
         4:   e8 00 00 00 00          callq  9 <set_reset_devices+0x9>
                              5: R_X86_64_PC32        mcount+0xfffffffffffffffc
      
      The first function in .init.text is a static function.
      
      00000000000000a8 t __setup_set_reset_devices
      000000000000105f t __setup_str_set_reset_devices
      0000000000000000 t set_reset_devices
      
      The lowercase 't' means that set_reset_devices is local and is not exported.
      If we simply try to link the tmp.o with the set_reset_devices we end
      up with two symbols: one local and one global.
      
       .section __mcount_loc,"a",@progbits
       .quad set_reset_devices + 0x10
      
      00000000000000a8 t __setup_set_reset_devices
      000000000000105f t __setup_str_set_reset_devices
      0000000000000000 t set_reset_devices
                       U set_reset_devices
      
      We still have an undefined reference to set_reset_devices, and if we try
      to compile the kernel, we will end up with an undefined reference to
      set_reset_devices, or even worst, it could be exported someplace else,
      and then we will have a reference to the wrong location.
      
      To handle this case, we make an intermediate step using objcopy.
      We convert set_reset_devices into a global exported symbol before linking
      it with tmp.o and set it back afterwards.
      
      00000000000000a8 t __setup_set_reset_devices
      000000000000105f t __setup_str_set_reset_devices
      0000000000000000 T set_reset_devices
      
      00000000000000a8 t __setup_set_reset_devices
      000000000000105f t __setup_str_set_reset_devices
      0000000000000000 T set_reset_devices
      
      00000000000000a8 t __setup_set_reset_devices
      000000000000105f t __setup_str_set_reset_devices
      0000000000000000 t set_reset_devices
      
      Now we have a section in main.o called __mcount_loc that we can place
      somewhere in the kernel using vmlinux.ld.S and access it to convert
      all these locations that call mcount into nops before starting SMP
      and thus, eliminating the need to do this with kstop_machine.
      
      Note, A well documented perl script (scripts/recordmcount.pl) is used
      to do all this in one location.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8da3821b
    • I
      tracing: clean up tracepoints kconfig structure · 5f87f112
      Ingo Molnar 提交于
      do not expose users to CONFIG_TRACEPOINTS - tracers can select it
      just fine.
      
      update ftrace to select CONFIG_TRACEPOINTS.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5f87f112
    • M
      ftrace: port to tracepoints · b07c3f19
      Mathieu Desnoyers 提交于
      Porting the trace_mark() used by ftrace to tracepoints. (cleanup)
      
      Changelog :
      - Change error messages : marker -> tracepoint
      
      [ mingo@elte.hu: conflict resolutions ]
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Acked-by: N'Peter Zijlstra' <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b07c3f19
  2. 29 9月, 2008 1 次提交
    • T
      hrtimer: prevent migration of per CPU hrtimers · ccc7dadf
      Thomas Gleixner 提交于
      Impact: per CPU hrtimers can be migrated from a dead CPU
      
      The hrtimer code has no knowledge about per CPU timers, but we need to
      prevent the migration of such timers and warn when such a timer is
      active at migration time.
      
      Explicitely mark the timers as per CPU and use a more understandable
      mode descriptor for the interrupts safe unlocked callback mode, which
      is used by hrtimer_sleeper and the scheduler code.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      ccc7dadf
  3. 28 7月, 2008 2 次提交
  4. 26 7月, 2008 3 次提交
  5. 24 7月, 2008 1 次提交
  6. 19 7月, 2008 2 次提交
    • M
      cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr · 65c01184
      Mike Travis 提交于
        * This patch replaces the dangerous lvalue version of cpumask_of_cpu
          with new cpumask_of_cpu_ptr macros.  These are patterned after the
          node_to_cpumask_ptr macros.
      
          In general terms, if there is a cpumask_of_cpu_map[] then a pointer to
          the cpumask_of_cpu_map[cpu] entry is used.  The cpumask_of_cpu_map
          is provided when there is a large NR_CPUS count, reducing
          greatly the amount of code generated and stack space used for
          cpumask_of_cpu().  The pointer to the cpumask_t value is needed for
          calling set_cpus_allowed_ptr() to reduce the amount of stack space
          needed to pass the cpumask_t value.
      
          If there isn't a cpumask_of_cpu_map[], then a temporary variable is
          declared and filled in with value from cpumask_of_cpu(cpu) as well as
          a pointer variable pointing to this temporary variable.  Afterwards,
          the pointer is used to reference the cpumask value.  The compiler
          will optimize out the extra dereference through the pointer as well
          as the stack space used for the pointer, resulting in identical code.
      
          A good example of the orthogonal usages is in net/sunrpc/svc.c:
      
      	case SVC_POOL_PERCPU:
      	{
      		unsigned int cpu = m->pool_to[pidx];
      		cpumask_of_cpu_ptr(cpumask, cpu);
      
      		*oldmask = current->cpus_allowed;
      		set_cpus_allowed_ptr(current, cpumask);
      		return 1;
      	}
      	case SVC_POOL_PERNODE:
      	{
      		unsigned int node = m->pool_to[pidx];
      		node_to_cpumask_ptr(nodecpumask, node);
      
      		*oldmask = current->cpus_allowed;
      		set_cpus_allowed_ptr(current, nodecpumask);
      		return 1;
      	}
      Signed-off-by: NMike Travis <travis@sgi.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      65c01184
    • S
      ftrace: only trace preempt off with preempt tracer · 1e01cb0c
      Steven Rostedt 提交于
      When PREEMPT_TRACER and IRQSOFF_TRACER are both configured and irqsoff
      tracer is running, the preempt_off sections might also be traced.
      
      Thanks to Andrew Morton for pointing out my mistake of spin_lock disabling
      interrupts while he was reviewing ftrace.txt. Seems that my example I used
      actually hit this bug.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1e01cb0c