Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6802642rwl; Wed, 22 Mar 2023 16:16:46 -0700 (PDT) X-Google-Smtp-Source: AK7set/4TLVJ9bPND6cLjCWs1HfI49wNaPIvZm3MvyAETKcEHlbj1Rqy/5UcBNTRdJJjbyCDm5PV X-Received: by 2002:a17:906:538e:b0:906:3373:cfe9 with SMTP id g14-20020a170906538e00b009063373cfe9mr9543346ejo.10.1679527005981; Wed, 22 Mar 2023 16:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679527005; cv=none; d=google.com; s=arc-20160816; b=L6DS7xG9sINpW8J+JIgtgmftjAmP9tA16dOakEhVKqAebgG2Wkqa1680aKLdwlqcfZ TRqIOwxAtppLrksQYTGBDkFu7BlZWRQZAWoqKTAD993knkErptLgM31R5eKmYxOx06Rb Z/xdhbjVwwYhz6qMXPr7K5epUtzORnNWxIVsK1fYtdv6OprolfSF+2qLUuxJYw3bHQpF 2qKKGo74XFeZsxpwZHXKaq+JgYKJ6+cSFhnEkcQCXLj7esgoKlNsnHXrNZtX10qGkH4/ GfyrOpuafWFQvM02fsOsTdCS1DBKMkgzPVCWS5Exq/IHvyYZQeg946Rcg1tfsrq0kyMo Xlew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hKMA4pE4ZC1WEjwlMS0oahB5WbuLzi761bi+OVXv/X8=; b=F7v92pc8w7/izC8jtDqsBAgqdVMpfqhaJ41uQeUiyVMvqElKUnC9k4NSKZm0Xx2Lht KfwlStbHTmff/+sYErfCKHOPPWwF5tZQtU1CjMmY0mIKRgK+gY3trYQDjLJ3hr0DUhdX ELBCH+9WRpdXPHiiTlYBgBdtNj6gERCrNmYJPW/fV3MJ4jkKXrpTPbUChEZBv2/PY4IT shvjG5vhUMgiGoSufZV3SRHqq4IuI3c8Rm6TrIZtBJWHZNb6T43RtzAcU66QWDfGCVpI /T1vf4fCJHCsHa/Ksw9VK9o5jEHomknnx7HIuxIwInppMPbKm5qNawPXWgd7FQQcB/l1 /m+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="k4/hIANB"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a170906859200b00930af710ea9si17154488ejx.664.2023.03.22.16.16.21; Wed, 22 Mar 2023 16:16:45 -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=@infradead.org header.s=desiato.20200630 header.b="k4/hIANB"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbjCVXPv (ORCPT + 99 others); Wed, 22 Mar 2023 19:15:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjCVXPu (ORCPT ); Wed, 22 Mar 2023 19:15:50 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BB061910F; Wed, 22 Mar 2023 16:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hKMA4pE4ZC1WEjwlMS0oahB5WbuLzi761bi+OVXv/X8=; b=k4/hIANBdxC2Z8c++HmkBPk16F hq1n4vi1aFY7d/izKMGpm0/zkTd++0c77IZs+Q5bV257Gjkiy34yMSDd8L7TKq46+CV0zDSHb27H+ 4KSIRSylcgYZ2OMei78Bb1gC7STjWled8MJkcwhhG29tpOAa6HtPIFWPyA9seeGrRiJr3vWUYPsTp 3Vu3FPyPpiLcCMVxhaxuIGSboSf1mmZy7nxDek09nDmg/P6bBJA5M4EMw//9ErW/pvBC1TxeGCDAY 4DGmD2DpR96GbtKoxaTV3TYyxFMIuFbNKoIU/LaGvb2xuytoT+Rk3V4s2DX53haN44indyDWk1fXo N1G/mBcw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pf7f5-004hB6-38; Wed, 22 Mar 2023 23:14:32 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9046D30035F; Thu, 23 Mar 2023 00:14:28 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 73D47202F7F60; Thu, 23 Mar 2023 00:14:28 +0100 (CET) Date: Thu, 23 Mar 2023 00:14:28 +0100 From: Peter Zijlstra To: Valentin Schneider 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 Message-ID: <20230322231428.GV2017917@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> <20230322172242.GH2357380@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_NONE, URIBL_BLOCKED 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 Wed, Mar 22, 2023 at 06:22:28PM +0000, Valentin Schneider wrote: > On 22/03/23 18:22, Peter Zijlstra wrote: > >> hackbench-157 [001] 10.894320: ipi_send_cpu: cpu=3 callsite=check_preempt_curr+0x37 callback=0x0 > > > > Arguably we should be setting callback to scheduler_ipi(), except > > ofcourse, that's not an actual function... > > > > Maybe we can do "extern inline" for the actual users and provide a dummy > > function for the symbol when tracing. > > > > Huh, I wasn't aware that was an option, I'll look into that. I did scribble > down a comment next to smp_send_reschedule(), but having a decodable > function name would be better! So clang-15 builds the below (and generates the expected code), but gcc-12 vomits nonsense about a non-static inline calling a static inline or somesuch bollocks :-/ --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1991,7 +1991,7 @@ extern char *__get_task_comm(char *to, s }) #ifdef CONFIG_SMP -static __always_inline void scheduler_ipi(void) +extern __always_inline void scheduler_ipi(void) { /* * Fold TIF_NEED_RESCHED into the preempt_count; anybody setting --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -130,9 +130,9 @@ extern void arch_smp_send_reschedule(int * 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_cpu(cpu, _RET_IP_, NULL); \ - arch_smp_send_reschedule(cpu); \ +#define smp_send_reschedule(cpu) ({ \ + trace_ipi_send_cpu(cpu, _RET_IP_, &scheduler_ipi); \ + arch_smp_send_reschedule(cpu); \ }) /* --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3790,6 +3790,15 @@ static int ttwu_runnable(struct task_str } #ifdef CONFIG_SMP +void scheduler_ipi(void) +{ + /* + * Actual users should end up using the extern inline, this is only + * here for the symbol. + */ + BUG(); +} + void sched_ttwu_pending(void *arg) { struct llist_node *llist = arg;