From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 7312825757 for ; Thu, 1 Aug 2024 18:26:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722536818; cv=none; b=iHFE9YxszubvH79PRA5NpkRZxqBSnjrTIo/pYZo1ID/TfOgshsg6yzTT11Ew+q9xQMMGtKZ/bQPkJAfJZLboSi5jTN9E7necphnikR8ERDoD60e+uv39sEUx48bBnlnwDtKowrslyELW1kYP9eogKPRvuZsYXJlEbLAPFB0qSeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722536818; c=relaxed/simple; bh=lHbIHLFhtQNciusEsnruiPFrsux+ubJl8cotIGgu9QA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cWZDC/xz06v+fz3koh4M7B+iYhM0EGYoMEo6yU8krv5rNS43TZ2AUfRQ26EBLwxxxnOfzxoOAyktU6tMqwWcEmcGdil1qoMgT7knTddcigHzO/grF6y/1lOu32OHR7GaopUm57OiXR5jPk+S1IdXaZYqgEe8msY3ZOQlZCEbLDY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rM8HMEdn; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rM8HMEdn" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3687f8fcab5so3602690f8f.3 for ; Thu, 01 Aug 2024 11:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722536815; x=1723141615; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2GkfD0g8hTHOTE05py9mAwmf1QYzZu9yR2OS6+zzI80=; b=rM8HMEdn29YaHok0uYeb+av22l4a6P6iEOCn7o/LV9v4EdyOHlzN6IHGcd7CIJUX4E JZP78BzADOkLTOY7VGY9mzcY9lR6uv++P+4QzVCV1NtxeUxIG0XyNC1oggfy9WKHqHnr 5j0ukVCpF+G0UVmRGOy318RMhnFbdGmIxT5aTPYg2vB+iIs5zRGWaOqVXQWWidujkT9n p+UnahzdH7A75jfvm/FO4wxFf1spK+L7Jy9iIzi8iDGP6RIGgAXcfKIwYo4nSJLI811z NJKXXEYTd53a8/xk+mV8Z6VM27AKDtUwwSE+V3jLZat1FcZ7Akz3iFDWExUDsyrIdUxd MWPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722536815; x=1723141615; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2GkfD0g8hTHOTE05py9mAwmf1QYzZu9yR2OS6+zzI80=; b=U7wtwgmoHxU1P6O+WHcAN1/Jp5OK7bPm6vjvq0o7lLw1KwJM57gdxw3ftUfQCI0ppm RXe+2HzIYBpNZ14DdHKbpwHlnwJHkkonaDxKNi5r8osN9vGfyQGSweGlZGI7cUlV+Pjx N6aY9gMhT/Yh62TZ6p9ybuQtGRjIo0PyL7f7fYB6CiS4O0OkSiawiED0ZRT8mYZWbXig PQxUfbpY2aWre19MkJ8mFocFx/uW1ligZc/RN0t9Lr9VKmVISmyWoAJGW9wiLDyft+t6 2K5o6vthxsYEXSA0SqH0tCOANefP2IYiBZOVoghg2r0WjmP1BGV17+gZB/eru5ML/9qD KkcA== X-Forwarded-Encrypted: i=1; AJvYcCVAjpJQQiwb8eniRFOfuyuyNxIpClgCIcoVCYYn/q+vCRwpgZO1Oj8tPG7B4dAk4VAEInkcyi7spxBMDZBhsjIFjVQ1OhjkRBpVKjm/bOA= X-Gm-Message-State: AOJu0YyQFdhSddfy8Pu8PvoLEOj7bfB7YGF5jJxy7tww2j8/a5Tj/DGn 7Lf5XNui/8vaX+pYSLH/fgSpipTtI65N0GlntXCmTcaOP5BtYaCdmZD8Uh5auSzadivAC85M3iZ pYNeqGH0hnhW6KTdTJPA6B1ehJ4L/f7fOs5xD X-Google-Smtp-Source: AGHT+IGwaGkw42I/amAH0IQd6LdSV/vkI/phXZAUV/1lm1vKxK6jNhFtpwWWcpoa+ZqQDQpJUtDs/GFofzfYgLUeu2Q= X-Received: by 2002:adf:a356:0:b0:368:3895:67d6 with SMTP id ffacd0b85a97d-36bbc0cbe69mr533475f8f.20.1722536814320; Thu, 01 Aug 2024 11:26:54 -0700 (PDT) Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240628-tracepoint-v4-0-353d523a9c15@google.com> <20240628-tracepoint-v4-1-353d523a9c15@google.com> <20240731170508.GJ33588@noisy.programming.kicks-ass.net> <20240801102804.GQ33588@noisy.programming.kicks-ass.net> In-Reply-To: <20240801102804.GQ33588@noisy.programming.kicks-ass.net> From: Alice Ryhl Date: Thu, 1 Aug 2024 20:26:42 +0200 Message-ID: Subject: Re: [PATCH v4 1/2] rust: add static_key_false To: Peter Zijlstra Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , 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 , linux-trace-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , linux-arch@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Peter Zijlstra (Intel)" , Sean Christopherson , Uros Bizjak , Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , Mark Rutland , Ryan Roberts , Fuad Tabba , linux-arm-kernel@lists.infradead.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Andrew Jones , Alexandre Ghiti , Conor Dooley , Samuel Holland , linux-riscv@lists.infradead.org, Huacai Chen , WANG Xuerui , Bibo Mao , Tiezhu Yang , Andrew Morton , Tianrui Zhao , loongarch@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 1, 2024 at 12:28=E2=80=AFPM Peter Zijlstra wrote: > > On Wed, Jul 31, 2024 at 11:34:13PM +0200, Alice Ryhl wrote: > > > > Please work harder to not have to duplicate stuff like this. > > > > I really didn't want to duplicate it, but it's very hard to find a > > performant alternative. Is there any way we could accept duplication > > only in the cases where an 'i' parameter is used? I don't have the > > choice of using a Rust helper for 'i' parameters. > > > > Perhaps one option could be to put the Rust code inside jump_label.h > > and have the header file evaluate to either C or Rust depending on the > > value of some #ifdefs? > > > > #ifndef RUST_ASM > > /* existing C code goes here */ > > #endif > > #ifdef RUST_ASM > > // rust code goes here > > #endif > > > > That way the duplication is all in a single file. It would also avoid > > the need for duplicating the nop5 string, as the Rust case is still > > going through the C preprocessor and can use the existing #define. > > I suppose that is slightly better, but ideally you generate the whole of > the Rust thing from the C version. After all, Clang can already parse > this. > > That said, with the below patch, I think you should be able to reuse the > JUMP_TABLE_ENTRY macro like: > > JUMP_TABLE_ENTRY({0}, {1}, {2} + {3}) Yeah, I think this can work. I will submit a follow-up patch that removes the duplication soon. Alice