* [PATCH] watchdog: print all locks on a softlock
@ 2014-05-01 18:55 Eric Paris
2014-05-01 19:17 ` Don Zickus
0 siblings, 1 reply; 5+ messages in thread
From: Eric Paris @ 2014-05-01 18:55 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Paris, Frederic Weisbecker, Andrew Morton, Don Zickus,
Michal Hocko, Ben Zhang
If the CPU hits a softlockup this patch will also have it print the
information about all locks being held on the system. This might help
determine if a lock is being held too long leading to this problem.
Signed-off-by: Eric Paris <eparis@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Ben Zhang <benzh@chromium.org>
---
kernel/watchdog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 516203e..a027240 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -322,6 +322,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
current->comm, task_pid_nr(current));
print_modules();
print_irqtrace_events(current);
+ debug_show_all_locks();
if (regs)
show_regs(regs);
else
--
1.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] watchdog: print all locks on a softlock
2014-05-01 18:55 [PATCH] watchdog: print all locks on a softlock Eric Paris
@ 2014-05-01 19:17 ` Don Zickus
2014-05-01 20:09 ` Frederic Weisbecker
0 siblings, 1 reply; 5+ messages in thread
From: Don Zickus @ 2014-05-01 19:17 UTC (permalink / raw)
To: Eric Paris
Cc: linux-kernel, Frederic Weisbecker, Andrew Morton, Michal Hocko,
Ben Zhang
On Thu, May 01, 2014 at 02:55:35PM -0400, Eric Paris wrote:
> If the CPU hits a softlockup this patch will also have it print the
> information about all locks being held on the system. This might help
> determine if a lock is being held too long leading to this problem.
I am not sure this helps you. A softlockup is the result of pre-emption
disabled, ie the scheduler not being called after 60 seconds. Holding a
lock does not disable pre-emption usually. So I don't think this is going
to add anything.
Are you trying to debug a hung task? The the hung_task thread checks to
see if a task hasn't scheduled in 2 minutes or so. That could be the
result of long lock (but that output already dumps the lockdep stuff).
Cheers,
Don
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Don Zickus <dzickus@redhat.com>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Ben Zhang <benzh@chromium.org>
> ---
> kernel/watchdog.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index 516203e..a027240 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -322,6 +322,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
> current->comm, task_pid_nr(current));
> print_modules();
> print_irqtrace_events(current);
> + debug_show_all_locks();
> if (regs)
> show_regs(regs);
> else
> --
> 1.9.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] watchdog: print all locks on a softlock
2014-05-01 19:17 ` Don Zickus
@ 2014-05-01 20:09 ` Frederic Weisbecker
2014-05-01 20:43 ` Frederic Weisbecker
2014-05-01 21:11 ` Don Zickus
0 siblings, 2 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2014-05-01 20:09 UTC (permalink / raw)
To: Don Zickus
Cc: Eric Paris, linux-kernel, Andrew Morton, Michal Hocko, Ben Zhang
On Thu, May 01, 2014 at 03:17:20PM -0400, Don Zickus wrote:
> On Thu, May 01, 2014 at 02:55:35PM -0400, Eric Paris wrote:
> > If the CPU hits a softlockup this patch will also have it print the
> > information about all locks being held on the system. This might help
> > determine if a lock is being held too long leading to this problem.
>
> I am not sure this helps you. A softlockup is the result of pre-emption
> disabled, ie the scheduler not being called after 60 seconds. Holding a
> lock does not disable pre-emption usually. So I don't think this is going
> to add anything.
>
> Are you trying to debug a hung task? The the hung_task thread checks to
> see if a task hasn't scheduled in 2 minutes or so. That could be the
> result of long lock (but that output already dumps the lockdep stuff).
There may be some deadlocks that lockdep doesn't detect yet. 2 example:
1) spinlock <-> IPI dependency
CPU 0 CPU 1
--------------------------------------------------------
spin_lock_irq(A)
smp_send_function_single_async(CPU 1, func)
//IPI
func {
spin_lock(1)
}
But this should be resolved with a virtual lock on the IPI functions.
I should try that.
2) rwlock <-> IPI
CPU 0 CPU 1
--------------------------------------------------------
read_lock(A)
write_lock_irq(A)
smp_send_function_single(CPU 1, func)
//IPI never happens
This one is much trickier.
Anyway those are the only scenario I know of but there may be more. When possible
we want to extend lockdep to detect new scenarios of deadlock but we don't have the
guarantee that it can detect everything.
So, could be useful...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] watchdog: print all locks on a softlock
2014-05-01 20:09 ` Frederic Weisbecker
@ 2014-05-01 20:43 ` Frederic Weisbecker
2014-05-01 21:11 ` Don Zickus
1 sibling, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2014-05-01 20:43 UTC (permalink / raw)
To: Don Zickus; +Cc: Eric Paris, LKML, Andrew Morton, Michal Hocko, Ben Zhang
2014-05-01 22:09 GMT+02:00 Frederic Weisbecker <fweisbec@gmail.com>:
> On Thu, May 01, 2014 at 03:17:20PM -0400, Don Zickus wrote:
>> On Thu, May 01, 2014 at 02:55:35PM -0400, Eric Paris wrote:
>> > If the CPU hits a softlockup this patch will also have it print the
>> > information about all locks being held on the system. This might help
>> > determine if a lock is being held too long leading to this problem.
>>
>> I am not sure this helps you. A softlockup is the result of pre-emption
>> disabled, ie the scheduler not being called after 60 seconds. Holding a
>> lock does not disable pre-emption usually. So I don't think this is going
>> to add anything.
>>
>> Are you trying to debug a hung task? The the hung_task thread checks to
>> see if a task hasn't scheduled in 2 minutes or so. That could be the
>> result of long lock (but that output already dumps the lockdep stuff).
>
> There may be some deadlocks that lockdep doesn't detect yet. 2 example:
>
> 1) spinlock <-> IPI dependency
>
>
> CPU 0 CPU 1
> --------------------------------------------------------
> spin_lock_irq(A)
> smp_send_function_single_async(CPU 1, func)
> //IPI
> func {
> spin_lock(1)
> }
>
> But this should be resolved with a virtual lock on the IPI functions.
> I should try that.
So actually this one above shouldn't be a problem because the _async
version doesn't wait for the IPI to complete. But the below still
looks possible.
>
> 2) rwlock <-> IPI
>
> CPU 0 CPU 1
> --------------------------------------------------------
> read_lock(A)
> write_lock_irq(A)
> smp_send_function_single(CPU 1, func)
> //IPI never happens
>
> This one is much trickier.
>
> Anyway those are the only scenario I know of but there may be more. When possible
> we want to extend lockdep to detect new scenarios of deadlock but we don't have the
> guarantee that it can detect everything.
>
> So, could be useful...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] watchdog: print all locks on a softlock
2014-05-01 20:09 ` Frederic Weisbecker
2014-05-01 20:43 ` Frederic Weisbecker
@ 2014-05-01 21:11 ` Don Zickus
1 sibling, 0 replies; 5+ messages in thread
From: Don Zickus @ 2014-05-01 21:11 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Eric Paris, linux-kernel, Andrew Morton, Michal Hocko, Ben Zhang
On Thu, May 01, 2014 at 10:09:01PM +0200, Frederic Weisbecker wrote:
> On Thu, May 01, 2014 at 03:17:20PM -0400, Don Zickus wrote:
> > On Thu, May 01, 2014 at 02:55:35PM -0400, Eric Paris wrote:
> > > If the CPU hits a softlockup this patch will also have it print the
> > > information about all locks being held on the system. This might help
> > > determine if a lock is being held too long leading to this problem.
> >
> > I am not sure this helps you. A softlockup is the result of pre-emption
> > disabled, ie the scheduler not being called after 60 seconds. Holding a
> > lock does not disable pre-emption usually. So I don't think this is going
> > to add anything.
> >
> > Are you trying to debug a hung task? The the hung_task thread checks to
> > see if a task hasn't scheduled in 2 minutes or so. That could be the
> > result of long lock (but that output already dumps the lockdep stuff).
>
> There may be some deadlocks that lockdep doesn't detect yet. 2 example:
>
> 1) spinlock <-> IPI dependency
>
>
> CPU 0 CPU 1
> --------------------------------------------------------
> spin_lock_irq(A)
> smp_send_function_single_async(CPU 1, func)
> //IPI
> func {
> spin_lock(1)
> }
>
> But this should be resolved with a virtual lock on the IPI functions.
> I should try that.
>
> 2) rwlock <-> IPI
>
> CPU 0 CPU 1
> --------------------------------------------------------
> read_lock(A)
> write_lock_irq(A)
> smp_send_function_single(CPU 1, func)
> //IPI never happens
The hardlockup detector would go off here. And dumping all the cpus in
the system (something we don't do today), would show this scenario. I see
this scenario a lot during page flushes on RHEL (a lot being once every
other month or so).
Cheers,
Don
>
> This one is much trickier.
>
> Anyway those are the only scenario I know of but there may be more. When possible
> we want to extend lockdep to detect new scenarios of deadlock but we don't have the
> guarantee that it can detect everything.
>
> So, could be useful...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-01 21:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-01 18:55 [PATCH] watchdog: print all locks on a softlock Eric Paris
2014-05-01 19:17 ` Don Zickus
2014-05-01 20:09 ` Frederic Weisbecker
2014-05-01 20:43 ` Frederic Weisbecker
2014-05-01 21:11 ` Don Zickus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox