From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62DE8C77B60 for ; Thu, 23 Mar 2023 16:26:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231741AbjCWQ0V (ORCPT ); Thu, 23 Mar 2023 12:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231904AbjCWQ0U (ORCPT ); Thu, 23 Mar 2023 12:26:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 298411BF3 for ; Thu, 23 Mar 2023 09:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679588731; 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=WtAcDI5Li9QEuKB6ODiSX0jbpDGrOdDIqwDU2vDXzdQwZ4qWnByqG4ED6i+CW3k0/Gt+V+ SVdKQ2jON8/0A7itlPWthpIyCtnBE9lSlxelDZpNicneCJ0cDdPReRYWbuxzJPXW1v+V1a wK0EDzKZaf+WDd+bqZnKQXTlkS1uyOQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-282-bdpCFZYEOAuLDT0AfMO6vQ-1; Thu, 23 Mar 2023 12:25:29 -0400 X-MC-Unique: bdpCFZYEOAuLDT0AfMO6vQ-1 Received: by mail-wm1-f72.google.com with SMTP id k29-20020a05600c1c9d00b003ee3a8d547eso4224413wms.2 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=hE+59m5wyu0XLHc4pJ15IOm2aEGfiyURdbaqXPc7ijjjP/XxNu8VnskTVXuFxBLuXX XTHDvWpYPR65ulmwcqtk53svKuL6d7uth3qrK9m+ty6PHxXr3v2nv0qwTCGrpHJkZi4N dPKpNYLVeSlws/+3vU/xRdmGxG/LZ4ZkJ8OD4QPSQWpCC8RLGm2caS84cK1dIUC3X6o1 HGzN2Fo9oNMvHosS8kpmy3+yTLJJ4WJiMdRKchFeFhOvQCMp4TymQZyylpOWHlzH8ra3 T+XGgvSuzmVM/7lvYA08krRzDygLWEzc9N6KNot13BwmiKGwbuhLrH5xEGUNUUzydgMX +/9g== X-Gm-Message-State: AAQBX9dYOod9o3FN8n0IA8WzdnxzjswCqts75gkqCYk6FmOxIFO8AkRp Av6jhAhd/BGBAFag/duVCs2Ec5kN+3x23uB1jCfqxkCr2+RiIFAXOj0ZrmJgyDkyuxIjhk1LjSN cf7adsWaVXwCslNGzwsrA+A== X-Received: by 2002:a5d:4568:0:b0:2c7:e5f:e0e0 with SMTP id a8-20020a5d4568000000b002c70e5fe0e0mr2967356wrc.65.1679588728476; Thu, 23 Mar 2023 09:25:28 -0700 (PDT) X-Google-Smtp-Source: AKy350Z2pOP19Ooh7wiG9F4iyBZnUcLGOtnlVl1iiXTySJV6QCXnwRVxEdgZiRrRO9IHVKHT4hkvPQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-csky@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;