All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
@ 2021-02-24 22:58 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-02-24 22:58 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8069 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git kernelci
head:   c83f21cbef612cdec0d9c6af2d40bea23a45a2a2
commit: 10a90e4556475c6b2d980ed313c41708c5511229 [81/97] smp: inline on_each_cpu_cond() and on_each_cpu()
config: openrisc-randconfig-r001-20210223 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=10a90e4556475c6b2d980ed313c41708c5511229
        git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
        git fetch --no-tags peterz-queue kernelci
        git checkout 10a90e4556475c6b2d980ed313c41708c5511229
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
      39 | void on_each_cpu(smp_call_func_t func, void *info, int wait)
         |      ^~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:61:20: note: previous definition of 'on_each_cpu' was here
      61 | static inline void on_each_cpu(smp_call_func_t func, void *info, int wait)
         |                    ^~~~~~~~~~~
>> kernel/up.c:55:6: error: redefinition of 'on_each_cpu_mask'
      55 | void on_each_cpu_mask(const struct cpumask *mask,
         |      ^~~~~~~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:82:20: note: previous definition of 'on_each_cpu_mask' was here
      82 | static inline void on_each_cpu_mask(const struct cpumask *mask,
         |                    ^~~~~~~~~~~~~~~~
>> kernel/up.c:87:6: error: redefinition of 'on_each_cpu_cond'
      87 | void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
         |      ^~~~~~~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:94:20: note: previous definition of 'on_each_cpu_cond' was here
      94 | static inline void on_each_cpu_cond(smp_cond_func_t cond_func,
         |                    ^~~~~~~~~~~~~~~~


vim +/on_each_cpu +39 kernel/up.c

40c01e8bd5575e Christoph Hellwig         2013-11-14  38  
caa759323c7367 Nadav Amit                2019-06-12 @39  void on_each_cpu(smp_call_func_t func, void *info, int wait)
bff2dc42bcafdd David Daney               2013-09-11  40  {
bff2dc42bcafdd David Daney               2013-09-11  41  	unsigned long flags;
bff2dc42bcafdd David Daney               2013-09-11  42  
bff2dc42bcafdd David Daney               2013-09-11  43  	local_irq_save(flags);
bff2dc42bcafdd David Daney               2013-09-11  44  	func(info);
bff2dc42bcafdd David Daney               2013-09-11  45  	local_irq_restore(flags);
bff2dc42bcafdd David Daney               2013-09-11  46  }
bff2dc42bcafdd David Daney               2013-09-11  47  EXPORT_SYMBOL(on_each_cpu);
bff2dc42bcafdd David Daney               2013-09-11  48  
fa688207c9db48 David Daney               2013-09-11  49  /*
fa688207c9db48 David Daney               2013-09-11  50   * Note we still need to test the mask even for UP
fa688207c9db48 David Daney               2013-09-11  51   * because we actually can get an empty mask from
fa688207c9db48 David Daney               2013-09-11  52   * code that on SMP might call us without the local
fa688207c9db48 David Daney               2013-09-11  53   * CPU in the mask.
fa688207c9db48 David Daney               2013-09-11  54   */
fa688207c9db48 David Daney               2013-09-11 @55  void on_each_cpu_mask(const struct cpumask *mask,
fa688207c9db48 David Daney               2013-09-11  56  		      smp_call_func_t func, void *info, bool wait)
fa688207c9db48 David Daney               2013-09-11  57  {
fa688207c9db48 David Daney               2013-09-11  58  	unsigned long flags;
fa688207c9db48 David Daney               2013-09-11  59  
fa688207c9db48 David Daney               2013-09-11  60  	if (cpumask_test_cpu(0, mask)) {
fa688207c9db48 David Daney               2013-09-11  61  		local_irq_save(flags);
fa688207c9db48 David Daney               2013-09-11  62  		func(info);
fa688207c9db48 David Daney               2013-09-11  63  		local_irq_restore(flags);
fa688207c9db48 David Daney               2013-09-11  64  	}
fa688207c9db48 David Daney               2013-09-11  65  }
fa688207c9db48 David Daney               2013-09-11  66  EXPORT_SYMBOL(on_each_cpu_mask);
fa688207c9db48 David Daney               2013-09-11  67  
fa688207c9db48 David Daney               2013-09-11  68  /*
fa688207c9db48 David Daney               2013-09-11  69   * Preemption is disabled here to make sure the cond_func is called under the
fa688207c9db48 David Daney               2013-09-11  70   * same condtions in UP and SMP.
fa688207c9db48 David Daney               2013-09-11  71   */
5671d814dbd204 Sebastian Andrzej Siewior 2020-01-17  72  void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  73  			   void *info, bool wait, const struct cpumask *mask)
fa688207c9db48 David Daney               2013-09-11  74  {
fa688207c9db48 David Daney               2013-09-11  75  	unsigned long flags;
fa688207c9db48 David Daney               2013-09-11  76  
fa688207c9db48 David Daney               2013-09-11  77  	preempt_disable();
fa688207c9db48 David Daney               2013-09-11  78  	if (cond_func(0, info)) {
fa688207c9db48 David Daney               2013-09-11  79  		local_irq_save(flags);
fa688207c9db48 David Daney               2013-09-11  80  		func(info);
fa688207c9db48 David Daney               2013-09-11  81  		local_irq_restore(flags);
fa688207c9db48 David Daney               2013-09-11  82  	}
fa688207c9db48 David Daney               2013-09-11  83  	preempt_enable();
fa688207c9db48 David Daney               2013-09-11  84  }
7d49b28a80b830 Rik van Riel              2018-09-25  85  EXPORT_SYMBOL(on_each_cpu_cond_mask);
7d49b28a80b830 Rik van Riel              2018-09-25  86  
5671d814dbd204 Sebastian Andrzej Siewior 2020-01-17 @87  void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  88  		      void *info, bool wait)
7d49b28a80b830 Rik van Riel              2018-09-25  89  {
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  90  	on_each_cpu_cond_mask(cond_func, func, info, wait, NULL);
7d49b28a80b830 Rik van Riel              2018-09-25  91  }
fa688207c9db48 David Daney               2013-09-11  92  EXPORT_SYMBOL(on_each_cpu_cond);
df8ce9d78a4e7f Juergen Gross             2016-08-29  93  

:::::: The code at line 39 was first introduced by commit
:::::: caa759323c73676b3e48c8d9c86093c88b4aba97 smp: Remove smp_call_function() and on_each_cpu() return values

:::::: TO: Nadav Amit <namit@vmware.com>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 20658 bytes --]

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

