From patchwork Wed Sep 13 13:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 138870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp1136103vqx; Wed, 13 Sep 2023 07:44:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGfrDRUlTdIQ/x5GOXHjGQrgP2/u30reNVSDEorX3yD8P4nweQnV516ehPD2JFxDouC4AP X-Received: by 2002:a05:6a00:2d8d:b0:68f:b015:ea99 with SMTP id fb13-20020a056a002d8d00b0068fb015ea99mr4327782pfb.10.1694616286599; Wed, 13 Sep 2023 07:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694616286; cv=none; d=google.com; s=arc-20160816; b=lB4hht5GjsqpfzkrRG0aUCh9ckinOdk7yJ3TqcK92VYf2wjs2fEeanD+p1xb1ctSr/ MYpJKqxsUIPaHk4g8Anf47fLsiGigCUrmGOIG4ejeJXskJ7416XhPZSCIhyn6cNQVhVq dO5gWEwt/IgtRCvsEdk0WY7FHwQGE8+6ldGFSNIhq0Bb/4jZDTaAEkiPgfAmDYJB91p7 REy/d6a6x1SjGefive8diN+W7iehxVcJCT2pQwPP5YxJOlKibiX5GVP2u34/F7ZTL8XC 2znYrRb98e63IZUTcmI9ndaKfvxJZVbbbMhz1KfRvLr8KOpj2DUksJxNmJuyCFNCVBrf Co0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=wb/APhQFGyMx84W31Q0gHe7XzN1/IU592+NvQ04bgvc=; fh=F/EKh3Dc9MOE/BkxqIH3i3jynwY6u9D/JCihEzs90iI=; b=v/BhbhFKOApfbxWnu1lD3uBZNODKQf0yBwPc1nGB1jPX99AwQ9+3ob+UZqrN4o4md/ Ex0v+hWbzbLSmkZsLjbD0JC5r1E8GmYl1ehx8EXx9fQIwjCqtJivhT3PMfzdlTJ4qhBT +v7abCp3OdBDjCUaI0WnEFaDaSb9mTH6W3dgUSHhDtSdYnUHomVHbx51Lqspa2s4hOUH KyHy01Tld6kuoXdV4Z1urAhwwLqnJwCo+mFyBGTfzLW2bPA9ZtyBtRqmaEdALJAihSkf QIjQvEiutIyDmBpuGMCGG4j1r5iRkgWcPR82hPbR4tLgbEljQknzWXuVc4EHQpEF1YIQ 4asw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=y7dmEXWo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8iRoC1+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b26-20020a6567da000000b0056a1a709797si10697361pgs.654.2023.09.13.07.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 07:44:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=y7dmEXWo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8iRoC1+g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9C25F83037E2; Wed, 13 Sep 2023 06:03:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234679AbjIMNDY (ORCPT + 36 others); Wed, 13 Sep 2023 09:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbjIMNDW (ORCPT ); Wed, 13 Sep 2023 09:03:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809B219B4; Wed, 13 Sep 2023 06:03:18 -0700 (PDT) Date: Wed, 13 Sep 2023 13:03:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694610196; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wb/APhQFGyMx84W31Q0gHe7XzN1/IU592+NvQ04bgvc=; b=y7dmEXWosAyV7xjx3joVAf9V6runeYiSYi2tPb/eBo4vKzddf9f7FGqetmeigmICpg0ot+ y9ZUqIveLeDmwfl0gwmVCMscUZKRCTyZDyVDydQyB74VkQKqJ9X3LT3bJaaroCm6QU/aqc +nKkBFL6HD4QlQeBGJbtYrGXP/+uXJnSwIb4feO2JzDZtBidzYmx2SZRg7vcODoiTSHcNA y0S1i544AVdPSfSV9Vhnq2Bxz5AvUeTjILLd8gjf9gDSXc+n8urfU2XVaWhMBDzVkkLCym j/Xm9fW/ROgWPNtCf+FkvWQfREQX0GM7MDcrLgYzJAqMZFit5eLMfZT+TBxJFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694610196; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wb/APhQFGyMx84W31Q0gHe7XzN1/IU592+NvQ04bgvc=; b=8iRoC1+g4tG8Hcvydy6eIXefTUelbBF56lzhfHxgQoEJVmQjMzai9GVCRXJ7cPTMNaCfC7 dXcdkOXV7B/IewBQ== From: "tip-bot2 for Leonardo Bras" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: smp/core] smp: Change function signatures to use call_single_data_t Cc: Leonardo Bras , Guo Ren , "Peter Zijlstra (Intel)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230831063129.335425-1-leobras@redhat.com> References: <20230831063129.335425-1-leobras@redhat.com> MIME-Version: 1.0 Message-ID: <169461019515.27769.14088820979826570090.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 06:03:45 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776845015913881002 X-GMAIL-MSGID: 1776933967087195430 The following commit has been merged into the smp/core branch of tip: Commit-ID: d090ec0df81e56556af3a2bf04a7e89347ae5784 Gitweb: https://git.kernel.org/tip/d090ec0df81e56556af3a2bf04a7e89347ae5784 Author: Leonardo Bras AuthorDate: Thu, 31 Aug 2023 03:31:28 -03:00 Committer: Ingo Molnar CommitterDate: Wed, 13 Sep 2023 14:59:24 +02:00 smp: Change function signatures to use call_single_data_t call_single_data_t is a size-aligned typedef of struct __call_single_data. This alignment is desirable in order to have smp_call_function*() avoid bouncing an extra cacheline in case of an unaligned csd, given this would hurt performance. Since the removal of struct request->csd in commit 660e802c76c8 ("blk-mq: use percpu csd to remote complete instead of per-rq csd") there are no current users of smp_call_function*() with unaligned csd. Change every 'struct __call_single_data' function parameter to 'call_single_data_t', so we have warnings if any new code tries to introduce an smp_call_function*() call with unaligned csd. Signed-off-by: Leonardo Bras Reviewed-by: Guo Ren Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20230831063129.335425-1-leobras@redhat.com --- include/linux/smp.h | 2 +- include/trace/events/csd.h | 8 ++++---- kernel/smp.c | 26 +++++++++++++------------- kernel/up.c | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/linux/smp.h b/include/linux/smp.h index 91ea4a6..e87520d 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, struct __call_single_data *csd); +int smp_call_function_single_async(int cpu, call_single_data_t *csd); /* * Cpus stopping functions in panic. All have default weak definitions. diff --git a/include/trace/events/csd.h b/include/trace/events/csd.h index 67e9d01..58cc83b 100644 --- a/include/trace/events/csd.h +++ b/include/trace/events/csd.h @@ -12,7 +12,7 @@ TRACE_EVENT(csd_queue_cpu, TP_PROTO(const unsigned int cpu, unsigned long callsite, smp_call_func_t func, - struct __call_single_data *csd), + call_single_data_t *csd), TP_ARGS(cpu, callsite, func, csd), @@ -39,7 +39,7 @@ TRACE_EVENT(csd_queue_cpu, */ DECLARE_EVENT_CLASS(csd_function, - TP_PROTO(smp_call_func_t func, struct __call_single_data *csd), + TP_PROTO(smp_call_func_t func, call_single_data_t *csd), TP_ARGS(func, csd), @@ -57,12 +57,12 @@ DECLARE_EVENT_CLASS(csd_function, ); DEFINE_EVENT(csd_function, csd_function_entry, - TP_PROTO(smp_call_func_t func, struct __call_single_data *csd), + TP_PROTO(smp_call_func_t func, call_single_data_t *csd), TP_ARGS(func, csd) ); DEFINE_EVENT(csd_function, csd_function_exit, - TP_PROTO(smp_call_func_t func, struct __call_single_data *csd), + TP_PROTO(smp_call_func_t func, call_single_data_t *csd), TP_ARGS(func, csd) ); diff --git a/kernel/smp.c b/kernel/smp.c index 385179d..822fabb 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -125,7 +125,7 @@ send_call_function_ipi_mask(struct cpumask *mask) } static __always_inline void -csd_do_func(smp_call_func_t func, void *info, struct __call_single_data *csd) +csd_do_func(smp_call_func_t func, void *info, call_single_data_t *csd) { trace_csd_function_entry(func, csd); func(info); @@ -172,7 +172,7 @@ module_param(csd_lock_timeout, ulong, 0444); static atomic_t csd_bug_count = ATOMIC_INIT(0); /* Record current CSD work for current CPU, NULL to erase. */ -static void __csd_lock_record(struct __call_single_data *csd) +static void __csd_lock_record(call_single_data_t *csd) { if (!csd) { smp_mb(); /* NULL cur_csd after unlock. */ @@ -187,13 +187,13 @@ static void __csd_lock_record(struct __call_single_data *csd) /* Or before unlock, as the case may be. */ } -static __always_inline void csd_lock_record(struct __call_single_data *csd) +static __always_inline void csd_lock_record(call_single_data_t *csd) { if (static_branch_unlikely(&csdlock_debug_enabled)) __csd_lock_record(csd); } -static int csd_lock_wait_getcpu(struct __call_single_data *csd) +static int csd_lock_wait_getcpu(call_single_data_t *csd) { unsigned int csd_type; @@ -208,7 +208,7 @@ static int csd_lock_wait_getcpu(struct __call_single_data *csd) * the CSD_TYPE_SYNC/ASYNC types provide the destination CPU, * so waiting on other types gets much less information. */ -static bool csd_lock_wait_toolong(struct __call_single_data *csd, u64 ts0, u64 *ts1, int *bug_id) +static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, int *bug_id) { int cpu = -1; int cpux; @@ -272,7 +272,7 @@ static bool csd_lock_wait_toolong(struct __call_single_data *csd, u64 ts0, u64 * * previous function call. For multi-cpu calls its even more interesting * as we'll have to ensure no other cpu is observing our csd. */ -static void __csd_lock_wait(struct __call_single_data *csd) +static void __csd_lock_wait(call_single_data_t *csd) { int bug_id = 0; u64 ts0, ts1; @@ -286,7 +286,7 @@ static void __csd_lock_wait(struct __call_single_data *csd) smp_acquire__after_ctrl_dep(); } -static __always_inline void csd_lock_wait(struct __call_single_data *csd) +static __always_inline void csd_lock_wait(call_single_data_t *csd) { if (static_branch_unlikely(&csdlock_debug_enabled)) { __csd_lock_wait(csd); @@ -296,17 +296,17 @@ static __always_inline void csd_lock_wait(struct __call_single_data *csd) smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK)); } #else -static void csd_lock_record(struct __call_single_data *csd) +static void csd_lock_record(call_single_data_t *csd) { } -static __always_inline void csd_lock_wait(struct __call_single_data *csd) +static __always_inline void csd_lock_wait(call_single_data_t *csd) { smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK)); } #endif -static __always_inline void csd_lock(struct __call_single_data *csd) +static __always_inline void csd_lock(call_single_data_t *csd) { csd_lock_wait(csd); csd->node.u_flags |= CSD_FLAG_LOCK; @@ -319,7 +319,7 @@ static __always_inline void csd_lock(struct __call_single_data *csd) smp_wmb(); } -static __always_inline void csd_unlock(struct __call_single_data *csd) +static __always_inline void csd_unlock(call_single_data_t *csd) { WARN_ON(!(csd->node.u_flags & CSD_FLAG_LOCK)); @@ -372,7 +372,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, struct __call_single_data *csd) +static int generic_exec_single(int cpu, call_single_data_t *csd) { if (cpu == smp_processor_id()) { smp_call_func_t func = csd->func; @@ -658,7 +658,7 @@ EXPORT_SYMBOL(smp_call_function_single); * * Return: %0 on success or negative errno value on error */ -int smp_call_function_single_async(int cpu, struct __call_single_data *csd) +int smp_call_function_single_async(int cpu, call_single_data_t *csd) { int err = 0; diff --git a/kernel/up.c b/kernel/up.c index a38b8b0..df50828 100644 --- a/kernel/up.c +++ b/kernel/up.c @@ -25,7 +25,7 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, } EXPORT_SYMBOL(smp_call_function_single); -int smp_call_function_single_async(int cpu, struct __call_single_data *csd) +int smp_call_function_single_async(int cpu, call_single_data_t *csd) { unsigned long flags;