From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171]) (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 1A2A83C5DC4 for ; Fri, 3 Apr 2026 15:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775231926; cv=none; b=GaHRsb1t0ILwxERLaTJSaPZ/bSESfbOrXIexBYLuGjBcuC5H6Eh8uVMnW3pT1aPG7OhX49Xw3cN8esflqOQjZj1U5T6i4THrXr0jNfo7v4ZEaT7vNiOYy6B3/sq/X4LzRlFLjT+E/t+zimuVwWlOpm/hFnx8bQezRxpXuN/qStA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775231926; c=relaxed/simple; bh=aD0uOt2ef9/FJhih4f3GlBW53LzPsSIke8T0jfI1ji0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OV3b7dXI/2LCosPHVrvVsQwKXpYp/vqR5iL7OLG5uj7/H7TlxgAxn27JWq9ufh4zgQUV3pzU7yOJE/sxlpCFu/d7/kiBzXva6nNLsIg7lJoyXA5HaEbH8D0XfeszBzWlhdtnujh2hkraSsK0ry+qAhtjq+KrqGQAmCwXmJ/awB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wbinvd.org; spf=pass smtp.mailfrom=wbinvd.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b=hyPk//JG; arc=none smtp.client-ip=74.125.82.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b="hyPk//JG" Received: by mail-dy1-f171.google.com with SMTP id 5a478bee46e88-2c1632faeb9so3862572eec.0 for ; Fri, 03 Apr 2026 08:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wbinvd.org; s=wbinvd; t=1775231924; x=1775836724; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FLq+zhXHAyPpjUVta8ldWnXIGZCtlC5mrrngsqAd3+w=; b=hyPk//JGlq0Jk0HNx+/ulZhwGFJGE/7seqWb9dN2MMwLKLykA6KSFTemK5Y06ER/d3 7ZTFZrbm44dGKtgAtC8fQbkn4s9SXr9+e9H0/yWF4c4SYGb3Nro9Ivmaq1+7RaJFzhNv b8P951rpVnZTPskCSRU4u+7cGsgEsnLbhyzi1KuOsBL/rJB7quFsHICLgL3nM9v3JobX st/+tlzCReyFnapKpCDMOiyEJHXm9hpfJ5zAuObuC2fgWs6Zm1oK5az2jB0ugaEmdEpc RETIVJbvuNVXCfn4fhwOLnlELdEOl0JH0JlHyv8T1IAS/S5Jdg0XZq8j4Eg2tsHlgJXR xHrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775231924; x=1775836724; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FLq+zhXHAyPpjUVta8ldWnXIGZCtlC5mrrngsqAd3+w=; b=EnljuhD6AIz++m2ex2WazykUf0NE7a8PUXF5N7lZfTwknntCWIByqWfud0szopuyQi Ylrz49uTHXjOKK3GvLnQlTurRZvkIkvoH9vanbiY8N4jSc3ZqtA4nIzWeYpLpGwYmMuk TFh+n6n1Ps9WB8o4q7v1ieaFBy/uSWEPiiwVBiMjDn7+khc3AgLnk0ep6iSbeZ3YUzZQ ObH5a8G8XseDysmu0qQj4HvptBgXY83plO5LfokBPp2DwAttriWeDM7j1/Ush7gfs/kK egA9BJkfdi5ybWin5h1PXb9RehsFLyfu1IrlnJquRpaulHeDsN0JRdUigwjnK8vFllIB gI6g== X-Forwarded-Encrypted: i=1; AJvYcCV9exMEyk1sufQkVRwIIwjfuCgDtlbAihFm1qQ9YGRUIfJtWQZhPHbF/Ldh9w9uhu7B0/W9a5y7ckXdZdU=@vger.kernel.org X-Gm-Message-State: AOJu0Yznqk+m4E+AkYFQ7rVVJkSiIcVNhE76vhELB5BmkSlKXDocslIs /Zerc0CsD0Borpn76elyxZKbwYCl3zpA5CGQoMAhTt3xntGbNu4YzBqjs+te3gsyWBQ= X-Gm-Gg: AeBDietkRZMrh1HCEqEEcEIxP8Y31JnXge/Rs4Qb4aLbikZoDjNDI7Hay7gySd98rvg Jr7092fiot8Lj1g62L0PqPApiddaz7BxeNqmCEcd8e7IJCwnz9GJo+yRpYM75NZTtKY8hloMxmY YGkPRQaTDEt+kp3zKc6gORROjKlXgGUTXHghEa8NzMa1iILH92AtFe4ER6onelsXuu4wdSH/clZ xurpHrM9aCJbccPy3l2sBL3PjUf2B+BPDImSlGgFb+GbOstC3Q6n6YJETzatJBQoVRz84Ip/UoF psn73LRoYfx+tIHs9vTHIAsd0wv1yG4JnGYkZAg99XnziVJhVP3nJrSkIrvdLBeasRZkC5wRkRW 5B90bbD4cH+YPdSJ/yWuSZ5aIKnlJe2z/kVAp0TI2YFF3kz7W6rXnYyr8Rk5Pyu265g1Z8ry+2y NeQmn99K7YDg4wAmzlkG5KB/4G2g== X-Received: by 2002:a05:7300:e78d:b0:2c0:da6f:55e0 with SMTP id 5a478bee46e88-2cbfc362ac8mr1845063eec.27.1775231924050; Fri, 03 Apr 2026 08:58:44 -0700 (PDT) Received: from mozart.vkv.me ([2001:5a8:468b:d015:9fa2:364c:1762:379a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2ca7cae9e9esm5278217eec.23.2026.04.03.08.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 08:58:42 -0700 (PDT) Date: Fri, 3 Apr 2026 08:58:39 -0700 From: Calvin Owens To: Thomas Gleixner Cc: Borislav Petkov , Petr Mladek , linux-kernel@vger.kernel.org, arighi@nvidia.com, yaozhenguo1@gmail.com, tj@kernel.org, feng.tang@linux.alibaba.com, lirongqing@baidu.com, realwujing@gmail.com, hu.shengming@zte.com.cn, dianders@chromium.org, joel.granados@kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Frederic Weisbecker , Anna-Maria Behnsen , x86@kernel.org Subject: Re: [PATCH] clockevents: Prevent timer interrupt starvation Message-ID: References: <87v7ejetl1.ffs@tglx> <875x6a913n.ffs@tglx> <20260401163435.GGac1JG42tWmsCKL37@fat_crate.local> <87jyup70ka.ffs@tglx> <87bjg06r7t.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87bjg06r7t.ffs@tglx> On Friday 04/03 at 16:41 +0200, Thomas Gleixner wrote: > On Thu, Apr 02 2026 at 22:11, Calvin Owens wrote: > > On Thursday 04/02 at 19:07 +0200, Thomas Gleixner wrote: > >> Calvin reported an odd NMI watchdog lockup which claims that the CPU locked > >> up in user space. He provided a reproducer, which set's up a timerfd based > >> timer and then rearms it in a loop with an absolute expiry time of 1ns. > >> > >> As the expiry time is in the past, the timer ends up as the first expiring > >> timer in the per CPU hrtimer base and the clockevent device is programmed > >> with the minimum delta value. If the machine is fast enough, this ends up > >> in a endless loop of programming the delta value to the minimum value > >> defined by the clock event device, before the timer interrupt can fire, > >> which starves the interrupt and consequently triggers the lockup detector > >> because the hrtimer callback of the lockup mechanism is never invoked. > >> > >> As a first step to prevent this, avoid reprogramming the clock event device > >> when: > >> - a forced minimum delta event is pending > >> - the new expiry delta is less then or equal to the minimum delta > >> > >> Thanks to Calvin for providing the reproducer and to Borislav for testing > >> and providing data from his Zen5 machine. > >> > >> The problem is not limited to Zen5, but depending on the underlying > >> clock event device (e.g. TSC deadline timer on Intel) and the CPU speed > >> not necessarily observable. > >> > >> This change serves only as the last resort and further changes will be made > >> to prevent this scenario earlier in the call chain. > >> > >> Reported-by: Calvin Owens > >> Signed-off-by: Thomas Gleixner > >> --- > >> P.S: I'm working on the other changes, but wanted to get this out ASAP > >> for testing. > > > > Unfortunately the AMD boxes won't boot with this: one gives me no > > video console output, the other gets to userspace but hangs trying to > > mount the rootfs and then prints hard lockup traces with idle stacks. > > > > Sorry not to have more info yet, I'll have time tomorrow to sit down and > > get more data for you. If there's anything specific that you'd like me > > grab just let me know. > > I'm an idiot. When I polished the patch up, I dropped the hunks which > clear the flag in the interrupt handler and tired brain did not notice > despite checking five times in a row. Updated version below. That did it, both AMD machines survive the reproducer and are well behaved afterwards. If you like: Tested-By: Calvin Owens Thanks, Calvin