Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp68885pxb; Thu, 27 Jan 2022 15:18:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2v8uv8QG4ZyNbzIMj+oUVB3/M3Kl4LiBe04Ve7IWKnPOao40yNuyEQifRA0ZAMODMALyC X-Received: by 2002:a05:6a00:2388:: with SMTP id f8mr1343620pfc.9.1643325505567; Thu, 27 Jan 2022 15:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643325505; cv=none; d=google.com; s=arc-20160816; b=kQ6TlLp4/1n7HIO4jLfyEeAVnkS+bT8Ue6RJ7WQoF+7zByIXt9qrHY0qe3zrxEn3Iv vZzHvxRm9xezEOghaDGnPjYg6RHaoYkiJ0ZAfwCGDZ1bYIqXUflP95zSGkwJNxFtCDkG 6tV8S7w2LwA1/Auwg599xOSyRizKbkNKS2l+8mvLuc4qB0nypTFNchqmFOkVB4kfkVk2 yoTTWUg6yW4ubQGJh/Mx3+xEyDE28hOHZIB411+A76kQzq4L8kTQjN+wTeJbApJL3DN9 XLGBtb/onBuRYouVdLxk4sq276GUAGT2aKCGAjxiZ2PZVdZPQ8Ineq8AsmZlXV3uvRbB Wb2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=2mp5ghioe/qBbAdRfzPPiuSO1cf+J5YUWfClyBnPLZ4=; b=cQmJz2uUzpLepouU0wFh/CjI0P4lFrKcbvALfs/Fi9EDFZOM+i/wcEt4Tp/oIcHBls 5/JKFamb9swNg8i1BmiPeC4s4kQ2ygiIbRKevYDBlPtIq0xl7KDkpwdFDgVNTfyEhIqV xs/Oc8JTcA2ViGBrtpvefBUSyEKvHeXmjg3KDWdBky7GCs4huyFSOuyp/puOR8ElCE3Z bh8YtzLEsjfJ6S6F/1qtBQo4GH1jk8f7cDQ6CEZTPH5u6Is9UsI4+EBsEwChfHsimPTG VZ/Ic5JF/wqwtp40DBVFCToMPCSyfxJNRFO1HOUsplJedm1BANMVPioRLF30veX9SWth BlXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=uYiu8ZPY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h187si3648246pgc.151.2022.01.27.15.18.13; Thu, 27 Jan 2022 15:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=uYiu8ZPY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241285AbiA0M6Q (ORCPT + 99 others); Thu, 27 Jan 2022 07:58:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241224AbiA0M6Q (ORCPT ); Thu, 27 Jan 2022 07:58:16 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7635C06173B for ; Thu, 27 Jan 2022 04:58:15 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id t14so4156792ljh.8 for ; Thu, 27 Jan 2022 04:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=2mp5ghioe/qBbAdRfzPPiuSO1cf+J5YUWfClyBnPLZ4=; b=uYiu8ZPYgAYV99r0UbkphixsddqWS+SLId9J5ZN/UcjvzelBqaotIjengcXg8sSM5R bhNYMsu+ZgETej0z/VP4PGRky+zhDi8cx43A8IBOjScU4MbWIchD4+oBbMTW1yZPg1ww UDtvelv0y058vxStvnVbPdqVACJA3z+AIU0bbHR4zXdt9zVybDeXn2myxd/RKVRHnjMP hGID6DDioZwcc6GHnGxC5NbaO/UotkTYS5Ynw2uUNyeaBRlcSLNaoyGyeQ9KGNTUj2mQ nA/jEgtnRClKKRxuACg+fxRHuO5HyY2q8UP5yLt2DPqHZLG6lPPLCGKU9klhC0RHigpa F3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=2mp5ghioe/qBbAdRfzPPiuSO1cf+J5YUWfClyBnPLZ4=; b=usYTFv+9yZntqnOEA6tWiyXM0vZMCKukmBOU0NV5E9Fkuct4RUlyc851v2EeKCenzC 1c3Ry4TmG9RtcgW8AfkYgFjGqL+jH8HCau/hLkd5cu0P4+s8eFTCFVY2oZM6Xgrn9Srk okqB4gp8N+D4nQQq7+rll6N01CrNaIeSN+gPdijuzrwndWIZX0IRrvm9gvnAkNmFq9N8 YTeFmJGpIxvTR6KrbTmlL4HAjYpuSprJhTNt/xWW7ADWa+QSW3SmO4iyPkIuSIfUXJI5 w53aeDRDeRaPnq+YZLgtC1HxT4OlsSrdmPt+41GTU1lzzL9yyFlNtAgR28smlDbpYZJz TFcw== X-Gm-Message-State: AOAM530bQLSXPKJ+DPnwa5rnDNJsOImhdQ3VdKLIIoyoG+1XNK0Pb00q qc5q0oN8SSZvwfuczw2ZwtxGU2y0JIUTbA== X-Received: by 2002:a2e:7a11:: with SMTP id v17mr2763595ljc.63.1643288293893; Thu, 27 Jan 2022 04:58:13 -0800 (PST) Received: from wkz-x280 (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id d13sm1795843lfv.172.2022.01.27.04.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 04:58:13 -0800 (PST) From: Tobias Waldekranz To: Andrew Lunn Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Vivien Didelot , Florian Fainelli , Vladimir Oltean , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Improve performance of busy bit polling In-Reply-To: References: <20220126231239.1443128-1-tobias@waldekranz.com> <20220126231239.1443128-2-tobias@waldekranz.com> Date: Thu, 27 Jan 2022 13:58:12 +0100 Message-ID: <87o83xbajf.fsf@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 00:45, Andrew Lunn wrote: > There are a few bit-banging systems out there. For those, i wonder if > 50ms is too short? With the old code, they had 16 chances, no matter > how slow they were. With the new code, if they take 50ms for one > transaction, they don't get a second chance. > > But if they have taken 50ms, around 37ms has been spent with the > preamble, start, op, phy address, and register address. I assume at > that point the switch actually looks at the register, and given your > timings, it really should be ready, so a second loop is probably not > required? > > O.K, so this seems safe. I think you raise a good point though. Say that you then have this series of events: 1. Bang out ST 2. Bang out OP 3. Bang out PHYADR 4. Bang out REGADR 5. Clock out TA 6. schedule() 7. A SCHED_FIFO/P99 task runs 8. Clock in DATA - Steps 1 through 5 could plausibly be completed before the bit clears if you are running over some memory mapped GPIO lines - Step 7 could execute for more than 50ms - After step 8, you would see the busy bit set, but your time is up All of this is of course _very_ unlikely, but not impossible. Should we ensure that you always get at least two bites at the apple?