From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (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 6E8DB44BCB8 for ; Fri, 31 Jul 2026 17:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785518374; cv=none; b=M1PKY0lPGJDU8oElL1+f3ru1qKf+0ym3ZH3SePOTtqp0SQhNctl4IowL2Ca6/oySrYXiERJtQWAeapL1TVy+mPgvmbuhqvJaYnPyFAN6y0VPcyzQJRcergTJrzHqXshkY/FBJWdrQcYyOU5Av3moMr74YcRSvOkimf5f8VftMqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785518374; c=relaxed/simple; bh=xIU6uO65MTI5GT5LeU4s+zhDQ366657/3pJut9ChS7g=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=SJIpjy9Brglashq31CcEgUUG1h84qj5CkKsRXsQr+/cl+GMAKTv5ezkZhWgie4tdm6qMy/TRFpp6aEDUGGhgMqnvP2nxS25VjlaoOlXFi/7XEbfCOEbDN8AqoGhtwxN7wCsyEtwjWQCW8Ud9xbuxTTRcB+k1N6jEWJW86E6rk+g= 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=naN+pMMT; arc=none smtp.client-ip=209.85.216.71 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="naN+pMMT" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e7621655eso2122365a91.0 for ; Fri, 31 Jul 2026 10:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785518369; x=1786123169; 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=XIBeCVj+waoKu55IzF4HgiRWJHXPMbjXy1AWpcy6gsA=; b=naN+pMMTIU2eyjP5o7bzJnEbE+nDIU049RmW4eUakW8rIoefIlNkAeZ4+r0dgJ2kAr JM1MMz1HyTWE0P8AkEI1adklxzED+I80tEcQwqwIoyM1G+HXwHEXjU3Wsr4VnYn3kqk8 Mt4RxqABV/pvbLk2i1x2OPQutBr3cFfMmFPquKTz9BEer1LAWF+94U7Y7MCynEckjjau l00dVxtyxWNWbYKtRgm4rr2vPktz11Sy2KS4w08NWq0VzHxlCOBrWsptPkgr381eZAyo FDtmifVhBE5AbLkqH0STpPVkFc2czSS59Dwlydjrz13Q0NMhu6s6yYF8WG+U8SFJubI5 aHow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785518369; x=1786123169; 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=XIBeCVj+waoKu55IzF4HgiRWJHXPMbjXy1AWpcy6gsA=; b=BKn232JYV2hRxkpWNxSkc4zN33+JgTE3IzsJUNRGyJzXsPw+2BeCMwQnB1RcOtbM6V fTVmFDaTmA36+kPclh78MbA3QFGDJN6f+TpnGTcRhS8OuBOF80uO/4F9atbZPeqSl5rH h46ja9cKH/EcStw+MdAuSwdECQB8Tzm4OYwpsWPprqIKg62VWdLPsqjkb9qp20iXCE88 KzV02FO4mQFWBrgXnNjF2UgwQ7JkH8Y6qHFppJy+d3ppfkaTpImX0Z1SrIN1bxQal1r6 +6ZgChRGEUY9MS8SZdqtQadf5FhxTNhMYkmxic70Ah+oczrXgvZSYfNV59rmYiWngfRG pgJQ== X-Forwarded-Encrypted: i=1; AHgh+Rpp2UEVxXRVlxC3b7w+CNGRl0gpJb2KTLmAFaePRrmS6GUmBA27Vo3pYcCm8eh3LMRcq61mteo1lzzuxV0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8yHH0tue8UMzeWrJ70nWz938GA0jBxjPT/goFzUnQTgYjiQle C9Dvo0KljwvLtUGY5hhrAA+ouwPMH5VpB7BdI908X9tO5npyftHPBiwD/g/gtPFbeRX48R3usFA roiPgFg== X-Received: from pgaf18.prod.google.com ([2002:a63:3812:0:b0:c85:98b1:c613]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4b8f:b0:38e:2524:7272 with SMTP id 98e67ed59e1d1-38fbc56c8d6mr561358a91.39.1785518367803; Fri, 31 Jul 2026 10:19:27 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 31 Jul 2026 10:19:24 -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.508.g3f0d502094-goog Message-ID: <20260731171926.2629627-1-seanjc@google.com> Subject: [PATCH v7 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]. v7: - Ensure the timer doesn't exceed the architectural max. [Sashiko] v6: - https://lore.kernel.org/all/20260729134203.1377606-2-seanjc@google.com - 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.508.g3f0d502094-goog