Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723027 > unrolled thread
| Started by | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| First post | 2017-08-30 07:20 +0200 |
| Last post | 2017-08-30 14:30 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-30 07:20 +0200
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Byungchul Park <byungchul.park@lge.com> - 2017-08-30 07:50 +0200
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-30 08:20 +0200
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Peter Zijlstra <peterz@infradead.org> - 2017-08-30 10:50 +0200
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Peter Zijlstra <peterz@infradead.org> - 2017-08-30 10:50 +0200
RE: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] "Byungchul Park" <byungchul.park@lge.com> - 2017-08-30 11:00 +0200
Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-30 14:30 +0200
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Date | 2017-08-30 07:20 +0200 |
| Subject | Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] |
| Message-ID | <uk3zY-484-5@gated-at.bofh.it> |
On (08/23/17 09:03), Byungchul Park wrote:
[..]
> > Byungchul, did you add the crosslock checks to lockdep? Can you have a look at
> > the above report? That report namely doesn't make sense to me.
>
> The report is talking about the following lockup:
>
> A work in a worker A task work on exit to user
> ------------------ ---------------------------
> mutex_lock(&bdev->bd_mutex)
> mutext_lock(&bdev->bd_mutex)
> blk_execute_rq()
> wait_for_completion_io_timeout(&A)
> complete(&A)
>
[..]
> To Peterz,
>
> Anyway I wanted to avoid lockdep reports in the case using a timeout
> interface. Do you think it's still worth reporting the kind of lockup?
> I'm ok if you do.
Byungchul, a quick question.
have you measured the performance impact? somehow my linux-next is
notably slower than earlier 4.13 linux-next. (e.g. scrolling in vim
is irritatingly slow)
`time dmesg' shows some difference, but probably that's not a good
test.
!LOCKDEP LOCKDEP LOCKDEP -CROSSRELEASE -COMPLETIONS
real 0m0.661s 0m2.290s 0m1.920s
user 0m0.010s 0m0.105s 0m0.000s
sys 0m0.636s 0m2.224s 0m1.888s
anyone else "sees"/"can confirm" the slow down?
it gets back to "usual normal" when I disable CROSSRELEASE and COMPLETIONS.
---
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b19c491cbc4e..cdc30ef81c5e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1091,8 +1091,6 @@ config PROVE_LOCKING
select DEBUG_MUTEXES
select DEBUG_RT_MUTEXES if RT_MUTEXES
select DEBUG_LOCK_ALLOC
- select LOCKDEP_CROSSRELEASE
- select LOCKDEP_COMPLETIONS
select TRACE_IRQFLAGS
default n
help
---
-ss
[toc] | [next] | [standalone]
| From | Byungchul Park <byungchul.park@lge.com> |
|---|---|
| Date | 2017-08-30 07:50 +0200 |
| Message-ID | <uk430-4hO-21@gated-at.bofh.it> |
| In reply to | #1723027 |
On Wed, Aug 30, 2017 at 02:20:37PM +0900, Sergey Senozhatsky wrote: > Byungchul, a quick question. Hello Sergey, > have you measured the performance impact? somehow my linux-next is Yeah, it might have performance impact inevitably. > notably slower than earlier 4.13 linux-next. (e.g. scrolling in vim > is irritatingly slow) To Ingo, I cannot decide if we have to roll back CONFIG_LOCKDEP_CROSSRELEASE dependency on CONFIG_PROVE_LOCKING in Kconfig. With them enabled, lockdep detection becomes strong but has performance impact. But, it's anyway a debug option so IMHO we don't have to take case of the performance impact. Please let me know your decision. > `time dmesg' shows some difference, but probably that's not a good > test. > > !LOCKDEP LOCKDEP LOCKDEP -CROSSRELEASE -COMPLETIONS > real 0m0.661s 0m2.290s 0m1.920s > user 0m0.010s 0m0.105s 0m0.000s > sys 0m0.636s 0m2.224s 0m1.888s > > anyone else "sees"/"can confirm" the slow down? > > > it gets back to "usual normal" when I disable CROSSRELEASE and COMPLETIONS. > > --- > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index b19c491cbc4e..cdc30ef81c5e 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -1091,8 +1091,6 @@ config PROVE_LOCKING > select DEBUG_MUTEXES > select DEBUG_RT_MUTEXES if RT_MUTEXES > select DEBUG_LOCK_ALLOC > - select LOCKDEP_CROSSRELEASE > - select LOCKDEP_COMPLETIONS > select TRACE_IRQFLAGS > default n > help > > --- > > -ss
[toc] | [prev] | [next] | [standalone]
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Date | 2017-08-30 08:20 +0200 |
| Message-ID | <uk4w2-4Jz-23@gated-at.bofh.it> |
| In reply to | #1723040 |
Hi, On (08/30/17 14:43), Byungchul Park wrote: [..] > > notably slower than earlier 4.13 linux-next. (e.g. scrolling in vim > > is irritatingly slow) > > To Ingo, > > I cannot decide if we have to roll back CONFIG_LOCKDEP_CROSSRELEASE > dependency on CONFIG_PROVE_LOCKING in Kconfig. With them enabled, > lockdep detection becomes strong but has performance impact. But, > it's anyway a debug option so IMHO we don't have to take case of the > performance impact. Please let me know your decision. well, I expected it :) I've been running lockdep enabled kernels for years, and was OK with the performance. but now it's just too much and I'm looking at disabling lockdep. a more relevant test -- compilation of a relatively small project LOCKDEP -CROSSRELEASE -COMPLETIONS LOCKDEP +CROSSRELEASE +COMPLETIONS real 1m23.722s real 2m9.969s user 4m11.300s user 4m15.458s sys 0m49.386s sys 2m3.594s you don't want to know how much time now it takes to recompile the kernel ;) -ss
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-08-30 10:50 +0200 |
| Message-ID | <uk6Rc-63h-29@gated-at.bofh.it> |
| In reply to | #1723058 |
On Wed, Aug 30, 2017 at 03:15:11PM +0900, Sergey Senozhatsky wrote:
> Hi,
>
> On (08/30/17 14:43), Byungchul Park wrote:
> [..]
> > > notably slower than earlier 4.13 linux-next. (e.g. scrolling in vim
> > > is irritatingly slow)
> >
> > To Ingo,
> >
> > I cannot decide if we have to roll back CONFIG_LOCKDEP_CROSSRELEASE
> > dependency on CONFIG_PROVE_LOCKING in Kconfig. With them enabled,
> > lockdep detection becomes strong but has performance impact. But,
> > it's anyway a debug option so IMHO we don't have to take case of the
> > performance impact. Please let me know your decision.
>
> well, I expected it :)
>
> I've been running lockdep enabled kernels for years, and was OK with
> the performance. but now it's just too much and I'm looking at disabling
> lockdep.
>
> a more relevant test -- compilation of a relatively small project
>
> LOCKDEP -CROSSRELEASE -COMPLETIONS LOCKDEP +CROSSRELEASE +COMPLETIONS
>
> real 1m23.722s real 2m9.969s
> user 4m11.300s user 4m15.458s
> sys 0m49.386s sys 2m3.594s
>
>
> you don't want to know how much time now it takes to recompile the
> kernel ;)
Right,.. so when I look at perf annotate for __lock_acquire and
lock_release (the two most expensive lockdep functions in a kernel
profile) I don't actually see much cross-release stuff.
So the overhead looks to be spread out over all sorts, which makes it
harder to find and fix.
stack unwinding is done lots and is fairly expensive, I've not yet
checked if crossrelease does too much of that.
The below saved about 50% of my __lock_acquire() time, not sure it made
a significant difference over all though.
---
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 44c8d0d17170..f8db1ead1c48 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3386,7 +3386,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (!class)
return 0;
}
- atomic_inc((atomic_t *)&class->ops);
+ /* atomic_inc((atomic_t *)&class->ops); */
if (very_verbose(class)) {
printk("\nacquire class [%p] %s", class->key, class->name);
if (class->name_version > 1)
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-08-30 10:50 +0200 |
| Message-ID | <uk6Rd-63h-39@gated-at.bofh.it> |
| In reply to | #1723122 |
On Wed, Aug 30, 2017 at 10:42:07AM +0200, Peter Zijlstra wrote: > > So the overhead looks to be spread out over all sorts, which makes it > harder to find and fix. > > stack unwinding is done lots and is fairly expensive, I've not yet > checked if crossrelease does too much of that. Aah, we do an unconditional stack unwind for every __lock_acquire() now. It keeps a trace in the xhlocks[]. Does the below cure most of that overhead? diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 44c8d0d17170..7b872036b72e 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -4872,7 +4872,7 @@ static void add_xhlock(struct held_lock *hlock) xhlock->trace.max_entries = MAX_XHLOCK_TRACE_ENTRIES; xhlock->trace.entries = xhlock->trace_entries; xhlock->trace.skip = 3; - save_stack_trace(&xhlock->trace); + /* save_stack_trace(&xhlock->trace); */ } static inline int same_context_xhlock(struct hist_lock *xhlock)
[toc] | [prev] | [next] | [standalone]
| From | "Byungchul Park" <byungchul.park@lge.com> |
|---|---|
| Date | 2017-08-30 11:00 +0200 |
| Subject | RE: possible circular locking dependency detected [was: linux-next: Tree for Aug 22] |
| Message-ID | <uk70S-66H-41@gated-at.bofh.it> |
| In reply to | #1723124 |
> -----Original Message----- > From: Peter Zijlstra [mailto:peterz@infradead.org] > Sent: Wednesday, August 30, 2017 5:48 PM > To: Sergey Senozhatsky > Cc: Byungchul Park; Bart Van Assche; linux-kernel@vger.kernel.org; linux- > block@vger.kernel.org; martin.petersen@oracle.com; axboe@kernel.dk; linux- > scsi@vger.kernel.org; sfr@canb.auug.org.au; linux-next@vger.kernel.org; > kernel-team@lge.com > Subject: Re: possible circular locking dependency detected [was: linux- > next: Tree for Aug 22] > > On Wed, Aug 30, 2017 at 10:42:07AM +0200, Peter Zijlstra wrote: > > > > So the overhead looks to be spread out over all sorts, which makes it > > harder to find and fix. > > > > stack unwinding is done lots and is fairly expensive, I've not yet > > checked if crossrelease does too much of that. > > Aah, we do an unconditional stack unwind for every __lock_acquire() now. > It keeps a trace in the xhlocks[]. Yeah.. I also think this is most significant.. > > Does the below cure most of that overhead? > > diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c > index 44c8d0d17170..7b872036b72e 100644 > --- a/kernel/locking/lockdep.c > +++ b/kernel/locking/lockdep.c > @@ -4872,7 +4872,7 @@ static void add_xhlock(struct held_lock *hlock) > xhlock->trace.max_entries = MAX_XHLOCK_TRACE_ENTRIES; > xhlock->trace.entries = xhlock->trace_entries; > xhlock->trace.skip = 3; > - save_stack_trace(&xhlock->trace); > + /* save_stack_trace(&xhlock->trace); */ > } > > static inline int same_context_xhlock(struct hist_lock *xhlock)
[toc] | [prev] | [next] | [standalone]
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Date | 2017-08-30 14:30 +0200 |
| Message-ID | <ukai6-8hx-41@gated-at.bofh.it> |
| In reply to | #1723124 |
Hello Peter, On (08/30/17 10:47), Peter Zijlstra wrote: [..] > On Wed, Aug 30, 2017 at 10:42:07AM +0200, Peter Zijlstra wrote: > > > > So the overhead looks to be spread out over all sorts, which makes it > > harder to find and fix. > > > > stack unwinding is done lots and is fairly expensive, I've not yet > > checked if crossrelease does too much of that. > > Aah, we do an unconditional stack unwind for every __lock_acquire() now. > It keeps a trace in the xhlocks[]. > > Does the below cure most of that overhead? thanks. mostly yes. the kernel is not so dramatically slower now. it's still seems to be a bit slower, which is expected I suppose, but over all it's much better real 1m35.209s user 4m12.467s sys 0m49.457s // approx 10 seconds slower. -ss
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web