Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2729949pxb; Mon, 31 Jan 2022 03:05:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKAgWlpb3QxSVDSfZUtOsXtKSTbG7pHMkjIX7FY9PdPDtr6YEj7dsb6egT2bLPux1Sq1Ux X-Received: by 2002:a17:90a:aa96:: with SMTP id l22mr23727684pjq.188.1643627148682; Mon, 31 Jan 2022 03:05:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643627148; cv=none; d=google.com; s=arc-20160816; b=y54DaLVlDWks1APju0a6bP/DgZScIFqDgC8yy4Tqv1ixS1/tbO/BBsFY9MP120lC3W /kkpWZKM1/ydYFz/nZ9N/ZmKlfo3y2FLoba3xdATy0rzQKrnhMgKNaO10FXv6WmkGxsk 60tw5kEbdJr2IIHILgR6ImuhQoFFCfGgcMcL966w8CoTu5/VXCRRx3jerHqPNReC3v+5 B+G0k49dRFr5xIWpGoM3cHA6mCe1UYFUXHcfCm6NuPw2jCSHmT+ZKi7oMm+jTFrUhBrC NhyZL2KfGsUqZMjy+nglm7WFYI9HINx0XllJLqj4F31Dm+TTXz48w3at1Ya1+IMftIJp HRZQ== 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=J6m+Ueqcjj16kxL0/GFptwVxl+GUTQVJ3vrrj5TwdLM=; b=xcngISaTJBsoz804FLCBiZNNHDeDQvOn0+gJWDK3tdrqQnI9BeQRfChD0qK+kNWTgs BGyPBjVcpNQaUK1vQaPaJqIrSO+xjsn6m8VumRGQgWZomlvdAzWghBq1jfLNu53OqRxv o53vv7FKKHzBmn/PpuYF9Hmqs6QJSTJxZ6HhM+RIdyWBw53s0uvTgYfLAttWupFMgpK0 QcR4mAMybq4+H2Xshvkf3CntKzGMncvmoLsHRHPnxk/3+895fjaucOrSW3NMt8EuitgD kCn5/lszOv0oR121b8LHftB5WQ8ASvWbP3SC3h88IHHki/LZ6C13D6BKVoub73gnffZG 4ldQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=BFisTSJD; 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 83si13450126pgc.454.2022.01.31.03.05.33; Mon, 31 Jan 2022 03:05:48 -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=BFisTSJD; 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 S1348845AbiA1ONT (ORCPT + 99 others); Fri, 28 Jan 2022 09:13:19 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:60190 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348556AbiA1ONR (ORCPT ); Fri, 28 Jan 2022 09:13:17 -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=J6m+Ueqcjj16kxL0/GFptwVxl+GUTQVJ3vrrj5TwdLM=; b=BFisTSJDNZXGzBHwBUPc0ksBrl LTJyFTzIPjkyyHZXNjbkJZO4TMqeFkZmVQS3IeQe/39OLuC6iojWUzNaGMOt3nKmCpnXR3h7eIRnF Tmhb0+oo6TdLC6gHtH5K48WN7NlXg8iFQ+omRwfvQiUYGkjybd/A4idj2/YVkXIDJC6o=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nDRzw-003BBq-Cs; Fri, 28 Jan 2022 15:13:08 +0100 Date: Fri, 28 Jan 2022 15:13:08 +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 v2 net-next 1/2] net: dsa: mv88e6xxx: Improve performance of busy bit polling Message-ID: References: <20220128104938.2211441-1-tobias@waldekranz.com> <20220128104938.2211441-2-tobias@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220128104938.2211441-2-tobias@waldekranz.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 11:49:37AM +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