From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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 0F4224A2E25 for ; Wed, 29 Jul 2026 13:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785332528; cv=none; b=Mt2yb6DwS3+gf25FzEpF6T9DX+vyC/VR5VlvSJSEBg3vpbfcEYAGokKa5JsJ85NGTUC68RZKLNBZQLENfRKOq8sxiCO8FVWh/mSNpVIFxE6vHYH4LClmmowx3AZJOqlKbSUwHxYtvtpduFKe+Dr10WcoAT5ljRsvfVjI0ko/VqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785332528; c=relaxed/simple; bh=khmxLp5K4ukXukURUaFTo3l5VuL6nUOSenrUb4o9od0=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=I/CZjeIWywRs2eT+3pEV14NgTuSbJKkM0kFpLjtW4bYcfzyUrrxmwFtYqjYEiQ3KnAs8+aHBhU2nhoXmQ+71WOP2+AwrGrG6nU1JJkLbp9VicO4cx2SQUEMTuGWk8j2A6W37WgEYZdwXq0tBmog/lGga1chRCSJrDs5W1aiRzxY= 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=Aej1dc3F; arc=none smtp.client-ip=209.85.210.198 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="Aej1dc3F" Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8488ac68185so2394759b3a.2 for ; Wed, 29 Jul 2026 06:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785332525; x=1785937325; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date :reply-to:from:to:cc:subject:date:message-id:reply-to:content-type; bh=h4/S7Hr3VP0PfA+XLbsiSJD6ArkO5P0hrxACr4+xXzI=; b=Aej1dc3FE0Y4FGsFHdnezT4YPgwtvB9eSPCjAyZYBBz+O1CcKt9Z5xk443hBcyOe2a aFmMf3IzfnvJluD5gs6OgwwyeC6c/fWfG1HlfFHKEwSEUXsJSyZSvi/OZNY/OmFVyy5z BOQWOOiwvia7hX2svMk7DHKOpknwH2xs3YJ2jhenHj0SxG2FgmwO0Dg3hj56iScCkGeE 5QFRquMOW/S9WvdDsdIlLbIPt0hS3AQllmQQYfC7sj7uv6TepNO5TD1ONZ8runW+KgO6 JO0OPdppB8S2MlL9keNbclFobLJDWqoZl5w1ey7y6GT02I2C9A3DpNKlhkNtYtyfwAg/ ByUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785332525; x=1785937325; h=content-type:cc:to:from:subject:message-id:mime-version:date :reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=h4/S7Hr3VP0PfA+XLbsiSJD6ArkO5P0hrxACr4+xXzI=; b=khm7s0HWsWLF3rm48b1jAJQbfakxIneodxo4lo2fbQMp5WUvDEqNshzgvQZE15/dox aHIrrVf4tBiKWx4UqRmNZ8FAxlfYLqKm1DiLPTqYH1UhOYjofa32MYomV6LjV8I4CPvU bX+IybDyjpMP4I9g7UHLPqX7i76xbVA2X7+9X7wRcOVxBNE4YqIXu/Ox1dUAR8/I810G qO2MiWDgK4ZQNI5E0XfEn5Ys9OwGkh/+YUPCt+f5YBgYYA0Pwu1UlE2V3afIwvAe1Id6 xymkIthXkW88DspWFbTIRHqxGZRaXyDguF8n8KTf3MzA/4OZP0ry/9HTyfEP8/gmUBkk MdCA== X-Forwarded-Encrypted: i=1; AHgh+RqxBthTTi1Yqs6C+kwyN444RZGESFW7g9yWVr3qIpfLQBhgZLtHowhWaBmwepW/ALwK4r/xDTjVtLqh+fs=@vger.kernel.org X-Gm-Message-State: AOJu0YxGgxOv0Hx1bXa8vGB2D3ive/MOc1bX/odmOzPMaMm0FAFcxXlr NAQ86yxu4avOs3jviD+DLuOJZWMva/7Aa/O07JD/SvCSRRYGqF6OgWvzpG1HyN1d37lCELSRe0j 31r/x0A== X-Received: from pfnw22.prod.google.com ([2002:aa7:8596:0:b0:848:2cfd:8fa1]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:a21c:b0:845:c8f9:6ce0 with SMTP id d2e1a72fcca58-84e931ecd92mr6251251b3a.21.1785332525042; Wed, 29 Jul 2026 06:42:05 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 29 Jul 2026 06:42:01 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.487.gaf234c4eb3-goog Message-ID: <20260729134203.1377606-1-seanjc@google.com> Subject: [PATCH v6 0/2] KVM: VMX: Workaround VMX preemption timer erratum From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Binbin Wu , Chao Gao , Jim Mattson Content-Type: text/plain; charset="UTF-8" Due to a widespread Intel erratum (e.g. EMR158), programming the VMX preemption timer with certain large values may cause the timer to expire earlier than expected. The recommended workaround is to cap the timer value to strictly less than 2^25 * CPUID.15H:EBX[31:0] / CPUID.15H:EAX[31:0]. v6: - Collect reviews. [Chao, Binbin] - Massage the wording in patch 1's changelog. [Binbin] - Use an inclusive "max" instead of an exclusive "limit". - Define a local ARCHITECTURAL_MAX_VALUE instead of open coding it in multiple locations. - Don't apply the workaround when running as a guest. - WARN if the CPUID.0x15 information would result in max value of 0. v5: - https://lore.kernel.org/all/20260724234914.987987-1-jmattson@google.com - Include Sean's preparatory patch burying VMX preemption timer code under CONFIG_X86_64=y [Sean] - Replace div_u64() with direct division (/) v4: https://lore.kernel.org/all/20260722143024.3938899-1-jmattson@google.com v3: https://lore.kernel.org/all/20260722040311.3369898-1-jmattson@google.com v2: https://lore.kernel.org/all/20260720231639.1592848-1-jmattson@google.com v1: https://lore.kernel.org/all/20260720205230.1457146-1-jmattson@google.com Jim Mattson (1): KVM: VMX: Cap VMX preemption timer to work around Intel erratum Sean Christopherson (1): KVM: VMX: Bury all of the VMX preemption timer code under CONFIG_X86_64=y arch/x86/kvm/vmx/vmx.c | 158 ++++++++++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 56 deletions(-) base-commit: 3c7d7f908d574277a845423ec32250a8d8df44c8 -- 2.55.0.487.gaf234c4eb3-goog