Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3869470pxu; Tue, 20 Oct 2020 02:38:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8MTUjjdv9ufMGtPs4Hnzz2UruEyfgJQW24xJydLc5EJdTDZt58C5+ltcl3Vhj0Rw8Zfha X-Received: by 2002:a05:6402:3070:: with SMTP id bs16mr1892870edb.371.1603186704221; Tue, 20 Oct 2020 02:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603186704; cv=none; d=google.com; s=arc-20160816; b=bpF/U1WHOqQuG3UpTXI1bDLLKhAIAG1S98TSnOTy4dggFul1A4xaJ/GN7IGoauwu9x Ftyd3v6z5q+CZ96fsoSr/iH1Xks30JQjf/xKPFdpRifpfZOlLigvu0BpOJWaCBiEQjhJ qMiObeavOKhrbvVnYZVfVJFh7GVXWPV6t/f5ATGongHPYjjtVef86cMUZ634dIYT3MhH HQ1ssTPKIF4al7jgYtbQ74zk/egzKAd5Am3/mSKU8oV4CxyHtiaXrx4DqBKSdPsrdn/f DAmTirMOGMF5UI3YenB+KyV9qJslX2QN3qr1JBr+8svXqkxBMQOR6FabtZd2ezA1VcQn zecA== 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=kklJxb1pAfS4+V6vWu2Yjxzrcku30//0SUfU96yc4/M=; b=AR5hova1jpO7wvOMSLVGL8Z2kCNADsnmnSf8Q5gSbQjk1o1Cg53+gYO+udANIiRSJN AmmGwUkvHsTyEq+8m/olzTyKXi2MPQIOEkMSU+UIhmHHEyT3RhqN479+fO3+LtVjmrGq x4AaOJikU6WcSLNDJNvlQhmixA1hHF2w81rJKg3Dqk9oosb8Cm9HdkramBUGaevzkRIE AUZVePKRo759t9esOh9t3o3rcRaWXlCG5cN6dgt+20CBbdrM7BBCXZqKlPoLhCNToKRs KxQbKfZlAPbPTvR4EtW7Vxj4B6ahM0l9nSR3epEYdPdy+sDf+pXWwjFo827GBLvnFGzb 8IAg== 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 h5si808712edn.189.2020.10.20.02.38.02; Tue, 20 Oct 2020 02:38:24 -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 S2403793AbgJTGQm (ORCPT + 99 others); Tue, 20 Oct 2020 02:16:42 -0400 Received: from kernel.crashing.org ([76.164.61.194]:42864 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403760AbgJTGQk (ORCPT ); Tue, 20 Oct 2020 02:16:40 -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 09K6FhPZ029406 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Oct 2020 01:15:56 -0500 Message-ID: <3ebaa814fe21eb7b4b25a2c9455a34434e0207d6.camel@kernel.crashing.org> Subject: Re: [PATCH] net: ftgmac100: Fix missing TX-poll issue From: Benjamin Herrenschmidt To: Jakub Kicinski Cc: Joel Stanley , Dylan Hung , "David S . Miller" , netdev@vger.kernel.org, Linux Kernel Mailing List , Po-Yu Chuang , linux-aspeed , OpenBMC Maillist , BMC-SW , Arnd Bergmann , linux-arch@vger.kernel.org Date: Tue, 20 Oct 2020 17:15:42 +1100 In-Reply-To: <20201019195723.41a5591f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20201019073908.32262-1-dylan_hung@aspeedtech.com> <20201019120040.3152ea0b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <1a02e57b6b7d425a19dc59f84091c38ca4edcf47.camel@kernel.crashing.org> <20201019195723.41a5591f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 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 Mon, 2020-10-19 at 19:57 -0700, Jakub Kicinski wrote: > > I suspect the problem is that the HW (and yes this would be a HW bug) > > doesn't order the CPU -> memory and the CPU -> MMIO path. > > > > What I think happens is that the store to txde0 is potentially still in > > a buffer somewhere on its way to memory, gets bypassed by the store to > > MMIO, causing the MAC to try to read the descriptor, and getting the > > "old" data from memory. > > I see, but in general this sort of a problem should be resolved by > adding an appropriate memory barrier. And in fact such barrier should > (these days) be implied by a writel (I'm not 100% clear on why this > driver uses iowrite, and if it matters). No, a barrier won't solve this I think. This is a coherency problem at the fabric/interconnect level. I has to do with the way they implemented the DMA path from memory to the ethernet controller using a different "port" of the memory controller than the one used by the CPU, separately from the MMIO path, with no proper ordering between those busses. Old school design .... and broken. By doing a read back, they probably force the previous write to memory to get past the point where it will be visible to a subsequent DMA read by the ethernet controller. > > It's ... fishy, but that isn't the first time an Aspeed chip has that > > type of bug (there's a similar one in the USB device controler iirc). Cheers, Ben.