linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] smp: fix smp_call_function_single_async prototype
@ 2021-04-29 15:09 Arnd Bergmann
  2021-04-29 15:54 ` Jens Axboe
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Arnd Bergmann @ 2021-04-29 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Jens Axboe, Jian Cai, Guenter Roeck,
	Peter Zijlstra, Huang, Ying, Borislav Petkov, Eric Dumazet,
	Juergen Gross, Michael Ellerman, Thomas Gleixner

From: Arnd Bergmann <arnd@arndb.de>

As of commit 966a967116e6 ("smp: Avoid using two cache lines for struct
call_single_data"), the smp code prefers 32-byte aligned call_single_data
objects for performance reasons, but the block layer includes an instance
of this structure in the main 'struct request' that is more senstive
to size than to performance here, see 4ccafe032005 ("block: unalign
call_single_data in struct request").

The result is a violation of the calling conventions that clang correctly
points out:

block/blk-mq.c:630:39: warning: passing 8-byte aligned argument to 32-byte aligned parameter 2 of 'smp_call_function_single_async' may result in an unaligned pointer access [-Walign-mismatch]
                smp_call_function_single_async(cpu, &rq->csd);

It does seem that the usage of the call_single_data without cache line
alignment should still be allowed by the smp code, so just change the
function prototype so it accepts both, but leave the default alignment
unchanged for the other users. This seems better to me than adding
a local hack to shut up an otherwise correct warning in the caller.

Link: https://lore.kernel.org/linux-block/20210330230249.709221-1-jiancai@google.com/
Link: https://github.com/ClangBuiltLinux/linux/issues/1328
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jian Cai <jiancai@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/smp.h | 2 +-
 kernel/smp.c        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 669e35c03be2..510519e8a1eb 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -53,7 +53,7 @@ int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
 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);
+int smp_call_function_single_async(int cpu, struct __call_single_data *csd);
 
 /*
  * Cpus stopping functions in panic. All have default weak definitions.
diff --git a/kernel/smp.c b/kernel/smp.c
index e21074900006..1ec771d9f91c 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -401,7 +401,7 @@ static void __csd_lock_wait(call_single_data_t *csd)
 	smp_acquire__after_ctrl_dep();
 }
 
-static __always_inline void csd_lock_wait(call_single_data_t *csd)
+static __always_inline void csd_lock_wait(struct __call_single_data *csd)
 {
 	if (static_branch_unlikely(&csdlock_debug_enabled)) {
 		__csd_lock_wait(csd);
@@ -501,7 +501,7 @@ void __smp_call_single_queue(int cpu, struct llist_node *node)
  * for execution on the given CPU. data must already have
  * ->func, ->info, and ->flags set.
  */
-static int generic_exec_single(int cpu, call_single_data_t *csd)
+static int generic_exec_single(int cpu, struct __call_single_data *csd)
 {
 	if (cpu == smp_processor_id()) {
 		smp_call_func_t func = csd->func;
@@ -784,7 +784,7 @@ EXPORT_SYMBOL(smp_call_function_single);
  * NOTE: Be careful, there is unfortunately no current debugging facility to
  * validate the correctness of this serialization.
  */
-int smp_call_function_single_async(int cpu, call_single_data_t *csd)
+int smp_call_function_single_async(int cpu, struct __call_single_data *csd)
 {
 	int err = 0;
 
-- 
2.29.2


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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 15:09 [PATCH] smp: fix smp_call_function_single_async prototype Arnd Bergmann
@ 2021-04-29 15:54 ` Jens Axboe
  2021-04-29 18:17 ` Nick Desaulniers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2021-04-29 15:54 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kernel
  Cc: Arnd Bergmann, Jian Cai, Guenter Roeck, Peter Zijlstra, Huang,
	Ying, Borislav Petkov, Eric Dumazet, Juergen Gross,
	Michael Ellerman, Thomas Gleixner

On 4/29/21 9:09 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> As of commit 966a967116e6 ("smp: Avoid using two cache lines for struct
> call_single_data"), the smp code prefers 32-byte aligned call_single_data
> objects for performance reasons, but the block layer includes an instance
> of this structure in the main 'struct request' that is more senstive
> to size than to performance here, see 4ccafe032005 ("block: unalign
> call_single_data in struct request").
> 
> The result is a violation of the calling conventions that clang correctly
> points out:
> 
> block/blk-mq.c:630:39: warning: passing 8-byte aligned argument to 32-byte aligned parameter 2 of 'smp_call_function_single_async' may result in an unaligned pointer access [-Walign-mismatch]
>                 smp_call_function_single_async(cpu, &rq->csd);
> 
> It does seem that the usage of the call_single_data without cache line
> alignment should still be allowed by the smp code, so just change the
> function prototype so it accepts both, but leave the default alignment
> unchanged for the other users. This seems better to me than adding
> a local hack to shut up an otherwise correct warning in the caller.

I think that's the right approach, rather than work-around it in eg
blk-mq.

Acked-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe


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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 15:09 [PATCH] smp: fix smp_call_function_single_async prototype Arnd Bergmann
  2021-04-29 15:54 ` Jens Axboe
@ 2021-04-29 18:17 ` Nick Desaulniers
  2021-04-29 18:24   ` Nick Desaulniers
  2021-04-29 19:08 ` kernel test robot
  2021-04-29 21:44 ` kernel test robot
  3 siblings, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2021-04-29 18:17 UTC (permalink / raw)
  To: arnd
  Cc: arnd, axboe, bp, eric.dumazet, jgross, jiancai, linux-kernel,
	linux, mpe, peterz, tglx, ying.huang, Nathan Chancellor,
	clang-built-linux

(replying manually to
https://lore.kernel.org/lkml/20210429150940.3256656-1-arnd@kernel.org/)

Thanks for the patch; with this applied I observe the following new warnings
though (for x86_64 defconfig; make LLVM=1 LLVM_IAS=1 -j72)

kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte
aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer
access [-Walign-mismatch]
                csd_lock_record(csd);
                                ^
kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte
aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
[-Walign-mismatch]
                csd_unlock(csd);
                           ^
kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte
aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
[-Walign-mismatch]
                csd_unlock(csd);
                           ^

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 18:17 ` Nick Desaulniers
@ 2021-04-29 18:24   ` Nick Desaulniers
  2021-04-29 18:26     ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2021-04-29 18:24 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jens Axboe, Borislav Petkov, eric.dumazet,
	Juergen Gross, Jian Cai, LKML, Guenter Roeck, Michael Ellerman,
	Peter Zijlstra, Thomas Gleixner, ying.huang, Nathan Chancellor,
	clang-built-linux

On Thu, Apr 29, 2021 at 11:17 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> (replying manually to
> https://lore.kernel.org/lkml/20210429150940.3256656-1-arnd@kernel.org/)
>
> Thanks for the patch; with this applied I observe the following new warnings
> though (for x86_64 defconfig; make LLVM=1 LLVM_IAS=1 -j72)
>
> kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte
> aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer
> access [-Walign-mismatch]
>                 csd_lock_record(csd);
>                                 ^
> kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte
> aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
> [-Walign-mismatch]
>                 csd_unlock(csd);
>                            ^
> kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte
> aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
> [-Walign-mismatch]
>                 csd_unlock(csd);
>                            ^

Perhaps roll this into a v2?

diff --git a/kernel/smp.c b/kernel/smp.c
index 1ec771d9f91c..499be1eb5189 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -226,7 +226,7 @@ static void __csd_lock_record(call_single_data_t *csd)
                  /* Or before unlock, as the case may be. */
 }

-static __always_inline void csd_lock_record(call_single_data_t *csd)
+static __always_inline void csd_lock_record(struct __call_single_data *csd)
 {
        if (static_branch_unlikely(&csdlock_debug_enabled))
                __csd_lock_record(csd);
@@ -431,7 +431,7 @@ static void __smp_call_single_queue_debug(int cpu,
struct llist_node *node)
 #else
 #define cfd_seq_store(var, src, dst, type)

-static void csd_lock_record(call_single_data_t *csd)
+static void csd_lock_record(struct __call_single_data *csd)
 {
 }

@@ -454,7 +454,7 @@ static __always_inline void
csd_lock(call_single_data_t *csd)
        smp_wmb();
 }

-static __always_inline void csd_unlock(call_single_data_t *csd)
+static __always_inline void csd_unlock(struct __call_single_data *csd)
 {
        WARN_ON(!(csd->node.u_flags & CSD_FLAG_LOCK));

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 18:24   ` Nick Desaulniers
@ 2021-04-29 18:26     ` Arnd Bergmann
  2021-04-29 18:39       ` Nick Desaulniers
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2021-04-29 18:26 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Jens Axboe, Borislav Petkov, Eric Dumazet, Juergen Gross,
	Jian Cai, LKML, Guenter Roeck, Michael Ellerman, Peter Zijlstra,
	Thomas Gleixner, Huang Ying, Nathan Chancellor,
	clang-built-linux

On Thu, Apr 29, 2021 at 8:24 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>
> On Thu, Apr 29, 2021 at 11:17 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > (replying manually to
> > https://lore.kernel.org/lkml/20210429150940.3256656-1-arnd@kernel.org/)
> >
> > Thanks for the patch; with this applied I observe the following new warnings
> > though (for x86_64 defconfig; make LLVM=1 LLVM_IAS=1 -j72)
> >
> > kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte
> > aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer
> > access [-Walign-mismatch]
> >                 csd_lock_record(csd);
> >                                 ^
> > kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte
> > aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
> > [-Walign-mismatch]
> >                 csd_unlock(csd);
> >                            ^
> > kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte
> > aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access
> > [-Walign-mismatch]
> >                 csd_unlock(csd);
> >                            ^
>
> Perhaps roll this into a v2?
>

Right, I just did the same thing. I wonder if I failed to hit those because of
differences in configuration or because I tested the wrong way.

Either way, I'll give it some more time on the randconfig build machine
before I send out v2.

       Arnd

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 18:26     ` Arnd Bergmann
@ 2021-04-29 18:39       ` Nick Desaulniers
  0 siblings, 0 replies; 9+ messages in thread
From: Nick Desaulniers @ 2021-04-29 18:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jens Axboe, Borislav Petkov, Eric Dumazet, Juergen Gross,
	Jian Cai, LKML, Guenter Roeck, Michael Ellerman, Peter Zijlstra,
	Thomas Gleixner, Huang Ying, Nathan Chancellor,
	clang-built-linux

On Thu, Apr 29, 2021 at 11:27 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> Either way, I'll give it some more time on the randconfig build machine
> before I send out v2.

SGTM and thanks for the fix.  Perhaps worth a note that this isn't
just "a violation of the calling conventions" but straight up
undefined behavior, full stop.

UBSAN folks are working on adding a catch for this as well:
https://reviews.llvm.org/D100037, see the relevant citations from the
standard.
-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 15:09 [PATCH] smp: fix smp_call_function_single_async prototype Arnd Bergmann
  2021-04-29 15:54 ` Jens Axboe
  2021-04-29 18:17 ` Nick Desaulniers
@ 2021-04-29 19:08 ` kernel test robot
  2021-04-29 21:44 ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-04-29 19:08 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kernel
  Cc: kbuild-all, clang-built-linux, Arnd Bergmann, Jens Axboe,
	Jian Cai, Guenter Roeck, Peter Zijlstra, Huang, Ying,
	Borislav Petkov, Eric Dumazet, Juergen Gross

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

Hi Arnd,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210429]
[cannot apply to linux/master soc/for-next linus/master v5.12 v5.12-rc8 v5.12-rc7 v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
base:    9e5cff2a1315fec1da1f497714395670366506b6
config: x86_64-randconfig-a013-20210429 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9131a078901b00e68248a27a4f8c4b11bb1db1ae)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/be40015a8e0990182fa440f75adecf40cf5d0062
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
        git checkout be40015a8e0990182fa440f75adecf40cf5d0062
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_lock_record(csd);
                                   ^
>> kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_unlock(csd);
                              ^
   kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_unlock(csd);
                              ^
   kernel/smp.c:684:6: warning: no previous prototype for function 'flush_smp_call_function_from_idle' [-Wmissing-prototypes]
   void flush_smp_call_function_from_idle(void)
        ^
   kernel/smp.c:684:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void flush_smp_call_function_from_idle(void)
   ^
   static 
   4 warnings generated.


vim +/csd_lock_record +515 kernel/smp.c

4b44a21dd640b6 Peter Zijlstra      2020-05-26  498  
3d4422332711ef Jens Axboe          2008-06-26  499  /*
966a967116e699 Ying Huang          2017-08-08  500   * Insert a previously allocated call_single_data_t element
0b13fda1e0936b Ingo Molnar         2009-02-25  501   * for execution on the given CPU. data must already have
0b13fda1e0936b Ingo Molnar         2009-02-25  502   * ->func, ->info, and ->flags set.
3d4422332711ef Jens Axboe          2008-06-26  503   */
be40015a8e0990 Arnd Bergmann       2021-04-29  504  static int generic_exec_single(int cpu, struct __call_single_data *csd)
3d4422332711ef Jens Axboe          2008-06-26  505  {
8053871d0f7f67 Linus Torvalds      2015-02-11  506  	if (cpu == smp_processor_id()) {
4b44a21dd640b6 Peter Zijlstra      2020-05-26  507  		smp_call_func_t func = csd->func;
4b44a21dd640b6 Peter Zijlstra      2020-05-26  508  		void *info = csd->info;
8b28499a71d343 Frederic Weisbecker 2014-02-24  509  		unsigned long flags;
8b28499a71d343 Frederic Weisbecker 2014-02-24  510  
8053871d0f7f67 Linus Torvalds      2015-02-11  511  		/*
8053871d0f7f67 Linus Torvalds      2015-02-11  512  		 * We can unlock early even for the synchronous on-stack case,
8053871d0f7f67 Linus Torvalds      2015-02-11  513  		 * since we're doing this from the same CPU..
8053871d0f7f67 Linus Torvalds      2015-02-11  514  		 */
35feb60474bf4f Paul E. McKenney    2020-06-30 @515  		csd_lock_record(csd);
8053871d0f7f67 Linus Torvalds      2015-02-11 @516  		csd_unlock(csd);
8b28499a71d343 Frederic Weisbecker 2014-02-24  517  		local_irq_save(flags);
8b28499a71d343 Frederic Weisbecker 2014-02-24  518  		func(info);
35feb60474bf4f Paul E. McKenney    2020-06-30  519  		csd_lock_record(NULL);
8b28499a71d343 Frederic Weisbecker 2014-02-24  520  		local_irq_restore(flags);
8b28499a71d343 Frederic Weisbecker 2014-02-24  521  		return 0;
8b28499a71d343 Frederic Weisbecker 2014-02-24  522  	}
8b28499a71d343 Frederic Weisbecker 2014-02-24  523  
5224b9613b91d9 Linus Torvalds      2015-04-19  524  	if ((unsigned)cpu >= nr_cpu_ids || !cpu_online(cpu)) {
5224b9613b91d9 Linus Torvalds      2015-04-19  525  		csd_unlock(csd);
8b28499a71d343 Frederic Weisbecker 2014-02-24  526  		return -ENXIO;
5224b9613b91d9 Linus Torvalds      2015-04-19  527  	}
8b28499a71d343 Frederic Weisbecker 2014-02-24  528  
545b8c8df41f9e Peter Zijlstra      2020-06-15  529  	__smp_call_single_queue(cpu, &csd->node.llist);
3d4422332711ef Jens Axboe          2008-06-26  530  
8b28499a71d343 Frederic Weisbecker 2014-02-24  531  	return 0;
3d4422332711ef Jens Axboe          2008-06-26  532  }
3d4422332711ef Jens Axboe          2008-06-26  533  

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

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

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 15:09 [PATCH] smp: fix smp_call_function_single_async prototype Arnd Bergmann
                   ` (2 preceding siblings ...)
  2021-04-29 19:08 ` kernel test robot
@ 2021-04-29 21:44 ` kernel test robot
  2021-04-29 23:00   ` Jian Cai
  3 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2021-04-29 21:44 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kernel
  Cc: kbuild-all, clang-built-linux, Arnd Bergmann, Jens Axboe,
	Jian Cai, Guenter Roeck, Peter Zijlstra, Huang, Ying,
	Borislav Petkov, Eric Dumazet, Juergen Gross

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

Hi Arnd,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210429]
[cannot apply to linux/master soc/for-next linus/master v5.12 v5.12-rc8 v5.12-rc7 v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
base:    9e5cff2a1315fec1da1f497714395670366506b6
config: arm64-randconfig-r022-20210429 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9131a078901b00e68248a27a4f8c4b11bb1db1ae)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/be40015a8e0990182fa440f75adecf40cf5d0062
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
        git checkout be40015a8e0990182fa440f75adecf40cf5d0062
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> kernel/smp.c:407:19: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of '__csd_lock_wait' may result in an unaligned pointer access [-Walign-mismatch]
                   __csd_lock_wait(csd);
                                   ^
   kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_lock_record(csd);
                                   ^
   kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_unlock(csd);
                              ^
   kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
                   csd_unlock(csd);
                              ^
   kernel/smp.c:684:6: warning: no previous prototype for function 'flush_smp_call_function_from_idle' [-Wmissing-prototypes]
   void flush_smp_call_function_from_idle(void)
        ^
   kernel/smp.c:684:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void flush_smp_call_function_from_idle(void)
   ^
   static 
   5 warnings generated.