* [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
@ 2021-02-24 23:32 kernel test robot
  2021-02-25  7:33 ` Nadav Amit
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-02-24 23:32 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8040 bytes --]

Hi Nadav,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git kernelci
head:   c83f21cbef612cdec0d9c6af2d40bea23a45a2a2
commit: 10a90e4556475c6b2d980ed313c41708c5511229 [81/97] smp: inline on_each_cpu_cond() and on_each_cpu()
config: x86_64-randconfig-s021-20210223 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-229-g60c1f270-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=10a90e4556475c6b2d980ed313c41708c5511229
        git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
        git fetch --no-tags peterz-queue kernelci
        git checkout 10a90e4556475c6b2d980ed313c41708c5511229
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
      39 | void on_each_cpu(smp_call_func_t func, void *info, int wait)
         |      ^~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:61:20: note: previous definition of 'on_each_cpu' was here
      61 | static inline void on_each_cpu(smp_call_func_t func, void *info, int wait)
         |                    ^~~~~~~~~~~
>> kernel/up.c:55:6: error: redefinition of 'on_each_cpu_mask'
      55 | void on_each_cpu_mask(const struct cpumask *mask,
         |      ^~~~~~~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:82:20: note: previous definition of 'on_each_cpu_mask' was here
      82 | static inline void on_each_cpu_mask(const struct cpumask *mask,
         |                    ^~~~~~~~~~~~~~~~
>> kernel/up.c:87:6: error: redefinition of 'on_each_cpu_cond'
      87 | void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
         |      ^~~~~~~~~~~~~~~~
   In file included from include/linux/percpu.h:7,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from kernel/up.c:6:
   include/linux/smp.h:94:20: note: previous definition of 'on_each_cpu_cond' was here
      94 | static inline void on_each_cpu_cond(smp_cond_func_t cond_func,
         |                    ^~~~~~~~~~~~~~~~


vim +/on_each_cpu +39 kernel/up.c

40c01e8bd5575e Christoph Hellwig         2013-11-14  38  
caa759323c7367 Nadav Amit                2019-06-12 @39  void on_each_cpu(smp_call_func_t func, void *info, int wait)
bff2dc42bcafdd David Daney               2013-09-11  40  {
bff2dc42bcafdd David Daney               2013-09-11  41  	unsigned long flags;
bff2dc42bcafdd David Daney               2013-09-11  42  
bff2dc42bcafdd David Daney               2013-09-11  43  	local_irq_save(flags);
bff2dc42bcafdd David Daney               2013-09-11  44  	func(info);
bff2dc42bcafdd David Daney               2013-09-11  45  	local_irq_restore(flags);
bff2dc42bcafdd David Daney               2013-09-11  46  }
bff2dc42bcafdd David Daney               2013-09-11  47  EXPORT_SYMBOL(on_each_cpu);
bff2dc42bcafdd David Daney               2013-09-11  48  
fa688207c9db48 David Daney               2013-09-11  49  /*
fa688207c9db48 David Daney               2013-09-11  50   * Note we still need to test the mask even for UP
fa688207c9db48 David Daney               2013-09-11  51   * because we actually can get an empty mask from
fa688207c9db48 David Daney               2013-09-11  52   * code that on SMP might call us without the local
fa688207c9db48 David Daney               2013-09-11  53   * CPU in the mask.
fa688207c9db48 David Daney               2013-09-11  54   */
fa688207c9db48 David Daney               2013-09-11 @55  void on_each_cpu_mask(const struct cpumask *mask,
fa688207c9db48 David Daney               2013-09-11  56  		      smp_call_func_t func, void *info, bool wait)
fa688207c9db48 David Daney               2013-09-11  57  {
fa688207c9db48 David Daney               2013-09-11  58  	unsigned long flags;
fa688207c9db48 David Daney               2013-09-11  59  
fa688207c9db48 David Daney               2013-09-11  60  	if (cpumask_test_cpu(0, mask)) {
fa688207c9db48 David Daney               2013-09-11  61  		local_irq_save(flags);
fa688207c9db48 David Daney               2013-09-11  62  		func(info);
fa688207c9db48 David Daney               2013-09-11  63  		local_irq_restore(flags);
fa688207c9db48 David Daney               2013-09-11  64  	}
fa688207c9db48 David Daney               2013-09-11  65  }
fa688207c9db48 David Daney               2013-09-11  66  EXPORT_SYMBOL(on_each_cpu_mask);
fa688207c9db48 David Daney               2013-09-11  67  
fa688207c9db48 David Daney               2013-09-11  68  /*
fa688207c9db48 David Daney               2013-09-11  69   * Preemption is disabled here to make sure the cond_func is called under the
fa688207c9db48 David Daney               2013-09-11  70   * same condtions in UP and SMP.
fa688207c9db48 David Daney               2013-09-11  71   */
5671d814dbd204 Sebastian Andrzej Siewior 2020-01-17  72  void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  73  			   void *info, bool wait, const struct cpumask *mask)
fa688207c9db48 David Daney               2013-09-11  74  {
fa688207c9db48 David Daney               2013-09-11  75  	unsigned long flags;
fa688207c9db48 David Daney               2013-09-11  76  
fa688207c9db48 David Daney               2013-09-11  77  	preempt_disable();
fa688207c9db48 David Daney               2013-09-11  78  	if (cond_func(0, info)) {
fa688207c9db48 David Daney               2013-09-11  79  		local_irq_save(flags);
fa688207c9db48 David Daney               2013-09-11  80  		func(info);
fa688207c9db48 David Daney               2013-09-11  81  		local_irq_restore(flags);
fa688207c9db48 David Daney               2013-09-11  82  	}
fa688207c9db48 David Daney               2013-09-11  83  	preempt_enable();
fa688207c9db48 David Daney               2013-09-11  84  }
7d49b28a80b830 Rik van Riel              2018-09-25  85  EXPORT_SYMBOL(on_each_cpu_cond_mask);
7d49b28a80b830 Rik van Riel              2018-09-25  86  
5671d814dbd204 Sebastian Andrzej Siewior 2020-01-17 @87  void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  88  		      void *info, bool wait)
7d49b28a80b830 Rik van Riel              2018-09-25  89  {
cb923159bbb8cc Sebastian Andrzej Siewior 2020-01-17  90  	on_each_cpu_cond_mask(cond_func, func, info, wait, NULL);
7d49b28a80b830 Rik van Riel              2018-09-25  91  }
fa688207c9db48 David Daney               2013-09-11  92  EXPORT_SYMBOL(on_each_cpu_cond);
df8ce9d78a4e7f Juergen Gross             2016-08-29  93  

:::::: The code at line 39 was first introduced by commit
:::::: caa759323c73676b3e48c8d9c86093c88b4aba97 smp: Remove smp_call_function() and on_each_cpu() return values

:::::: TO: Nadav Amit <namit@vmware.com>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35641 bytes --]

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

* Re: [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
  2021-02-24 23:32 [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu' kernel test robot
@ 2021-02-25  7:33 ` Nadav Amit
  2021-02-25  9:31   ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Nadav Amit @ 2021-02-25  7:33 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]



