Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7868179rwl; Thu, 23 Mar 2023 09:34:28 -0700 (PDT) X-Google-Smtp-Source: AK7set+WOEuvZYZv6e7wcnQ/ctffv9+qXrblgZYiQSugBC9g/3EmHtL9pbslvKRujVbrb5NqSf6K X-Received: by 2002:aa7:d8c2:0:b0:4fb:7ccf:3b33 with SMTP id k2-20020aa7d8c2000000b004fb7ccf3b33mr11712579eds.31.1679589268331; Thu, 23 Mar 2023 09:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679589268; cv=none; d=google.com; s=arc-20160816; b=eRuecWMc1y9F0HreFsTnQtL6ur6ndsawak0D+YhUOUllMZnE0pZ4hjqbgw5TAMwZO3 1GXPoceepNwMngYlvpi020lRkBYkTZfzDKzZizuzhr78y58qdEnwI9QewpRXPItShmmO WqGCy00zl5uoDZKujb9gHCYjfqODbZq7IjWg1bW5nU0uBwSYWLn19eEf2rORS6aT5Ios uMmRcwV9XeTl6CrWE09Y/sIV6PsJXSODHqr1LmqtLaYHZU+aE4kbHLkSP4YxBNcjEZSw 2Vv0Z/WcFyH0EySJSLJeTLk6+d1XWK/UJ/FshB00QMEaosWKY/ykS/yRhNn4JiYvaCBU yw3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Rf1EargHhjBzXfO07IgMLtInuWGSM9rCL6OoPVE8vbA=; b=uT52vtZgNCLqXlIPosY2xwE2rzb8YQAgglywjy/ksgXIn1C5VSK30SaSHf98Rt8fQR zKlYrcuuaz0mj5YZdiOxhWRdh2Fv3WP8Iy4BPbluj8zGmTENKbTVjt+CkHQbjhZSXBEy yanfekZDOaJGu4GqPthpGXXTKHXyy0gJaaJof+Vn63nnmUsYbamWb09UYTxZW5gCCLPr zFRMxP5AJ1NDwpABaxmyG+PPBNOp7hH81/ITR1E38aoVl7kV5D6OzGBGN55EVhUkNPea /D2BFLeYG4PQjOIrnexDTTs2vqQJHKXgoqu/jkVQTcjM8pc/ksFP7YuAW99hjasBSPPS REwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mz2Pv64Y; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw23-20020a1709066a1700b0093a9258f5e4si7474519ejc.358.2023.03.23.09.34.02; Thu, 23 Mar 2023 09:34:28 -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=@redhat.com header.s=mimecast20190719 header.b=Mz2Pv64Y; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231904AbjCWQ0c (ORCPT + 99 others); Thu, 23 Mar 2023 12:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231334AbjCWQ0a (ORCPT ); Thu, 23 Mar 2023 12:26:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC20113F4 for ; Thu, 23 Mar 2023 09:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679588734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rf1EargHhjBzXfO07IgMLtInuWGSM9rCL6OoPVE8vbA=; b=Mz2Pv64YQ0sSR6Myj4znjH8HJN/gehooaIdPGsuPAI3fquzqLel7vIm6K+ODrakOzK6+ZM dFfu0ItLtTvUwwef4FDS8a5RbAMioKObk9XoZ2lXl4z1MFmZzLdb5rCADDZL6lyntc6Il/ B9Y1mh8NuqTknuxr0isL/nfK+wR3FjA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-ZHtn27cXPfamo2FbNVDDoA-1; Thu, 23 Mar 2023 12:25:29 -0400 X-MC-Unique: ZHtn27cXPfamo2FbNVDDoA-1 Received: by mail-wm1-f69.google.com with SMTP id i3-20020a05600c354300b003edfa408811so1268928wmq.1 for ; Thu, 23 Mar 2023 09:25:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679588728; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rf1EargHhjBzXfO07IgMLtInuWGSM9rCL6OoPVE8vbA=; b=g6mqb+HaegMbFxY/PGGvFjiW8nnP6iDUSVXDIU2O4nLHdR4GT98AxjTq51qG04YAIQ ziONALcQgztfUmZx5JcSPy4odjQ4KBJZ1YkZK0q7Z6svv7082mEcW30pKuI72XlwJ9Ci ZD+qBPRlMWlNB+y7QZYhQ4AhIIksLWAfzpqmT8JjFohNPHRikRkUl5mlSkOepCC9v1L2 NSMITRKCQdg7Nqf8lHSBMPH8JLTB55wBzq9m3A/yZswkbzT1N4p8EEI6LOt0w3GfD0pg 8RtRaI+MOnlyYaqY5rAhevewOrcMIwM+u/LAPg+AJsjil6ihPpnXdmm4nHQM21ygcocI wkEg== X-Gm-Message-State: AAQBX9fbtzut7lOX6J4B9q5ZWS6cWpy1FpbAQ8ptTKo7MMFr7JsMs1fV /Jg7ZrHf/8uyGMeNr+8wYBzvOqpq4XUV9yfNrhnaUpZikr6bLu4RREemXksY8sdERPLeRCtcVzl 9mVORKwUBUSbol+TP0VLW45Aa X-Received: by 2002:a5d:4568:0:b0:2c7:e5f:e0e0 with SMTP id a8-20020a5d4568000000b002c70e5fe0e0mr2967369wrc.65.1679588728477; Thu, 23 Mar 2023 09:25:28 -0700 (PDT) X-Received: by 2002:a5d:4568:0:b0:2c7:e5f:e0e0 with SMTP id a8-20020a5d4568000000b002c70e5fe0e0mr2967333wrc.65.1679588728212; Thu, 23 Mar 2023 09:25:28 -0700 (PDT) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id d10-20020adfe88a000000b002c70e60abd4sm16586783wrm.2.2023.03.23.09.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 09:25:27 -0700 (PDT) From: Valentin Schneider To: Peter Zijlstra Cc: linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, x86@kernel.org, "Paul E. McKenney" , Steven Rostedt , Thomas Gleixner , Sebastian Andrzej Siewior , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Frederic Weisbecker , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Marc Zyngier , Mark Rutland , Russell King , Nicholas Piggin , Guo Ren , "David S. Miller" Subject: Re: [PATCH v5 7/7] sched, smp: Trace smp callback causing an IPI In-Reply-To: <20230322140434.GC2357380@hirez.programming.kicks-ass.net> References: <20230307143558.294354-1-vschneid@redhat.com> <20230307143558.294354-8-vschneid@redhat.com> <20230322095329.GS2017917@hirez.programming.kicks-ass.net> <20230322140434.GC2357380@hirez.programming.kicks-ass.net> Date: Thu, 23 Mar 2023 16:25:25 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 On 22/03/23 15:04, Peter Zijlstra wrote: > @@ -798,14 +794,20 @@ static void smp_call_function_many_cond( > } > > /* > + * Trace each smp_function_call_*() as an IPI, actual IPIs > + * will be traced with func==generic_smp_call_function_single_ipi(). > + */ > + trace_ipi_send_cpumask(cfd->cpumask_ipi, _RET_IP_, func); I just got a trace pointing out this can emit an event even though no IPI is sent if e.g. the cond_func predicate filters all CPUs in the argument mask: ipi_send_cpumask: cpumask= callsite=on_each_cpu_cond_mask+0x3c callback=flush_tlb_func+0x0 Maybe something like so on top? --- diff --git a/kernel/smp.c b/kernel/smp.c index ba5478814e677..1dc452017d000 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -791,6 +791,8 @@ static void smp_call_function_many_cond(const struct cpumask *mask, } } + if (!nr_cpus) + goto local; /* * Trace each smp_function_call_*() as an IPI, actual IPIs * will be traced with func==generic_smp_call_function_single_ipi(). @@ -804,10 +806,10 @@ static void smp_call_function_many_cond(const struct cpumask *mask, */ if (nr_cpus == 1) send_call_function_single_ipi(last_cpu); - else if (likely(nr_cpus > 1)) + else send_call_function_ipi_mask(cfd->cpumask_ipi); } - +local: if (run_local && (!cond_func || cond_func(this_cpu, info))) { unsigned long flags;