Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp710386lqt; Thu, 6 Jun 2024 16:51:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlBM7fKTov1DpunMtFPMwTv1HvFK/gpYMke9KeYcqn+qV06EsrGutkGyiVXnZ0frlCXQHufJj3mkL61HWyZK1xRTyrOEEYR4u9JWkApw== X-Google-Smtp-Source: AGHT+IHTA/4BursTyXsB1dHxo3SQKTsqOIb+T1yl6aztpJ/xdofe06dxORtAfWtTHa4oO4G96DX9 X-Received: by 2002:a05:620a:244f:b0:795:2ce7:4dfd with SMTP id af79cd13be357-7953c2e88d0mr109907185a.9.1717717878023; Thu, 06 Jun 2024 16:51:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717717878; cv=pass; d=google.com; s=arc-20160816; b=0R+jg/hsyPT4/EptA3Jb38sslGI/bxPEOfv1gAB9q7lZMXjuR/b6j6O/giKOBmxSyZ Hw3ooZUr1mUCbpxM2F1A6DZMRC4E40bLkE5dgcDR4GHqKVod84c37loDoJDZikwatllu nAeXUTP3jZMMtrzEh4ILqQyyukoq2EE2VcKC3ZslW/QP63dGZZzWctnBsciyZxWnAfBM 66+XL/PncECx9TvUg7M0AzMQLsaF76SsT2/lVYeXDCdfdfI0C05i8kLOxX83tybv1kjF gOn5DdsYuPYyvI6IzpZ2JzY07vMAlUYxTf7KIYHS7E0Vwtmn9j1mlakwNrmGclax7G5r NasQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=yxRFb8jNZD704/30Zm3Ud+U3UJ7d2I13EMGRbHwqT3Y=; fh=7oasV/ZeU+egQRWXrMUsnswYbCGP/Lre4Nmj4EjU5fA=; b=jd+amPmZmuMv1Zyd8KFlLbnf5W5LYOFd1W3Igx5mgH4A1eLyTWC0cICNUvupqEcPxw YUiitQWbCdlgrf+nJ4kkstVoUP5E1jbjXZbp46rt5JTfzFwfldryMvzkEk42x7RyZDcw cPPuo6kpMDyBxT/BA5HeK0F7OkjsW7ic3+X+eVkv9cbcX2F+ZDBAlR4cDhuoEbiu1Qop UUC7p8iBjIKvCgicgnzOnIe2y2AhnGOEjkXyxnWsa0BrIcZNGfje7/IkzWK92IPF+3EF xaUkMcN5Ua5Jy1Dd7KsYimaPg+2dtQwmh23T3NaU3l0khzhaT5Jg/tkCqpKrUoHEp6uP gY6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a89D7I0q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b3c232si27847601cf.476.2024.06.06.16.51.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 16:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a89D7I0q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AFE6C1C22A12 for ; Thu, 6 Jun 2024 23:51:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 245DF13F45F; Thu, 6 Jun 2024 23:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a89D7I0q" Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1958482F6; Thu, 6 Jun 2024 23:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717717866; cv=none; b=UvDFCQt12v17Y8aGU2zVDslc8ouavwBZ1ZzAz7fSzDnNM5JLa9TrJkEnxuDMVrydO4N0cXbgpYIg/izPO/Gykr8g7a4jGD1SKeZsZ72XTyLIrJGIb2d0KfqNgtjjLUA/rQ75gCJfuIVWGsrK21kPKYdqgCnBfncQPpq3Sr/oAuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717717866; c=relaxed/simple; bh=bbVleMmmMakhROC+VISatQueB3wussVSW+M+2HzXVsI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LoWGH3uIp0NMpELibNZtmDdqnuwU+1jxUUW7SCTVnXTm4pFTZ4JCkJmBqcPOhB1L1mlYvW9fNS1JW9uiO+w1LG9ojtRwzc8B7jnAyUQuRGgMegITnz/TYSj+GQfoDmzsMQVPFoqOLHxrKOnPYTwYHZrLHvrcPHt5eixnUADO+ew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a89D7I0q; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6f945b242easo1400413a34.1; Thu, 06 Jun 2024 16:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717717864; x=1718322664; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=yxRFb8jNZD704/30Zm3Ud+U3UJ7d2I13EMGRbHwqT3Y=; b=a89D7I0q/3Wuvz2B2r7Kf4wCxTqfa6K2HM4HATO7SPehDGvl8kZfw5uec/TO8821Rb t28DrBFqxT4cyl0RhK8RvwGvqH7UpSruJS/ustCjl8gz28fU785dygqEoUBju7V/0J74 NdinWE0vXdJQHCvthkC2X3KMzVxTIW/cpVHiLnZ6B3KQq8PcrSZiWB4EnXePXASMx3Nz rs1OY4EM38mkYCPaY3mNJwwK39buWOzTjqL71LdkCb6AoT+3tV6dWiLZz/7GTduGLjr3 I1KdbjOW7EOAP4UyXcOjKCPmDfmfI8a/bOBiLXiV9WGxvFFbEGsgHUC5n/C4lP6KsCHb bWCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717717864; x=1718322664; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yxRFb8jNZD704/30Zm3Ud+U3UJ7d2I13EMGRbHwqT3Y=; b=TdKC0REkJq7uWjLAaa0IMXUEFDfpSLFbPTrbK2heW+iX1VaGLy04y8i1H/bfLudPGm uyD7VN99fnUGA6Q3aeQuNOL0NaUydJLz7VXTCjUYQINOI0aV5ZueeEh3iJWfAkp1YJnv jE7XI5L4n6aU5FZQ9AqveGsTOkPBCym9cTFECRbjuSbTxKznvzYhCDtatAjeNA6SFPIE dBWzo022gOFvrT/NYgqW/pj1TH/9NY2/5EAollawVC2l0aAUq1I62wdKULYmB8hclZSA xo2rRFTKDSd46QQ9N5fR46SNt00X0arui0OPzCi6DmdVanYPhYAPN7vSY9vY8nl7MAb4 u9ww== X-Forwarded-Encrypted: i=1; AJvYcCXgL5IvMT7sUyOqF87guM/UEczsrl8Wi6L5r4jjjrDSAt7Q4Ywqhs9jHLLTleLt8piC+I2euj+nipasCWV36kXh/JhN2JHmVhmS9GHcIbRa+Tcgt39jRYOuqPbVEFRzuBzAs4I9dd3zIalIXqPwyevXo7Eud867bjltnmIxh+Qxs7a1vxDmMU5F0DDHsIIvCpw= X-Gm-Message-State: AOJu0YxzztmF5QfrZaPH76Ow+GxqX1TL9jbRryjucrSvQvfBRD9gM9Kk L3Le9fGNdsLxUOYigLWEXB7l73BFX369Ifq1U1GYH0zkCd81Whgc X-Received: by 2002:a05:6830:2049:b0:6f9:1b6a:1e66 with SMTP id 46e09a7af769-6f95721b518mr941006a34.16.1717717863703; Thu, 06 Jun 2024 16:51:03 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7953286feb2sm105196185a.56.2024.06.06.16.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 16:51:03 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfauth.nyi.internal (Postfix) with ESMTP id 737B71200043; Thu, 6 Jun 2024 19:51:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 06 Jun 2024 19:51:02 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelledgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpefhtedvgfdtueekvdekieetieetjeeihedvteehuddujedvkedtkeefgedv vdehtdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhh phgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunh drfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jun 2024 19:51:01 -0400 (EDT) Date: Thu, 6 Jun 2024 16:50:52 -0700 From: Boqun Feng To: Peter Zijlstra Cc: Mathieu Desnoyers , Alice Ryhl , Steven Rostedt , Masami Hiramatsu , Josh Poimboeuf , Jason Baron , Ard Biesheuvel , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , linux-trace-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] rust: add tracepoint support Message-ID: References: <20240606-tracepoint-v1-0-6551627bf51b@google.com> <20240606-tracepoint-v1-3-6551627bf51b@google.com> <389a8c55-a169-47ef-99c0-48f58003b40c@efficios.com> <20240606173544.GI8774@noisy.programming.kicks-ass.net> <20240606192951.GJ8774@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240606192951.GJ8774@noisy.programming.kicks-ass.net> On Thu, Jun 06, 2024 at 09:29:51PM +0200, Peter Zijlstra wrote: > On Thu, Jun 06, 2024 at 12:00:36PM -0700, Boqun Feng wrote: > > On Thu, Jun 06, 2024 at 07:35:44PM +0200, Peter Zijlstra wrote: > > > On Thu, Jun 06, 2024 at 08:49:06AM -0700, Boqun Feng wrote: > > > > > > > Long-term plan is to 1) compile the C helpers in some IR and 2) inline > > > > the helpers with Rust in IR-level, as what Gary has: > > > > > > > > https://lore.kernel.org/rust-for-linux/20240529202817.3641974-1-gary@garyguo.net/ > > > > > > Urgh, that still needs us to maintain that silly list of helpers :-/ > > > > > > > But it's an improvement from the current stage, right? ;-) > > Somewhat, but only marginal. > > > > Can't we pretty please have clang parse the actual header files into IR > > > and munge that into rust? So that we don't get to manually duplicate > > > everything+dog. > > > > That won't always work, because some of our kernel APIs are defined as > > macros, and I don't think it's a trivial job to generate a macro > > definition to a function definition so that it can be translated to > > something in IR. We will have to do the macro -> function mapping > > ourselves somewhere, if we want to inline the API across languages. > > We can try and see how far we can get with moving a bunch of stuff into > inlines. There's quite a bit of simple CPP that could be inlines or > const objects I suppose. > We can, but I'd first stick with what we have, improve it and make it stable until we go to the next stage. Plus, there's benefit of keeping an explicit helper list: it's clear what APIs are called by Rust, and moreover, it's easier to modify the helpers if you were to change an API, other than chasing where Rust code calls it. (Don't make me wrong, I'm happy if you want to do that ;-)) Regards, Boqun > Things like the tracepoints are of course glorious CPP abuse and are > never going to work. > > But perhaps you can have an explicit 'eval-CPP on this here' construct > or whatnot. If I squit I see this paste! thingy (WTF's up with that ! > operator?) to munge function names in the static_call thing. So > something like apply CPP from over there on this here can also be done > :-)