Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp58232lqp; Mon, 10 Jun 2024 18:25:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTYBjbYX+X00f2fxHFLoEBYUNkLKzJM2RajSltg1pR22w+2G6Chgw4LsFRKd57HOcFTG5c2luB/msM2M+9+ajclDKKajdw7gwyYZNa3g== X-Google-Smtp-Source: AGHT+IFd8b5+Z8fKrtfVpmRo0qgp5DkIoIruQ7Vwgu4i2vV6exo9U9AZUR/MjLG1L7/Juz5doag/ X-Received: by 2002:a05:6a21:9986:b0:1b5:bc67:b9f9 with SMTP id adf61e73a8af0-1b5bc67bf1amr9313844637.17.1718069116110; Mon, 10 Jun 2024 18:25:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718069116; cv=pass; d=google.com; s=arc-20160816; b=air2//YSCszEqbsoEV54TB1ajIzpAcYmuGaf3dDxW3/5xNhhNuICDjKxgAIUaimzDG glwtz7JHtctP7TXwHNlgagFT4MMtvgbvYkz+XSnFSG6V407NRYmhyAJ/MXgFwXapRdIW IBSpBApdIPasfHkdKUKtW5G3rKOd45DgdXYIgVrDz+9RareR1kfcFVzELmmUXY5xnio/ GGmXTnL8BsMDjK0dRI2U84Yp6dT4eqcMkFcWZy3/t79eVSDTQFd5AEMwb0v+EG+FAhOM qd6YfdiyzyUmSXUFkuytWyU7dsSSZIaMttqFw1XpgNdJ81CZQaRnZKPAAtl7bJmB0mnp j53g== 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=c7ZYubABZSpYrLP7RVmTG2Pj59U8OWIrsQrqs7DlbNY=; fh=lTFPl33I9ppnmkxUTnwWCRECxzYJ1zNJl56p16Z1meg=; b=Wdnb+6PMABW8bE/yxFfRvETKULYY10mS36OYbI8/ZvLJwAvVGzdoNjAkCX1515yqJ4 uYQittvPWO7sqRCQKbgCm6b7JNLqkUIPMTHuRZTWHtfMU0pkjv5LV/2m2NGA/iPZ/hji 4Aj3zqNzv9AYmXrYzow2CaiTi2WRk0doLvqj8N3IfgWNZuwkQJP5kLfcQkim6BcUnQb3 vadAy5R1EJSbgY3Adk6XKI4BT43xtzx+ylLGPGmf/EJLNBj3fo2WZ017JULwqYyS1l/b yF1///P/ETqzmd8JSomroZP1cXUead1LRCpGceJ7apSCbbke2jmebb/iY8qKQBei58qQ 8orw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="J0tcoW/K"; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209154-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209154-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f7209fb09fsi14284895ad.218.2024.06.10.18.25.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 18:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209154-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=@linux-foundation.org header.s=google header.b="J0tcoW/K"; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-209154-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209154-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B0B44B21E90 for ; Tue, 11 Jun 2024 01:24:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C09BF111A1; Tue, 11 Jun 2024 01:24:41 +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="J0tcoW/K" 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 1FBB3DDB8 for ; Tue, 11 Jun 2024 01:24:38 +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=1718069080; cv=none; b=k0qm5LcCbYTp8v2DMShRB/lS/GheDkvCn8npT9kgBUdwF71APgFkA5GS6VXbQrvgtS7t2NbHa6kPTa7+4c33t4U+vBukJAodB0BN2tLVwtob11eA9XtZa1H2vAxcszHTnfcJwfd16v7Lz2YOkil6gc6b8DEOqpshrwnti9yrtkQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718069080; c=relaxed/simple; bh=D2mY0PxworDetejFBvMMJPM3s8A1YQGEEiK9nq7hZKM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Z9FtAvht/z0prZA7L+FHYCPJaCMHY/wObTCETNTdF6Q7xeDy4zka+p597ubD95HWIVWQQk0hK1kto/pN08LXS2ReAkLIE/m3ot3D/zBmpRbmNAe5N4kO7s4yiHh/iUESVNW1UffzlYryjRrPZLItDydQoaXZj9d+Y1iuk0fxZsE= 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=J0tcoW/K; 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-57c83100c5fso482852a12.3 for ; Mon, 10 Jun 2024 18:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1718069077; x=1718673877; 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=c7ZYubABZSpYrLP7RVmTG2Pj59U8OWIrsQrqs7DlbNY=; b=J0tcoW/KBgdMPuLf7Gk4WmnYQAOFKXVunxkAsMJYjh2x36jYBITHxO7+7gOFPqY+l0 hZ8AClvwKoXmhAmPaLHHcwElxx4ZTnaMN5c89+iapkjfTUwL5EmDlYiIZx9s1G/Doek8 VUB5QDxbGAEzvn/CXrEXaqBo3El431zCe/3Wo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718069077; x=1718673877; 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=c7ZYubABZSpYrLP7RVmTG2Pj59U8OWIrsQrqs7DlbNY=; b=oSkd37u0vJRak7CpzDQBIY0X+ZcwyIMVdF7P9bGl8Hv97C7tNo9cDJU2bC+COug31H EDOFs7Roa7RGg+LojbzuS9GbhFZF5JPkloKeglrRA/u153Wfv1L67kx836iziEAV5Q4E AFlu/K+htT28gUYNDU19kxDzGdg324Xo0fKbLGmRrj1dKAlRkxHZBgJsJR9ZuE9xUi8B QsjZ1cct9ZOMIguCoDdVytGoUOLFW8qvuPnGi03mzTaEMUObrwKHXd4t1K4driCx6iyg AnuM2wXT5c15713JeN313lbCyWCbl/Hi3+zsb89F7I5SsqihZ1UtcpNOEFoB4MSenHQX mGYg== X-Forwarded-Encrypted: i=1; AJvYcCXFpnwHouH0MrSYJMOAZdCTpb3HAjS87idaeHOn6f5d7vmBlyvonC6xibKrmzWbdy9B/xkKzW1YZWWA61ES5UHCvix7uF8pLQ1HA7Y0 X-Gm-Message-State: AOJu0YwSxGUdnZVrVTShC7ZNTsUid69B4+OV52CiLubX4ztdDzQ2devX muapD/XEsrcDstyh5yi5R9gihFvjRDDS1aQvMzjoPuNixEqZVV63XlHHO+0+NHefJJeVIEb05QF Knjs= X-Received: by 2002:a50:cd1c:0:b0:57c:73ff:d13e with SMTP id 4fb4d7f45d1cf-57c73ffd1b2mr3801166a12.31.1718069077182; Mon, 10 Jun 2024 18:24:37 -0700 (PDT) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com. [209.85.208.53]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c7d3d5efbsm3510348a12.64.2024.06.10.18.24.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 18:24:36 -0700 (PDT) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5751bcb3139so528086a12.1 for ; Mon, 10 Jun 2024 18:24:36 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU9TxJEiciPT2Lf9BJbM65VcAcWYAFCSJY8A8RNBy2/wLjphINfdkgEQ2K1es8LqQxARIxsTX2hqu6fWrY83dWPfvXRKzT9pksqnW9n X-Received: by 2002:a50:d648:0:b0:57c:8c45:74ff with SMTP id 4fb4d7f45d1cf-57c8c45751cmr1347189a12.41.1718069076241; Mon, 10 Jun 2024 18:24:36 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240608193504.429644-2-torvalds@linux-foundation.org> <20240610104352.GT8774@noisy.programming.kicks-ass.net> <20240610120201.GAZmbrOYmcA21kD8NB@fat_crate.local> <71FE7A14-62F6-45D3-9BC4-BE09E06F7863@zytor.com> In-Reply-To: From: Linus Torvalds Date: Mon, 10 Jun 2024 18:24:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86: add 'runtime constant' infrastructure To: "H. Peter Anvin" Cc: Borislav Petkov , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Rasmus Villemoes , Josh Poimboeuf , Linux Kernel Mailing List , "the arch/x86 maintainers" , linux-arch Content-Type: text/plain; charset="UTF-8" On Mon, 10 Jun 2024 at 18:09, Linus Torvalds wrote: > > Doing it in general is actually very very painful. Feel free to try - > but I can almost guarantee that you will throw out the "Keep It Simple > Stupid" approach and your patch will be twice the size if you do some > "rewrite the whole instruction" stuff. > > I really think there's a fundamental advantage to keeping things simple. I guess the KISS approach would be to have a debug mode that just adds an 'int3' instruction *after* the constant. And then the constant rewriting rewrites the constant and just changes the 'int3' into the standard single-byte 'nop' instruction. That wouldn't be complicated, and the cost would be minimal. But I don't see it being worth it, at least not for the current use where the unrewritten constant will just cause an oops on use. Linus