Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Oliver Sang <oliver.sang@intel.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: kernel test robot <lkp@intel.com>, <llvm@lists.linux.dev>,
	<oe-kbuild-all@lists.linux.dev>, <oliver.sang@intel.com>
Subject: Re: [paulmckrcu:dev 82/82] kernel/rcu/rcutorture.c:2453:110: warning: format specifies type 'unsigned long' but the argument has type 'int'
Date: Thu, 13 Feb 2025 13:51:48 +0800	[thread overview]
Message-ID: <Z62IdAeMn71eHNqu@xsang-OptiPlex-9020> (raw)
In-Reply-To: <555c789d-5fe8-40d4-9b72-3490baa5c9b3@paulmck-laptop>

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;
>  	}

  reply	other threads:[~2025-02-13  5:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-02-13  7:56     ` Paul E. McKenney

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=Z62IdAeMn71eHNqu@xsang-OptiPlex-9020 \
    --to=oliver.sang@intel.com \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paulmck@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