Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp314132rwb; Fri, 18 Nov 2022 01:40:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sNdJB2Is8FnWdatJSYqFtEFKb6wQQVfqC9V4m/OHcxsB8Ho8Kv8TTPxIxLkACh7iIGtyb X-Received: by 2002:a17:902:930a:b0:186:8c19:d472 with SMTP id bc10-20020a170902930a00b001868c19d472mr6863380plb.12.1668764428461; Fri, 18 Nov 2022 01:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668764428; cv=none; d=google.com; s=arc-20160816; b=yXsaFYI8H9gGFxBbcbn+8YhMdVsOO5m8Qv3+d2OsGwUlF8xVWjdhHLar4msfPMJ95L qxwiPZyhYGiN+BcEReT92mriiP24atJEX7XigxO2G+M+LdDPWoxb33QWS2PVVxUZPIu7 lSTUbR0IGbMBekPwhHiompm4wAwekmN8Apbd1+RgQSNYEzzdKcWvcWyMko5komjL7LNR M1ECEoCBEgaiTLG1ugB1RUZRHwAHojPyy+s3cpUmmkbd6RDG4uB252gG64NmY8i7oI8N OjAFVhfnVmnny4pEApCsADSqjaz9ryN9ldfRBTydC8bb4a0Yn/aWEWVkkBdtA7jiBHUv X6fQ== 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=mwt73Igv1Cbi6CXwxAPKd0Pr+R9hvpBvRt03pYQ3bys=; b=iJbSSl8EO9CU4corQpQkpCxd1jB11NI+k/KlDgUvoFJaAQ/pAYIfHynm/5YzZ2IV+y ski0528qJTY2WxQoOxhgt77tnyIVU/6mJcTEq4Na8QRiQMUYFhz7CjKDxXmWpUlj6lF/ quU2Y/IjlurTpckJufeeQInfI6xZgmZv1AFuhcgJdVUlt8Doz34WxaQ7UDbu30myOKce Ry43ab9T62QzQcMmx/cEp1CHBDaj1nrZ+GXTQiSl4XzA2ivH17soFeOq+mKxJg8j9xw5 KhxyShcCOHvUuWozTee3hfB9VhqGJizbaKI+5u1wY1Rhb3BK9GVg+mYvTP+usBdTSrV0 7xag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ab3Y1GXh; 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 x18-20020a056a00189200b0054252c63d75si3756401pfh.98.2022.11.18.01.40.17; Fri, 18 Nov 2022 01:40:28 -0800 (PST) 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=casper.20170209 header.b=ab3Y1GXh; 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 S241798AbiKRJN6 (ORCPT + 90 others); Fri, 18 Nov 2022 04:13:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235275AbiKRJN4 (ORCPT ); Fri, 18 Nov 2022 04:13:56 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7385FF0; Fri, 18 Nov 2022 01:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=mwt73Igv1Cbi6CXwxAPKd0Pr+R9hvpBvRt03pYQ3bys=; b=ab3Y1GXh5hZN4kYCUal3zeuK3Q 7SRG1cvzhO7eKodvFDYyuRae96G8g5PWd/XWhtSWcEI5MUsYEab5Ovzc8ze8gBOk9y9y/n4/VG6QA kxoDu7O/fG1a2giqiMnnG8GWp7V1BxUra+Jgp+oiupx2occO6L51vWUZQgeu4+7U3imdC7NUUUJ2N J5VaNoVksNMD06l+gxDbRhfwA3keSj0mXPL1+LX088MVxqFi6HWwWMGwF0jamw9uSp14pYO1PV0sb dSKJCydBYVIQlrwj2um9MWjTnI+ZTo1PEgHrvF9BZHJpiPATdBDwJ3bT9CqtMVsKHp/fep69BWHYQ 1FAlMbCA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxQb-00287L-Gd; Fri, 18 Nov 2022 09:12:54 +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 78E20300487; Fri, 18 Nov 2022 10:12:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5E8232C316131; Fri, 18 Nov 2022 10:12:43 +0100 (CET) Date: Fri, 18 Nov 2022 10:12:43 +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: [RFC PATCH v2 8/8] sched, smp: Trace smp callback causing an IPI Message-ID: References: <20221102182949.3119584-1-vschneid@redhat.com> <20221102183336.3120536-7-vschneid@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Thu, Nov 17, 2022 at 02:45:29PM +0000, Valentin Schneider wrote: > > + if (trace_ipi_send_cpumask_enabled()) { > > + call_single_data_t *csd; > > + smp_call_func_t func; > > + > > + csd = container_of(node, call_single_data_t, node.llist); > > + > > + func = sched_ttwu_pending; > > + if (CSD_TYPE(csd) != CSD_TYPE_TTWU) > > + func = csd->func; > > + > > + if (raw_smp_call_single_queue(cpu, node)) > > + trace_ipi_send_cpumask(cpumask_of(cpu), _RET_IP_, func); > > So I went with the tracepoint being placed *before* the actual IPI gets > sent to have a somewhat sane ordering between trace_ipi_send_cpumask() and > e.g. trace_call_function_single_entry(). > > Packaging the call_single_queue logic makes the code less horrible, but it > does mix up the event ordering... Keeps em sharp ;-) > > + return; > > + } > > + > > + raw_smp_call_single_queue(cpu, node); > > } > > > > /* > > @@ -983,10 +1017,13 @@ static void smp_call_function_many_cond( > > * number of CPUs might be zero due to concurrent changes to the > > * provided mask. > > */ > > - if (nr_cpus == 1) > > + if (nr_cpus == 1) { > > + trace_ipi_send_cpumask(cpumask_of(last_cpu), _RET_IP_, func); > > send_call_function_single_ipi(last_cpu); > > This'll yield an IPI event even if no IPI is sent due to the idle task > polling, no? Oh, right..