1. 02 Mar, 2017 1 commit
  2. 26 Aug, 2014 1 commit
  3. 27 Aug, 2012 1 commit
    • Robert Richter's avatar
      oprofile: Remove 'WQ on CPUx, prefer CPUy' warning · 61bccf19
      Robert Richter authored
      Under certain workloads we see the following warnings:
      
       WQ on CPU0, prefer CPU1
       WQ on CPU0, prefer CPU2
       WQ on CPU0, prefer CPU3
      
      It warns the user that the wq to access a per-cpu buffers runs not on
      the same cpu. This happens if the wq is rescheduled on a different cpu
      than where the buffer is located. This was probably implemented to
      detect performance issues. Not sure if there actually is one as the
      buffers are copied to a single buffer anyway which should be the
      actual bottleneck.
      
      We wont change WQ implementation. Since a user can do nothing the
      warning is pointless. Removing it.
      
      Cc: Andi Kleen <andi@firstfloor.org>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      61bccf19
  4. 15 Feb, 2011 1 commit
  5. 29 Oct, 2010 1 commit
  6. 25 Aug, 2010 1 commit
    • Robert Richter's avatar
      oprofile: fix crash when accessing freed task structs · 750d857c
      Robert Richter authored
      This patch fixes a crash during shutdown reported below. The crash is
      caused by accessing already freed task structs. The fix changes the
      order for registering and unregistering notifier callbacks.
      
      All notifiers must be initialized before buffers start working. To
      stop buffer synchronization we cancel all workqueues, unregister the
      notifier callback and then flush all buffers. After all of this we
      finally can free all tasks listed.
      
      This should avoid accessing freed tasks.
      
      On 22.07.10 01:14:40, Benjamin Herrenschmidt wrote:
      
      > So the initial observation is a spinlock bad magic followed by a crash
      > in the spinlock debug code:
      >
      > [ 1541.586531] BUG: spinlock bad magic on CPU#5, events/5/136
      > [ 1541.597564] Unable to handle kernel paging request for data at address 0x6b6b6b6b6b6b6d03
      >
      > Backtrace looks like:
      >
      >       spin_bug+0x74/0xd4
      >       ._raw_spin_lock+0x48/0x184
      >       ._spin_lock+0x10/0x24
      >       .get_task_mm+0x28/0x8c
      >       .sync_buffer+0x1b4/0x598
      >       .wq_sync_buffer+0xa0/0xdc
      >       .worker_thread+0x1d8/0x2a8
      >       .kthread+0xa8/0xb4
      >       .kernel_thread+0x54/0x70
      >
      > So we are accessing a freed task struct in the work queue when
      > processing the samples.
      Reported-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      750d857c
  7. 03 May, 2010 1 commit
  8. 23 Apr, 2010 1 commit
    • Andi Kleen's avatar
      oprofile: remove double ring buffering · cb6e943c
      Andi Kleen authored
      oprofile used a double buffer scheme for its cpu event buffer
      to avoid races on reading with the old locked ring buffer.
      
      But that is obsolete now with the new ring buffer, so simply
      use a single buffer. This greatly simplifies the code and avoids
      a lot of sample drops on large runs, especially with call graph.
      
      Based on suggestions from Steven Rostedt
      
      For stable kernels from v2.6.32, but not earlier.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      cb6e943c
  9. 01 Apr, 2010 1 commit
    • Steven Rostedt's avatar
      ring-buffer: Add place holder recording of dropped events · 66a8cb95
      Steven Rostedt authored
      Currently, when the ring buffer drops events, it does not record
      the fact that it did so. It does inform the writer that the event
      was dropped by returning a NULL event, but it does not put in any
      place holder where the event was dropped.
      
      This is not a trivial thing to add because the ring buffer mostly
      runs in overwrite (flight recorder) mode. That is, when the ring
      buffer is full, new data will overwrite old data.
      
      In a produce/consumer mode, where new data is simply dropped when
      the ring buffer is full, it is trivial to add the placeholder
      for dropped events. When there's more room to write new data, then
      a special event can be added to notify the reader about the dropped
      events.
      
      But in overwrite mode, any new write can overwrite events. A place
      holder can not be inserted into the ring buffer since there never
      may be room. A reader could also come in at anytime and miss the
      placeholder.
      
      Luckily, the way the ring buffer works, the read side can find out
      if events were lost or not, and how many events. Everytime a write
      takes place, if it overwrites the header page (the next read) it
      updates a "overrun" variable that keeps track of the number of
      lost events. When a reader swaps out a page from the ring buffer,
      it can record this number, perfom the swap, and then check to
      see if the number changed, and take the diff if it has, which would be
      the number of events dropped. This can be stored by the reader
      and returned to callers of the reader.
      
      Since the reader page swap will fail if the writer moved the head
      page since the time the reader page set up the swap, this gives room
      to record the overruns without worrying about races. If the reader
      sets up the pages, records the overrun, than performs the swap,
      if the swap succeeds, then the overrun variable has not been
      updated since the setup before the swap.
      
      For binary readers of the ring buffer, a flag is set in the header
      of each sub page (sub buffer) of the ring buffer. This flag is embedded
      in the size field of the data on the sub buffer, in the 31st bit (the size
      can be 32 or 64 bits depending on the architecture), but only 27
      bits needs to be used for the actual size (less actually).
      
      We could add a new field in the sub buffer header to also record the
      number of events dropped since the last read, but this will change the
      format of the binary ring buffer a bit too much. Perhaps this change can
      be made if the information on the number of events dropped is considered
      important enough.
      
      Note, the notification of dropped events is only used by consuming reads
      or peeking at the ring buffer. Iterating over the ring buffer does not
      keep this information because the necessary data is only available when
      a page swap is made, and the iterator does not swap out pages.
      
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      66a8cb95
  10. 29 Oct, 2009 1 commit
    • Tejun Heo's avatar
      percpu: make percpu symbols in oprofile unique · b3e9f672
      Tejun Heo authored
      This patch updates percpu related symbols in oprofile such that percpu
      symbols are unique and don't clash with local symbols.  This serves
      two purposes of decreasing the possibility of global percpu symbol
      collision and allowing dropping per_cpu__ prefix from percpu symbols.
      
      * drivers/oprofile/cpu_buffer.c: s/cpu_buffer/op_cpu_buffer/
      
      Partly based on Rusty Russell's "alloc_percpu: rename percpu vars
      which cause name clashes" patch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarRobert Richter <robert.richter@amd.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      b3e9f672
  11. 11 Jun, 2009 2 commits
  12. 07 May, 2009 1 commit
  13. 06 Feb, 2009 1 commit
  14. 17 Jan, 2009 1 commit
  15. 07 Jan, 2009 11 commits
  16. 30 Dec, 2008 1 commit
  17. 29 Dec, 2008 5 commits
  18. 16 Dec, 2008 1 commit
  19. 10 Dec, 2008 7 commits
    • Robert Richter's avatar
      oprofile: fix lost sample counter · 211117ff
      Robert Richter authored
      The number of lost samples could be greater than the number of
      received samples. This patches fixes this. The implementation
      introduces return values for add_sample() and add_code().
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      211117ff
    • Robert Richter's avatar
      oprofile: remove nr_available_slots() · 1d7503b5
      Robert Richter authored
      This function is no longer available after the port to the new ring
      buffer. Its removal can lead to incomplete sampling sequences since
      IBS samples and backtraces are transfered in multiple samples. Due to
      a full buffer, samples could be lost any time. The userspace daemon
      has to live with such incomplete sampling sequences as long as the
      data within one sample is consistent.
      
      This will be fixed by changing the internal buffer data there all data
      of one IBS sample or a backtrace is packed in a single ring buffer
      entry. This is possible since the new ring buffer supports variable
      data size.
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      1d7503b5
    • Robert Richter's avatar
      oprofile: port to the new ring_buffer · 6dad828b
      Robert Richter authored
      This patch replaces the current oprofile cpu buffer implementation
      with the ring buffer provided by the tracing framework. The motivation
      here is to leave the pain of implementing ring buffers to others. Oh,
      no, there are more advantages. Main reason is the support of different
      sample sizes that could be stored in the buffer. Use cases for this
      are IBS and Cell spu profiling. Using the new ring buffer ensures
      valid and complete samples and allows copying the cpu buffer stateless
      without knowing its content. Second it will use generic kernel API and
      also reduce code size. And hopefully, there are less bugs.
      
      Since the new tracing ring buffer implementation uses spin locks to
      protect the buffer during read/write access, it is difficult to use
      the buffer in an NMI handler. In this case, writing to the buffer by
      the NMI handler (x86) could occur also during critical sections when
      reading the buffer. To avoid this, there are 2 buffers for independent
      read and write access. Read access is in process context only, write
      access only in the NMI handler. If the read buffer runs empty, both
      buffers are swapped atomically. There is potentially a small window
      during swapping where the buffers are disabled and samples could be
      lost.
      
      Using 2 buffers is a little bit overhead, but the solution is clear
      and does not require changes in the ring buffer implementation. It can
      be changed to a single buffer solution when the ring buffer access is
      implemented as non-locking atomic code.
      
      The new buffer requires more size to store the same amount of samples
      because each sample includes an u32 header. Also, there is more code
      to execute for buffer access. Nonetheless, the buffer implementation
      is proven in the ftrace environment and worth to use also in oprofile.
      
      Patches that changes the internal IBS buffer usage will follow.
      
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      6dad828b
    • Robert Richter's avatar
      oprofile: moving cpu_buffer_reset() to cpu_buffer.h · fbc9bf9f
      Robert Richter authored
      This is in preparation for changes in the cpu buffer implementation.
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      fbc9bf9f
    • Robert Richter's avatar
      oprofile: adding cpu_buffer_write_commit() · 229234ae
      Robert Richter authored
      This is in preparation for changes in the cpu buffer implementation.
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      229234ae
    • Robert Richter's avatar
      oprofile: adding cpu buffer r/w access functions · 7d468abe
      Robert Richter authored
      This is in preparation for changes in the cpu buffer implementation.
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      7d468abe
    • Robert Richter's avatar
      oprofile: whitspace changes only · cdc1834d
      Robert Richter authored
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      cdc1834d