[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191113114334.GA1647@zn.tnic>
Date: Wed, 13 Nov 2019 12:44:14 +0100
From: Borislav Petkov <bp@...en8.de>
To: Xiaochen Shen <xiaochen.shen@...el.com>
Cc: tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
tony.luck@...el.com, fenghua.yu@...el.com,
reinette.chatre@...el.com, x86@...nel.org,
linux-kernel@...r.kernel.org, pei.p.jia@...el.com
Subject: Re: [PATCH] x86/resctrl: Fix potential lockdep warning
On Thu, Nov 07, 2019 at 06:36:36AM +0800, Xiaochen Shen wrote:
> rdtgroup_cpus_write() and mkdir_rdt_prepare() call
> rdtgroup_kn_lock_live() -> kernfs_to_rdtgroup() to get 'rdtgrp', and
> then call rdt_last_cmd_xxx() functions which will check if
Write those names like this:
rdt_last_cmd_{clear,puts,...} but not with an "xxx" which confuses
people unfamiliar with the code.
> rdtgroup_mutex is held/requires its caller to hold rdtgroup_mutex.
> But if 'rdtgrp' returned from kernfs_to_rdtgroup() is NULL,
> rdtgroup_mutex is not held and calling rdt_last_cmd_xxx() will result
> in a lockdep warning.
That's more of a self-incurred lockdep warning. You can't be calling
lockdep_assert_held() after a function which doesn't always grab the
mutex. Looks like the design needs changing here...
> Remove rdt_last_cmd_xxx() in these two paths. Just returning error
> should be sufficient to report to the user that the entry doesn't exist
> any more.
... or that.
In any case, you should consider fixing such patterns in the code as it
looks sub-optimal from where I'm standing.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists