Skip to contentSkip to conversation

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used

PATCH kernel test robot 3 participants 7 messages Mar 19, 2023 – Mar 21, 2023 RCU

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu: Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
git remote add paulmck-rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git fetch --no-tags paulmck-rcu dev.2023.03.17a
git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/srcu.h:49,

                    from include/linux/notifier.h:16,
                    from arch/x86/include/asm/uprobes.h:13,
                    from include/linux/uprobes.h:49,
                    from include/linux/mm_types.h:16,
                    from include/linux/sched/signal.h:13,
                    from kernel/rcu/update.c:26:
>> kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         |                    ^~~~~~~~~~~~~~~~~~~
   include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~
   kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         | ^~~~~~~~~~~~~~~~~~

vim +/tasks_rcu_exit_srcu +140 kernel/rcu/tasks.h

07e105158d97b4 Paul E. McKenney 2020-03-02 138
eacd6f04a13331 Paul E. McKenney 2020-03-02 139 /* Track exiting tasks in order to allow them to be waited for. */ eacd6f04a13331 Paul E. McKenney 2020-03-02 @140 DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); eacd6f04a13331 Paul E. McKenney 2020-03-02 141

:::::: The code at line 140 was first introduced by commit
:::::: eacd6f04a1333187dd3e96e5635c0edce0a2e354 rcu-tasks: Move Tasks RCU to its own file

:::::: TO: Paul E. McKenney <[email protected]>
:::::: CC: Paul E. McKenney <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
maintainer
#1 lore raw
Quoted 29 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu: Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
git remote add paulmck-rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git fetch --no-tags paulmck-rcu dev.2023.03.17a
git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/srcu.h:49,

                    from include/linux/notifier.h:16,
                    from arch/x86/include/asm/uprobes.h:13,
                    from include/linux/uprobes.h:49,
                    from include/linux/mm_types.h:16,
                    from include/linux/sched/signal.h:13,
                    from kernel/rcu/update.c:26:
Quoted 1 line
Quoted 1 line

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

Quoted 8 lines
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         |                    ^~~~~~~~~~~~~~~~~~~
   include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~
   kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         | ^~~~~~~~~~~~~~~~~~

It is true that if you build a kernel with CONFIG_TASKS_RCU_GENERIC=y and CONFIG_TASKS_RCU=n, you will get this warning. I am at a loss as to why this commit would have changed that, but in any case it does need a fix.

Thank you for catching it!

Thanx, Paul

Quoted 16 lines

vim +/tasks_rcu_exit_srcu +140 kernel/rcu/tasks.h

07e105158d97b4 Paul E. McKenney 2020-03-02 138
eacd6f04a13331 Paul E. McKenney 2020-03-02 139 /* Track exiting tasks in order to allow them to be waited for. */ eacd6f04a13331 Paul E. McKenney 2020-03-02 @140 DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); eacd6f04a13331 Paul E. McKenney 2020-03-02 141

:::::: The code at line 140 was first introduced by commit
:::::: eacd6f04a1333187dd3e96e5635c0edce0a2e354 rcu-tasks: Move Tasks RCU to its own file

:::::: TO: Paul E. McKenney <[email protected]>
:::::: CC: Paul E. McKenney <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
maintainer
#2 lore raw
In reply to kernel test robot
Quoted 29 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu: Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
git remote add paulmck-rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git fetch --no-tags paulmck-rcu dev.2023.03.17a
git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/srcu.h:49,

                    from include/linux/notifier.h:16,
                    from arch/x86/include/asm/uprobes.h:13,
                    from include/linux/uprobes.h:49,
                    from include/linux/mm_types.h:16,
                    from include/linux/sched/signal.h:13,
                    from kernel/rcu/update.c:26:
Quoted 1 line
Quoted 1 line

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

Quoted 8 lines
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         |                    ^~~~~~~~~~~~~~~~~~~
   include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~
   kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         | ^~~~~~~~~~~~~~~~~~

Good catch, thank you!

Does the patch shown below fix this?

Thanx, Paul

------------------------------------------------------------------------

commit a9b8406e51603238941dbc6fa1437f8915254ebb

Author: Paul E. McKenney <[email protected]>
Date:   Sun Mar 19 17:29:20 2023 -0700

rcu-tasks: Fix warning for unused tasks_rcu_exit_srcu

The tasks_rcu_exit_srcu variable is used only by kernels built with CONFIG_TASKS_RCU=y, but is defined for all kernesl with CONFIG_TASKS_RCU_GENERIC=y. Therefore, in kernels built with CONFIG_TASKS_RCU_GENERIC=y but CONFIG_TASKS_RCU=n, this gives a "defined but not used" warning.

This commit therefore moves this variable under CONFIG_TASKS_RCU

kernel/rcu/tasks.h +1 -1
index baf7ec178155..85a874d4166b 100644
@@ -136,10 +136,10 @@ static struct rcu_tasks rt_name =							\
 	.kname = #rt_name,								\
 }
 
+#ifdef CONFIG_TASKS_RCU
 /* Track exiting tasks in order to allow them to be waited for. */
 DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
 
-#ifdef CONFIG_TASKS_RCU
 /* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). */
 static void tasks_rcu_exit_srcu_stall(struct timer_list *unused);
 static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);
#3 lore raw

Hi Paul,

Quoted 39 lines · Paul E. McKenney
Quoted 29 lines · kernel test robot

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu: Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
        git remote add paulmck-rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
        git fetch --no-tags paulmck-rcu dev.2023.03.17a
        git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451

        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable

Quoted 2 lines

All warnings (new ones prefixed by >>):

   In file included from include/linux/srcu.h:49, from include/linux/notifier.h:16, from arch/x86/include/asm/uprobes.h:13, from include/linux/uprobes.h:49, from include/linux/mm_types.h:16, from include/linux/sched/signal.h:13, from kernel/rcu/update.c:26:

Quoted 1 line
Quoted 1 line

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

Quoted 8 lines

     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         |                    ^~~~~~~~~~~~~~~~~~~
   include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~
   kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         | ^~~~~~~~~~~~~~~~~~

Quoted 3 lines

Good catch, thank you!

Does the patch shown below fix this?

We've tested the patch and the build warning is fixed by it. Thanks.

--
Best Regards,
Yujie

Quoted 39 lines

                                                        Thanx, Paul

------------------------------------------------------------------------

commit a9b8406e51603238941dbc6fa1437f8915254ebb
Author: Paul E. McKenney <[email protected]>
Date:   Sun Mar 19 17:29:20 2023 -0700

    rcu-tasks: Fix warning for unused tasks_rcu_exit_srcu
    The tasks_rcu_exit_srcu variable is used only by kernels built with CONFIG_TASKS_RCU=y, but is defined for all kernesl with CONFIG_TASKS_RCU_GENERIC=y.  Therefore, in kernels built with CONFIG_TASKS_RCU_GENERIC=y but CONFIG_TASKS_RCU=n, this gives a "defined but not used" warning.

    This commit therefore moves this variable under CONFIG_TASKS_RCU

kernel/rcu/tasks.h +0 -0
index baf7ec178155..85a874d4166b 100644
@@ -136,10 +136,10 @@ static struct rcu_tasks rt_name =                                                 \
         .kname = #rt_name,                                                              \
  }


+#ifdef CONFIG_TASKS_RCU
 /* Track exiting tasks in order to allow them to be waited for. */ DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);

-#ifdef CONFIG_TASKS_RCU
 /* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). */ static void tasks_rcu_exit_srcu_stall(struct timer_list *unused); static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);

maintainer
#4 lore raw
Quoted 42 lines · Yujie

Hi Paul,

Quoted 39 lines · Paul E. McKenney
Quoted 37 lines · kernel test robot

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu: Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230319/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
        git remote add paulmck-rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
        git fetch --no-tags paulmck-rcu dev.2023.03.17a
        git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451

        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable

Quoted 2 lines

All warnings (new ones prefixed by >>):

   In file included from include/linux/srcu.h:49, from include/linux/notifier.h:16, from arch/x86/include/asm/uprobes.h:13, from include/linux/uprobes.h:49, from include/linux/mm_types.h:16, from include/linux/sched/signal.h:13, from kernel/rcu/update.c:26:

