From patchwork Mon Oct 31 09:11:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Vanheule X-Patchwork-Id: 1697054 X-Patchwork-Delegate: sander@svanheule.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uXRoqQWZ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=3ouO4RIu; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N16xg3k18z23lV for ; Mon, 31 Oct 2022 20:17:43 +1100 (AEDT) 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:Date:Subject:Cc :To:From: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=agIjFPbON+3sZjTRxyMj8pf5PB1ANq05V2G41Xw1+lA=; b=uXRoqQWZgsL1U7 veeJmeQhuoCgLAQ5eZNpYtpkwVV3Tpvn3JjR5vletZBCROgvUwV0oTeRljlZndketLi86cGDCfG+a Jssss5Me4yxhtuGk2MK3MwUDT3g71uYTG/gFVmVZbEq/PLQ/G0b3dcFJsMBGOLsHqsqg/TUshsjsD +RnDQv2ALzwdoViJjbnruVz+kHnHe77iRue09rmYFIrMbA9XQuRcNSNLq0N2t2A7/eBjwJgsmHxyp xdKrfv2ky2+5+cMkzQCPrRygv2zDZtdZJUHvggsiFM7evz7BEFWEn3BrBYmAC0tvxQhUnM6F/i5NG nLaiOQOdW+ar4ACromVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opQrp-009v4h-GX; Mon, 31 Oct 2022 09:14:01 +0000 Received: from polaris.svanheule.net ([84.16.241.116]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opQrl-009uzy-Kq for openwrt-devel@lists.openwrt.org; Mon, 31 Oct 2022 09:13:59 +0000 Received: from terra.. (unknown [IPv6:2a02:a03f:eaf9:8401:aa9f:5d01:1b2a:e3cd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 09F5433D777; Mon, 31 Oct 2022 10:13:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1667207631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PImX8xb9ZNYISw15xLjEaZOVE5lRWCv0yeMlpkVmclM=; b=3ouO4RIuVgCdogoMBAuN2NM2EwIF3FTI6guBLiM5YPdFEI28/BCnU463urOQjrFi+ba+X9 oRoFwpaCUvVx/P6ilpDQVSLFsvQnnFzEWbyMzi98EsHM22159M3foHwBIJgUtj2aYRAkic mnpeGfwxdjkvmJ31Eyv41Oq2V5itUcGFeDuzpokDwwwm3k/+ltrgQkNuOp4UhbUM0ZpPaH iSR/SlqaXmeakv8WOEPxEqD4P6sfs3pKDPNjzi9itSVOe+c7QQ0Kxp/qBqGYwCOEmDmTfh RwxzO6zCQKeVa9fe0GMV4YwsoX6agQe6cTzeRMiAEzB1SuRx8MGAuh4wy9g4yQ== From: Sander Vanheule To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , INAGAKI Hiroshi , Markus Stockhausen Subject: [PATCH] realtek: mark clock source as continuous Date: Mon, 31 Oct 2022 10:11:04 +0100 Message-Id: <20221031091103.667846-1-sander@svanheule.net> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221031_021358_148223_A3D9EE3C X-CRM114-Status: GOOD ( 10.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: After replacing the R4K event timer and clock source with the new Realtek Otto timer, performance for RTL839x devices was severely impacted, as reported by Hiroshi. Research by Markus showed that after commit 4657a5301eb5 (realtek: avoid busy waiting for RTL839x PHY read/write, 2022-10-14), the ethernet driver could only update a phy once per timer interval, whic [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org After replacing the R4K event timer and clock source with the new Realtek Otto timer, performance for RTL839x devices was severely impacted, as reported by Hiroshi. Research by Markus showed that after commit 4657a5301eb5 (realtek: avoid busy waiting for RTL839x PHY read/write, 2022-10-14), the ethernet driver could only update a phy once per timer interval, which also heavily impacted boot time. On e.g. a Zyxel GS1900-48, this added around a minute to the time to fully initialise the switch. By marking the otto clocksource as continuous, the kernel enables it to be used for high resolution timers. This allows readx_poll_timeout() to sleep for less than one system timer interval, reducing system dead time. Link: https://github.com/openwrt/openwrt/issues/11117 Reported-by: INAGAKI Hiroshi Cc: Markus Stockhausen Signed-off-by: Sander Vanheule --- With this patch, initialisation time for my GS1900-48 drops from 110 seconds to 50 seconds. Please check if you can reproduce this. The 'why this works' from the commit message is from a quick look at the places where this CLOCK_SOURCE flag is checked, so I hope it actually makes sense. Best, Sander .../realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c index 12eed78653d0..14e28e50f40e 100644 --- a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c @@ -227,6 +227,7 @@ struct rttm_cs rttm_cs = { .name = "realtek_otto_timer", .rating = 400, .mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT), + .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = rttm_read_clocksource, .enable = rttm_enable_clocksource }