Re: [PATCH] smp: fix smp_call_function_single_async prototype

From: Nick Desaulniers
Date: Thu Apr 29 2021 - 14:28:54 EST


On Thu, Apr 29, 2021 at 11:17 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> (replying manually to
> https://lore.kernel.org/lkml/20210429150940.3256656-1-arnd@xxxxxxxxxx/)
>
> 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