From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 7DF763E3C4B for ; Mon, 4 May 2026 17:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777917550; cv=none; b=Cdu8acQXTbIMTYudu9g4sq9T32W6mxPTQUXOt2NgLfobbr1KXKj5IrnadpTDFv/g9tu9T70LD1yUP78BnSV7RFXMlNFoXBfukgaVQognndILSAzoIBt2wkc0/yAU/yfAGFbJaN4H5yHHBkbUdjzljRHBSnYj+KBN199dFZUTvyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777917550; c=relaxed/simple; bh=1IqJvmzII7/T39MzvKNBERzTIiEA/ExVEQqrmFi4W5I=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=e0ZSPWPipX4lbpr/WjOIBLSjCs7QOVAYq8BfclTt/AJu32Ljio3a7yIIcK21Cx7Qixdofkt9PCN8yb0Evdt1TPzPIGIceQ94RXo7I9UKsgFV0qRiXJlsWdgxRQ65wuBCd6kwiYk65Hy4WIF7d2R8iSlklDOIH7L6fmPxh3QRiM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=N+eFMwoX; arc=none smtp.client-ip=209.85.210.202 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=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="N+eFMwoX" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82f756ebd0dso2631106b3a.1 for ; Mon, 04 May 2026 10:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777917549; x=1778522349; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=zkucIX59KTNPBaVai4FthTKe5zTpFdhn5FHJDfPK5ao=; b=N+eFMwoXxgt8jiu1JI0ibHDGvQMB30SwtW54St1UX5hkRMSv6uUayt6tBdpfC2n2P2 BAI9tAC5OI4lrrTxpo+eg4w5K4ECulrhM3mek/9jucUrK+t79W9hfQky8FdpqXjpKJOQ TYsaLK73UX9MTGE2ZEnY/1n5havNOpKocRjOdph+y4AttcR5lON0QrQhLPdg4RILvnTu Wg6d5tdvUzR3SqlhBHRDPHrszOXFpQNQPd0sMzANzGuX3LUSIFsJgR2z+0WygP50jJOT dCcn+EEaA8BtCCaVdkaq/J7mjBXTmrEyYLP2qdClsCrSaQj2OcT1gAxAhSL3+xw0q0Kc +EBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777917549; x=1778522349; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=zkucIX59KTNPBaVai4FthTKe5zTpFdhn5FHJDfPK5ao=; b=Rz5LbLp/TrC35TDsecM5yaUf5WQ6n8/bHSSVk3rh56cAgeS0jiFn0ddkiRAY7TuqmG SMWLPl2ObOl2MM440yx6/DUeM8e9b8UbAozi2FvLwUAO9XNI4uQG/jz1ufHlk6CGfqQV +uFWHiDG6qecNdVTS0jKRGxATqDlFRcjDVNwD6h5+vmQ2dgHY7bqKb4dpILsLaBdbFf6 dnYsP5NtdEtSSCLqq6ORZKNibVOFctTA1uBmUG8LMpafNYYkHnNgAagmSMwO5pSlQrK6 eYwpDk2ZKgzl9aaLRZCBUcaR5CPtCSUSdTtE2Y0PeiYJVDdDXPdl5liEUnvOPc+M0vB+ Y9rg== X-Forwarded-Encrypted: i=1; AFNElJ9E91Lgvd6Hq43wQvC3c35y7tMPtmCcUdnOnhLiVnJDcYHyVWp/SDKNz3wRE/8t3XTNjccVW3yBQ/IB7OE=@vger.kernel.org X-Gm-Message-State: AOJu0YwiUATUHbOM825UerD6J5q3tPq5tlA2CDwiobIh6g8D895iWnK0 zk2BimSM1xtQxTDa0RnjUA4EgY0ei39cMEALckxYW/bd2XOXvHhD2+Uq33rdLESaCBsbZgE4Gc7 yOHgACw== X-Received: from pfoo26.prod.google.com ([2002:a05:6a00:1a1a:b0:82f:b388:7a9e]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:a489:b0:835:685b:8e31 with SMTP id d2e1a72fcca58-835685b9161mr6298997b3a.25.1777917548420; Mon, 04 May 2026 10:59:08 -0700 (PDT) Date: Mon, 4 May 2026 10:59:06 -0700 In-Reply-To: <20260427080554.GD1733452@pedri> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260408001137.3290444-1-peter.fang@intel.com> <20260427080554.GD1733452@pedri> Message-ID: Subject: Re: [PATCH v2 0/3] KVM: Fix and clean up kvm_vcpu_map[_readonly]() usages From: Sean Christopherson To: Peter Fang Cc: David Woodhouse , Paolo Bonzini , Madhavan Srinivasan , Nicholas Piggin , Fred Griffoul , Yosry Ahmed , Ritesh Harjani , Michael Ellerman , "Christophe Leroy (CS GROUP)" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 27, 2026, Peter Fang wrote: > On Fri, Apr 24, 2026 at 11:27:03AM +0100, David Woodhouse wrote: > >=20 > > Fred is already removing all the usage of kvm_vcpu_map() in nested VMX= =C2=B9 > > and nested SVM probably wants the same treatment. And the PowerPC one > > looks like it could just as easily operate on the userspace address?=20 > >=20 > > Could we just kill kvm_vcpu_map() completely? Yeah, that's probably for the best in the long run. > Thanks David! >=20 > I think I'd need at least input from the maintainers on this but just by > code inspection, the kvm_vcpu_map() usage in sev.c seems a bit tricky. > Unmapping doesn't happen until right before switching to the guest, so > this might fall into the "keep the mapping around for a longer time" > category [1]. It definitely falls into that category. But that code is also rather gross= , i.e. could use some cleanup no matter what, so I don't think it's a good argumen= t for keeping kvm_vcpu_map() around. To avoid a bunch of pointless work and churn, let's hold off on hardening a= nd/or renaming kvm_vcpu_map() for now. I'll take this v2 as-is; even though taki= ng a gpa instead of a gfn will conflict with the nVMX series, it's dead simple a= nd a worthwhile cleanup even if some of the conversions get discarded shortly af= ter.