Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp486811lqp; Tue, 11 Jun 2024 09:59:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5QymPHFQEgHWoQyMwBXToDRaxTNAp53E/y7IbOGiJMGZmMUfwatI3T6Wmf+EBqz14NHN1IDCAX4eJdxcVizuiVkFuFFCfpakts9IT6g== X-Google-Smtp-Source: AGHT+IHxeRCIV/uXvhbslyxE1PonZmA4xno+7B4ueUrg9y2FkX6VJdyVq+Pjna+xUbZuTnntcqZQ X-Received: by 2002:a17:906:3954:b0:a6f:125:6b66 with SMTP id a640c23a62f3a-a6f01256f3amr607085366b.5.1718125181309; Tue, 11 Jun 2024 09:59:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718125181; cv=pass; d=google.com; s=arc-20160816; b=sDDRGe+lyG9o4clkCdiHAiWkU58B+Fej00n8eK0Y6vUWhEEtytEt/LJRQCWL93F4+q lcom6h633hNa9LXWOyZDs/uzHw1Iydb87HGXuXTtTrD5DkP3KA8Rtfx7Cr/LcAixSMSC FJaH2Iuvj1ELwWsH3yLHVEs1Fy9uYx/j29Z28uCDKHTWxxKR9DsSDgoXNly3MvinrojC kfT8sYcaJPSy+VnLE2StxGdggSsNlALYpdw6Js42413iRBUTG6LLukosJwLCZMu+RYC2 8G99pQVdtNFiG4HSAvxCO2GDRzw/jI70vUnYmdr3ewtyCyNwOLVX4hwA383kjm++RPvD FSxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=9fd3UL80BMA34VQCo8tmKRzc+M7L8fT8pwxngoicvPg=; fh=d+rb7WcwxkKkJxd60lKz4VXi6cW4csBt9Ya5S+YULqo=; b=OL+F6Yc/BmqdsrC47zA5MkT4/V1IujmHhBTQO5GKaiWTyxXLNA2gXwffv5Ag9Z5WQX f/FeD9IR7RSaZMrvtRIHZvDiZUbnDqYRNiq5SVfNKUve9bIc8IGKdxvL860MWrE5b4w5 3YXnziuj6K+ajXm4IOf9GYelnl2tOcG6G3WgSU4o1n/prIQDc8XTmDXjXS0fi7lalMOc us8uk76YbysUFrYNLbGyx09uuN10UwHJa7iFzFqGcP4bQfqz8XRGPhdg/9z55mbkXTM/ ojEb+JzbRcm2n75laxAhtZuEUPiS08PjkFBopQCHHiByl6BgfQ0mo4h1SC0zl8AizL4E IQlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="R/4NmU+W"; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-210298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210298-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f0fccfe0csi317547366b.35.2024.06.11.09.59.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="R/4NmU+W"; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-210298-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210298-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D8B551F26642 for ; Tue, 11 Jun 2024 16:58:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7341D4F211; Tue, 11 Jun 2024 16:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="R/4NmU+W" Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 5E72948CCD for ; Tue, 11 Jun 2024 16:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718124999; cv=none; b=pOj2IWNYykXKwcV5Bw6mafes1ImiN70UXUcM/L/I8Dizmu1yb94JoCReEwKRqmPlQencHL4U5yAqtiWqmgGoVzEM/5xz3D9PGUeHfWnbgpvIjByDu2DgRQMaOw9+ToQlxECAGCWSqj+NxqgVl9WnwmEtHmBfSRAMZh7SC0Sv2XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718124999; c=relaxed/simple; bh=o29lQlHY6pBB5D1miRHhOsA44JWXgR9MvIZMXmk7GOA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=QJCwEkM4eI1SKRbaGbPIo0V8w8gaCeG4cf/D6XrV81PZ+POnl80SuCkS2shYAXeimWaC8sYY8JGS86p34nq7acXEVR/vH+41d0RL0pxbwb+3RLKlugM0+cyoB46lwQJAZnSkBcbJ0jCmNcasWqmoPo1T+/ckrRKn2y0dOS2NzEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=R/4NmU+W; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57c714a1e24so1567773a12.2 for ; Tue, 11 Jun 2024 09:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1718124995; x=1718729795; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9fd3UL80BMA34VQCo8tmKRzc+M7L8fT8pwxngoicvPg=; b=R/4NmU+Wuz/rBDw2TOarfy0eq39D/abecawkkTiTcgiObG8r+NmdI4/uOH9fOkCOI9 aBAq+c/z+6+dYBngFmBUl8WIOqM3wVDs+Yz9/k5ER+T88utxsRZTDHXhWcSsUF1B79xY 05I2NgVzJDRnGduGMoSzLNvNIL+Isv7VnRtSU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718124995; x=1718729795; h=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=9fd3UL80BMA34VQCo8tmKRzc+M7L8fT8pwxngoicvPg=; b=R8sJIMVEnoXFiuO/Ba+ZU8qsWL0CvB5LSSHeTefPgorfRrxirRKpUAjXKrQXJazzv+ PfCk4SvLVQdYbFhSjrFZoi9IGY5+CnJtsvE2Z55Yk657ohLzLaxcpWWb3gb578TER5m2 ijSxmJn3RmYMJDUVHw19LZdrkpC25LtQZuRuy2VeozO2ZRL8s0y/uiAJvIkjIJvR3T7G lhfYwEOU4cWsCEoOTo0Ljj48j5BZO0ysoyzEsp7hjJoPrlu2ksS8ppOeVygVFpLFaaVr HDBZLyb4bddzEtKYNd6vR6op28AtbHVjaysQ+qLfrh0hQ+zIKztHQsNUJ6qImCBGTzUT xm5A== X-Forwarded-Encrypted: i=1; AJvYcCVB5FdNeKtVsu00Jr3R1ooYTm0xWWh2g1tpu2CaOu6FbNPwIPriERn4ooCFJRhE4GNQb+Ow9i3T9YRvUq54eAUM1F9GMnGIfSlNRqPI X-Gm-Message-State: AOJu0YylFGDBs365mc9rAb2Nzsw5AnWFh1s6snKLZy7GGHwZL5Q1RGJ4 u6uFpbtRSZRI5uA23BSh8U8QeitgK/kF02a+s9KOgn3TZ1SyqtzAiaMQy29/C0QmzVKlTcJY1+Y nb0k= X-Received: by 2002:a50:8719:0:b0:57c:8022:a3d9 with SMTP id 4fb4d7f45d1cf-57c8022a9demr4562505a12.20.1718124995362; Tue, 11 Jun 2024 09:56:35 -0700 (PDT) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com. [209.85.218.49]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c9d5e29e9sm809232a12.2.2024.06.11.09.56.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 09:56:34 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a6f0dc80ab9so181249866b.2 for ; Tue, 11 Jun 2024 09:56:34 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCV/i8DLcSLU1NKy+BxXAJH1qkQBITpfM9qF1pqwpvU/59t+a7lezSz9yYwJLsum3MG215ZUisDa3L/6SaNGkZgw3VT48kWkkPpeTukh X-Received: by 2002:a17:907:72d3:b0:a6f:1f4a:dfba with SMTP id a640c23a62f3a-a6f1f4ae1eamr427237266b.43.1718124993806; Tue, 11 Jun 2024 09:56:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240610204821.230388-1-torvalds@linux-foundation.org> <20240610204821.230388-5-torvalds@linux-foundation.org> In-Reply-To: From: Linus Torvalds Date: Tue, 11 Jun 2024 09:56:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/7] arm64: add 'runtime constant' support To: Mark Rutland Cc: Peter Anvin , Ingo Molnar , Borislav Petkov , Thomas Gleixner , Rasmus Villemoes , Josh Poimboeuf , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , "the arch/x86 maintainers" , linux-arm-kernel@lists.infradead.org, linux-arch Content-Type: text/plain; charset="UTF-8" On Tue, 11 Jun 2024 at 07:29, Mark Rutland wrote: > > Do we expect to use this more widely? If this only really matters for > d_hash() it might be better to handle this via the alternatives > framework with callbacks and avoid the need for new infrastructure. Hmm. The notion of a callback for alternatives is intriguing and would be very generic, but we don't have anything like that right now. Is anybody willing to implement something like that? Because while I like the idea, it sounds like a much bigger change. > As-is this will break BE kernels [...] I had forgotten about that horror. BE in this day and age is insane, but it's easy enough to fix as per your comments. Will do. > We have some helpers for instruction manipulation, and we can use > aarch64_insn_encode_immediate() here, e.g. > > #include > > static inline void __runtime_fixup_16(__le32 *p, unsigned int val) > { > u32 insn = le32_to_cpu(*p); > insn = aarch64_insn_encode_immediate(AARCH64_INSN_IMM_16, insn, val); > *p = cpu_to_le32(insn); > } Ugh. I did that, and then noticed that it makes the generated code about ten times bigger. That interface looks positively broken. There is absolutely nobody who actually wants a dynamic argument, so it would have made both the callers and the implementation *much* simpler had the "AARCH64_INSN_IMM_16" been encoded in the function name the way I did it for my instruction rewriting. It would have made the use of it simpler, it would have avoided all the "switch (type)" garbage, and it would have made it all generate much better code. So I did that change you suggested, and then undid it again. Because that whole aarch64_insn_encode_immediate() thing is an abomination, and should be burned at the stake. It's misdesigned in the *worst* possible way. And no, this code isn't performance-critical, but I have some taste, and the code I write will not be using that garbage. > This is missing the necessary cache maintenance and context > synchronization event. Will do. Linus