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: <4b58c74d-6ad6-3658-30fb-1957a7b212dc@redhat.com>
Date:   Wed, 9 Feb 2022 15:20:42 -0500
From:   Waiman Long <longman@...hat.com>
To:     Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>, Will Deacon <will@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Steven Rostedt <rostedt@...dmis.org>,
        Byungchul Park <byungchul.park@....com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Radoslaw Burny <rburny@...gle.com>,
        Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>, cgroups@...r.kernel.org,
        Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 02/12] cgroup: rstat: Make cgroup_rstat_cpu_lock name
 readable

On 2/8/22 14:43, Namhyung Kim wrote:
> The raw_spin_lock_init() uses the argument to name its lockdep map.
> But passing per_cpu_ptr() macro directly makes it a very very long
> name as it expanded like below:
>
>    ({ do { const void *__vpp_verify = (typeof((&cgroup_rstat_cpu_lock) ...
>
> Let's fix it by passing a local variable instead.  With this change,
> the name now looks like:
>
>    cgrp_rstat_cpu_lock
>
> Cc: Zefan Li <lizefan.x@...edance.com>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: cgroups@...r.kernel.org
> Acked-by: Tejun Heo <tj@...nel.org>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>   kernel/cgroup/rstat.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
> index 9d331ba44870..371f54a59c38 100644
> --- a/kernel/cgroup/rstat.c
> +++ b/kernel/cgroup/rstat.c
> @@ -286,9 +286,17 @@ void cgroup_rstat_exit(struct cgroup *cgrp)
>   void __init cgroup_rstat_boot(void)
>   {
>   	int cpu;
> +	raw_spinlock_t *cgrp_rstat_cpu_lock;
>   
> -	for_each_possible_cpu(cpu)
> -		raw_spin_lock_init(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu));
> +	for_each_possible_cpu(cpu) {
> +		/*
> +		 * raw_spin_lock_init() uses the argument to name the lock in
> +		 * lockdep results.  Passing per_cpu_ptr() directly created a
> +		 * cryptic name as the macro was expanded before stringified.
> +		 */
> +		cgrp_rstat_cpu_lock = per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu);
> +		raw_spin_lock_init(cgrp_rstat_cpu_lock);
> +	}
>   }
>   
>   /*

That is a standalone fix. Maybe Tejun can take it directly into the 
cgroup tree.

Acked-by: Waiman Long <longman@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