On Mon, Jun 08, 2020 at 09:56:16AM +0800, Kefeng Wang wrote:
> 
> On 2020/6/8 3:00, Paul E. McKenney wrote:
> > On Fri, Jun 05, 2020 at 05:19:14PM -0700, Paul E. McKenney wrote:
> > > On Sat, Jun 06, 2020 at 07:07:10AM +0800, kernel test robot wrote:
> > > > tree:   
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
> > > > dev.2020.06.02a
> > > > head:   5216948905dd07a84cef8a7dc72c2ec076802efd
> > > > commit: 7d16add62717136b1839f0b3d7ea4cbb98f38c2a [67/90] rcuperf: Fix 
> > > > kfree_mult to match printk() format
> > > > config: arm-randconfig-r004-20200605 (attached as .config)
> > > > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 
> > > > 6dd738e2f0609f7d3313b574a1d471263d2d3ba1)
> > > > reproduce (this is a W=1 build):
> > > >          wget 
> > > > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
> > > >  -O ~/bin/make.cross
> > > >          chmod +x ~/bin/make.cross
> > > >          # install arm cross compiling tool for clang build
> > > >          # apt-get install binutils-arm-linux-gnueabi
> > > >          git checkout 7d16add62717136b1839f0b3d7ea4cbb98f38c2a
> > > >          # save the attached .config to linux build tree
> > > >          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 
> > > > ARCH=arm
> > > > 
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot <l...@intel.com>
> > > Adding Kefeng on CC.  Kefeng, thoughts?
> > Like this, perhaps?
> 
> Hi Paul,I check https://lkml.org/lkml/2020/6/2/286 and 
> <https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/log/?h=dev.2020.06.02a>
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/log/?h=dev.2020.06.02a
> 
> There are two different ways to fix the same issue
> 
> patch 1:  rcuperf: Fix printk format warning urgent-for-mingo
> 
> patch 2:  'rcuperf: Fix kfree_mult to match printk() format' from Ingo 
> after my patch
> 
> since patch1 already merged,  patch2 is not needed, so skip patch2?
> 
> Thanks.
> 
> 
> 
> 
> > 
> >                                                     Thanx, Paul
> > 
> > diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
> > index 962869d..dc7483a 100644
> > --- a/kernel/rcu/rcuperf.c
> > +++ b/kernel/rcu/rcuperf.c
> > @@ -724,7 +724,7 @@ kfree_perf_init(void)
> >             schedule_timeout_uninterruptible(1);
> >     }
> > -   pr_alert("kfree object size=%zu\n", kfree_mult * sizeof(struct 
> > kfree_obj));
> > +   pr_alert("kfree object size=%zu\n", (size_t)kfree_mult * sizeof(struct 
> > kfree_obj));
> >     kfree_reader_tasks = kcalloc(kfree_nrealthreads, 
> > sizeof(kfree_reader_tasks[0]),
> >                            GFP_KERNEL);
> > 
> > > > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > > > 
> > > > > > kernel/rcu/rcuperf.c:727:38: warning: format specifies type 
> > > > > > 'size_t' (aka 'unsigned int') but the argument has type 'unsigned 
> > > > > > long' [-Wformat]
> > > > pr_alert("kfree object size=%zun", kfree_mult * sizeof(struct 
> > > > kfree_obj));
> > > > ~~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > %lu
> > > > include/linux/printk.h:295:35: note: expanded from macro 'pr_alert'
> > > > printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
> > > > ~~~     ^~~~~~~~~~~
> > > > 1 warning generated.
> > > > 
> > > > vim +727 kernel/rcu/rcuperf.c
> > > > 
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  709)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  710) static int 
> > > > __init
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  711) 
> > > > kfree_perf_init(void)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  712) {
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  713)         long i;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  714)         int 
> > > > firsterr = 0;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  715)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  716)         
> > > > kfree_nrealthreads = compute_real(kfree_nthreads);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  717)         /* 
> > > > Start up the kthreads. */
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  718)         if 
> > > > (shutdown) {
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  719)                 
> > > > init_waitqueue_head(&shutdown_wq);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  720)                 
> > > > firsterr = torture_create_kthread(kfree_perf_shutdown, NULL,
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  721)                 
> > > >                                   shutdown_task);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  722)                 
> > > > if (firsterr)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  723)                 
> > > >         goto unwind;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  724)                 
> > > > schedule_timeout_uninterruptible(1);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  725)         }
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  726)
> > > > b3e2d20973db3e Kefeng Wang             2020-04-17 @727          
> > > > pr_alert("kfree object size=%zu\n", kfree_mult * sizeof(struct 
> > > > kfree_obj));
> > > > f87dc808009ac8 Joel Fernandes (Google  2020-03-16  728)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  729)         
> > > > kfree_reader_tasks = kcalloc(kfree_nrealthreads, 
> > > > sizeof(kfree_reader_tasks[0]),
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  730)                 
> > > >                GFP_KERNEL);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  731)         if 
> > > > (kfree_reader_tasks == NULL) {
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  732)                 
> > > > firsterr = -ENOMEM;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  733)                 
> > > > goto unwind;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  734)         }
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  735)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  736)         for (i 
> > > > = 0; i < kfree_nrealthreads; i++) {
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  737)                 
> > > > firsterr = torture_create_kthread(kfree_perf_thread, (void *)i,
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  738)                 
> > > >                                   kfree_reader_tasks[i]);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  739)                 
> > > > if (firsterr)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  740)                 
> > > >         goto unwind;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  741)         }
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  742)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  743)         while 
> > > > (atomic_read(&n_kfree_perf_thread_started) < kfree_nrealthreads)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  744)                 
> > > > schedule_timeout_uninterruptible(1);
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  745)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  746)         
> > > > torture_init_end();
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  747)         return 
> > > > 0;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  748)
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  749) unwind:
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  750)         
> > > > torture_init_end();
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  751)         
> > > > kfree_perf_cleanup();
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  752)         return 
> > > > firsterr;
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  753) }
> > > > e6e78b004fa7e0 Joel Fernandes (Google  2019-08-30  754)
> > > > 
> > > > :::::: The code at line 727 was first introduced by commit
> > > > :::::: b3e2d20973db3ec87a6dd2fee0c88d3c2e7c2f61 rcuperf: Fix printk 
> > > > format warning
> > > > 
> > > > :::::: TO: Kefeng Wang <wangkefeng.w...@huawei.com>
> > > > :::::: CC: Paul E. McKenney <paul...@kernel.org>
> > > > 
> > > > ---
> > > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > > https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
> > > 
> > .
> > 
> 

Agreed, this is a problem with both patches being applied together,
both GCC and clang agree: https://godbolt.org/z/gGzPV7

Either patch works, it is just a matter of deciding which is better.

Cheers,
Nathan

Reply via email to