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] [thread-next>] [day] [month] [year] [list]
Message-ID: <n6zstrcbqp7fqpennqf3qgt2nuc2tdrnsc5dmoawyke3zn3xcm@6uirkotvrhe6>
Date: Mon, 27 May 2024 22:16:41 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: "Vlastimil Babka (SUSE)" <vbabka@...nel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>, 
	Andrew Morton <akpm@...ux-foundation.org>, Johannes Weiner <hannes@...xchg.org>, 
	Michal Hocko <mhocko@...nel.org>, Roman Gushchin <roman.gushchin@...ux.dev>, 
	Muchun Song <muchun.song@...ux.dev>, linux-mm@...ck.org, linux-kernel@...r.kernel.org, 
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2] memcg: simple cleanup of stats update functions

On Mon, May 27, 2024 at 06:34:24PM GMT, Vlastimil Babka (SUSE) wrote:
> On 5/27/24 5:22 PM, Sebastian Andrzej Siewior wrote:
> > On 2024-04-20 16:25:05 [-0700], Shakeel Butt wrote:
> >> mod_memcg_lruvec_state() is never called from outside of memcontrol.c
> >> and with always irq disabled. So, replace it with the irq disabled
> >> version and add an assert that irq is disabled in the caller.
> > 
> > unless PREEMPT_RT is enabled. In that case IRQs are not disabled as part
> > of local_lock_irqsave(&memcg_stock.stock_lock, …) leading to:

Sorry about that and thanks for the report.

> 
> But then the "interrupts are handled by a kernel thread that can sleep" part
> of RT also means it's ok to just have the stock_lock taken with no
> interrupts disabled as no actual raw interrupt handler will interrupt the
> holder and deadlock, right?
> 

Thanks Vlastimil for jolting my memory on RT reasoning.

> > | ------------[ cut here ]------------
> > | WARNING: CPU: 0 PID: 1 at mm/memcontrol.c:3150 __mod_objcg_mlstate+0xc2/0x110
> > | CPU: 0 PID: 1 Comm: systemd Not tainted 6.10.0-rc1-rt0+ #17
> > | Call Trace:
> > |  <TASK>
> > |  mod_objcg_state+0x2b3/0x320
> > |  __memcg_slab_post_alloc_hook+0x13c/0x340
> > |  kmem_cache_alloc_lru_noprof+0x2bd/0x2e0
> > |  alloc_inode+0x59/0xc0
> > |  iget_locked+0xf0/0x290
> > 
> > suggestions?
> 
> So in that case the appropriate thing would be to replace the assert with
> lockdep_assert_held(&memcg_stock.stock_lock);
> ?
> 
> It seems all the code paths leading here have that one.
> 

Yeah this seems right and reasonable. Should I send a fix or you want to
send it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