1. 22 4月, 2011 5 次提交
    • S
      lockdep: Replace "Bad BFS generated tree" message with something less cryptic · 6be8c393
      Steven Rostedt 提交于
      The message of "Bad BFS generated tree" is a bit confusing.
      Replace it with a more sane error message.
      
      Thanks to Peter Zijlstra for helping me come up with a better
      message.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20110421014300.135521252@goodmis.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      6be8c393
    • S
      lockdep: Print a nicer description for irq inversion bugs · dad3d743
      Steven Rostedt 提交于
      Irq inversion and irq dependency bugs are only subtly
      different. The diffenerence lies where the interrupt occurred.
      
      For irq dependency:
      
      	irq_disable
      	lock(A)
      	lock(B)
      	unlock(B)
      	unlock(A)
      	irq_enable
      
      	lock(B)
      	unlock(B)
      
       	<interrupt>
      	  lock(A)
      
      The interrupt comes in after it has been established that lock A
      can be held when taking an irq unsafe lock. Lockdep detects the
      problem when taking lock A in interrupt context.
      
      With the irq_inversion the irq happens before it is established
      and lockdep detects the problem with the taking of lock B:
      
       	<interrupt>
      	  lock(A)
      
      	irq_disable
      	lock(A)
      	lock(B)
      	unlock(B)
      	unlock(A)
      	irq_enable
      
      	lock(B)
      	unlock(B)
      
      Since the problem with the locking logic for both of these issues
      is in actuality the same, they both should report the same scenario.
      This patch implements that and prints this:
      
      other info that might help us debug this:
      
      Chain exists of:
        &rq->lock --> lockA --> lockC
      
       Possible interrupt unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(lockC);
                                     local_irq_disable();
                                     lock(&rq->lock);
                                     lock(lockA);
        <Interrupt>
          lock(&rq->lock);
      
       *** DEADLOCK ***
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20110421014259.910720381@goodmis.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      dad3d743
    • S
      lockdep: Print a nicer description for simple deadlocks · 48702ecf
      Steven Rostedt 提交于
      Lockdep output can be pretty cryptic, having nicer output
      can save a lot of head scratching. When a simple deadlock
      scenario is detected by lockdep (lock A -> lock A) we now
      get the following new output:
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&(lock)->rlock);
        lock(&(lock)->rlock);
      
       *** DEADLOCK ***
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20110421014259.643930104@goodmis.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      48702ecf
    • S
      lockdep: Print a nicer description for normal deadlocks · f4185812
      Steven Rostedt 提交于
      The lockdep output can be pretty cryptic, having nicer output
      can save a lot of head scratching. When a normal deadlock
      scenario is detected by lockdep (lock A -> lock B and there
      exists a place where lock B -> lock A) we now get the following
      new output:
      
      other info that might help us debug this:
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(lockB);
                                     lock(lockA);
                                     lock(lockB);
        lock(lockA);
      
       *** DEADLOCK ***
      
      On cases where there's a deeper chair, it shows the partial
      chain that can cause the issue:
      
      Chain exists of:
        lockC --> lockA --> lockB
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(lockB);
                                     lock(lockA);
                                     lock(lockB);
        lock(lockC);
      
       *** DEADLOCK ***
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20110421014259.380621789@goodmis.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      f4185812
    • S
      lockdep: Print a nicer description for irq lock inversions · 3003eba3
      Steven Rostedt 提交于
      Locking order inversion due to interrupts is a subtle problem.
      
      When an irq lockiinversion discovered by lockdep it currently
      reports something like:
      
      [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
      
      ... and then prints out the locks that are involved, as back traces.
      
      Judging by lkml feedback developers were routinely confused by what
      a HARDIRQ->safe to unsafe issue is all about, and sometimes even
      blew it off as a bug in lockdep.
      
      It is not obvious when lockdep prints this message about a lock that
      is never taken in interrupt context.
      
      After explaining the problems that lockdep is reporting, I
      decided to add a description of the problem in visual form. Now
      the following is shown:
      
       ---
      other info that might help us debug this:
      
       Possible interrupt unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(lockA);
                                     local_irq_disable();
                                     lock(&rq->lock);
                                     lock(lockA);
        <Interrupt>
          lock(&rq->lock);
      
       *** DEADLOCK ***
      
       ---
      
      The above is the case when the unsafe lock is taken while
      holding a lock taken in irq context. But when a lock is taken
      that also grabs a unsafe lock, the call chain is shown:
      
       ---
      other info that might help us debug this:
      
      Chain exists of:
        &rq->lock --> lockA --> lockC
      
       Possible interrupt unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(lockC);
                                     local_irq_disable();
                                     lock(&rq->lock);
                                     lock(lockA);
        <Interrupt>
          lock(&rq->lock);
      
       *** DEADLOCK ***
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20110421014259.132728798@goodmis.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      3003eba3
  2. 19 4月, 2011 1 次提交
    • L
      next_pidmap: fix overflow condition · c78193e9
      Linus Torvalds 提交于
      next_pidmap() just quietly accepted whatever 'last' pid that was passed
      in, which is not all that safe when one of the users is /proc.
      
      Admittedly the proc code should do some sanity checking on the range
      (and that will be the next commit), but that doesn't mean that the
      helper functions should just do that pidmap pointer arithmetic without
      checking the range of its arguments.
      
      So clamp 'last' to PID_MAX_LIMIT.  The fact that we then do "last+1"
      doesn't really matter, the for-loop does check against the end of the
      pidmap array properly (it's only the actual pointer arithmetic overflow
      case we need to worry about, and going one bit beyond isn't going to
      overflow).
      
      [ Use PID_MAX_LIMIT rather than pid_max as per Eric Biederman ]
      Reported-by: NTavis Ormandy <taviso@cmpxchg8b.com>
      Analyzed-by: NRobert Święcki <robert@swiecki.net>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Pavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c78193e9
  3. 18 4月, 2011 1 次提交
  4. 16 4月, 2011 2 次提交
    • J
      block: make unplug timer trace event correspond to the schedule() unplug · 49cac01e
      Jens Axboe 提交于
      It's a pretty close match to what we had before - the timer triggering
      would mean that nobody unplugged the plug in due time, in the new
      scheme this matches very closely what the schedule() unplug now is.
      It's essentially the difference between an explicit unplug (IO unplug)
      or an implicit unplug (timer unplug, we scheduled with pending IO
      queued).
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      49cac01e
    • J
      block: let io_schedule() flush the plug inline · a237c1c5
      Jens Axboe 提交于
      Linus correctly observes that the most important dispatch cases
      are now done from kblockd, this isn't ideal for latency reasons.
      The original reason for switching dispatches out-of-line was to
      avoid too deep a stack, so by _only_ letting the "accidental"
      flush directly in schedule() be guarded by offload to kblockd,
      we should be able to get the best of both worlds.
      
      So add a blk_schedule_flush_plug() that offloads to kblockd,
      and only use that from the schedule() path.
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      a237c1c5
  5. 15 4月, 2011 1 次提交
  6. 13 4月, 2011 1 次提交
  7. 12 4月, 2011 4 次提交
  8. 11 4月, 2011 3 次提交
    • K
      sched: Fix erroneous all_pinned logic · b30aef17
      Ken Chen 提交于
      The scheduler load balancer has specific code to deal with cases of
      unbalanced system due to lots of unmovable tasks (for example because of
      hard CPU affinity). In those situation, it excludes the busiest CPU that
      has pinned tasks for load balance consideration such that it can perform
      second 2nd load balance pass on the rest of the system.
      
      This all works as designed if there is only one cgroup in the system.
      
      However, when we have multiple cgroups, this logic has false positives and
      triggers multiple load balance passes despite there are actually no pinned
      tasks at all.
      
      The reason it has false positives is that the all pinned logic is deep in
      the lowest function of can_migrate_task() and is too low level:
      
      load_balance_fair() iterates each task group and calls balance_tasks() to
      migrate target load. Along the way, balance_tasks() will also set a
      all_pinned variable. Given that task-groups are iterated, this all_pinned
      variable is essentially the status of last group in the scanning process.
      Task group can have number of reasons that no load being migrated, none
      due to cpu affinity. However, this status bit is being propagated back up
      to the higher level load_balance(), which incorrectly think that no tasks
      were moved.  It kick off the all pinned logic and start multiple passes
      attempt to move load onto puller CPU.
      
      To fix this, move the all_pinned aggregation up at the iterator level.
      This ensures that the status is aggregated over all task-groups, not just
      last one in the list.
      Signed-off-by: NKen Chen <kenchen@google.com>
      Cc: stable@kernel.org
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/BANLkTi=ernzNawaR5tJZEsV_QVnfxqXmsQ@mail.gmail.comSigned-off-by: NIngo Molnar <mingo@elte.hu>
      b30aef17
    • K
      sched: Fix sched-domain avg_load calculation · b0432d8f
      Ken Chen 提交于
      In function find_busiest_group(), the sched-domain avg_load isn't
      calculated at all if there is a group imbalance within the domain. This
      will cause erroneous imbalance calculation.
      
      The reason is that calculate_imbalance() sees sds->avg_load = 0 and it
      will dump entire sds->max_load into imbalance variable, which is used
      later on to migrate entire load from busiest CPU to the puller CPU.
      
      This has two really bad effect:
      
      1. stampede of task migration, and they won't be able to break out
         of the bad state because of positive feedback loop: large load
         delta -> heavier load migration -> larger imbalance and the cycle
         goes on.
      
      2. severe imbalance in CPU queue depth.  This causes really long
         scheduling latency blip which affects badly on application that
         has tight latency requirement.
      
      The fix is to have kernel calculate domain avg_load in both cases. This
      will ensure that imbalance calculation is always sensible and the target
      is usually half way between busiest and puller CPU.
      Signed-off-by: NKen Chen <kenchen@google.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      Link: http://lkml.kernel.org/r/20110408002322.3A0D812217F@elm.corp.google.comSigned-off-by: NIngo Molnar <mingo@elte.hu>
      b0432d8f
    • S
      perf_event: Fix cgrp event scheduling bug in perf_enable_on_exec() · e566b76e
      Stephane Eranian 提交于
      There is a bug in perf_event_enable_on_exec() when cgroup events are
      active on a CPU: the cgroup events may be scheduled twice causing event
      state corruptions which eventually may lead to kernel panics.
      
      The reason is that the function needs to first schedule out the cgroup
      events, just like for the per-thread events. The cgroup event are
      scheduled back in automatically from the perf_event_context_sched_in()
      function.
      
      The patch also adds a WARN_ON_ONCE() is perf_cgroup_switch() to catch any
      bogus state.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20110406005454.GA1062@quadSigned-off-by: NIngo Molnar <mingo@elte.hu>
      e566b76e
  9. 09 4月, 2011 1 次提交
  10. 05 4月, 2011 3 次提交
  11. 04 4月, 2011 1 次提交
  12. 03 4月, 2011 1 次提交
  13. 01 4月, 2011 1 次提交
  14. 31 3月, 2011 5 次提交
  15. 30 3月, 2011 3 次提交
  16. 29 3月, 2011 7 次提交