Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int'
@ 2025-02-11 12:37 kernel test robot
  2025-02-12 10:03 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-02-11 12:37 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: llvm, oe-kbuild-all

tree:   https://github.com/paulmckrcu/linux dev
head:   31c00ec5301cf02af354d57007bf0d79d5aef1c5
commit: 31c00ec5301cf02af354d57007bf0d79d5aef1c5 [82/82] rcutorture: Check for ->up_read() without matching ->down_read()
config: i386-buildonly-randconfig-006-20250211 (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502112058.rTKa7Z3A-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from kernel/rcu/rcutorture.c:47:
   In file included from include/linux/oom.h:10:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
    2453 |         WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
         |                                                                                                  ~~~                ^~~~~~~~~~~~~~~~~~~~~~~
         |                                                                                                  %d
   include/asm-generic/bug.h:185:57: note: expanded from macro 'WARN_ONCE'
     185 | #define WARN_ONCE(condition, format...) WARN(condition, format)
         |                                                         ^~~~~~
   include/asm-generic/bug.h:179:12: note: expanded from macro 'WARN'
     179 |         no_printk(format);                                              \
         |                   ^~~~~~
   include/linux/printk.h:135:18: note: expanded from macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                         ~~~    ^~~~~~~~~~~
   kernel/rcu/rcutorture.c:2524:111: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
    2524 |                 WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
         |                                                                                                          ~~~                ^~~~~~~~~~~~~~~~~~~~~~~
         |                                                                                                          %d
   include/asm-generic/bug.h:185:57: note: expanded from macro 'WARN_ONCE'
     185 | #define WARN_ONCE(condition, format...) WARN(condition, format)
         |                                                         ^~~~~~
   include/asm-generic/bug.h:179:12: note: expanded from macro 'WARN'
     179 |         no_printk(format);                                              \
         |                   ^~~~~~
   include/linux/printk.h:135:18: note: expanded from macro 'no_printk'
     135 |                 _printk(fmt, ##__VA_ARGS__);            \
         |                         ~~~    ^~~~~~~~~~~
   3 warnings generated.


vim +2453 kernel/rcu/rcutorture.c

  2446	
  2447	static enum hrtimer_restart rcu_torture_updown_hrt(struct hrtimer *hrtp)
  2448	{
  2449		struct rcu_torture_one_read_state_updown *rtorsup;
  2450	
  2451		rtorsup = container_of(hrtp, struct rcu_torture_one_read_state_updown, rtorsu_hrt);
  2452		rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
> 2453		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
  2454		rtorsup->rtorsu_nups++;
  2455		smp_store_release(&rtorsup->rtorsu_inuse, false);
  2456		return HRTIMER_NORESTART;
  2457	}
  2458	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int'
  2025-02-11 12:37 [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' kernel test robot
@ 2025-02-12 10:03 ` Paul E. McKenney
  2025-02-13  5:51   ` Oliver Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2025-02-12 10:03 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all

On Tue, Feb 11, 2025 at 08:37:12PM +0800, kernel test robot wrote:
> tree:   https://github.com/paulmckrcu/linux dev
> head:   31c00ec5301cf02af354d57007bf0d79d5aef1c5
> commit: 31c00ec5301cf02af354d57007bf0d79d5aef1c5 [82/82] rcutorture: Check for ->up_read() without matching ->down_read()
> config: i386-buildonly-randconfig-006-20250211 (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/config)
> compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202502112058.rTKa7Z3A-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from kernel/rcu/rcutorture.c:47:
>    In file included from include/linux/oom.h:10:
>    In file included from include/linux/mm.h:2223:
>    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~
> >> kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
>     2453 |         WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
>          |                                                                                                  ~~~                ^~~~~~~~~~~~~~~~~~~~~~~
>          |                                                                                                  %d

And %d breaks my build.  So this is presumably what %zu was intended
to take care of.  So does the diff below fix this for you?  Either way,
thank you for your testing!

							Thanx, Paul

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

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index d62f1c787bd6..b4286136a052 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -2450,7 +2450,7 @@ static enum hrtimer_restart rcu_torture_updown_hrt(struct hrtimer *hrtp)
 
 	rtorsup = container_of(hrtp, struct rcu_torture_one_read_state_updown, rtorsu_hrt);
 	rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
-	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
+	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
 	rtorsup->rtorsu_nups++;
 	smp_store_release(&rtorsup->rtorsu_inuse, false);
 	return HRTIMER_NORESTART;
@@ -2498,7 +2498,12 @@ static void rcu_torture_updown_cleanup(void)
 		if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
 			continue;
 		(void)hrtimer_cancel(&rtorsup->rtorsu_hrt);
-		WARN_ON_ONCE(rtorsup->rtorsu_inuse);
+		if (WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
+			rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
+			WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
+			rtorsup->rtorsu_nups++;
+			smp_store_release(&rtorsup->rtorsu_inuse, false);
+		}
 
 	}
 	kfree(updownreaders);
@@ -2521,7 +2526,7 @@ static void rcu_torture_updown_one(struct rcu_torture_one_read_state_updown *rto
 	if (!rcu_torture_one_read_start(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1)) {
 		cur_ops->up_read(rawidx);
 		rtorsup->rtorsu_nups++;
-		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
+		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
 		schedule_timeout_idle(HZ);
 		return;
 	}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int'
  2025-02-12 10:03 ` Paul E. McKenney
@ 2025-02-13  5:51   ` Oliver Sang
  2025-02-13  7:56     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Sang @ 2025-02-13  5:51 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: kernel test robot, llvm, oe-kbuild-all, oliver.sang

hi, Paul,

On Wed, Feb 12, 2025 at 02:03:27AM -0800, Paul E. McKenney wrote:
> On Tue, Feb 11, 2025 at 08:37:12PM +0800, kernel test robot wrote:
> > tree:   https://github.com/paulmckrcu/linux dev
> > head:   31c00ec5301cf02af354d57007bf0d79d5aef1c5
> > commit: 31c00ec5301cf02af354d57007bf0d79d5aef1c5 [82/82] rcutorture: Check for ->up_read() without matching ->down_read()
> > config: i386-buildonly-randconfig-006-20250211 (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/config)
> > compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202502112058.rTKa7Z3A-lkp@intel.com/
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >    In file included from kernel/rcu/rcutorture.c:47:
> >    In file included from include/linux/oom.h:10:
> >    In file included from include/linux/mm.h:2223:
> >    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> >      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
> >          |                               ~~~~~~~~~~~ ^ ~~~
> > >> kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
> >     2453 |         WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> >          |                                                                                                  ~~~                ^~~~~~~~~~~~~~~~~~~~~~~
> >          |                                                                                                  %d
> 
> And %d breaks my build.  So this is presumably what %zu was intended
> to take care of.  So does the diff below fix this for you?  Either way,
> thank you for your testing!

yes, diff below fix the new warning we reported. thanks

Tested-by: kernel test robot <oliver.sang@intel.com>

> 
> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index d62f1c787bd6..b4286136a052 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -2450,7 +2450,7 @@ static enum hrtimer_restart rcu_torture_updown_hrt(struct hrtimer *hrtp)
>  
>  	rtorsup = container_of(hrtp, struct rcu_torture_one_read_state_updown, rtorsu_hrt);
>  	rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
> -	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> +	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
>  	rtorsup->rtorsu_nups++;
>  	smp_store_release(&rtorsup->rtorsu_inuse, false);
>  	return HRTIMER_NORESTART;
> @@ -2498,7 +2498,12 @@ static void rcu_torture_updown_cleanup(void)
>  		if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
>  			continue;
>  		(void)hrtimer_cancel(&rtorsup->rtorsu_hrt);
> -		WARN_ON_ONCE(rtorsup->rtorsu_inuse);
> +		if (WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
> +			rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
> +			WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
> +			rtorsup->rtorsu_nups++;
> +			smp_store_release(&rtorsup->rtorsu_inuse, false);
> +		}
>  
>  	}
>  	kfree(updownreaders);
> @@ -2521,7 +2526,7 @@ static void rcu_torture_updown_one(struct rcu_torture_one_read_state_updown *rto
>  	if (!rcu_torture_one_read_start(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1)) {
>  		cur_ops->up_read(rawidx);
>  		rtorsup->rtorsu_nups++;
> -		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> +		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
>  		schedule_timeout_idle(HZ);
>  		return;
>  	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int'
  2025-02-13  5:51   ` Oliver Sang
@ 2025-02-13  7:56     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2025-02-13  7:56 UTC (permalink / raw)
  To: Oliver Sang; +Cc: kernel test robot, llvm, oe-kbuild-all

On Thu, Feb 13, 2025 at 01:51:48PM +0800, Oliver Sang wrote:
> hi, Paul,
> 
> On Wed, Feb 12, 2025 at 02:03:27AM -0800, Paul E. McKenney wrote:
> > On Tue, Feb 11, 2025 at 08:37:12PM +0800, kernel test robot wrote:
> > > tree:   https://github.com/paulmckrcu/linux dev
> > > head:   31c00ec5301cf02af354d57007bf0d79d5aef1c5
> > > commit: 31c00ec5301cf02af354d57007bf0d79d5aef1c5 [82/82] rcutorture: Check for ->up_read() without matching ->down_read()
> > > config: i386-buildonly-randconfig-006-20250211 (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/config)
> > > compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502112058.rTKa7Z3A-lkp@intel.com/reproduce)
> > > 
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202502112058.rTKa7Z3A-lkp@intel.com/
> > > 
> > > All warnings (new ones prefixed by >>):
> > > 
> > >    In file included from kernel/rcu/rcutorture.c:47:
> > >    In file included from include/linux/oom.h:10:
> > >    In file included from include/linux/mm.h:2223:
> > >    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> > >      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
> > >          |                               ~~~~~~~~~~~ ^ ~~~
> > > >> kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' [-Wformat]
> > >     2453 |         WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> > >          |                                                                                                  ~~~                ^~~~~~~~~~~~~~~~~~~~~~~
> > >          |                                                                                                  %d
> > 
> > And %d breaks my build.  So this is presumably what %zu was intended
> > to take care of.  So does the diff below fix this for you?  Either way,
> > thank you for your testing!
> 
> yes, diff below fix the new warning we reported. thanks
> 
> Tested-by: kernel test robot <oliver.sang@intel.com>

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

							Thanx, Paul

> > ------------------------------------------------------------------------
> > 
> > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> > index d62f1c787bd6..b4286136a052 100644
> > --- a/kernel/rcu/rcutorture.c
> > +++ b/kernel/rcu/rcutorture.c
> > @@ -2450,7 +2450,7 @@ static enum hrtimer_restart rcu_torture_updown_hrt(struct hrtimer *hrtp)
> >  
> >  	rtorsup = container_of(hrtp, struct rcu_torture_one_read_state_updown, rtorsu_hrt);
> >  	rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
> > -	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> > +	WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
> >  	rtorsup->rtorsu_nups++;
> >  	smp_store_release(&rtorsup->rtorsu_inuse, false);
> >  	return HRTIMER_NORESTART;
> > @@ -2498,7 +2498,12 @@ static void rcu_torture_updown_cleanup(void)
> >  		if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
> >  			continue;
> >  		(void)hrtimer_cancel(&rtorsup->rtorsu_hrt);
> > -		WARN_ON_ONCE(rtorsup->rtorsu_inuse);
> > +		if (WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
> > +			rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
> > +			WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
> > +			rtorsup->rtorsu_nups++;
> > +			smp_store_release(&rtorsup->rtorsu_inuse, false);
> > +		}
> >  
> >  	}
> >  	kfree(updownreaders);
> > @@ -2521,7 +2526,7 @@ static void rcu_torture_updown_one(struct rcu_torture_one_read_state_updown *rto
> >  	if (!rcu_torture_one_read_start(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1)) {
> >  		cur_ops->up_read(rawidx);
> >  		rtorsup->rtorsu_nups++;
> > -		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%lu.\n", __func__, rtorsup - updownreaders);
> > +		WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
> >  		schedule_timeout_idle(HZ);
> >  		return;
> >  	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-13  7:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 12:37 [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int' kernel test robot
2025-02-12 10:03 ` Paul E. McKenney
2025-02-13  5:51   ` Oliver Sang
2025-02-13  7:56     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox