Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5702184pxu; Thu, 22 Oct 2020 08:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzY3dsX+6bv0FqWs/f3ZBjuIRT4gWC6TMs5Hw9/AmzO5aNFdiEpauFrIRiZ6hsXJW51jhE X-Received: by 2002:a17:906:cc8a:: with SMTP id oq10mr3107118ejb.14.1603382387833; Thu, 22 Oct 2020 08:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603382387; cv=none; d=google.com; s=arc-20160816; b=FsXsynPGvJYESkiBRPsPxIpaLLv/QGH9VY7Oec6jPXpW2fhK21napojvky3a3Kyjq/ 7FIhfcxSam7MQ4H1DFUNFb1w/fsqHRYetWBzCFWtHrlpeSBYs/n3OxvIS9vaieAiu+rx ICMD/oOJUHqo8joYFoEhE6Wlur9CSCUH8qitUKMxM7TJIF3x0Y+HN45AzyrYMMd736Ht Ffim/5g0AdHWJEbyiYuREeq1p+20B+uDl7C80NjbQlKghoSmWvOgIAn2sm8sp6oe19ck 0oCfwi/WMl5x+ZmQ5fW6YOr637bSHfC4Cn9BcS4O3Q+Ao15BxAnsBU5Hef0mq1oqfdxd MO1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=7zdmmRJ/nM4ffTyGknEEazsZOgCtmXij9CW/qFLk4FE=; b=ji6ydaz62mTfBggYkqalKdCBzxhAkNa1zdPAHQBa8xRRDynI3L9KKo86oT2zyvTTf7 NJx1zr1AWfZtAJXAEb0a8Xon9wa5D7d/Ns8ptpkmHZwaf2NcZmm5EQjWsAYk3RZO6miL MZSm4r4eCIbNTO3oHMkbDfL2P+dRdZDUd0FbBzwI3mHyI/wJxwXzPCkvm6I6ZO1cHxyx vgkFBAjL675LBWozU8w5TN7SVW56dV1wzCBz2EJiN5NFjxXEpJZXbSUj48509jXmhvgP eTofRSPye0FajMtVfUEVWm8Ku/ZwUYD5jXXP0/PiKZztn4ENWsbXxPjTcEm0lIJ+yoeV J+gg== ARC-Authentication-Results: i=1; mx.google.com; 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 g4si1281354edy.98.2020.10.22.08.59.01; Thu, 22 Oct 2020 08:59:47 -0700 (PDT) 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; 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 S2508691AbgJVHin (ORCPT + 99 others); Thu, 22 Oct 2020 03:38:43 -0400 Received: from kernel.crashing.org ([76.164.61.194]:45132 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508681AbgJVHin (ORCPT ); Thu, 22 Oct 2020 03:38:43 -0400 Received: from localhost (gate.crashing.org [63.228.1.57]) (authenticated bits=0) by kernel.crashing.org (8.14.7/8.14.7) with ESMTP id 09M7bwWk027578 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Oct 2020 02:38:04 -0500 Message-ID: Subject: Re: [PATCH] net: ftgmac100: Ensure tx descriptor updates are visible From: Benjamin Herrenschmidt To: David Laight , Joel Stanley , Jakub Kicinski , "David S . Miller" , Dylan Hung Cc: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-aspeed@lists.ozlabs.org" Date: Thu, 22 Oct 2020 18:37:58 +1100 In-Reply-To: References: <20201020220639.130696-1-joel@jms.id.au> <86480db3977cfbf6750209c34a28c8f042be55fb.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-10-21 at 08:18 +0000, David Laight wrote: > From: Benjamin Herrenschmidt > > Sent: 21 October 2020 01:00 > > > > On Wed, 2020-10-21 at 08:36 +1030, Joel Stanley wrote: > > > We must ensure the tx descriptor updates are visible before updating > > > the tx pointer. > > > > > > This resolves the tx hangs observed on the 2600 when running iperf: > > > > To clarify the comment here. This doesn't ensure they are visible to > > the hardware but to other CPUs. This is the ordering vs start_xmit and > > tx_complete. > > You need two barriers. > 1) after making the data buffers available before transferring > the descriptor ownership to the device. > 2) after transferring the ownership before 'kicking' the mac engine. > > The first is needed because the mac engine can poll the descriptors > at any time (eg on completing the previous transmit). > This stops it transmitting garbage. > > The second makes sure it finds the descriptor you've just set. > This stops delays before sending the packet. > (But it will get sent later.) The above is unrelated to this patch. This isn't about fixing any device <-> CPU ordering or interaction but purely about ensuring proper ordering between start_xmit and tx packet cleanup. IE. We are looking at two different issues with this driver. > For (2) dma_wmb() is the documented barrier. > > I'm not sure which barrier you need for (1). > smp_wmb() would be right if the reader were another cpu, > but it is (at most) a compile barrier on UP kernels. > So you need something stronger than smp_wmb(). There should already be sufficient barriers for that in the driver (except for the HW bug mentioned earlier). > On a TSO system (which yours probably is) a compile barrier > is probably sufficient, but if memory writes can get re-ordered > it needs to be a stronger barrier - but not necessarily as strong > as dma_wmb(). > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)