Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp485582lqt; Thu, 6 Jun 2024 09:09:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUir9LtsejN+uenXEyZGQCLFEdw5WnZvTpT8P07WudBOyYOXlC6iRY18ifaLif+5etgTQ6jJ5qUPo7UxwWxfDArXEiDa2CwzWmgUH6zuw== X-Google-Smtp-Source: AGHT+IG/IYP6/VYC5AxPWvVdCIIXFrs0txQyu+0iEwLEBVVQWpfvWdGTwRTWEXFduZcGXmkSZJub X-Received: by 2002:a05:6a20:840c:b0:1af:4fa3:30c2 with SMTP id adf61e73a8af0-1b2c56e4578mr3980739637.20.1717690195355; Thu, 06 Jun 2024 09:09:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717690195; cv=pass; d=google.com; s=arc-20160816; b=W3m2hFivc8O6vx601vmK3wEcg7cBJj7B+xcf4G6MJ9Dfc3MxwradIwyLSd0n1mEotg BGWqtx27ZGMKZ+f8DKCM5OHgEF0JMKOrOkt87k6mkZ1cXSieIfLBkTBCCPDsbSZeaIaj NtlXFKFXlWEhUkJLE8nG63CY5Xipbx6CBD6UAdOv5eZO0RxCkJnbqDjKJTF3yrGoBFqD K59RWx+ThKy/5iAVl/E4bBVa6CfHCTIehes6nLw3xWEzAGUs4H6/u8vJDu551UgtR1b0 61/5WSqEC+Ztdml1asYpdxtugTHPIE0Upm7iDk1eH6UHfgXj0bkApqsPfNuqNDeoDael 0oeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Z1szhbitVUi6CaYoioxWmoQdfXH+CfmIJQ9qtItdYLo=; fh=XE3UDgawnS36jgWQ1qqJG17ClqW+gUU7X1MwxvWftWE=; b=MP+h7B8hpP+OvkLenpvJlfOdApqObWVzsjHq/UWrYmxSO8TEMHaCdhYHnN/QwHeNiC g9bX352VrhPGFAl3afA5DKsVRiSJIuqqKcFLoOzK1MO4ZHgDOuPKpSgF+9mkFoIl5nh+ zHmWRuxWku1lnOISOLfNisr4Ge96cecGcoq+iegcuw0dJtPBcEM+BRGTm2Ey2+EByaEg YkxomqaCi0XJMB0bnMbnGQJZAB4KRM/YFevosjgrnH7sDV6itv4H1fApT6h8MWcr0qfY 06AMlQfilnd9RGVW9WKHft8/5p43bLPXBczq0abPQt4/q5sxjbiFGFribM2Lu4ko5fG3 CYdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=A3LjRNJB; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-204576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de219779fesi1354804a12.234.2024.06.06.09.09.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=A3LjRNJB; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-204576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 37CEDB2B843 for ; Thu, 6 Jun 2024 15:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D7361974F3; Thu, 6 Jun 2024 15:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="A3LjRNJB" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF3A5196C72; Thu, 6 Jun 2024 15:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717687757; cv=none; b=bSlZ+QtORlqDGeXap+J31IKFPPdiXFnwIaIf2BGX8PPUBhinS9SyZUzGKzJpo+kBdoIG1dK6EzjFcrEHzGA1YaegOh5vUC5PuWe9ppugC5dK5vQKPDk/1+Jt6YaFPtIoLv37YYTXFuH5zWGlgMWSF7d9y0OLyDfIhhj1exsuXj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717687757; c=relaxed/simple; bh=eBB9aBsiHmO7WU3mW/9YuXTak8tCclcTkOS/Rq6E7qk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FgJhwY6lGBl9FQJU/UcnvMuKru/SMuGTSPV+919KhWFwYVnNRcwb4Q6hHqL0Z+UWSb8JBYYrKSLLid7NUA37wzrErGoMbnj4fZBWKItb5H2JtQ2TZzUQzUo8kHE05kQO1sMQGwyYHZuUjsbPXthK7xHi4YHWLXr8qMaGrKPdBKI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=A3LjRNJB; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1717687754; bh=eBB9aBsiHmO7WU3mW/9YuXTak8tCclcTkOS/Rq6E7qk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=A3LjRNJBEERCPjwPScg2ylCa5gji25832C322+S371TeZM/YKkxh0OPo7S/9Fc9jY QKmCofOGy8HweZsq1Mze1B/jrfqevddKdNyyVOXfYlIO/b9QDfVlD+2mJ6mUtF4+Ik pvjWsScyQtxDbtHGtimWQph+F70cAVEac222LcrSnRebRmWIysrodQR6BFhFwWZiHX h9cPNQ4pFk91vERkOaia81xFrhCpNZspEJR0sPuPvPJguln0WjehwQQrjJ7+9aI0Kj 2jLxTO9kmp+3igDS52Jn1sFxayMBry45PyVJ9W+gczgCQ6alF8fY5mC1cAhD7jycLL 4AUaPKpc6L9GQ== 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 4Vw7Xp3yhGz13B5; Thu, 6 Jun 2024 11:29:14 -0400 (EDT) Message-ID: <389a8c55-a169-47ef-99c0-48f58003b40c@efficios.com> Date: Thu, 6 Jun 2024 11:30:03 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] rust: add tracepoint support To: Alice Ryhl , Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Ard Biesheuvel , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg Cc: linux-trace-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240606-tracepoint-v1-0-6551627bf51b@google.com> <20240606-tracepoint-v1-3-6551627bf51b@google.com> From: Mathieu Desnoyers Content-Language: en-US In-Reply-To: <20240606-tracepoint-v1-3-6551627bf51b@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-06-06 11:05, Alice Ryhl wrote: > Make it possible to have Rust code call into tracepoints defined by C > code. It is still required that the tracepoint is declared in a C > header, and that this header is included in the input to bindgen. > > Signed-off-by: Alice Ryhl [...] > diff --git a/rust/helpers.c b/rust/helpers.c > index 2c37a0f5d7a8..0560cc2a512a 100644 > --- a/rust/helpers.c > +++ b/rust/helpers.c > @@ -165,6 +165,30 @@ rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags) > } > EXPORT_SYMBOL_GPL(rust_helper_krealloc); > > +void rust_helper_preempt_enable_notrace(void) > +{ > + preempt_enable_notrace(); > +} > +EXPORT_SYMBOL_GPL(rust_helper_preempt_enable_notrace); > + > +void rust_helper_preempt_disable_notrace(void) > +{ > + preempt_disable_notrace(); > +} > +EXPORT_SYMBOL_GPL(rust_helper_preempt_disable_notrace); > + > +bool rust_helper_current_cpu_online(void) > +{ > + return cpu_online(raw_smp_processor_id()); > +} > +EXPORT_SYMBOL_GPL(rust_helper_current_cpu_online); > + > +void *rust_helper___rcu_dereference_raw(void **p) > +{ > + return rcu_dereference_raw(p); > +} > +EXPORT_SYMBOL_GPL(rust_helper___rcu_dereference_raw); Ouch. Doing a function call for each of those small operations will have a rather large performance impact when tracing is active. If it is not possible to inline those in Rust, then implementing __DO_TRACE in a C function would at least allow Rust to only do a single call to C rather than go back and forth between Rust and C. What prevents inlining those helpers in Rust ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com