From nobody Mon May 25 01:17:36 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BF5E368284; Tue, 19 May 2026 18:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779215253; cv=none; b=uk+y20NhXPIGsXanH/rCnCiduduyqkpFMmzmdAQ9q2VgNDm2x62j3Yul07hPBDiPhSJBZVERE5YCtmnz6qzprULvpjPhoMxYjExs90zwiYRGdrBsDajtVkvqrTf7t/BIhfha0f7kQ/PqaJPNJTDYUGm5NGwwCQ6I6NBQjMgmsf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779215253; c=relaxed/simple; bh=UgeXVP90VGVobf9gkPz8WmF2hIXejFiHlEpyriExcpk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=IPgN37MpXgdv2q1Z1OkE1ybRlnY+8ODrhUvoAL7hbEbNdjDMfDYgnL6wFNJSoIz3X+3URy/VXofYhTZDQpfyEUC2pxl/JkvIzaDzCZV4K2Im73uLEsIpm5nb1VOV11ToRbWm5DrF2Qu8OdZGVm+FskCTl6CBIJObFBcwEnJgzg8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Fe3OcjdQ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FL1pocgG; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Fe3OcjdQ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FL1pocgG" Date: Tue, 19 May 2026 18:27:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779215249; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEUrZrQLbEg/vuPAJnAZ9ElUXsUamiDEG1gyyxsIJDw=; b=Fe3OcjdQ8Z+TBAKfLHaJ8s5MMpjyyVZn+XmKGCzU7VUhUGgQEwEI1OF0ir/gG/4W04pAuM gjJtJfq0IhzK5pliPWSyeFyzkOLcSFBXngo4JCfvAHl6ycJoFixXl2CR/dkG48PKAjcxut 3hE8Hu/fqVSWM1tOzrM/AGyAlAQsmGCZH2Wl+viZkyllFGZcZDOeZvOEfwGNPrCTPB6mJe iuolFJCdQXbD/hK2M+d2dV29GGD2l4g+ZkeRwG0FXppE3kXmaHDmGlIv93glmCkveyhsCU UcVtCkJdPwwT6Ey3+e0OQgf0N7nZQBXiVusBQXkBUryyK7lx/EIRshZuLg9j+Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779215249; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEUrZrQLbEg/vuPAJnAZ9ElUXsUamiDEG1gyyxsIJDw=; b=FL1pocgGEDSLxc6KrVW3jrNhx4mTD4scPmH4yGgSwRco6Wxv2tW/zfrr4TXc//ihCw3g+D K6KgRYhEzvSfkQCg== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/kvm/vmx: Fix VMX vs hrtimer_rearm_deferred() Cc: "Verma, Vishal L" , Thomas Gleixner , "Peter Zijlstra (Intel)" , David Woodhouse , Zhao Liu , Sean Christopherson , Binbin Wu , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260423155936.957351833@infradead.org> References: <20260423155936.957351833@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177921524808.711.15705860071676736444.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 5fcc48d521877c5d83828d715c81f4d169ef97f3 Gitweb: https://git.kernel.org/tip/5fcc48d521877c5d83828d715c81f4d16= 9ef97f3 Author: Peter Zijlstra AuthorDate: Thu, 23 Apr 2026 17:56:13 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 19 May 2026 20:25:51 +02:00 x86/kvm/vmx: Fix VMX vs hrtimer_rearm_deferred() Vishal reported that KVM unit test 'x2apic' started failing after commit 0e98eb14814e ("entry: Prepare for deferred hrtimer rearming"). The reason is that KVM/VMX is injecting interrupts while it has interrupts disabled, for a context that will enable interrupts, this means that regs->flags.X86_EFLAGS_IF =3D=3D 0 and irqentry_exit() will not do the right thing. Notably, irqentry_exit() must not call hrtimer_rearm_deferred() when the re= turn context does not have IF set, because this will cause problems vs NMIs. Therefore, fix up the state after the injection. Fixes: 0e98eb14814e ("entry: Prepare for deferred hrtimer rearming") Reported-by: "Verma, Vishal L" Suggested-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Tested-by: "Verma, Vishal L" Tested-by: David Woodhouse Tested-by: Zhao Liu Tested-by: Sean Christopherson Reviewed-by: Binbin Wu Link: https://patch.msgid.link/20260423155936.957351833@infradead.org Closes: https://lore.kernel.org/r/70cd3e97fbb796e2eb2ff8cd4b7614ada05a5f24.= camel%40intel.com --- arch/x86/entry/common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index b62ac82..06c7c6e 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -2,6 +2,7 @@ =20 #include #include +#include #include #include =20 @@ -27,6 +28,18 @@ noinstr void x86_entry_from_kvm(unsigned int event_type,= unsigned int vector) #else idt_entry_from_kvm(vector); #endif + /* + * Strictly speaking, only the NMI path requires noinstr. + */ + instrumentation_begin(); + /* + * KVM/VMX will dispatch from IRQ-disabled but for a context + * that will have IRQs-enabled. This confuses the entry code + * and it will not have reprogrammed the timer. Do so now. + */ + hrtimer_rearm_deferred(); + instrumentation_end(); + return; } =20