Quoted 1 line
Quoted 1 line

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         |                    ^~~~~~~~~~~~~~~~~~~
   include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~
   kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);
         | ^~~~~~~~~~~~~~~~~~

Quoted 5 lines
Quoted 3 lines

Good catch, thank you!

Does the patch shown below fix this?

We've tested the patch and the build warning is fixed by it. Thanks.

Thank you! May I apply your Tested-by?

Thanx, Paul

Quoted 44 lines

--
Best Regards,
Yujie

Quoted 39 lines

                                                        Thanx, Paul

------------------------------------------------------------------------

commit a9b8406e51603238941dbc6fa1437f8915254ebb
Author: Paul E. McKenney <[email protected]>
Date:   Sun Mar 19 17:29:20 2023 -0700

    rcu-tasks: Fix warning for unused tasks_rcu_exit_srcu
    The tasks_rcu_exit_srcu variable is used only by kernels built with CONFIG_TASKS_RCU=y, but is defined for all kernesl with CONFIG_TASKS_RCU_GENERIC=y.  Therefore, in kernels built with CONFIG_TASKS_RCU_GENERIC=y but CONFIG_TASKS_RCU=n, this gives a "defined but not used" warning.

    This commit therefore moves this variable under CONFIG_TASKS_RCU

kernel/rcu/tasks.h +0 -0
index baf7ec178155..85a874d4166b 100644
@@ -136,10 +136,10 @@ static struct rcu_tasks rt_name =                                                 \
         .kname = #rt_name,                                                              \
  }


+#ifdef CONFIG_TASKS_RCU
 /* Track exiting tasks in order to allow them to be waited for. */ DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);

-#ifdef CONFIG_TASKS_RCU
 /* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). */ static void tasks_rcu_exit_srcu_stall(struct timer_list *unused); static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);

Tested-by
#5 lore raw
Quoted 57 lines · Paul E. McKenney
Quoted 56 lines · Yujie

Hi Paul,

Quoted 53 lines · Paul E. McKenney
Quoted 50 lines · kernel test robot

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu:
Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec
(https://download.01.org/0day-ci/archive/20230319/202303191536
[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        #
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
        git remote add paulmck-rcu
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
        git fetch --no-tags paulmck-rcu dev.2023.03.17a git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451

        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
kernel/

If you fix the issue, kindly add following tag where applicable

Quoted 3 lines

Link:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from include/linux/srcu.h:49, from include/linux/notifier.h:16, from arch/x86/include/asm/uprobes.h:13, from include/linux/uprobes.h:49, from include/linux/mm_types.h:16, from include/linux/sched/signal.h:13, from kernel/rcu/update.c:26:

Quoted 2 lines
Quoted 2 lines

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); |                    ^~~~~~~~~~~~~~~~~~~ include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~ kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); | ^~~~~~~~~~~~~~~~~~

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Good catch, thank you!

Does the patch shown below fix this?

We've tested the patch and the build warning is fixed by it. Thanks.

Thank you!  May I apply your Tested-by?

Sure, with pleasure.

Thanks.

Quoted 59 lines

                                                        Thanx, Paul

Quoted 56 lines

--
Best Regards,
Yujie

Quoted 51 lines

                                                        Thanx, Paul

-----------------------------------------------------------------
-------

commit a9b8406e51603238941dbc6fa1437f8915254ebb
Author: Paul E. McKenney <[email protected]>
Date:   Sun Mar 19 17:29:20 2023 -0700

    rcu-tasks: Fix warning for unused tasks_rcu_exit_srcu
    The tasks_rcu_exit_srcu variable is used only by kernels built
    with CONFIG_TASKS_RCU=y, but is defined for all kernesl with CONFIG_TASKS_RCU_GENERIC=y.  Therefore, in kernels built with CONFIG_TASKS_RCU_GENERIC=y but CONFIG_TASKS_RCU=n, this gives a "defined but not used" warning.

    This commit therefore moves this variable under CONFIG_TASKS_RCU

    Link:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

kernel/rcu/tasks.h +0 -0
index baf7ec178155..85a874d4166b 100644
@@ -136,10 +136,10 @@ static struct rcu_tasks rt_name
 =                                                 \

        .kname =