vim +/__csd_lock_wait +407 kernel/smp.c

35feb60474bf4f Paul E. McKenney 2020-06-30  403  
be40015a8e0990 Arnd Bergmann    2021-04-29  404  static __always_inline void csd_lock_wait(struct __call_single_data *csd)
8d0968cc6b8ffd Juergen Gross    2021-03-01  405  {
8d0968cc6b8ffd Juergen Gross    2021-03-01  406  	if (static_branch_unlikely(&csdlock_debug_enabled)) {
8d0968cc6b8ffd Juergen Gross    2021-03-01 @407  		__csd_lock_wait(csd);
8d0968cc6b8ffd Juergen Gross    2021-03-01  408  		return;
8d0968cc6b8ffd Juergen Gross    2021-03-01  409  	}
8d0968cc6b8ffd Juergen Gross    2021-03-01  410  
8d0968cc6b8ffd Juergen Gross    2021-03-01  411  	smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK));
8d0968cc6b8ffd Juergen Gross    2021-03-01  412  }
a5aabace5fb8ab Juergen Gross    2021-03-01  413  

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

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

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

* Re: [PATCH] smp: fix smp_call_function_single_async prototype
  2021-04-29 21:44 ` kernel test robot
@ 2021-04-29 23:00   ` Jian Cai
  0 siblings, 0 replies; 9+ messages in thread
From: Jian Cai @ 2021-04-29 23:00 UTC (permalink / raw)
  To: kernel test robot
  Cc: Arnd Bergmann, Linux Kernel Mailing List, kbuild-all,
	clang-built-linux, Arnd Bergmann, Jens Axboe, Guenter Roeck,
	Peter Zijlstra, Huang, Ying, Borislav Petkov, Eric Dumazet,
	Juergen Gross

Thanks for the patch! Some of the stable kernels also have this
warning, but they don't seem to have the dependencies (4.14, 4,19,
5.4). Do we plan to fix those branches as well?


On Thu, Apr 29, 2021 at 2:46 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Arnd,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on next-20210429]
> [cannot apply to linux/master soc/for-next linus/master v5.12 v5.12-rc8 v5.12-rc7 v5.12]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
> base:    9e5cff2a1315fec1da1f497714395670366506b6
> config: arm64-randconfig-r022-20210429 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9131a078901b00e68248a27a4f8c4b11bb1db1ae)
> 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 arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         # https://github.com/0day-ci/linux/commit/be40015a8e0990182fa440f75adecf40cf5d0062
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Arnd-Bergmann/smp-fix-smp_call_function_single_async-prototype/20210429-231235
>         git checkout be40015a8e0990182fa440f75adecf40cf5d0062
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> kernel/smp.c:407:19: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of '__csd_lock_wait' may result in an unaligned pointer access [-Walign-mismatch]
>                    __csd_lock_wait(csd);
>                                    ^
>    kernel/smp.c:515:19: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_lock_record' may result in an unaligned pointer access [-Walign-mismatch]
>                    csd_lock_record(csd);
>                                    ^
>    kernel/smp.c:516:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
>                    csd_unlock(csd);
>                               ^
>    kernel/smp.c:525:14: warning: passing 8-byte aligned argument to 32-byte aligned parameter 1 of 'csd_unlock' may result in an unaligned pointer access [-Walign-mismatch]
>                    csd_unlock(csd);
>                               ^
>    kernel/smp.c:684:6: warning: no previous prototype for function 'flush_smp_call_function_from_idle' [-Wmissing-prototypes]
>    void flush_smp_call_function_from_idle(void)
>         ^
>    kernel/smp.c:684:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>    void flush_smp_call_function_from_idle(void)
>    ^
>    static
>    5 warnings generated.
>
>
> vim +/__csd_lock_wait +407 kernel/smp.c
>
> 35feb60474bf4f Paul E. McKenney 2020-06-30  403
> be40015a8e0990 Arnd Bergmann    2021-04-29  404  static __always_inline void csd_lock_wait(struct __call_single_data *csd)
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  405  {
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  406         if (static_branch_unlikely(&csdlock_debug_enabled)) {
> 8d0968cc6b8ffd Juergen Gross    2021-03-01 @407                 __csd_lock_wait(csd);
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  408                 return;
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  409         }
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  410
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  411         smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK));
> 8d0968cc6b8ffd Juergen Gross    2021-03-01  412  }
> a5aabace5fb8ab Juergen Gross    2021-03-01  413
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2021-04-29 23:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 15:09 [PATCH] smp: fix smp_call_function_single_async prototype Arnd Bergmann
2021-04-29 15:54 ` Jens Axboe
2021-04-29 18:17 ` Nick Desaulniers
2021-04-29 18:24   ` Nick Desaulniers
2021-04-29 18:26     ` Arnd Bergmann
2021-04-29 18:39       ` Nick Desaulniers
2021-04-29 19:08 ` kernel test robot
2021-04-29 21:44 ` kernel test robot
2021-04-29 23:00   ` Jian Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).