From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (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 DEF0836E466 for ; Tue, 19 May 2026 23:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779233159; cv=none; b=Y1SDmaVLhlnIj2/YSMW+IQMF6frF7+s+yTbOzse7C7v1vcHF7kfGGQoxZ5Bo0lg0SnzYLDhHd/q6U4OEW0JAO/mw1+nEOsy0JEhrQtK4fpI96UkgeNLjpjgwQ8YvlWazIaXzB34om8mzgs9yB28tKZ6+b92SKrVczl8j/+plojE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779233159; c=relaxed/simple; bh=qzAr6/WsgFKssqlPCxXSDzt8GyeSAbibXjHXxB4WTP8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qr638imO9iDf5k2Cwmakfy+tjc+m8rlaS4rbY+ElsUbTPCuRs9K/Qkqivm9V+g4jrDUH4uKKE/9Krl4oBsUhwIm+R3tSAVJEgYXi9c3ZlaR8vh2wGluvonauHBTK6UdmmZhq/F5H1MnrH4tL91akOct9C7TMKZuVGHpMLIdZdBs= 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=ehXqV/TY; arc=none smtp.client-ip=74.125.82.54 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="ehXqV/TY" Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-133466cf955so14636553c88.0 for ; Tue, 19 May 2026 16:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779233157; x=1779837957; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=q3SS2yS5uCTePausm4fGtWUlfakc5T6xBGkbwj6NS7w=; b=ehXqV/TYxg/OG/RsQqL10m+W4a9YfynrDzhTSBDY8+rai7Hkz6up2XY2E84Kn9ZiFM 3+Ivbn4Oxl1M+1+oKrZsX+hThdIdrp5c0J42OOkv4LZHSHPJOe/rDlJZlgT5/0vLPeB7 6GGtejnrn1FGSD2bqb5kv+HwBEdYNn7nDbjpDBNuMwP3hL7Juk1Wj8fdzVbnUCvVxzi6 1qN/F+taCVIuC3I1i+AQ0syY5BGzjLKza3lQkKSSV1T3r4KBTBKZkmLEp3wxv5Uv3ZIG lZ8EfmKqMWuo2fFTZm2jFWiShhIU9Ger+RkoEYU+shPVaQBbWdj5trlpM7wMelxTgvMU aorA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779233157; x=1779837957; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to: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=q3SS2yS5uCTePausm4fGtWUlfakc5T6xBGkbwj6NS7w=; b=oSN9KQ08cuwQ7k4dKgwuiLGVLLrw/7hzGIdSHmYZHL9in07sUKNQOB0TaFzUkGPhYH 9pZVw3MPuURtjPCsH+Psf80bxQHhqisPbig21fejqH5E2RbBLdqqHc8i2BSl3q0mszO0 Hj9RmjPwhXchf5czTium4DdLLWMP/1lAKozdzsxerZx74EzHlRQJnYB39BjwNy9dXzAX gKU3dsNcB0POPvBEA1wAQ4t5wuLSiwPgXNQvaMLWBf2lwyHjfS7GoWTakHJgYUhLCweg M234r/h9qEeZi4eB+DYnlCONg0NY70vtOvL0itbcRzybSKU4C3yAEdQgADBd/1iyCZym yzVA== X-Gm-Message-State: AOJu0YwPmChLh0k5kyx4P7liQFWBoGYcJprQqK1AQanNEV90pRxJ3Qa+ 23y7Ir6Xy7V9bBXbm9T/q9xFqGU+wuyWb4sHbYCmNUEkv7dlAfcxf5aT X-Gm-Gg: Acq92OELOqv/BHkiH/aec0uewcprlFOD4hRN5ENN5J3gtfxgB0ND+SGz/E4xdtywCxh zHRpN73X2U0qys6iU2ZUjIZOjhhWPzgEeYkk6PgRF3t0NUXI9m5KbVx9InG34MCCjuA2zGlERVF +6N7Cwcv1NEm+7+xrwub48TH6p/T7Sxh+zN2yAoI7lkgsV/eHmVprXfvFYd7GhTZbrM5QZ6BGL7 JPP+Vs3iqXkR3Nw6Jz6BbPFmVntawzbhI7MpQTBjXr4m1UjNtdfTsN1brRxpmzdn4CpEl75dwZn UMKLNBOD/k1/fuTmB7bFTuadP71lPDSDJYRFkliV+up3+/AitktOU4iMtOqOuJer1TKOwCPKZsV +K6f4xWtUxkKnXJL69WAeIOqYzRCYeVdNBDNCqCIgQ9QGFhcqrtH/2BGN9jND3A6r03ugkGUys2 TqOpadKpRq3QqzZy/mBwF8UnONS614gA== X-Received: by 2002:a05:7022:43a4:b0:134:a701:de8 with SMTP id a92af1059eb24-1350441871fmr9821327c88.5.1779233156752; Tue, 19 May 2026 16:25:56 -0700 (PDT) Received: from [192.168.21.192] ([67.170.89.46]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbcb93f3sm25577758c88.3.2026.05.19.16.25.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2026 16:25:56 -0700 (PDT) Message-ID: <10382506-3f57-4b33-8356-34f23fb5f153@gmail.com> Date: Tue, 19 May 2026 16:25:54 -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: [PATCH v2 1/1] sparc64: Fix comparator problem with timer interrupts To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, andreas@gaisler.com, thomas.weissschuh@linutronix.de, regressions@lists.linux.dev, glaubitz@physik.fu-berlin.de, linux@leemhuis.info, torvalds@linux-foundation.org, davem@davemloft.net, sparclinux@vger.kernel.org References: <20260519022421.5978-1-unixpro1970@gmail.com> <20260519022421.5978-2-unixpro1970@gmail.com> <878q9fxywc.ffs@tglx> Content-Language: en-US From: Tony Rodriguez In-Reply-To: <878q9fxywc.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Thomas, Thanks again for the careful analysis of the comparator ordering. After applying the changes in the patch I confirmed S7‑2 and T7‑1 systems no longer hang; timer scheduling now behaves as expected. I don’t have bandwidth right now to finish the remaining tidy steps and I’d rather avoid delaying this fix. Since we worked on this together and you’re familiar with the issue, would you be willing to take it over so upstream has everything required for approval? I’m happy to answer any questions; if you’re busy I can ask the maintainer to reassign. Thanks again for the review and the clear explanation. Tony On 5/19/26 7:22 AM, Thomas Gleixner wrote: >> On SPARC64 the check: >> >> return ((long)(new_tick - (orig_tick + adj))) > 0L; >> >> Is safe only if retries make forward progress. The comparator can >> take effect with a latency, so the moment when counter == comparator >> may be missed, which can cause delays or hangs on some SPARC64 systems. >> >> For clarity: >> exp = orig_tick + adj /* expected comparator value */ >> >> The current check requires new_tick to be strictly greater than exp; >> equality (new_tick == exp) is treated as not yet passed and the caller >> will retry. > That's confusing at best. You really want to explain how the ordering is > similar to what I described in the analysis: > > exp = read_cnt() + delta_ticks; > write_cmp(exp); > return (read_cnt() - exp) > 0; > > If the counter advanced past the expected expiry time, after writing it, > then the caller will retry, as the calling code does: > > return tick.add_compare(delta_ticks) ? -ETIME : 0; > > But it won't do so when the counter is equal, which is causing the > problem. > >> By contrast, using: >> >> return ((long)(new_tick - (orig_tick + adj))) >= 0L; >> >> causes the caller to stop retrying and assume the timer is scheduled; >> both equality and greater-than are accepted (new_tick == exp or >> new_tick > exp). > It's the other way round. When counter >= expiry time, then the write is > considered failed. If the counter has not yet reached expiry time, > i.e. it is smaller, then it assumes the timer is scheduled. > >> Signed-off-by: Tony Rodriguez > It would be nice to have a link to the original thread in the change log > itself as that gives people quick access when they are wondering about > this a year down the road. > > Thanks, > > tglx