From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796121127; b=BrRB54l1L7pAKoEpPiiChMgl0YNI0D3G5YdIL2t4o23b5VeSbNe+DcnnOi5yhKGouWv4 PSeDuxql+/5X6pQFKABA7B5HAHtHFWRmSshmdsCxUUHcGkrgeYpHClVeD+PKobExeTma1 dhXDa7DtXo79pNGOSMur4qOiLchdhiKfi6kU+tf34PwA5CfguKdMC+eHKgAdRSCuX65W1 v745el0P17/q9IGY/1PqF2EyQrhK3A7+r5jJoBe07avb9i1z/1J5Q81nyk0WsRuwbKD9z 7ihMyTuYawpGZmhvdbfcpW/+EdLn0q6dYjp8jSGAiTWGUgj3iswdkjo95SpXoqcX63g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121127; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=AkRitSUIYYj0ukryZRTejmPn7PMC9aQJ/BIH7axR1AY=; b=TvdceVeFHLo08Nnhz7Tw5qNI49LqKWn6tAdNNJVxf0wlJLWlIja1HglDWGyoYekRxzrq esnytV7syV4lhFf49Kxiw8KyZwOD6zUNdtF+6ptbvZQdtOWMt8K+K1z31DrftOT5G9gqa PbHhTsRlVpnh82xgNBH+MwyqUlDPkwk/mYBTDsMrS+tXcUJr19P5n0gcxEhPNcm7YjMTs ZkUXviFR23ElrnG8u9Q8DQGqp7aeXKM+eQ/87YWzijKJPZI0HAxIaIKpPWMv9xp8QiiPQ 5u8TWqjyVztDKK+XyU5/OMnS6LfzR0PS8krOjxGRy7sTWL0KxXZiA0e1ceZOuvUiz1g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=GSjXyRdN; arc=none smtp.remote-ip=209.85.221.49 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B5EB606A32A for ; Tue, 1 Dec 2026 10:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4B5EB606A32A 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=GSjXyRdN Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-4ac08f4a0b2so8132264f8f.3 for ; Tue, 01 Dec 2026 02:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796121126; x=1796725926; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=AkRitSUIYYj0ukryZRTejmPn7PMC9aQJ/BIH7axR1AY=; b=GSjXyRdNUkLf6wHqKbmxEB09kgRJMSyyGyqIw66wsMEDkHogEHe39cy35+0ynJPi5G tFLY2B2wzsFnhHyTpOvjM5XLlLcDLYdH9nZ5OURmPK2q/ZId56L4Lz0Mq6fNpGYQopJ6 Owzx2LsEp7dQwiRsQcffwFRiqbsC/fXBp9dUbmeyzpvG7U7W5XjE7Q8gnY0rYaUSQtap 8d3gNV+jU3eY4eGRt5nbYtm/+L01ske5uI73wWC0kk9T8AC1UIVxwmQ/FU74vjxzm3Pv 8vk5yqUgYmYTUo3m0e9Ju4Sr83rhSa26j7Asu/+o9lc9y74mvDsLOV5aU7Czrpnklm25 10Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796121126; x=1796725926; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AkRitSUIYYj0ukryZRTejmPn7PMC9aQJ/BIH7axR1AY=; b=Ds0gOAJ2w7OXnyGit4WstO3thHuVyfYgRJTPC3zMnNswTeIfbq1v3LBhiwT4/qZXlY Q6169qB3/KYnjlp2faJ1t/V3C+jEkootyYR6mAid1pvD7XwbM4vctMrC+cwd+DFXquSq 5m4ie5WG6uwGHK7G/3KgJxmDrFwwGQ7FrwVknisuWBPERSMS1xs6l/vezGJ1tVJyvz6u +JYLgRwpt9YsbKhZUuscpPpGB/qmf0wufQOzO3yA4PBsMBce11KSyqxo6vlxn6Tii8Zt gj4QjAxXCoPjrcFiNHQ9a9lOLIuFw9JlqEXu9Io9xR0MwCOzaI4WX5f1+uvUhsuDnN3f tw7w== X-Forwarded-Encrypted: i=1; AL+hErFGwhItSk0zOvKnuzuX3S0ERSYB7+U/glF570DazohikUNhAx5oyB55yfhmbI/QmKJjM1fE61UULpKFwx0=@vger.kernel.org X-Gm-Message-State: APuU4Z8KRuD+0h98a3q4TuG3NLBB0RSfOdea6czd/FRll/hRYxKY+Rpd 7+B59hVA1sMuQGjPnbzx5Esdm9Zls2oT4t/BWG52NQP1IsZYXUo4c/7E X-Gm-Gg: AZFdTZdZt1Z4drSuwnW718Q0sTe/3ny5mDKanfzfkFQqVDgh7zdhIAfHLNTTMv90xGd 3fChy279DfwIf8JK7pZd9ptm2ihjs2mSwwBUMkqdJ3z+5XxLBynxxUI4SCD3+Yc2O2o8JqHYVGo KAuQwGQBfjBLKlON92pCaSG9RAxt2OVUjv3VLbE6+ZEZqmOw/TfzIdGhQsKKdcRKPSTQPFgvxIH MZFoffv96L6Jexmp3GabfQ+L2l2vKU83jvpiLYhAMnb6aPNCiv6ygMjoWODKjIOLvBg2qiHU4DJ xy1NLMyhAOJMIWa6yOhBcr15h8KCkJdhRcoNif8yZpnwJ9m5hx6jk/rkCDM3KzUwGeqpiVWI5fx EkEtuK5YRCEpjNZqUdPBr7l32Bte4LmiYQl6Y4+4EQRLwEa5d33AXZeOlCN8mJzu/uWbZKseyXa ckw1d6XXgj4WJmD5kj5xfhOAbFuigQrx+NZ//8G5DVwmJh1qhiiVIR8NAT+O1IN6UEYD2NqsgsM a0e03r+LpAQkUy77Z/lfLUcepKus69CTrq+gxJDD7DQv0ZSVbJoz+7ukPAfm8Rs+Aiqfrv4eR6J QzKZaCL/fK/bKIRFwb28DP9ZPQebKucNQ3ikOizpuUoyJq1gAHBVTXtG1VH6DQrX X-Received: by 2002:a05:600c:37c9:b0:4a4:4d57:8487 with SMTP id 5b1f17b1804b1-4bb887fe7f7mr624006485e9.5.1796121125438; Tue, 01 Dec 2026 02:32:05 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb906cdcc1sm643638815e9.2.2026.12.01.02.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 02:32:04 -0800 (PST) Date: Tue, 1 Dec 2026 10:31:59 +0000 From: David Laight To: "H. Peter Anvin" Cc: Sohil Mehta , Dave Hansen , Dave Hansen , Borislav Petkov , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Xin Li , Andy Lutomirski , Peter Zijlstra , Binbin Wu , Tom Lendacky , "Chang S . Bae" , Chao Gao , Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments Message-ID: <20261201103159.2e083365@pumpkin> In-Reply-To: <712DC603-0E37-4B39-AE44-3446A198B40A@zytor.com> References: <20261124200659.471685-1-sohil.mehta@intel.com> <8525439b-5b3e-4eed-a09f-f387d8377013@intel.com> <6F472667-8E3B-4CA7-BC38-27C55B8354AA@zytor.com> <1a3ebcfc-dbb0-48eb-9674-7c34e5fdcb2d@intel.com> <712DC603-0E37-4B39-AE44-3446A198B40A@zytor.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 30 Nov 2026 16:06:43 -0800 "H. Peter Anvin" wrote: > On November 30, 2026 4:02:52 PM PST, Sohil Mehta wrote: > >On 11/30/2026 3:48 PM, Dave Hansen wrote: > >> On 11/30/26 15:43, Sohil Mehta wrote: > >>> KVM doesn't write to the same MSR as the kernel. KVM reads the value and > >>> writes to the VMCS field HOST_IA32_FRED_RSP1. > >> > >> This is all optimization, right? How about the series just does rdmsr() > >> for now. It's the smallest amount of code. Start there. Optimize later. > > > >Yes, we could do the optimization later. > > > >Sean's request originated here: > >https://lore.kernel.org/all/aahchI7oiFrjFAmb@google.com/ > > > >"The simplest approach would be to read the actual MSR. _If_ using a > >per-CPU read provides meaningful performance benefits over RDMSR, ... > >then have the kernel provide a dedicated accessor." > > > >So, I am assuming he is still okay with deferring the optimization. > > > >FWIW, I measured the cycle difference between the per-CPU read and the > >MSR read. It was ~6x more with the MSR read but with all the things > >happening during vCPU load 3 MSR reads shouldn't matter much. > > > > > > The one reason I see to avoid rdmsr is the idea of "frustrate an attacker" by resetting fixed-value control registers when convenient. > Unless you make writes to the per-cpu variables fault aren't they likely to be just as easy to overwrite? David