Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5792473pxb; Wed, 26 Jan 2022 22:35:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmom218BCwYEuiRSn0YGjD2gMK4P3lVhAySRlhg07eRrnXMMVI5UUDZccLj9+yJ60GyCKV X-Received: by 2002:a63:3744:: with SMTP id g4mr1760971pgn.373.1643265334362; Wed, 26 Jan 2022 22:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643265334; cv=none; d=google.com; s=arc-20160816; b=PHj/Oj9zT4hnDOUnHZpwSzSWRezjeyaeOyry4+Z9RMViiaInZ96qJ/4pQAQi0KGuFu eJ4+bk0P6qmTzbT1n1UgRRZuFtKvEUXtWpd2LFfbrN7HDN88O8G3xJMqD/0n0krWIjxH 6Xgv460LSz7oLgbA4NFaNGJWxBeq+iH/4uBtKMywyafBnVCF7mHW88efIpolW7xIIgpO 9XWbidv+S/aK35qBmt3IbcKkCkccaD5+GlK/DrIRYWcjBtkOksNuE6WACFmVHrLJVstY P1hYZ2qHDeoY4n+RUElmq7tNzR4slZgByjBJEjkxErjgOWmHmU4e1Yn0ZVgvjfh3WrLy aNDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ruwprbz0f5p7KOjDzwUouucRjUvoUVr07OyhDETLV9A=; b=vXQyfZ1iMsuU91KdCr4l/heELtgCA+mVC9YKUQuokwgWnixBscI3ZsoY1BNq9ruupV 89wDfNBQXzxZTze6PBR03zdVzrCtUK1r/4U+BeEeWMMYEHSDUFaqN0SwmHWQtV99cNfC EqggbVErKZzfxOLZmh0rIK9XRoM0WULwZjE4iDHgFh4eg7hqilJkwfSK/qawGYA43jOI F0Y9sJ1N28xn5iKWrpXRLlEAoSwnsiDctoa1vSLbhmnsMasIceQqtdPORy0ivAG8kuRX RozuD5A5XL75T+gJdamSkdbUQFNRs6DFO9dh7VePiFzcCP1bM4cHE6R2oa1lORCC4tsk 2YTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=LSwQYPjY; 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 p13si1436740plf.197.2022.01.26.22.35.22; Wed, 26 Jan 2022 22:35:34 -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=@lunn.ch header.s=20171124 header.b=LSwQYPjY; 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 S231495AbiAZXyK (ORCPT + 99 others); Wed, 26 Jan 2022 18:54:10 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:56564 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbiAZXyJ (ORCPT ); Wed, 26 Jan 2022 18:54:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ruwprbz0f5p7KOjDzwUouucRjUvoUVr07OyhDETLV9A=; b=LSwQYPjYGat0/DJ0FblW3LmcZU zWiW8g00EoBf3G4cirCQ6JmPE582fFVRTcovnK49W/cuCwnzHq+oYRR6f3K/vxDLPTS0SrGDcIwox dCbwjP5Euah96qHmcucfxhhhv0JYuiuQppQ8MIwC5q/46FdTFv5MwQvVXqScX3dtQ0pk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nCs73-002sSS-Gk; Thu, 27 Jan 2022 00:54:05 +0100 Date: Thu, 27 Jan 2022 00:54:05 +0100 From: Andrew Lunn To: Tobias Waldekranz 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 Message-ID: References: <20220126231239.1443128-1-tobias@waldekranz.com> <20220126231239.1443128-2-tobias@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220126231239.1443128-2-tobias@waldekranz.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 12:12:38AM +0100, Tobias Waldekranz wrote: > Avoid a long delay when a busy bit is still set and has to be polled > again. > > Measurements on a system with 2 Opals (6097F) and one Agate (6352) > show that even with this much tighter loop, we have about a 50% chance > of the bit being cleared on the first poll, all other accesses see the > bit being cleared on the second poll. > > On a standard MDIO bus running MDC at 2.5MHz, a single access with 32 > bits of preamble plus 32 bits of data takes 64*(1/2.5MHz) = 25.6us. > > This means that mv88e6xxx_smi_direct_wait took 26us + CPU overhead in > the fast scenario, but 26us + 1500us + 26us + CPU overhead in the slow > case - bringing the average close to 1ms. > > With this change in place, the slow case is closer to 2*26us + CPU > overhead, with the average well below 100us - a 10x improvement. > > This translates to real-world winnings. On a 3-chip 20-port system, > the modprobe time drops by 88%: > > Before: > > root@coronet:~# time modprobe mv88e6xxx > real 0m 15.99s > user 0m 0.00s > sys 0m 1.52s > > After: > > root@coronet:~# time modprobe mv88e6xxx > real 0m 2.21s > user 0m 0.00s > sys 0m 1.54s > > Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn Andrew