lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <33103ab3-6237-4215-b8de-bef680bef691@linux.dev>
Date: Tue, 27 May 2025 19:59:26 +0800
From: Lance Yang <lance.yang@...ux.dev>
To: Waiman Long <llong@...hat.com>, peterz@...radead.org
Cc: mingo@...hat.com, will@...nel.org, boqun.feng@...il.com,
 linux-kernel@...r.kernel.org, Lance Yang <ioworker0@...il.com>,
 Zi Li <zi.li@...ux.dev>
Subject: Re: [WARN] LOCKDEP: MAX_LOCKDEP_CHAIN_HLOCKS too low



On 2025/5/27 13:53, Waiman Long wrote:
> MAX_LOCKDEP_CHAIN_HLOCKS is composed of 2 parts - (1 << 
> MAX_LOCKDEP_CHAINS_BITS) and AVG_LOCKDEP_CHAIN_DEPTH (5). I believe that 
> the average lock chain length is probably bigger than 5 now. We will 
> have to check the /proc/lockdep file to figure out if we should increase 
> it as well. Anyway, I think we should increase 

Yeah, just checked `/proc/lockdep_stats` on my machine, and it shows
'max locking depth: 30':

$ cat /proc/lockdep_stats
  lock-classes:                         2074 [max: 8192]
  direct dependencies:                 22596 [max: 32768]
  indirect dependencies:              124267
  all direct dependencies:            527384
  dependency chains:                   51354 [max: 65536]
  dependency chain hlocks used:       327679 [max: 327680]
  dependency chain hlocks lost:            1
  in-hardirq chains:                     209
  in-softirq chains:                    1068
  in-process chains:                   50076
  stack-trace entries:                306274 [max: 524288]
  number of stack traces:              11921
  number of stack hash chains:          8482
  combined max dependencies:      2651851138
  hardirq-safe locks:                     85
  hardirq-unsafe locks:                 1301
  softirq-safe locks:                    284
  softirq-unsafe locks:                 1123
  irq-safe locks:                        303
  irq-unsafe locks:                     1301
  hardirq-read-safe locks:                 4
  hardirq-read-unsafe locks:             312
  softirq-read-safe locks:                12
  softirq-read-unsafe locks:             307
  irq-read-safe locks:                    12
  irq-read-unsafe locks:                 312
  uncategorized locks:                   352
  unused locks:                            0
  max locking depth:                      30
  max bfs queue depth:                   379
  max lock class index:                 2073
  debug_locks:                             0

  zapped classes:                          6
  zapped lock chains:                    163
  large chain blocks:                      0

And, the average lock chain depth could be calculated as:

dependency chain hlocks used (327679) / dependency chains (51354) ~= 6.38

Seems like we should also consider bumping 'AVG_LOCKDEP_CHAIN_DEPTH' to
something like 7 or higher.

> CONFIG_LOCKDEP_CHAINS_BITS to at least 17, those we may still hit the 
> "MAX_LOCKDEP_CHAIN_HLOCKS too low" if we run a variety of different 
> workloads without reboot.

Agreed. We may still hit this issue, but tweaking these values can make
it less likely ;)

Thanks,
Lance


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