Re: [PATCH 5.15 00/91] 5.15.108-rc1 review
From: Tom Saeger
Date: Tue Apr 18 2023 - 12:52:02 EST
On Tue, Apr 18, 2023 at 09:47:33PM +0530, Harshit Mogalapalli wrote:
> Hi Greg,
>
> On 18/04/23 8:17 pm, Naresh Kamboju wrote:
> > On Tue, 18 Apr 2023 at 18:07, Greg Kroah-Hartman
> > <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > This is the start of the stable review cycle for the 5.15.108 release.
> > > There are 91 patches in this series, all will be posted as a response
> > > to this one. If anyone has any issues with these being applied, please
> > > let me know.
> > >
> > > Responses should be made by Thu, 20 Apr 2023 12:02:44 +0000.
> > > Anything received after that time might be too late.
> > >
> > > The whole patch series can be found in one patch at:
> > > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.108-rc1.gz
> > > or in the git tree and branch at:
> > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
> > > and the diffstat can be found below.
> > >
> > > thanks,
> > >
> > > greg k-h
> >
> >
> > Following patch causing build break on stable-rc 5.15
> >
> >
> > > Waiman Long <longman@xxxxxxxxxx>
> > > cgroup/cpuset: Add cpuset_can_fork() and cpuset_cancel_fork() methods
> >
> > cgroup/cpuset: Add cpuset_can_fork() and cpuset_cancel_fork() methods
> > commit eee87853794187f6adbe19533ed79c8b44b36a91 upstream.
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> >
> > Build error:
> > kernel/cgroup/cpuset.c: In function 'cpuset_can_fork':
> > kernel/cgroup/cpuset.c:2979:30: error: 'cgroup_mutex' undeclared
> > (first use in this function); did you mean 'cgroup_put'?
> > 2979 | lockdep_assert_held(&cgroup_mutex);
> > | ^~~~~~~~~~~~
> > include/linux/lockdep.h:415:61: note: in definition of macro
> > 'lockdep_assert_held'
> > 415 | #define lockdep_assert_held(l) do {
> > (void)(l); } while (0)
> > | ^
> > kernel/cgroup/cpuset.c:2979:30: note: each undeclared identifier is
> > reported only once for each function it appears in
> > 2979 | lockdep_assert_held(&cgroup_mutex);
> > | ^~~~~~~~~~~~
> > include/linux/lockdep.h:415:61: note: in definition of macro
> > 'lockdep_assert_held'
> > 415 | #define lockdep_assert_held(l) do {
> > (void)(l); } while (0)
> > | ^
> > make[3]: *** [scripts/Makefile.build:289: kernel/cgroup/cpuset.o] Error 1
> >
> >
>
> We observed same build error.(5.15.108-rc1), and investigated about this.
>
> Please see the below findings.
>
> With defconfig --> build breaks.
> With allmodconfig --> build succeeds.
>
> From the above we know that this is something related to CONFIG.
>
> In 5.15.y -->
> cgroup_mutex is defined like this in include/linux/cgroup.h
>
> #ifdef CONFIG_PROVE_RCU
> extern struct mutex cgroup_mutex;
>
> In 6.2.y --> include/linux/cgroup.h
>
> extern struct mutex cgroup_mutex;
>
> -- We don't have that ifdef in 6.2.y.
>
> Tom Saeger identified that the below commit moves it out of ifdef.
>
> commit 354ed597442952fb680c9cafc7e4eb8a76f9514c
> Author: Yu Zhao <yuzhao@xxxxxxxxxx>
> Date: Sun Sep 18 02:00:07 2022 -0600
>
> mm: multi-gen LRU: kill switch
>
> Given that we don't have this commit in 5.15.y and 5.10.y we are seeing this
> build problem.
>
> on allmodconfig:
>
> ~/linux$ grep "CONFIG_PROVE_RCU" .config
> CONFIG_PROVE_RCU=y
> CONFIG_PROVE_RCU_LIST=y
>
> on defconfig:
> ~/linux$ grep "CONFIG_PROVE_RCU" .config
> -- No match
>
> This explains the failure on defconfig and a build success on allmodconfig.
>
> Thanks,
> Harshit
>
FWIW - partially backporting (location of cgroup_mutex extern) from:
354ed5974429 ("mm: multi-gen LRU: kill switch")
fixes x86_64 build for me.
Regards,
--Tom
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 45cdb12243e3..460ba084888a 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -433,6 +433,8 @@ static inline void cgroup_put(struct cgroup *cgrp)
css_put(&cgrp->self);
}
+extern struct mutex cgroup_mutex;
+
/**
* task_css_set_check - obtain a task's css_set with extra access conditions
* @task: the task to obtain css_set for
@@ -447,7 +449,6 @@ static inline void cgroup_put(struct cgroup *cgrp)
* as locks used during the cgroup_subsys::attach() methods.
*/
#ifdef CONFIG_PROVE_RCU
-extern struct mutex cgroup_mutex;
extern spinlock_t css_set_lock;
#define task_css_set_check(task, __c) \
rcu_dereference_check((task)->cgroups, \
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
index d8fcc139ac05..28c32a01da7d 100644
--- a/kernel/cgroup/cgroup-internal.h
+++ b/kernel/cgroup/cgroup-internal.h
@@ -165,7 +165,6 @@ struct cgroup_mgctx {
#define DEFINE_CGROUP_MGCTX(name) \
struct cgroup_mgctx name = CGROUP_MGCTX_INIT(name)
-extern struct mutex cgroup_mutex;
extern spinlock_t css_set_lock;
extern struct cgroup_subsys *cgroup_subsys[];
extern struct list_head cgroup_roots;