From: Ming Lei <ming.lei@redhat.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Peter Newman <peternewman@google.com>,
Babu Moger <babu.moger@amd.com>,
linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: resctrl mount fail on v6.13-rc1
Date: Thu, 5 Dec 2024 17:29:13 +0800 [thread overview]
Message-ID: <Z1FyabRPB2UrR3UA@fedora> (raw)
In-Reply-To: <95e33677-66e7-458d-937d-e1b5842666d3@intel.com>
On Wed, Dec 04, 2024 at 08:48:14AM -0800, Reinette Chatre wrote:
> Hi Ming,
>
> On 12/3/24 7:27 PM, Ming Lei wrote:
> > On Mon, Dec 02, 2024 at 09:02:45PM -0800, Reinette Chatre wrote:
> >>
> >>
> >> On 12/2/24 8:54 PM, Reinette Chatre wrote:
> >>>
> >>>
> >>> On 12/2/24 6:47 PM, Luck, Tony wrote:
> >>>> On Mon, Dec 02, 2024 at 02:26:48PM -0800, Reinette Chatre wrote:
> >>>>> Hi Tony,
> >>>>>
> >>>>> On 12/2/24 1:42 PM, Luck, Tony wrote:
> >>>>>> Anyone better a decoding lockdep dumps then me make sense of this?
> >>>>>>
> >>>>>> All I did was build v6.13-rc1 with (among others)
> >>>>>>
> >>>>>> CONFIG_PROVE_LOCKING=y
> >>>>>> CONFIG_PROVE_RAW_LOCK_NESTING=y
> >>>>>> CONFIG_PROVE_RCU=y
> >>>>>>
> >>>>>> and then mount the resctrl filesystem:
> >>>>>>
> >>>>>> $ sudo mount -t resctrl resctrl /sys/fs/resctrl
> >>>>>>
> >>>>>> There are only trivial changes to the resctrl code between
> >>>>>> v6.12 (which works) and v6.13-rc1:
> >>>>>>
> >>>>>> $ git log --oneline v6.13-rc1 ^v6.12 -- arch/x86/kernel/cpu/resctrl
> >>>>>> 5a4b3fbb4849 Merge tag 'x86_cache_for_v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> >>>>>> 9bce6e94c4b3 x86/resctrl: Support Sub-NUMA cluster mode SNC6
> >>>>>> 29eaa7958367 x86/resctrl: Slightly clean-up mbm_config_show()
> >>>>>>
> >>>>>> So something in kernfs? Or the way resctrl uses kernfs?
> >>>>>
> >>>>> I am not seeing this but that may be because I am not testing with
> >>>>> selinux enabled. My test kernel has:
> >>>>> # CONFIG_SECURITY_SELINUX is not set
> >>>>>
> >>>>> I am also not running with any btrfs filesystems.
> >>>>>
> >>>>> Is this your usual setup in which you are seeing this the first time? Is it
> >>>>> perhaps possible for you to bisect?
> >>>>
> >>>> Bisection says:
> >>>>
> >>>> $ git bisect bad
> >>>> f1be1788a32e8fa63416ad4518bbd1a85a825c9d is the first bad commit
> >>>> commit f1be1788a32e8fa63416ad4518bbd1a85a825c9d
> >>>> Author: Ming Lei <ming.lei@redhat.com>
> >>>> Date: Fri Oct 25 08:37:20 2024 +0800
> >>>>
> >>>> block: model freeze & enter queue as lock for supporting lockdep
> >>>>
> >>>
> >>> Thank you very much Tony. Since you did not respond to the question about
> >>> bisect I assumed that you would not do it. I ended up duplicating the bisect
> >>> effort after getting an environment in which I can reproduce the issue. Doing so
> >>> I am able to confirm the commit pointed to by bisect.
> >>> The commit cannot be reverted cleanly so I could not test v6.13-rc1 with it
> >>> reverted.
> >>>
> > Gi> > Ming Lei: I'd be happy to help with testing if you do not have hardware with
> >>> which you can reproduce the issue.
> >>
> >> One datapoint that I neglected to mention: btrfs does not seem to be required. The system
> >> I tested on used ext4 filesystem resulting in trace below:
> >
> > Hi Reinette and Tony,
> >
> > The warning is triggered because the two subsystems are connected with
> > &cpu_hotplug_lock.
> >
> > rdt_get_tree():
> > cpus_read_lock();
> > mutex_lock(&rdtgroup_mutex);
> > ...
> >
> > blk_mq_realloc_hw_ctxs()
> > mutex_lock(&q->sysfs_lock);
> > ...
> > blk_mq_alloc_and_init_hctx()
> > blk_mq_init_hctx
> > cpuhp_state_add_instance_nocalls
> > __cpuhp_state_add_instance
> > cpus_read_lock();
> >
> > Given cpus_read_lock() is often implied in cpuhp APIs, I feel rdt_get_tree()
> > may re-order the two locks for avoiding the dependency.
>
> This is not possible for exactly the reason you provide ("cpus_read_lock() is
> often implied in cpuhp APIs").
>
> resctrl relies on hotplug state callbacks for its initialization. You can find
> the callback setup in:
>
> arch/x86/kernel/cpu/resctrl/core.c:
>
> static int __init resctrl_late_init(void)
> {
>
> ...
> state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
> "x86/resctrl/cat:online:",
> resctrl_arch_online_cpu,
> resctrl_arch_offline_cpu);
> ...
> }
>
> Since resctrl code is called by the CPU hotplug subsystem with cpu_hotplug_lock
> already held it is not possible for resctrl to change the lock ordering.
OK, I see now, and thanks for the explanation.
I will try to figure out moving cpuhp_state_add_instance_nocalls out of
q->sysfs_lock, and it should be fine in case that queue is live.
Thanks,
Ming
prev parent reply other threads:[~2024-12-05 9:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 21:42 resctrl mount fail on v6.13-rc1 Luck, Tony
2024-12-02 22:26 ` Reinette Chatre
2024-12-02 22:46 ` Luck, Tony
2024-12-03 0:03 ` Fenghua Yu
2024-12-02 22:46 ` Fenghua Yu
2024-12-03 2:47 ` Luck, Tony
2024-12-03 3:35 ` Ming Lei
2024-12-03 3:49 ` Reinette Chatre
2024-12-03 4:54 ` Reinette Chatre
2024-12-03 5:02 ` Reinette Chatre
2024-12-04 3:27 ` Ming Lei
2024-12-04 16:48 ` Reinette Chatre
2024-12-05 9:29 ` Ming Lei [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1FyabRPB2UrR3UA@fedora \
--to=ming.lei@redhat.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox