From patchwork Tue Mar 28 08:34:44 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: 75895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2059203vqo; Tue, 28 Mar 2023 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AKy350bSvUBfVx3Xw6IKg/IX5jT0O8/KelVu0cxHBAkzwvLzjKGnh3xQQW0kLZVRXYiPZTE6Rk1t X-Received: by 2002:a17:90b:33c5:b0:23f:9fac:6b35 with SMTP id lk5-20020a17090b33c500b0023f9fac6b35mr16288107pjb.39.1679992606414; Tue, 28 Mar 2023 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679992606; cv=none; d=google.com; s=arc-20160816; b=EnArLoC5mmrIT5LiXN5vX5OHQ3GOO9OoaSqVTV9a8thy9fUeyFBTIDBavht78mMsKT RgxjxFatcw28fK7WschQyUF1Ljq35kFnPufic8V8zlQC2orI7sRKcqB9q0PLheaTghEF VBJ+JF+yuX8Wqprp29BSYpO8TuO5imsQe0JyvfFUvDcGgU+uLtPukbRKan1RJQYzXGhQ 5VoUpe09KH6sjmoTYFEPhsCWrIiVgV3xEpwnmXp4NOx+9huzeZbEV2qNSQ3T4YBlPWKE g1Ihz8MmSWD8f39dodVmzTc/aQDlcAisK2G1w78jP9Dph0YbHbVEAhmY4V0/hffowW0J EOsg== 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:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=XpLjRFRiEVC9/oYrVNBJfIL8dz/BQSgaQjKmk/OnM7E=; b=epzytSCW7BToM8QzMLZL1RlQ1m7+/gi2lVuB/HyFxpVIOEKICFVX3nuIo+aaBUG4rp u9tF53hZzuipITE0A/d8dPALiLPdcN7EElRVviGdxpIxzHo0g2P+wVUyN0wG0/gUbqkq lnvnHH+KuqUWRFJbFGo7QjZgjhLSaWrGtXMWhAHMNmIC5/Hwj8ruKBOJhuedh6JqT3/2 nNNGoBAJhWycZTvriFRN8zdW+EqKA5iPRvkFTI2BF+hp7rfIRX5NvjEzJe7pe43cYxai T3WcaggqeaLVrxJfFraGfKb3SpFc8khFKBkjH45FtCuDopHr4rS+Bo34bzoBL6jpnxYk ryrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aXWEWHLS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a170903230300b0019ab692fc96si31367291plh.346.2023.03.28.01.36.33; Tue, 28 Mar 2023 01:36:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aXWEWHLS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232509AbjC1Ie6 (ORCPT + 99 others); Tue, 28 Mar 2023 04:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232220AbjC1Iet (ORCPT ); Tue, 28 Mar 2023 04:34:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A32944A2; Tue, 28 Mar 2023 01:34:47 -0700 (PDT) Date: Tue, 28 Mar 2023 08:34:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679992484; 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; bh=XpLjRFRiEVC9/oYrVNBJfIL8dz/BQSgaQjKmk/OnM7E=; b=aXWEWHLS3Aw9XnGdosUPHOV9eVIpnbKiqEwdsm6W1AiLtj+xTNHrAyeLkeVIvOTFyApliB VoE4XzjMbnyAeMHPsWyoDX55dgRAkXY/JMpd+8DjMbANO3OHLF3fPgNro8iQa5PUTFyV5E o9EzQpLv+H/SdbSbGyezxhGyiyzNHoSLBJj/GruKy3cjEeswQY34XUfUnoiyO6RTqS+Ndt j6LCuFMycNUoRFQd/AS6zf7LXnD3MXOIpv6Np4xuF9MBQmdruExz3HaCM4NBIedAMWKsCy IUMZHQAWwE6hLxetNo+T5GuO1NfvT/d5IGCBwvbuisG3010GZuZdAoZQKZv5LA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679992484; 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; bh=XpLjRFRiEVC9/oYrVNBJfIL8dz/BQSgaQjKmk/OnM7E=; b=48tew/NiVka8f3nUXl+FAw+xiwTzXy7EZodP/z7qgbKXQDnBqULhExClWOEChB55hYEFst Gr8/f4StuAeZUlCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: smp/core] trace: Add trace_ipi_send_cpu() Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167999248419.5837.9236956776813815592.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761599927125564419?= X-GMAIL-MSGID: =?utf-8?q?1761599927125564419?= The following commit has been merged into the smp/core branch of tip: Commit-ID: 68e2d17c9eb311ab59aeb6d0c38aad8985fa2596 Gitweb: https://git.kernel.org/tip/68e2d17c9eb311ab59aeb6d0c38aad8985fa2596 Author: Peter Zijlstra AuthorDate: Wed, 22 Mar 2023 11:28:36 +01:00 Committer: Peter Zijlstra CommitterDate: Fri, 24 Mar 2023 11:01:29 +01:00 trace: Add trace_ipi_send_cpu() Because copying cpumasks around when targeting a single CPU is a bit daft... Tested-and-reviewed-by: Valentin Schneider Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230322103004.GA571242%40hirez.programming.kicks-ass.net --- include/linux/smp.h | 6 +++--- include/trace/events/ipi.h | 22 ++++++++++++++++++++++ kernel/irq_work.c | 6 ++---- kernel/sched/core.c | 1 + kernel/smp.c | 4 ++-- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/include/linux/smp.h b/include/linux/smp.h index c036a22..ed8f344 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -130,9 +130,9 @@ extern void arch_smp_send_reschedule(int cpu); * scheduler_ipi() is inline so can't be passed as callback reason, but the * callsite IP should be sufficient for root-causing IPIs sent from here. */ -#define smp_send_reschedule(cpu) ({ \ - trace_ipi_send_cpumask(cpumask_of(cpu), _RET_IP_, NULL); \ - arch_smp_send_reschedule(cpu); \ +#define smp_send_reschedule(cpu) ({ \ + trace_ipi_send_cpu(cpu, _RET_IP_, NULL); \ + arch_smp_send_reschedule(cpu); \ }) /* diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h index b1125dc..3de9bfc 100644 --- a/include/trace/events/ipi.h +++ b/include/trace/events/ipi.h @@ -35,6 +35,28 @@ TRACE_EVENT(ipi_raise, TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason) ); +TRACE_EVENT(ipi_send_cpu, + + TP_PROTO(const unsigned int cpu, unsigned long callsite, void *callback), + + TP_ARGS(cpu, callsite, callback), + + TP_STRUCT__entry( + __field(unsigned int, cpu) + __field(void *, callsite) + __field(void *, callback) + ), + + TP_fast_assign( + __entry->cpu = cpu; + __entry->callsite = (void *)callsite; + __entry->callback = callback; + ), + + TP_printk("cpu=%u callsite=%pS callback=%pS", + __entry->cpu, __entry->callsite, __entry->callback) +); + TRACE_EVENT(ipi_send_cpumask, TP_PROTO(const struct cpumask *cpumask, unsigned long callsite, void *callback), diff --git a/kernel/irq_work.c b/kernel/irq_work.c index c33e88e..2f4fb33 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c @@ -78,10 +78,8 @@ void __weak arch_irq_work_raise(void) static __always_inline void irq_work_raise(struct irq_work *work) { - if (trace_ipi_send_cpumask_enabled() && arch_irq_work_has_interrupt()) - trace_ipi_send_cpumask(cpumask_of(smp_processor_id()), - _RET_IP_, - work->func); + if (trace_ipi_send_cpu_enabled() && arch_irq_work_has_interrupt()) + trace_ipi_send_cpu(smp_processor_id(), _RET_IP_, work->func); arch_irq_work_raise(); } diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b0a48cf..ad40755 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -96,6 +96,7 @@ #include "../../io_uring/io-wq.h" #include "../smpboot.h" +EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_send_cpu); EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_send_cpumask); /* diff --git a/kernel/smp.c b/kernel/smp.c index 37e9613..43f0796 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -107,7 +107,7 @@ static __always_inline void send_call_function_single_ipi(int cpu, smp_call_func_t func) { if (call_function_single_prep_ipi(cpu)) { - trace_ipi_send_cpumask(cpumask_of(cpu), _RET_IP_, func); + trace_ipi_send_cpu(cpu, _RET_IP_, func); arch_send_call_function_single_ipi(cpu); } } @@ -346,7 +346,7 @@ void __smp_call_single_queue(int cpu, struct llist_node *node) * even if we haven't sent the smp_call IPI yet (e.g. the stopper * executes migration_cpu_stop() on the remote CPU). */ - if (trace_ipi_send_cpumask_enabled()) { + if (trace_ipi_send_cpu_enabled()) { call_single_data_t *csd; smp_call_func_t func;