Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5702183pxu; Thu, 22 Oct 2020 08:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtRke/ftfSSkIds8QcLhVFf1t5rgq/XineBake1Qq4CwdOyyJvg59goItKZn+CrO0skw+h X-Received: by 2002:a05:6402:74f:: with SMTP id p15mr2940426edy.69.1603382387830; 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=Cn6pzbl0ZUB2pIGcgjQJxclZPR/Tt8WwjhEB0X+XiDQaGrG84ojDP3ixG6mLnNcg8u a+eXzkRb7GvjP2wjct43bMLScwHIwtCsLOp6RAgu/X5NIa0WkMA789MqkNC3nnUQo05+ Prqy4yhuDPtzaSPXHrpZdqoLk27pIcoDbsgYI4BTqgRk3mqKJEYUzXC4j54ce2QoIyw9 rHIt0u0DbDUcOczXOQnP+HM/K8HLYnskuVpKmB9YzP3hyyxVh0LxpfPrcxUqXJeJ7Znu ShqIUEBoSpbtbuIUqx6bpKnVfqNdBethuH7EYt/049aextQf7xzWkh9QdDsxP88cqKuv NVXg== 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=OI5fv/rhImqjWE+E7f/N8ieSSr7aZJnzdRGWwTwHBDk=; b=Zhhk8b+zu+HdBLZVFk+dk+xFuK+JOVqFfa02yG/Rwk0V4FJz2xT61lxG84gJ+3yvvg L/88IX9OhfRPgDIUwhS2V/t/iCsaAwtFFbXTerBiLEDqfPpnagoLJw+Ja7mMCJy/CvwK L0zfmnk0GfH68V1M9skZ5WM/0frHE6StfJWYQRYjArem4xpImYuIeVqpSLLDgQSZqtP6 nzYcMGNrQrgr3A1Ocr/T4C52hAj+sosrl0JavC8VWhlJ/I2DA8j89D5fQ/JtGwR9FJEy BhqFM4a0EFcLLRTmDOYj8ZUMookpzVXmeV9sX2hqW+BstLBUKXlUzFjlOMqz+7Z9CY10 lJTg== 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 g27si1135958ejd.639.2020.10.22.08.59.06; 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 S2508765AbgJVHlj (ORCPT + 99 others); Thu, 22 Oct 2020 03:41:39 -0400 Received: from kernel.crashing.org ([76.164.61.194]:45166 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2506935AbgJVHlj (ORCPT ); Thu, 22 Oct 2020 03:41:39 -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 09M7fDFQ027629 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Oct 2020 02:41:18 -0500 Message-ID: <428dc31828795ce0b010509c8c30bf0049ad9190.camel@kernel.crashing.org> Subject: Re: [PATCH] net: ftgmac100: Ensure tx descriptor updates are visible From: Benjamin Herrenschmidt To: Arnd Bergmann , Joel Stanley Cc: Jakub Kicinski , "David S . Miller" , Dylan Hung , Networking , "linux-kernel@vger.kernel.org" , linux-aspeed Date: Thu, 22 Oct 2020 18:41:13 +1100 In-Reply-To: References: <20201020220639.130696-1-joel@jms.id.au> 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 14:40 +0200, Arnd Bergmann wrote: > On Wed, Oct 21, 2020 at 12:39 PM Joel Stanley wrote: > > > > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c > > index 331d4bdd4a67..15cdfeb135b0 100644 > > --- a/drivers/net/ethernet/faraday/ftgmac100.c > > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > > @@ -653,6 +653,11 @@ static bool ftgmac100_tx_complete_packet(struct ftgmac100 *priv) > > ftgmac100_free_tx_packet(priv, pointer, skb, txdes, ctl_stat); > > txdes->txdes0 = cpu_to_le32(ctl_stat & priv->txdes0_edotr_mask); > > > > + /* Ensure the descriptor config is visible before setting the tx > > + * pointer. > > + */ > > + smp_wmb(); > > + > > priv->tx_clean_pointer = ftgmac100_next_tx_pointer(priv, pointer); > > > > return true; > > @@ -806,6 +811,11 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb, > > dma_wmb(); > > first->txdes0 = cpu_to_le32(f_ctl_stat); > > > > + /* Ensure the descriptor config is visible before setting the tx > > + * pointer. > > + */ > > + smp_wmb(); > > + > > Shouldn't these be paired with smp_rmb() on the reader side? (Not near the code right now) I *think* the reader already has them where it matters but I might have overlooked something when I quickly checked the other day. Cheers, Ben.