#rt_name,
      \
 }

+#ifdef CONFIG_TASKS_RCU
 /* Track exiting tasks in order to allow them to be waited for. */
 DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);

-#ifdef CONFIG_TASKS_RCU
 /* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). */
 static void tasks_rcu_exit_srcu_stall(struct timer_list *unused);
 static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);

maintainer
#6 lore raw
Quoted 62 lines · Yujie
Quoted 61 lines · Paul E. McKenney
Quoted 60 lines · Yujie

Hi Paul,

Quoted 56 lines · Paul E. McKenney
Quoted 39 lines · kernel test robot

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 dev.2023.03.17a
head:   19d218a4b125a4dce12eb88097a9c55f7126ce8c
commit: 61eea4556e8cf92d4c9b483110a679d2652aa451 [33/38] srcu:
Move work-scheduling fields from srcu_struct to srcu_usage
config: x86_64-kexec
(https://download.01.org/0day-ci/archive/20230319/202303191536
[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        #
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=61eea4556e8cf92d4c9b483110a679d2652aa451
        git remote add paulmck-rcu
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
        git fetch --no-tags paulmck-rcu dev.2023.03.17a git checkout 61eea4556e8cf92d4c9b483110a679d2652aa451

        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
kernel/

If you fix the issue, kindly add following tag where applicable

Quoted 3 lines

Link:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from include/linux/srcu.h:49, from include/linux/notifier.h:16, from arch/x86/include/asm/uprobes.h:13, from include/linux/uprobes.h:49, from include/linux/mm_types.h:16, from include/linux/sched/signal.h:13, from kernel/rcu/update.c:26:

Quoted 2 lines
Quoted 2 lines

kernel/rcu/tasks.h:140:20: warning: 'tasks_rcu_exit_srcu' defined but not used [-Wunused-variable]

Quoted 11 lines

     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); |                    ^~~~~~~~~~~~~~~~~~~ include/linux/srcutree.h:184:38: note: in definition of macro '__DEFINE_SRCU'
     184 |         is_static struct srcu_struct name =                                                     \
         |                                      ^~~~ kernel/rcu/tasks.h:140:1: note: in expansion of macro 'DEFINE_STATIC_SRCU'
     140 | DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); | ^~~~~~~~~~~~~~~~~~

Good catch, thank you!

Does the patch shown below fix this?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

We've tested the patch and the build warning is fixed by it. Thanks.

Thank you!  May I apply your Tested-by?

Sure, with pleasure.

Thank you, and I will apply on my next rebase.

Thanx, Paul

Quoted 62 lines

Thanks.

Quoted 59 lines

                                                        Thanx, Paul

Quoted 56 lines

--
Best Regards,
Yujie

Quoted 51 lines

                                                        Thanx, Paul

-----------------------------------------------------------------
-------

commit a9b8406e51603238941dbc6fa1437f8915254ebb
Author: Paul E. McKenney <[email protected]>
Date:   Sun Mar 19 17:29:20 2023 -0700

    rcu-tasks: Fix warning for unused tasks_rcu_exit_srcu
    The tasks_rcu_exit_srcu variable is used only by kernels built
    with CONFIG_TASKS_RCU=y, but is defined for all kernesl with CONFIG_TASKS_RCU_GENERIC=y.  Therefore, in kernels built with CONFIG_TASKS_RCU_GENERIC=y but CONFIG_TASKS_RCU=n, this gives a "defined but not used" warning.

    This commit therefore moves this variable under CONFIG_TASKS_RCU

    Link:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

kernel/rcu/tasks.h +0 -0
index baf7ec178155..85a874d4166b 100644
@@ -136,10 +136,10 @@ static struct rcu_tasks rt_name
 =                                                 \

        .kname =
#rt_name,
      \
 }

+#ifdef CONFIG_TASKS_RCU
 /* Track exiting tasks in order to allow them to be waited for. */
 DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu);

-#ifdef CONFIG_TASKS_RCU
 /* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). */
 static void tasks_rcu_exit_srcu_stall(struct timer_list *unused);
 static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_stall);