Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4007576pxu; Tue, 20 Oct 2020 06:18:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcL4uo8azaviDw2LuW48mThnnDtEaa+t6kh8i/6hpaF/fD3D94FOsfMiBEslnaJgZfEgHs X-Received: by 2002:a50:fd83:: with SMTP id o3mr2781967edt.17.1603199914881; Tue, 20 Oct 2020 06:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603199914; cv=none; d=google.com; s=arc-20160816; b=eXNRKDESv5H7aBOr9JmqlWrG8mufSPyRJ486AzYV33NDecSHo6FqK5Xd72R0H2l6aN yFjC0lDqip8foP8bjznmX9hXhNg8FVBx8VIUCC2YrBJuY893kIWx5coakVFR0l51Ofox nuY2KHQNP0Mmdk0VVmfLr8Z8//Ko/WROM4egblZpndlr3ejyB8vZQYr/Szf6h921O4XO 57AurGcQ6y5nidE3wS3o1xaL8isepYqh2aIWbcK6mqaCCeF9P6FrVmIQem6RE4QRjpdR kDydUeM4XTq0yI2PB43UHfrHcSLtZPrJZEa+a98g+5vYMQt7HcCb3J1ZLwA77K2qMogN t5Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=7J8/h4zOOe+oUTr5xbSTT84EcDocMwUEpnROMzF3ByA=; b=ND0XKcRSmZQWikzNztpeblZ7vDXlHw1w3ukaep08RWSdtmh/ytIMqcM15Pqlt00onl HHn/CdYS9OY+9wutLE+aOX6Cx+zVxDBk1LAXjry0xtjM/Q2v//9kkCSpe0CIdz5g9SFC 3Vzy3Oo6kpzQ5do+EClJJMEXtJQUz9tfjfGn3aKYcpKtdGxq/L4H2tS6r4VnxNLxs34S eyX8a9BF5IxkTBijlQr+iOWbvfgnXYeXnXnZXXkauwrnFxKcLm49u/QqPdcAkkjrcXsC IqTSmdPXh92E2jBYdTyd95skuqPaykx0BcafDOrwkMSNOTxwCNNj/4uWoXi3bnLJQ+JQ 9ddw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si1139237edm.401.2020.10.20.06.18.11; Tue, 20 Oct 2020 06:18:34 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407322AbgJTNPT convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Oct 2020 09:15:19 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:48172 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407274AbgJTNPT (ORCPT ); Tue, 20 Oct 2020 09:15:19 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-91-WlibNx1BNMemSMrpm2jZzw-1; Tue, 20 Oct 2020 14:15:12 +0100 X-MC-Unique: WlibNx1BNMemSMrpm2jZzw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 20 Oct 2020 14:15:12 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 20 Oct 2020 14:15:12 +0100 From: David Laight To: 'Dylan Hung' , Jakub Kicinski , Joel Stanley CC: Benjamin Herrenschmidt , "David S . Miller" , "netdev@vger.kernel.org" , Linux Kernel Mailing List , Po-Yu Chuang , linux-aspeed , OpenBMC Maillist , BMC-SW Subject: RE: [PATCH] net: ftgmac100: Fix missing TX-poll issue Thread-Topic: [PATCH] net: ftgmac100: Fix missing TX-poll issue Thread-Index: AQHWper5b6m5IMpmJk2Uyk3yAiWzCqmen8qAgACopgCAALYZ4IAAd6yw Date: Tue, 20 Oct 2020 13:15:11 +0000 Message-ID: References: <20201019073908.32262-1-dylan_hung@aspeedtech.com> <20201019120040.3152ea0b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dylan Hung > Sent: 20 October 2020 07:15 > > > -----Original Message----- > > From: Jakub Kicinski [mailto:kuba@kernel.org] > > > > On Mon, 19 Oct 2020 08:57:03 +0000 Joel Stanley wrote: > > > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c > > > > b/drivers/net/ethernet/faraday/ftgmac100.c > > > > index 00024dd41147..9a99a87f29f3 100644 > > > > --- a/drivers/net/ethernet/faraday/ftgmac100.c > > > > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > > > > @@ -804,7 +804,8 @@ static netdev_tx_t > > ftgmac100_hard_start_xmit(struct sk_buff *skb, > > > > * before setting the OWN bit on the first descriptor. > > > > */ > > > > dma_wmb(); > > > > - first->txdes0 = cpu_to_le32(f_ctl_stat); > > > > + WRITE_ONCE(first->txdes0, cpu_to_le32(f_ctl_stat)); > > > > + READ_ONCE(first->txdes0); > > > > > > I understand what you're trying to do here, but I'm not sure that this > > > is the correct way to go about it. > > > > > > It does cause the compiler to produce a store and then a load. > > Yes, the load instruction here is to guarantee the previous store is indeed > pushed onto the physical memory. That rather depends where the data is 'stuck'. An old sparc cpu would flush the cpu store buffer before the read. But a modern x86 cpu will satisfy the read from the store buffer for cached data. If the write is 'posted' on a PCI(e) bus then the read can't overtake it. But that is a memory access so shouldn't be to a PCI(e) address. Shouldn't dma_wb() actually force your 'cpu to dram' queue be flushed? In which case you need one after writing the ring descriptor and before the poke of the mac engine. The barrier before the descriptor write only needs to guarantee ordering of the writes - it can probably be a lighter barrier? It might be that your dma_wmb() needs to do a write+read of an uncached DRAM location in order to empty the cpu to dram queue. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)