> On Feb 24, 2021, at 3:32 PM, kernel test robot <lkp@intel.com> wrote:
> 
> Hi Nadav,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fpeterz%2Fqueue.git&amp;data=04%7C01%7Cnamit%40vmware.com%7C020cfe0ba84848af7b7a08d8d91c8524%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C637498063862592091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=esAHpdM5DZJcD%2BAc1l7IG%2BtlbGigwahHi%2F5gstQ9uik%3D&amp;reserved=0 kernelci
> head:   c83f21cbef612cdec0d9c6af2d40bea23a45a2a2
> commit: 10a90e4556475c6b2d980ed313c41708c5511229 [81/97] smp: inline on_each_cpu_cond() and on_each_cpu()
> config: x86_64-randconfig-s021-20210223 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

Sorry for that, Peter.

I will give the bot few more hours to look for problems and send v7.

Regards,
Nadav

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

* Re: [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
  2021-02-25  7:33 ` Nadav Amit
@ 2021-02-25  9:31   ` Peter Zijlstra
  2021-02-25 17:30     ` Nadav Amit
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2021-02-25  9:31 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

On Thu, Feb 25, 2021 at 07:33:18AM +0000, Nadav Amit wrote:
> 
> 
> > On Feb 24, 2021, at 3:32 PM, kernel test robot <lkp@intel.com> wrote:
> > 
> > Hi Nadav,
> > 
> > FYI, the error/warning still remains.
> > 
> > tree:   https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fpeterz%2Fqueue.git&amp;data=04%7C01%7Cnamit%40vmware.com%7C020cfe0ba84848af7b7a08d8d91c8524%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C637498063862592091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=esAHpdM5DZJcD%2BAc1l7IG%2BtlbGigwahHi%2F5gstQ9uik%3D&amp;reserved=0 kernelci
> > head:   c83f21cbef612cdec0d9c6af2d40bea23a45a2a2
> > commit: 10a90e4556475c6b2d980ed313c41708c5511229 [81/97] smp: inline on_each_cpu_cond() and on_each_cpu()
> > config: x86_64-randconfig-s021-20210223 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> 
> Sorry for that, Peter.
> 
> I will give the bot few more hours to look for problems and send v7.

Just send an updated patch to the one that needs updating and I'll
replace it in the queue. No need to resend everything else.

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

* Re: [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
  2021-02-25  9:31   ` Peter Zijlstra
@ 2021-02-25 17:30     ` Nadav Amit
  2021-02-26  9:33       ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Nadav Amit @ 2021-02-25 17:30 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9355 bytes --]



> On Feb 25, 2021, at 1:31 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> On Thu, Feb 25, 2021 at 07:33:18AM +0000, Nadav Amit wrote:
>> 
>> 
>>> On Feb 24, 2021, at 3:32 PM, kernel test robot <lkp@intel.com> wrote:
>>> 
>>> Hi Nadav,
>>> 
>>> FYI, the error/warning still remains.
>>> 
>>> tree:   https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fpeterz%2Fqueue.git&amp;data=04%7C01%7Cnamit%40vmware.com%7Caab0736a20e94f44b14008d8d97018a5%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C637498422772098111%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=SObdpR3r6RN9FPeFkzBp1sU0ewhYWJQNfQMGkwRJvHQ%3D&amp;reserved=0 kernelci
>>> head:   c83f21cbef612cdec0d9c6af2d40bea23a45a2a2
>>> commit: 10a90e4556475c6b2d980ed313c41708c5511229 [81/97] smp: inline on_each_cpu_cond() and on_each_cpu()
>>> config: x86_64-randconfig-s021-20210223 (attached as .config)
>>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>> 
>> Sorry for that, Peter.
>> 
>> I will give the bot few more hours to look for problems and send v7.
> 
> Just send an updated patch to the one that needs updating and I'll
> replace it in the queue. No need to resend everything else.

I combined the UP functions in a similar way to SMP.

-- >8 --

From: Nadav Amit <namit@vmware.com>
Date: Tue, 16 Feb 2021 11:04:30 -0800
Subject: [PATCH 9/9] smp: inline on_each_cpu_cond() and on_each_cpu()

Simplify the code and avoid having an additional function on the stack
by inlining on_each_cpu_cond() and on_each_cpu().

Adapt UP in a similar manner to SMP. This might lead to a few cycles
wasted but would consolidate the code and hopefully remove some
inconsistencies: UP's on_each_cpu() did not disable preemption, while
SMP's does; and UP's on_each_cpu_cond_mask() does not check the mask.

Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Nadav Amit <namit@vmware.com>
---
 include/linux/smp.h | 50 ++++++++++++++++++++++++++++------------
 kernel/smp.c        | 56 ---------------------------------------------
 kernel/up.c         | 38 +-----------------------------
 3 files changed, 37 insertions(+), 107 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 70c6f6284dcf..84a0b4828f66 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -50,30 +50,52 @@ extern unsigned int total_cpus;
 int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
 			     int wait);
 
+void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
+			   void *info, bool wait, const struct cpumask *mask);
+
+int smp_call_function_single_async(int cpu, call_single_data_t *csd);
+
 /*
  * Call a function on all processors
  */
-void on_each_cpu(smp_call_func_t func, void *info, int wait);
+static inline void on_each_cpu(smp_call_func_t func, void *info, int wait)
+{
+	on_each_cpu_cond_mask(NULL, func, info, wait, cpu_online_mask);
+}
 
-/*
- * Call a function on processors specified by mask, which might include
- * the local one.
+/**
+ * on_each_cpu_mask(): Run a function on processors specified by
+ * cpumask, which may include the local processor.
+ * @mask: The set of cpus to run on (only runs on online subset).
+ * @func: The function to run. This must be fast and non-blocking.
+ * @info: An arbitrary pointer to pass to the function.
+ * @wait: If true, wait (atomically) until function has completed
+ *        on other CPUs.
+ *
+ * If @wait is true, then returns once @func has returned.
+ *
+ * You must not call this function with disabled interrupts or from a
+ * hardware interrupt handler or from a bottom half handler.  The
+ * exception is that it may be used during early boot while
+ * early_boot_irqs_disabled is set.
  */
-void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
-		void *info, bool wait);
+static inline void on_each_cpu_mask(const struct cpumask *mask,
+				    smp_call_func_t func, void *info, bool wait)
+{
+	on_each_cpu_cond_mask(NULL, func, info, wait, mask);
+}
 
 /*
  * Call a function on each processor for which the supplied function
  * cond_func returns a positive value. This may include the local
- * processor.
+ * processor.  May be used during early boot while early_boot_irqs_disabled is
+ * set. Use local_irq_save/restore() instead of local_irq_disable/enable().
  */
-void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
-		      void *info, bool wait);
-
-void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
-			   void *info, bool wait, const struct cpumask *mask);
-
-int smp_call_function_single_async(int cpu, call_single_data_t *csd);
+static inline void on_each_cpu_cond(smp_cond_func_t cond_func,
+				    smp_call_func_t func, void *info, bool wait)
+{
+	on_each_cpu_cond_mask(cond_func, func, info, wait, cpu_online_mask);
+}
 
 #ifdef CONFIG_SMP
 
diff --git a/kernel/smp.c b/kernel/smp.c
index c8a5a1facc1a..b6375d775e93 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -847,55 +847,6 @@ void __init smp_init(void)
 	smp_cpus_done(setup_max_cpus);
 }
 
-/*
- * Call a function on all processors.  May be used during early boot while
- * early_boot_irqs_disabled is set.  Use local_irq_save/restore() instead
- * of local_irq_disable/enable().
- */
-void on_each_cpu(smp_call_func_t func, void *info, int wait)
-{
-	unsigned long flags;
-
-	preempt_disable();
-	smp_call_function(func, info, wait);
-	local_irq_save(flags);
-	func(info);
-	local_irq_restore(flags);
-	preempt_enable();
-}
-EXPORT_SYMBOL(on_each_cpu);
-
-/**
- * on_each_cpu_mask(): Run a function on processors specified by
- * cpumask, which may include the local processor.
- * @mask: The set of cpus to run on (only runs on online subset).
- * @func: The function to run. This must be fast and non-blocking.
- * @info: An arbitrary pointer to pass to the function.
- * @wait: If true, wait (atomically) until function has completed
- *        on other CPUs.
- *
- * If @wait is true, then returns once @func has returned.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler.  The
- * exception is that it may be used during early boot while
- * early_boot_irqs_disabled is set.
- */
-void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
-			void *info, bool wait)
-{
-	unsigned int scf_flags;
-
-	scf_flags = SCF_RUN_LOCAL;
-	if (wait)
-		scf_flags |= SCF_WAIT;
-
-	preempt_disable();
-	smp_call_function_many_cond(mask, func, info, scf_flags, NULL);
-	preempt_enable();
-}
-EXPORT_SYMBOL(on_each_cpu_mask);
-
 /*
  * on_each_cpu_cond(): Call a function on each processor for which
  * the supplied function cond_func returns true, optionally waiting
@@ -932,13 +883,6 @@ void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
 }
 EXPORT_SYMBOL(on_each_cpu_cond_mask);
 
-void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
-		      void *info, bool wait)
-{
-	on_each_cpu_cond_mask(cond_func, func, info, wait, cpu_online_mask);
-}
-EXPORT_SYMBOL(on_each_cpu_cond);
-
 static void do_nothing(void *unused)
 {
 }
diff --git a/kernel/up.c b/kernel/up.c
index c6f323dcd45b..bf20b4a9af60 100644
--- a/kernel/up.c
+++ b/kernel/up.c
@@ -36,35 +36,6 @@ int smp_call_function_single_async(int cpu, call_single_data_t *csd)
 }
 EXPORT_SYMBOL(smp_call_function_single_async);
 
-void on_each_cpu(smp_call_func_t func, void *info, int wait)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	func(info);
-	local_irq_restore(flags);
-}
-EXPORT_SYMBOL(on_each_cpu);
-
-/*
- * Note we still need to test the mask even for UP
- * because we actually can get an empty mask from
- * code that on SMP might call us without the local
- * CPU in the mask.
- */
-void on_each_cpu_mask(const struct cpumask *mask,
-		      smp_call_func_t func, void *info, bool wait)
-{
-	unsigned long flags;
-
-	if (cpumask_test_cpu(0, mask)) {
-		local_irq_save(flags);
-		func(info);
-		local_irq_restore(flags);
-	}
-}
-EXPORT_SYMBOL(on_each_cpu_mask);
-
 /*
  * Preemption is disabled here to make sure the cond_func is called under the
  * same condtions in UP and SMP.
@@ -75,7 +46,7 @@ void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
 	unsigned long flags;
 
 	preempt_disable();
-	if (cond_func(0, info)) {
+	if ((!cond_func || cond_func(0, info)) && cpumask_test_cpu(0, mask)) {
 		local_irq_save(flags);
 		func(info);
 		local_irq_restore(flags);
@@ -84,13 +55,6 @@ void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
 }
 EXPORT_SYMBOL(on_each_cpu_cond_mask);
 
-void on_each_cpu_cond(smp_cond_func_t cond_func, smp_call_func_t func,
-		      void *info, bool wait)
-{
-	on_each_cpu_cond_mask(cond_func, func, info, wait, NULL);
-}
-EXPORT_SYMBOL(on_each_cpu_cond);
-
 int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
 {
 	int ret;
-- 
2.25.1

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

* Re: [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu'
  2021-02-25 17:30     ` Nadav Amit
@ 2021-02-26  9:33       ` Peter Zijlstra
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2021-02-26  9:33 UTC (permalink / raw
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Thu, Feb 25, 2021 at 05:30:51PM +0000, Nadav Amit wrote:
> > Just send an updated patch to the one that needs updating and I'll
> > replace it in the queue. No need to resend everything else.
> 
> I combined the UP functions in a similar way to SMP.

Thanks, pushed out anew.

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

end of thread, other threads:[~2021-02-26  9:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-24 23:32 [peterz-queue:kernelci 81/97] kernel/up.c:39:6: error: redefinition of 'on_each_cpu' kernel test robot
2021-02-25  7:33 ` Nadav Amit
2021-02-25  9:31   ` Peter Zijlstra
2021-02-25 17:30     ` Nadav Amit
2021-02-26  9:33       ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2021-02-24 22:58 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.