From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F4017C433FE for ; Wed, 9 Nov 2022 21:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+5Uk218u6nbMS9smfsqTBAqsn7mIzT95hHm5QUf5kEg=; b=2ySKT4w1J8whN/ hlhxEJ511qncqUvvz5/U3Ap/kEjdYEr9vuAYWM7ZP0KqEityhaRjB1WI2iCXOefau+k6wFUcqN1Od ReTC6RsgDz076M6xenEy8/V9zAgYkBxNOnxLrUpHRxKpqQAkCEiB/iE/Jg5FWJBz9RH8zcOev9b3Q Wcn80j0p8gp35FpUQk509Nn9YRPu/HzuIpCAYUZ1c6B3fDSlYbUbHcu/AyWBB9ZjRThPZSZVofEXx WHUaTjthhxS9g5p3ok01/rf9WjI6bzQbCGyVEa5oiEmFVmu75o87Z3/L8dKRgk8jhUPar3UZdy3Wt LtdnIzxaxwEoKlrI3YJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ossLw-00HLP4-AW; Wed, 09 Nov 2022 21:11:20 +0000 Received: from smtp-4.b-tu.de ([141.43.208.14]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ossLs-00HLHc-AI for linux-arm-kernel@lists.infradead.org; Wed, 09 Nov 2022 21:11:18 +0000 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 To: Mark Rutland , Marc Zyngier Cc: Daniel Lezcano , Thomas Gleixner , Samuel Holland , Chen-Yu Tsai , Jernej =?UTF-8?B?xaBrcmFiZWM=?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221109_131116_925860_F31501D1 X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; \ -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel