From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f43.google.com (mail-dl1-f43.google.com [74.125.82.43]) (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 2B92F3D7D7C for ; Thu, 14 May 2026 07:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778743491; cv=none; b=muvPi05XFaDJ29fFasGod3Gkm7aQ0geVAmZEU3YwzQ04cUsrmdg2LzXOX8dkTYVpwuLi3sbMHCYC62MLcnX/yO+/IZ94jSDhn2gjuwnhiJU6E0c0z/vK14e1dEkJ6wAvg0GDlFjHWyN+NtkkKbMXAlFaVQ92LNs1MM/dt1r4y4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778743491; c=relaxed/simple; bh=ZsIbdxclhE0yu0CL85hsH+17xmgFscAym9LDrlC1wNM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lk4ii9ozZaxGfsrXtI1LYlkG7qCeGuq1ZiiKktSOaTKv0+ucRpwbxwWA+hEp0aWxd5zR5WLELng8cZB5JVTIzLXjsgBEK3NMOkXAv7ptDwOLfIMyFhPP1e/Q7oVsyaU/kcpS42J+kjLwSe64Grp/RmnSDwrrLEsqFSqfb4UDsOo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ixphh4m/; arc=none smtp.client-ip=74.125.82.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ixphh4m/" Received: by mail-dl1-f43.google.com with SMTP id a92af1059eb24-132d1b2519eso1683459c88.0 for ; Thu, 14 May 2026 00:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778743489; x=1779348289; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=F97Fyk4de96jpUWYQ2GaVritRCACZPpXcVzTRglA1VM=; b=Ixphh4m/Wzj4cKb10gxR2KwhZuLu5sJtlgNJVzptEMMEQHVHTsgav4iGRKeXjpEaEw MjlpMV7sHbdjwJzi4tpzExf0dV7NyjtIm7NvdoS9m0tp6DodUWXS1OIoKo0+3fISA7TA oLeGgbOcZboofmTVuIZ1+bwbhx2Hlt75PjxnIjRMb+pVtA3U5946Jiwno2xq3x2TDfUH G/26YOxQfWWP+PE44tLYCh4YxBZf7lrRYsjBU70K8kyGQHx5uYVfXhcD0gHlDtjwpJx9 u5bSb4p19eEgNkfGb6KOLJNoc8kIgYqicV8DXIRDJrkJva/sLeH2+7qABBAqnCUelKEj 7hew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778743489; x=1779348289; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F97Fyk4de96jpUWYQ2GaVritRCACZPpXcVzTRglA1VM=; b=abikb+MAONXF8xLQB/7vrFlXyZB9TWAFLMBeraDkcsWH5NVp4Piy58mmqQUtG+hMtj ppHiXhhCdfAC0J1eOGqoGXWD1TLAUcj531J/V3jCHt7QuvEKfax7tNI7T0GimsUVtLX3 TGoA2LND44z/HYtTyGOq6BAPH4iscJMZC0rCXnp2pIkipS5AhEOuV11m2WTtiXyqZLyh Z6UFXqsAlsIilL9XItIG5JuVB33tqSxGHYTpo+VnWe7nxKyA/xQ9iMVTey5ZE897P0XK D9FnkH3QrXK9zjiYvcT4O6MMjAmLPRvyghH/vLRarzO09JsPmutKHGxFr65fZopdB8AR lXgQ== X-Forwarded-Encrypted: i=1; AFNElJ8p4g8w4PZtavR3tiUOc0r/DAk8X1sfC5P/L+1mwIAmEzJLEbcxbGAHNeAy5Y8gPMMbbKrx2Rv35FxMd9Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2MkceibyFnyL7LCV68tJngqemI9+19CpFwqltpCbfnoFKFttJ kNeX0wkuKgr/IIKLwwJu/1U063hYlAxml6cgBtxdLWrL7O44oAdIZqArl4kML30C X-Gm-Gg: Acq92OHxSzx3cof6fn7SCH9vsvSlFCDM8QgTbrXrSZXMTJ1aRsJgX5uZnChAxZPjlwk ceVqwvGNEFpVFi08TNcXyKS6282RHxPHJWRcnu8PbqDnvsBXh626knQ+miVAFGP/Ka7kCF+VcDW qc3GJVkjQfzOjulkdUJlalX4MJR5ggCU+lQJ5YSGP5g4oAkljlRXpQiqlHRcLGx2PTGdsPiD/Ti +Yp78AO7xC8a6NPaN2nqIZ003Vnowr1PgBuVz4wpTTkW04UHS4zJ3W3Azel6CIsbjE4p8Da3Ej9 Msm3unNvbv9o8vKJrbQubj6cMeNlAv3aO66eGXydbP5BQhe8+3tz/rEFj4JcXz3hYi/w0/iGqw0 g7+C2Z3Ui0QcjY66MzuZObaQF5hUyZ9qbN+hTVbJuy75bX/y1C9HxenLIytoh8TeFhZ6aRdGFj8 TSVJt7AZGbevoSvP3RqWJcaX0qFHMPcli9aHFZHAJI X-Received: by 2002:a05:7022:6612:b0:12c:6da8:856d with SMTP id a92af1059eb24-1349ab4b4a8mr3637724c88.26.1778743488955; Thu, 14 May 2026 00:24:48 -0700 (PDT) Received: from [192.168.21.192] ([67.170.89.46]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbcb93f3sm3248292c88.3.2026.05.14.00.24.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2026 00:24:48 -0700 (PDT) Message-ID: Date: Thu, 14 May 2026 00:24:46 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Betterbird (Linux) Subject: Re: the stuttering regression in 7.0: should I have done something different Content-Language: en-US To: Thomas Gleixner Cc: Linux kernel regressions list , LKML , sparclinux@vger.kernel.org, John Paul Adrian Glaubitz , Thorsten Leemhuis , Linus Torvalds References: <1c165caf-36b4-4673-97fd-ed86bef17b88@leemhuis.info> <3332123b-9e11-4895-9ab3-1707fba5815c@gmail.com> <871pfj9cmj.ffs@tglx> <088e6cfa-0167-4748-af6c-458ade2f303a@gmail.com> <878q9p82je.ffs@tglx> <64f465ca-6117-4375-9c4b-af771b8205fd@gmail.com> <87tssb6olo.ffs@tglx> From: Tony Rodriguez In-Reply-To: <87tssb6olo.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Thomas, Cheers! Initial validation of the test patches for v7.0.6 and 7.1-rc3 on the S7-2 looks promising: I have not observed panics, timer delays, or other timer-related issues so far. I will pause broader validation on the S7-2 and T7-1 until I receive your recommendation or any requested revisions (see inline comments below). Note: I did see an intermittent error on the S7-2 running 7.1-rc3, usually when the system is under heavy load during a kernel build. I’m not sure whether it is a separate problem? "[676.464681] BUG: Bad rss-counter state mm:000000008d9f1cf2 type:MM_FILEPAGES val:-4096 Comm:cc1 Pid:78165". On 5/13/26 1:28 PM, Thomas Gleixner wrote: > Just to be clear: I never saw the VHDL code of that CPU, but that > pattern is way too familiar. > > Those equal comparators, which were designed by AI (Absence of > Intelligence) before AI got popular, generally work this way: > > The comparator is only evaluated on the clock edge which increments > the counter, but not when the comparator value is written. So a write > of the same value does not result in an interrupt. > > That's an "optimization" which spares quite a few gates and is obviously > nowhere documented. So software has to deal with the consequences by > using a crystal ball, which is trivial to get wrong and can go unnoticed > for a long time until it roars it's ugly head at some point for whatever > reasons. > > I'm willing to bet a round of beers at the next conference that this is > the problem and that it will magically disappear when you change that > condition to: > > return (read_cnt() - exp) >= 0 ? -ETIME : 0; Attempted to locate "return (read_cnt() - exp) >= 0 ? -ETIME : 0;" but could not find an exact match. After additional inspection I updated the following functions "tick_add_compare()" and "stick_add_compare()" in arch/sparc/kernel/time_64.c to from "> 0L" to ">= 0L". This appears to have resolved the lost-timer behavior. --- time_64.c.orig +++ time_64.c @@ -146,7 +146,7 @@                              : "=r" (new_tick));         new_tick &= ~TICKCMP_IRQ_BIT; -       return ((long)(new_tick - (orig_tick+adj))) > 0L; +       return ((long)(new_tick - (orig_tick+adj))) >= 0L;  }  static unsigned long tick_add_tick(unsigned long adj) @@ -277,7 +277,7 @@                              : "=r" (new_tick));         new_tick &= ~TICKCMP_IRQ_BIT; -       return ((long)(new_tick - (orig_tick+adj))) > 0L; +       return ((long)(new_tick - (orig_tick+adj))) >= 0L;  }  static unsigned long stick_get_frequency(void) > > unless they managed to add some extra propagation delay to that > comparator write like the HPET folks did at some point without telling > anyone. I doubt the SPARC janitor who implemented it did so because > that would have made the failure way more likely. > > I have truly no idea why the original code did not expose this problem, > though it might have been just papered over by sheer luck and timing. > > Thanks, > > tglx > --- > --- a/kernel/time/clockevents.c > +++ b/kernel/time/clockevents.c > @@ -381,6 +381,8 @@ int clockevents_program_event(struct clo > if (dev->set_next_event(dev->min_delta_ticks, dev)) { > if (!force || clockevents_program_min_delta(dev)) > return -ETIME; > + } else if (delta <= 0) { > + dev->next_event = ktime_add_ns(ktime_get(), dev->min_delta_ns); > } > dev->next_event_forced = 1; > return 0; > You mentioned this kernel/time/clockevents.c patch is optional, but I propose revising clockevents_program_event(). If the requested event time is already at or before now, record a sane next_event (now + min_delta) so core code sees a future expected time and can behave correctly. Does this seem reasonable?  --- clockevents.c.orig +++ clockevents.c @@ -347,6 +347,11 @@         if (dev->set_next_event(dev->min_delta_ticks, dev)) {                 if (!force || clockevents_program_min_delta(dev))                         return -ETIME; +       } else { +               ktime_t now = ktime_get(); +               s64 delta_ns = ktime_to_ns(ktime_sub(expires, now)); +               if (delta_ns <= 0) +                       dev->next_event = ktime_add_ns(now, dev->min_delta_ns);         }         dev->next_event_forced = 1;         return 0;