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 9681679DA for ; Wed, 22 Apr 2026 00:40:02 +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=1776818403; cv=none; b=sfMeHGX8BjwcX5lyJdmE0sea55Ge7viVwL2KxUfgg32ZAtNs0kyK7Z3ohmU7NRWsBvPBbYXMnReGyhGC2H18Xh63/Fe+pBgYOK5hMQgUV4sHaaWcbrHHI37wZ+LI2hGl1FzGKsnTNTjkLK4ErYpzenRDKbBYQMIYENC0c9xOgeE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776818403; c=relaxed/simple; bh=J1tArWnulocLUn4+cJkKhjttTKFMjzmT1ngPpiM0o7M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=eENwteWjtXOpT8nZZuioNJaMgDxWZ5MYeQjdvwIf60E7JaVPN0eSi5SoBGlzAqFMzcUHvbb8kMvihQkn9kmzZuTJLyVZSTc2DxIfQU4MWfz8YnIrhOM+6Tj/Z4krlFRaDFRlFe/61MYgpXoaZydk0d4J1wapHq8mAs92vf5TDio= 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=wiWaKm3L; 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="wiWaKm3L" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82cf8dcd079so3160499b3a.1 for ; Tue, 21 Apr 2026 17:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1776818402; x=1777423202; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=igF/cUsBIzKJTZC4XKIeh9By96551N+odSOFbiyoihs=; b=wiWaKm3LtymQQiCA6/uM3S/Nyw2XPAL+DM5O3NG8xzrT6/X3HNnJHAljwq3PXZ4Tid TnFKADBahozi/iY9OgwB93utPwiNDoo/33gdt/HHuYU7tVcJcgjnRz6mCz6NY39t++Zh kdB58E1LL2c0IXap3Nl/SBVQoDDZeZZKpcGmlgkOucFojcLAfEcu03DlJ7ZL++lRwMAS 8+oUNWOJNc37BygQ5cWXS3j1ijFDlIGyC6ug5dfsHLIcPJB4tWXyyIyJPo94CxPmbylO sJyokRewaghyR60HURaLnZmfYG2huEMTVmcweDWWrENYP4R17Rd2TLCnn0QXo2z7x9Lm cJvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776818402; x=1777423202; h=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=igF/cUsBIzKJTZC4XKIeh9By96551N+odSOFbiyoihs=; b=Neam8sl5eXk4qnjOtAu5vblJKFiXV2ywSmVNlkPKJp7AY9zxsF32kFkT4XGbKjY9Y8 ZFgStcO1+LjTvttOtIxH3e3/qaegvxIeVb1b9V9Pg1l5sJMzkty6Tm3jDWA+nc44u+ax IzHZvQgizwknXR+0lnKhqlcbPvHu4HFHsxxT4ClvosmrpJ1YxW9eHtQLLr+8Fj4f10J4 VaOFZw+NYuYumK9/LaC1SIoQcjDyGRAhCyi+RiPS+vbL44rT68J93XeZukKyYda3150l 131eWYTk3ek4NHWpkBXibhseqpIFSGwcXgDgpiA+jt6sDHBmCnpOl8Y+FVXSLku/5PnB 0FXg== X-Forwarded-Encrypted: i=1; AFNElJ9eSDjbgXEbg1J1e+NyL8UI6IAvYVPGuYGew64lymscLerHOAK56kFedsMU9O75LUeww4rIJulnwciwFDU=@vger.kernel.org X-Gm-Message-State: AOJu0YyrnM3GZhQ+5xb+yTlOEv6r+IdQdZP/r0XREaMPpWJzS4rfcSsw uHRm1ol5fE/9de6hxtE8hBy8IHlTeF42Fey+tntSHm2zq4jNylylN3e92BfWXoZRWjiPhut2erO enS0cTQ== X-Received: from pfqf11.prod.google.com ([2002:aa7:9d8b:0:b0:82f:70a0:5bb1]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:368c:b0:82c:e9cc:f61d with SMTP id d2e1a72fcca58-82f8c7ef3ebmr20336623b3a.9.1776818401572; Tue, 21 Apr 2026 17:40:01 -0700 (PDT) Date: Tue, 21 Apr 2026 17:40:00 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260409235622.2052730-1-seanjc@google.com> <20260409235622.2052730-7-seanjc@google.com> Message-ID: Subject: Re: [PATCH 06/11] KVM: x86: Move kvm__{read,write}() definitions to x86.h From: Sean Christopherson To: Yosry Ahmed Cc: Paolo Bonzini , Vitaly Kuznetsov , David Woodhouse , Paul Durrant , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Tue, Apr 21, 2026, Yosry Ahmed wrote: > On Thu, Apr 09, 2026 at 04:56:17PM -0700, Sean Christopherson wrote: > > Move the direct GPR accessors to x86.h so that they can use > > is_64_bit_mode(). > > > > No functional change intended. > > > > Signed-off-by: Sean Christopherson > > --- > > arch/x86/kvm/kvm_cache_regs.h | 34 ---------------------------------- > > arch/x86/kvm/x86.h | 34 ++++++++++++++++++++++++++++++++++ > > That's a shame, register accessors semantically fit in kvm_cache_regs.h, Sort of. I actually had the opposite reaction. KVM very specifically doesn't do available/dirty tracking for GPRs, in large part because it's not a caching behavior per se: vcpu->arch.regs[] is _the_ source of truth for GPRs (modulo RSP on Intel). > but taking a step back.. is it even worth having kvm_cache_regs.h > anymore? > > At some point I needed to move guest mode helpers out of there too (as > they should be): > > https://lore.kernel.org/kvm/20260326031150.3774017-3-yosry@kernel.org/ > > With this patch and that one, we'd have <200 lines left. Is there a > reason why it can't just be merged with x86.h? I don't see any of the > headers included by x86.h including kvm_cache_regs.h. What if we go in the opposite direction? I didn't try moving e.g. is_64_bit_mode() into kvm_cache_regs.h because that reaaaaaly stretches the meaning of "cache regs". But if we rename kvm_cache_regs.h to something like kvm_regs.h, then I think we can move more of the simpler accessors (and mutators?) into kvm_regs.h. The motivation would be to keep x86.h from becoming a chonker. One of the regrets with x86.c is that it became a dumping ground for everything that didn't have an obvious home, and now it's sitting at nearly 15k LoC. Naming is hard, but if we can come up with a kvm_blah.{h,c} pair, maybe we can kill two birds with one stone? Or at least kill one, and injure the other :-)