Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp406940rdf; Tue, 21 Nov 2023 06:07:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHyUGUF7SCWpmhsFpnyfM3p6c6XFkWz2ZR7mlGTzWKuFQH+jw+gXGyFXgjnNqGSB7P9xAGp X-Received: by 2002:a05:6808:f8d:b0:3a9:c25d:176a with SMTP id o13-20020a0568080f8d00b003a9c25d176amr14388376oiw.36.1700575641723; Tue, 21 Nov 2023 06:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700575641; cv=none; d=google.com; s=arc-20160816; b=ZgalVIqp55KTFDO83FV3Ban4zv6Gdl+w3Yi2juj1fJYJLz4RII2F7KY/Q8nsmGJ+l4 30RDMwk/XARDNOl22S1Ob/ErLVzwmuOJsGW6v41fhRpRNyFOJ1cVrNDRCkLoZpAOeRmL ShbiVhNPqDYjuqntne0gzA/V/w4V1C6CD3zmsuzUqJhADyC9f3F9wEZftenTy01ZhLUm cWhcpuJCcvx/GdMO+Hii+G9I56U2MjFzzbxdQbd/gQKpIOpbsYXSucPrN/zFKqf8MamJ wWGF3vrZ6ncmztOK9fG9jlnQIzJzeQLfowkFGwzVpRMO5lGYxCl8X5TLjqc6vw1YS1KY aAQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=V88FKNNEBrjcbvXkQNOvACe1BhX8q96ajK1J/Zuwi+I=; fh=0bKfY6AyIaAiS8LY+7MBeTeu7WNVPPaz45SO6XujPrs=; b=JBdq2tKchgQfUf00qP0vFZSNay7QnNRxwOTx0Wph7HgjrJOInT0pwBK0bDV/F6cyOK jPVXiTsXNFW6MDWZGFPV7WaNssR92mKzngUzcILpJKkiIYn5YJmHsplKUmRaa0BzGkvz Z3tl7gRjUD+YN92vJ+ZbqYlGFyvP6YC4hPvGRs7MS/vk8uqm/rbYxjDBHO3mWd3OlCf/ Y/Z2tPBkVrXH7WzMvMHCbQQvtuVHNdqsM0fwqG5CrVqfnNsVFedFg69ToXiBLEsqqh0d y4nKbzawsI4i/m0xZ4aX2FRieH6Lm685Zq5yME9raFL0UgV/s+xIZJjyOcoW26v0LUbY Nbrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=thxzknEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id el15-20020a05680838cf00b003b8386028b2si231259oib.255.2023.11.21.06.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 06:07:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=thxzknEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7F3698095887; Tue, 21 Nov 2023 06:06:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234088AbjKUOGF (ORCPT + 99 others); Tue, 21 Nov 2023 09:06:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233976AbjKUOGB (ORCPT ); Tue, 21 Nov 2023 09:06:01 -0500 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0D2D79; Tue, 21 Nov 2023 06:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1700575556; bh=Rjo+GzhBLOQg08qfzJaOOas6LcnZO+kRHO1x7xhCg5A=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=thxzknEYOsX54Uxq75EVE8gsqAuZckze9eVbdjGrqWhnAxFJd2zTUYbp3rlwsvm8L RvifiE+dNS7ZSLgO1vz/2iuBA+vxTg+gon+T9GxUfPeiqu1Cn1B3IDL+Ia+I3b2tn4 DUC/TT7rpYPd1WMR/O9eiC1zLaBkDDg/AWBX5uFU9AIA2HzYKaNAjYt0BqP2t5Mj4i ACdF1uP7Z+1r36tCdmelBH4eidFpnqjDGiDmFd1pe/d61iNtSmMAHFrsJwhHlsYXim cg2WHeKtjYA2VqeCjjb3bN4HawXXVIVV8MT8V9NjvagkHshjx+GeLlz0QRrCqOkWhL ZBJqug52ltvkw== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4SZR442Pzhz1dBP; Tue, 21 Nov 2023 09:05:56 -0500 (EST) Message-ID: Date: Tue, 21 Nov 2023 09:06:18 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/5] tracing: Introduce faultable tracepoints Content-Language: en-US To: Peter Zijlstra , "Paul E. McKenney" Cc: Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, Michael Jeanson , Alexei Starovoitov , Yonghong Song , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , bpf@vger.kernel.org, Joel Fernandes References: <20231120205418.334172-1-mathieu.desnoyers@efficios.com> <20231120205418.334172-2-mathieu.desnoyers@efficios.com> <20231120214742.GC8262@noisy.programming.kicks-ass.net> <62c6e37c-88cc-43f7-ac3f-1c14059277cc@paulmck-laptop> <20231120222311.GE8262@noisy.programming.kicks-ass.net> <20231121084706.GF8262@noisy.programming.kicks-ass.net> From: Mathieu Desnoyers In-Reply-To: <20231121084706.GF8262@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 06:06:32 -0800 (PST) On 2023-11-21 03:47, Peter Zijlstra wrote: > On Mon, Nov 20, 2023 at 03:56:30PM -0800, Paul E. McKenney wrote: >> On Mon, Nov 20, 2023 at 11:23:11PM +0100, Peter Zijlstra wrote: >>> On Mon, Nov 20, 2023 at 02:18:29PM -0800, Paul E. McKenney wrote: >>>> On Mon, Nov 20, 2023 at 10:47:42PM +0100, Peter Zijlstra wrote: >>>>> On Mon, Nov 20, 2023 at 03:54:14PM -0500, Mathieu Desnoyers wrote: >>>>>> When invoked from system call enter/exit instrumentation, accessing >>>>>> user-space data is a common use-case for tracers. However, tracepoints >>>>>> currently disable preemption around iteration on the registered >>>>>> tracepoint probes and invocation of the probe callbacks, which prevents >>>>>> tracers from handling page faults. >>>>>> >>>>>> Extend the tracepoint and trace event APIs to allow defining a faultable >>>>>> tracepoint which invokes its callback with preemption enabled. >>>>>> >>>>>> Also extend the tracepoint API to allow tracers to request specific >>>>>> probes to be connected to those faultable tracepoints. When the >>>>>> TRACEPOINT_MAY_FAULT flag is provided on registration, the probe >>>>>> callback will be called with preemption enabled, and is allowed to take >>>>>> page faults. Faultable probes can only be registered on faultable >>>>>> tracepoints and non-faultable probes on non-faultable tracepoints. >>>>>> >>>>>> The tasks trace rcu mechanism is used to synchronize read-side >>>>>> marshalling of the registered probes with respect to faultable probes >>>>>> unregistration and teardown. >>>>> >>>>> What is trace-trace rcu and why is it needed here? What's wrong with >>>>> SRCU ? >>>> >>>> Tasks Trace RCU avoids SRCU's full barriers and the array accesses in the >>>> read-side primitives. This can be important when tracing low-overhead >>>> components of fast paths. >>> >>> So why wasn't SRCU improved? That is, the above doesn't much explain. >>> >>> What is the trade-off made to justify adding yet another RCU flavour? >> >> We didn't think you would be all that happy about having each and >> every context switch iterating through many tens or even hundreds of >> srcu_struct structures. For that matter, we didn't think that anyone >> else would be all that happy either. Us included. > > So again, what is task-trace RCU ? How does it differ from say > preemptible rcu, which AFAICT could be used here too, no? Task trace RCU fits a niche that has the following set of requirements/tradeoffs: - Allow page faults within RCU read-side (like SRCU), - Has a low-overhead read lock-unlock (without the memory barrier overhead of SRCU), - The tradeoff: Has a rather slow synchronize_rcu(), but tracers should not care about that. Hence, this is not meant to be a generic replacement for SRCU. Based on my reading of https://lwn.net/Articles/253651/ , preemptible RCU is not a good fit for the following reasons: - It disallows blocking within a RCU read-side on non-CONFIG_PREEMPT kernels, - AFAIU the mmap_sem used within the page fault handler does not have priority inheritance. Please let me know if I'm missing something. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com