From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.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 6C6323DABE3 for ; Mon, 1 Jun 2026 15:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780327083; cv=none; b=GvBRgxg1xjjVVu3CvqOT9L0sESkdFC1CVaNG/2c2AVya1/REqLbAcCg9sftX+Y7AjEkhKWtUGOzcL7DkzkRJtdbFAgV65ePAA5uIULDKk2ZE0cR1HsQ+35TghsKFVPkvv9pZCqtxU31DNOWrOcuFL9Fpu/CQjIjqjISv2Sq/Foc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780327083; c=relaxed/simple; bh=qt6jdTukQiCQTq9T+Y4Vz7LaPDtWdBuYDLgqfpjkrlM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cBKymQp5vWbfaJnx2STAXHNd1urT0yflnkf/mAG6K9L3A7aAdoccM8lx+yVp0FnLAQtSdgmljzTDCXL19WOcgXUGE9SBIh91Jiu+KQdQ3rumkSKGWDRhpMZp0e2p1ufYKsmro0zkcbyFw3RROwn6xt6stWjATm6lm4R3DtxO6PU= 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=I1238cLr; arc=none smtp.client-ip=209.85.214.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="I1238cLr" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2befec3fd8fso31972235ad.3 for ; Mon, 01 Jun 2026 08:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780327076; x=1780931876; 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=ahMbIkijP/BdXQhTZb9LZG5WCNYJS47pXidopl02Z6g=; b=I1238cLrhCkI9VJHolGVmGGJxyUvh7z1pEg1tmW/dRg7jjXhbYzbVS65N+cjvKTFzX 5p8riIe8ojXeMJodnKMwK6cPV1c/02y658zrde4N1/3+k258La/Op8Hd4o5infjAgL/S o0D6nWdeVZqtHEQUMtNhkqQCOLnXNTD/9p7CdysIf7/Wakk5FQb9RMqbM8gwelqgGyY/ eJ1ttLkqYHo9sSnzyouUIsEJALvDLQGyFE9Le5AUSMgxn2wcVYCO6sQKHs5ISStWzaGE 6F9PDu78O2Au7HOy5Cooc0EoAdEFCtX0Y4BVNffoK5+GgMbmRCgOIwT78nuEsxGCLmCz 10dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780327076; x=1780931876; 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=ahMbIkijP/BdXQhTZb9LZG5WCNYJS47pXidopl02Z6g=; b=ZrICBtRdE79G6QBwc4Y5obtoV9X0NpO+ZqK9PX4sF/pfePGCf9XyTYt9wtYeTW2zJG Wgbr3lmQIKugKlEuEyw0u4LPbPt7quUu8/1IxP4qnofu2EprUczAAk6Jh8V5JnpPG6j6 H0PYeT4LY8s9XdZpyXbBBGkCPHEFWn5HUGFif45BTHf/mu1bKwXCcT0Qk70bnWthuOyE qY39Xd1uzA7fEktDnpuzB7E8lqtbcCvRiqZ1O3pmQur/CPhGSEj3bQm8xmuv97ESVUAB Ssl3QdJk7lSH9J245X9ewQurEQ0vSG/m1BmhroeOEp5R945zoS06fKpsOZXlajSfbuOR Qsyw== X-Forwarded-Encrypted: i=1; AFNElJ/3lQoapCxdSWePZCrQoxwJgxB0KV5u8XSK7XQMxxvtPrSe11rExfZwmpD4OO+2jZfDY6zALU2GcDUbT14=@vger.kernel.org X-Gm-Message-State: AOJu0YyNuVRHsgDpKcMRIr128UPH+quv+aIkONNS7DWkIF0xiQjt4Fxn vOtdHiTHcP3iO3+PL1UcBk7MWl7B8ITjOBkBv1FuwpbTXKjMteJ9yAHeKICWSuRVuNaTXAvvf7/ YHPZO4A== X-Received: from plth11.prod.google.com ([2002:a17:902:704b:b0:2b6:417:db8d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d2cd:b0:2c0:ab82:6b99 with SMTP id d9443c01a7336-2c0ab826c73mr105242275ad.33.1780327076177; Mon, 01 Jun 2026 08:17:56 -0700 (PDT) Date: Mon, 1 Jun 2026 08:17:55 -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: <20260529222223.870923-1-seanjc@google.com> <20260529222223.870923-33-seanjc@google.com> Message-ID: Subject: Re: [PATCH v3 32/40] KVM: x86: Move LLDT assembly wrappers into VMX From: Sean Christopherson To: Yosry Ahmed Cc: Paolo Bonzini , Vitaly Kuznetsov , David Woodhouse , Paul Durrant , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Binbin Wu , David Woodhouse , Kai Huang Content-Type: text/plain; charset="us-ascii" On Sat, May 30, 2026, Yosry Ahmed wrote: > On Fri, May 29, 2026 at 03:22:15PM -0700, Sean Christopherson wrote: > > Move kvm_{load,read}_ldt() into vmx.c, as they are exclusively used by VMX > > to save/restore host state, and have no business being globally visible. > > But they are generic helpers. I agree with mvoing them out of > kvm_host.h, but maybe into another header? No, absolutely not. The fact that KVM has to manually save, and conditionally restore, LDT is a quirk of the VMX architecture. If it weren't for the fact that VMX's segment_base() also needs to query the LDT, I would just open code the asm(). If it's a naming concern, I'll happily rename them to vmx_{load,store}_ldt(). Hmm, arch/x86/include/asm/desc.h provides {load,store}_ldt(), but load_ldt() is only available for CONFIG_PARAVIRT_XXL=n builds, and both #define unnecessarily constrain the output to memory. Those are both fixable, e.g. load_ldt() isn't used _anywhere_ AFAICT, so burying it under CONFIG_PARAVIRT_XXL=n is just some weird historical quirk, and I can't show_fault_oops() would care store_ldt() were allowed to store to a register. So after the dust settles, it probably makes sense to improve desc.h's versions and then use those in KVM. But I don't want to do that in this series, because it will be challenging enough to land all of this code movement without also having to coordinate with the tip tree.