From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5FE8C23ED5B; Fri, 9 Jan 2026 12:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767960703; cv=none; b=MqpRuZHv8UXMDhIQqU74wGPLQ45vminPaAX3BZY+iBS9uX0XksFJIqK8BsZczAdIj4q06aDG3AANcWK9Xvhb4sATDM7Lloy+x4Qm77fMPwSIOTqdRRc4u3YjFKhFIBU/h33A0FUt6LnqTavbBnnymt8jtXnubyQIlvEDwvhOQUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767960703; c=relaxed/simple; bh=iu6sLnUNmS+4Z3S8pTfs20lcFaqSYvMof0XLBr5NX9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IsSu0ClUzAQISVqA4nhkItrEcmdiBW2Y2fLUuxlmUhj7X0PgjxyAusbOWMiM2S1WmsaDdKiTPbWSqmR0Tr0u6uQuFWsFETtze8L4wLrkVFRWBzhWgc+e52Js+8p+COhnuq8XgvAZucYyCMQ1stQyOgM80iYZorwp0pTwmmC7dTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1WvPh3dS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1WvPh3dS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2BF0C4CEF1; Fri, 9 Jan 2026 12:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767960703; bh=iu6sLnUNmS+4Z3S8pTfs20lcFaqSYvMof0XLBr5NX9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WvPh3dSNQjC25zonrGmRvvw9B+0QZq2a0/aBkmWU4EAJUSRLIqHtVUlvDcm0NeU/ 7CKVOYA4xWQRoGz+1bjDjVWFB4OvuCFAsAQovnhRp9lbxsIfKX8Eubye/2U9OcejXB eqn42UhPuJxJDju4rd1IBjiARLoZ8ZRlxQ4Zn67I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sean Christopherson Subject: [PATCH 6.6 462/737] KVM: x86: WARN if hrtimer callback for periodic APIC timer fires with period=0 Date: Fri, 9 Jan 2026 12:40:01 +0100 Message-ID: <20260109112151.370875881@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112133.973195406@linuxfoundation.org> References: <20260109112133.973195406@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Christopherson commit 0ea9494be9c931ddbc084ad5e11fda91b554cf47 upstream. WARN and don't restart the hrtimer if KVM's callback runs with the guest's APIC timer in periodic mode but with a period of '0', as not advancing the hrtimer's deadline would put the CPU into an infinite loop of hrtimer events. Observing a period of '0' should be impossible, even when the hrtimer is running on a different CPU than the vCPU, as KVM is supposed to cancel the hrtimer before changing (or zeroing) the period, e.g. when switching from periodic to one-shot. Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20251113205114.1647493-2-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2855,7 +2855,7 @@ static enum hrtimer_restart apic_timer_f apic_timer_expired(apic, true); - if (lapic_is_periodic(apic)) { + if (lapic_is_periodic(apic) && !WARN_ON_ONCE(!apic->lapic_timer.period)) { advance_periodic_target_expiration(apic); hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); return HRTIMER_RESTART;