Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp602607lqt; Thu, 6 Jun 2024 12:30:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVzASHcluhOqsz7Y8a6o3Spk3munbjGFyZoyr1r3qAIn2VNDfwJzZY0ubYOwUzLpTprkVYZ7e+FUDgldT7b3W6pJt7wPk/2zrRhdo6kw== X-Google-Smtp-Source: AGHT+IEmrQGlc+A6QhCcoH/mDo4dr63Est1m4KpmYzh3DPUJxMsDw1YXlw7ppVgpu/XhLYyWj+Vs X-Received: by 2002:a05:6830:1e64:b0:6ed:7ce1:6612 with SMTP id 46e09a7af769-6f9572e7afbmr406608a34.32.1717702214125; Thu, 06 Jun 2024 12:30:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717702214; cv=pass; d=google.com; s=arc-20160816; b=BV8ZICAN7EZKyNpqLVvKg63GdUf3pg9eCurRpWEtlvaQ7GTz9hkSz/5pSjHGFNhjtT BJ/OJTLin+dKpHXT7gRdeAsDQC/iJyfrPAZbZTEKHZVGNAdcU4vPUrWHh8IOuRVINlyq DN1HpnfPAuUHUCiMky3eOCZyVCaHSoHRZuuIQiGplKE1jp5YR8+TcGo3onSeC5zV6nuy SL9FpPD/zo2XqkO+r8y62ncjHIh3f1d48O2h1NbJVIAWT5jPMAr/UJd2RL1wbbCurzGY VOdQX5WI2lSPTXOnbYQh3IoBUQHjgJeg/TEwG9mUs452sb+aczFBKssq9/VzfzGkuzp4 CN5Q== 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:dkim-signature; bh=qA4o5RhLhxxQQJ4V/KaMjw8f4e84B0lZhKxN3jROpVo=; fh=+4Ilwqssqpe+InCHsD2R4yu3s2A8k1OM0l/VO0zOva4=; b=yY4bNISwQcaqMHfBe6nrB91ojjFJD7/jeckE/D6nilf4IOR25S4z0jgRyOGU+107fq uc71kjMup85e1GI1hMoNB6iZsCt0zmux4/7pEnzNu836ZXgIHqRKzDcpcZCIqagrurl3 q4teigX5fFsPGusdPd2hFMnyV6mG0zTy6i15hNz253hF10cg3+iJablIJ8M5mLVS0hNI Ze775EMhNSB+JupG8scnIo4zHt0LXUHgsE3plXLZ7u8GuJeymwTXfubNwKCDXKYtHaOU BiexWYeJWCOGOrywN1PxiqqSI3x/y0q5qI5ELHG+NHwX2u1X23ZGMIehAwuUAZfmmLHK kPUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TLvnw+LZ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-204942-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204942-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79533367b82si142850385a.626.2024.06.06.12.30.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:30:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204942-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=@infradead.org header.s=casper.20170209 header.b=TLvnw+LZ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-204942-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204942-linux.lists.archive=gmail.com@vger.kernel.org" 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 CAA3B1C22D77 for ; Thu, 6 Jun 2024 19:30:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F6D261FF9; Thu, 6 Jun 2024 19:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TLvnw+LZ" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 DF7F061FF4; Thu, 6 Jun 2024 19:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717702206; cv=none; b=BBnkgzwuFzUlPwISyRJrqHztK93D06sLvVmNJOBylNcCjjiQhNtbfEtlph2Ed8IwQZqLcR6SP/cRs/Fv0wxSFYrlvVB0BPAA2My56FxOUsFj+ZEw0VFA4dBXk6zvraaoFVI75NN7nQNLk37uSNchgU+lLlrGQEEvDeQK2dTjl+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717702206; c=relaxed/simple; bh=wy1/27O4ST7Jy9JP64TpBdbyH6AK9ftFJSVxc2OSFec=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=so+DLevSqtkDNykD5kdHrmhTAa7KsEp77TtJHNp4hfogFFWXcIU8HKRpEfHXDsU4Mk4D63fwuNT3lDw4D/ZUOjrXe6sF7hzlwZuAjIFMY1kKvq5pMbXsS9tYRFN2cwbNTpGm8RZS+qS2ItYgzTqOsJ9bz5Kw5zcNIOWcUOsRBHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=TLvnw+LZ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=qA4o5RhLhxxQQJ4V/KaMjw8f4e84B0lZhKxN3jROpVo=; b=TLvnw+LZ/wnjwjqGrMD54EPGyO rgreJpieJ2i9XPHAxvnGKfIFioZJaBmMsgu2sIWt+gIcxYNrIveD2M/w+WaoSfL7ENWKtetioczN2 +LKxTvWHnsLHFGYJwblc7gG5KAlkNMO6EiO5rG9uAgh8xW6AAh0ToSFOaEwY4nl4jY2QzEebSu2dk ZozKxf5huJ22QzBCQ0Gm8SlPywrSABPalEQJVF9HLFecs8hKlcna5AkSfp0tSDHxdmQeUdSlu9gRq r+ob5Ofa2vq30q5z00FVbZKtkT6T7vK8wvyRHagYOFFHHnfINEnW5JJRyDDdcO7MjRFnwGO92iZlB FB35iSmA==; 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.97.1 #2 (Red Hat Linux)) id 1sFIo5-00000004ApV-28S9; Thu, 06 Jun 2024 19:29:53 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 5BEAA30047C; Thu, 6 Jun 2024 21:29:51 +0200 (CEST) Date: Thu, 6 Jun 2024 21:29:51 +0200 From: Peter Zijlstra To: Boqun Feng 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: <20240606192951.GJ8774@noisy.programming.kicks-ass.net> 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> 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: 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. 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 :-)