Message ID | 20221109221049.4bf3c5bb@rosh |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp566737wru; Wed, 9 Nov 2022 13:21:26 -0800 (PST) X-Google-Smtp-Source: AMsMyM5jieDJ0xcFB0BHAlSta2v9GytngkYG+6K3pU23g1gKPrTUBPXWcNBLVQX7UwQrtFItvOd4 X-Received: by 2002:a63:82c3:0:b0:470:9d9:c2a9 with SMTP id w186-20020a6382c3000000b0047009d9c2a9mr34925071pgd.255.1668028886084; Wed, 09 Nov 2022 13:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668028886; cv=none; d=google.com; s=arc-20160816; b=S5KVnGSA7dheLY0pPsm9H7dWs65e23gce1GpkxV2nhvIuSaWNwiejG7kkLLs+gDanY Ggz5hXAdRGkTsOdhXayqfeeLX61fjBD87a6vUdwOoSB8IJ0fQKErLQkGPURpVquFnzjm 7PXpYIha4B5+RR4BVWOJJ8fUwUUV48yaSRTmclFf3tMwO7KALJ9AajkYc47BoIOggk1d qE68Q3zB82th7HGyMu3AABy8UlHMeAgG6cjfaPylzHmzKQafASZCqXXivuO55Zue+wik nhsyGICEdquWPAgvHR6/z56iJfmQuN5yrtVw8QO/7Ig40XPlU76Sj8AggRTgjn50H0gO kEHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=zoLCS75uMnarYBqQhRGSYiyqlqEkkaItCFsNb1yqLdI=; b=EmHEebE1thrLvCVt8JjeVf6/pcwb7amWhI6TOwk0lYjy/CyXBbWlsMN/Ax4OW91BUm OWBfMdJ4nx0AReq5sxswK40KGFNfi/UwPoGVum04Jg3SeGkwikwCIgIImRicIkdAuOeN nnHbAZLSc1Ddj5blSy4roKFN7b3M6XD2smvOX+12btv2K5rQYuWHn5+1nZ2iE4QhQpzE Ebc57hevsiwgif8zXfsUnaX+zzPAoxZZyUmyV029UzW9oSYpMTPQm0Gs1fgZLrQ03orp fIRabovUqtqAsyJ2ItiYW9aZUqS/L0K+IMUUvw/f8IKRFFts6vj5sDDVOuUtwqyCIlUi w34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@b-tu.de header.s=smtp header.b=pnbckGjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a056a001a4100b0056b82fbafebsi20433552pfv.379.2022.11.09.13.21.12; Wed, 09 Nov 2022 13:21:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@b-tu.de header.s=smtp header.b=pnbckGjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbiKIVRE (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 16:17:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbiKIVRD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 16:17:03 -0500 X-Greylist: delayed 358 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 09 Nov 2022 13:17:00 PST Received: from smtp-4.b-tu.de (smtp-4.b-tu.de [141.43.208.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D616231221 for <linux-kernel@vger.kernel.org>; Wed, 9 Nov 2022 13:17:00 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by smtp-4.b-tu.de (Postfix) with ESMTP id 4N6yLV2z53zGsZnW; Wed, 9 Nov 2022 22:10:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=b-tu.de; h= content-transfer-encoding:content-type:content-type:mime-version :x-mailer:message-id:subject:subject:from:from:date:date :received:received; s=smtp; t=1668028256; x=1668892257; bh=P4rW3 JoP+8noNBW4QOWFMnNFqANdUsIam1OlFgKyq+4=; b=pnbckGjVvB0bVgOSZtwK2 pQIgepZeS9OVLSMdbntzTZtQ/QfigasOtX9u8l0kPcfZNfK+UDjG4X9FEV/7ACul pU27rPEeHse03dLaKfAt4HlvxND9u1J2keO3qseGsqH3DEf/Ltu5QV/AbCG4+taY 6XeyDouEY94Pl+fbsnQaYE= X-Virus-Scanned: by AMaViS (at smtp-4.b-tu.de) Received: from smtp-4.b-tu.de ([127.0.0.1]) by localhost (smtp-4.b-tu.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UcF6QBYdIPq7; Wed, 9 Nov 2022 22:10:56 +0100 (CET) Received: from rosh (ipsec233.vpn.tu-cottbus.de [141.43.177.233]) (Authenticated sender: dikarill@b-tu.de) by smtp-4.b-tu.de (Postfix) with ESMTPSA id 4N6yLM5xCHzGsZnV; Wed, 9 Nov 2022 22:10:51 +0100 (CET) Date: Wed, 9 Nov 2022 22:10:49 +0100 From: Ilya Dikariev <dikarill@b-tu.de> To: Mark Rutland <mark.rutland@arm.com>, Marc Zyngier <maz@kernel.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, Samuel Holland <samuel@sholland.org>, Chen-Yu Tsai <wens@csie.org>, Jernej =?utf-8?q?=C5=A0krabec?= <jernej.skrabec@gmail.com>, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH] drivers/clocksource/arm_arch_timer: Tighten Allwinner arch timer workaround Message-ID: <20221109221049.4bf3c5bb@rosh> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749055057514149444?= X-GMAIL-MSGID: =?utf-8?q?1749055057514149444?= |
Series |
drivers/clocksource/arm_arch_timer: Tighten Allwinner arch timer workaround
|
|
Commit Message
Ilya Dikariev
Nov. 9, 2022, 9:10 p.m. UTC
As we know, the Allwinner A64 SoC has a buggy RCU time unit. The
workaround named UNKNOWN1 was not sufficient to cover some more buggy
bunches of this SoC. This workaround diminish the mask to 8 bits instead
of 9.
An example run of timer test tool https://github.com/smaeul/timer-tools
on PinePhone device (owns the A64 SoC) gives following result on a non
patched kernel (cut off):
Running parallel counter test...
0: Failed after 5507 reads (0.003578 s)
0: 0x0000000c8272cbf1 -> 0x0000000c8272ccff -> 0x0000000c8272cc0e ( 0.011 ms)
2: Failed after 14518 reads (0.009248 s)
2: 0x0000000c827513f1 -> 0x0000000c82751300 -> 0x0000000c8275140e ( -0.010 ms)
3: Failed after 14112 reads (0.008730 s)
3: 0x0000000c8274f3f2 -> 0x0000000c8274f300 -> 0x0000000c8274f40d ( -0.010 ms)
1: Failed after 12030 reads (0.008409 s)
1: 0x0000000c8274abf1 -> 0x0000000c8274acff -> 0x0000000c8274ac0f ( 0.011 ms)
1: 0x0000000c827759f2 -> 0x0000000c82775aff -> 0x0000000c82775a0e ( 0.011 ms)
0: 0x0000000c8277a9f2 -> 0x0000000c8277aaff -> 0x0000000c8277aa0d ( 0.011 ms)
2: 0x0000000c8278f3f1 -> 0x0000000c8278f300 -> 0x0000000c8278f40e ( -0.010 ms)
0: 0x0000000c82785ff2 -> 0x0000000c82784300 -> 0x0000000c8278600d ( -0.309 ms)
After the proposed patch applied the test runs
correctly (~2 hours of testing with a tool above without fails)
Signed-off-by: Ilya Dikariev <dikarill@b-tu.de>
---
drivers/clocksource/arm_arch_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, 09 Nov 2022 21:10:49 +0000, Ilya Dikariev <dikarill@b-tu.de> wrote: > > As we know, the Allwinner A64 SoC has a buggy RCU time unit. The What is RCU? > workaround named UNKNOWN1 was not sufficient to cover some more buggy > bunches of this SoC. This workaround diminish the mask to 8 bits instead > of 9. > > An example run of timer test tool https://github.com/smaeul/timer-tools > on PinePhone device (owns the A64 SoC) gives following result on a non > patched kernel (cut off): > > Running parallel counter test... > 0: Failed after 5507 reads (0.003578 s) > 0: 0x0000000c8272cbf1 -> 0x0000000c8272ccff -> 0x0000000c8272cc0e ( 0.011 ms) > 2: Failed after 14518 reads (0.009248 s) > 2: 0x0000000c827513f1 -> 0x0000000c82751300 -> 0x0000000c8275140e ( -0.010 ms) > 3: Failed after 14112 reads (0.008730 s) > 3: 0x0000000c8274f3f2 -> 0x0000000c8274f300 -> 0x0000000c8274f40d ( -0.010 ms) > 1: Failed after 12030 reads (0.008409 s) > 1: 0x0000000c8274abf1 -> 0x0000000c8274acff -> 0x0000000c8274ac0f ( 0.011 ms) > 1: 0x0000000c827759f2 -> 0x0000000c82775aff -> 0x0000000c82775a0e ( 0.011 ms) > 0: 0x0000000c8277a9f2 -> 0x0000000c8277aaff -> 0x0000000c8277aa0d ( 0.011 ms) > 2: 0x0000000c8278f3f1 -> 0x0000000c8278f300 -> 0x0000000c8278f40e ( -0.010 ms) > 0: 0x0000000c82785ff2 -> 0x0000000c82784300 -> 0x0000000c8278600d ( -0.309 ms) > > After the proposed patch applied the test runs > correctly (~2 hours of testing with a tool above without fails) 2 hours seems like an incredibly small amount of time given that the existing workaround was believed to be correct. Run it continuously for a couple of weeks on several different machines with varying workloads and less us know the outcome. Thanks, M.
El Thu, 10 Nov 2022 08:31:21 +0000 Marc Zyngier <maz@kernel.org> escribió: MZ> > MZ> > As we know, the Allwinner A64 SoC has a buggy RCU time unit. The MZ> MZ> What is RCU? I think I called it wrong. Anyway I mean the HR timer of A64. MZ> MZ> > workaround named UNKNOWN1 was not sufficient to cover some more buggy MZ> > bunches of this SoC. This workaround diminish the mask to 8 bits instead MZ> > of 9. MZ> > MZ> > An example run of timer test tool https://github.com/smaeul/timer-tools MZ> > on PinePhone device (owns the A64 SoC) gives following result on a non MZ> > patched kernel (cut off): MZ> > MZ> > Running parallel counter test... MZ> > 0: Failed after 5507 reads (0.003578 s) MZ> > 0: 0x0000000c8272cbf1 -> 0x0000000c8272ccff -> 0x0000000c8272cc0e ( 0.011 ms) [......] MZ> > After the proposed patch applied the test runs MZ> > correctly (~2 hours of testing with a tool above without fails) MZ> MZ> 2 hours seems like an incredibly small amount of time given that the MZ> existing workaround was believed to be correct. Run it continuously MZ> for a couple of weeks on several different machines with varying MZ> workloads and less us know the outcome. The only A64 machine I own is the Pinephone. First time I did this patch ~9 month ago (on behalf os Samuel). Before it the system suffered hangs every 15-20 minutes and backward time jumps ~1 time a day. Since applying of this patch none of above occurred. To be honest, I never did long tests (weeks). I will put the device on a probe for some weeks and let you know then. Best regards, Ilya
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index a7ff77550e17..3019faa263f5 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -371,7 +371,7 @@ static u64 notrace arm64_858921_read_cntvct_el0(void) do { \ _val = read_sysreg(reg); \ _retries--; \ - } while (((_val + 1) & GENMASK(8, 0)) <= 1 && _retries); \ + } while (((_val + 1) & GENMASK(7, 0)) <= 1 && _retries); \ \ WARN_ON_ONCE(!_retries); \ _val; \