From nobody Tue Oct 10 18:28:43 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S4ktx6M5gz4x80t; Tue, 10 Oct 2023 18:28:57 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4ktx0111z3LQT; Tue, 10 Oct 2023 18:28:56 +0000 (UTC) (envelope-from manu@bidouilliste.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1696962528; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/9lraDOflKh8fdI7RmYUlKZXROVNhfd5M0N809jFVio=; b=SQbmZw2SnhApk+HeXlHxWofDceiv8ynDUXfjKFGN6yF+WysCPJxZ20sN8eLirrkb6DOKwm tPIKb5KL5xu6dfy7f5NbgChioL2K9uF2Tr5yf+QoZbOJOf5NLE4uAin5ZHo5R3oLcSv3Ki uyrKr7mATPX/wlIPcN17c6/2mcrA+NI= Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 1e582402 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 10 Oct 2023 18:28:48 +0000 (UTC) Date: Tue, 10 Oct 2023 20:28:43 +0200 From: Emmanuel Vadot To: John Baldwin Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 38cbdae33b7c - main - dwc: Rewrite barrier part Message-Id: <20231010202843.705a2397da1464dec32813d3@bidouilliste.com> In-Reply-To: <0d8a9a3f-d1d0-b5ee-b50f-49eb3888f68e@FreeBSD.org> References: <202310061706.396H63in060807@gitrepo.freebsd.org> <0d8a9a3f-d1d0-b5ee-b50f-49eb3888f68e@FreeBSD.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd15.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR] X-Rspamd-Queue-Id: 4S4ktx0111z3LQT On Tue, 10 Oct 2023 11:21:21 -0700 John Baldwin wrote: > On 10/6/23 1:06 PM, Emmanuel Vadot wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=38cbdae33b7c3f772845c06f52b86c0ddeab6a17 > > > > commit 38cbdae33b7c3f772845c06f52b86c0ddeab6a17 > > Author: Emmanuel Vadot > > AuthorDate: 2023-10-06 16:04:49 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2023-10-06 17:05:45 +0000 > > > > dwc: Rewrite barrier part > > > > We only need a barrier after writing the OWN bit so everything is > > coherent for the DMA engine. > > --- > > sys/dev/dwc/dwc1000_dma.c | 3 --- > > 1 file changed, 3 deletions(-) > > > > diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c > > index f6baa0bd3e45..4f8ae088305a 100644 > > --- a/sys/dev/dwc/dwc1000_dma.c > > +++ b/sys/dev/dwc/dwc1000_dma.c > > @@ -216,7 +216,6 @@ txdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr, > > sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr); > > sc->txdesc_ring[idx].desc0 = desc0; > > sc->txdesc_ring[idx].desc1 = desc1; > > - wmb(); > > sc->txdesc_ring[idx].desc0 |= TDESC0_OWN; > > wmb(); > > } > > @@ -237,7 +236,6 @@ rxdesc_setup(struct dwc_softc *sc, int idx, bus_addr_t paddr) > > sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | > > MIN(MCLBYTES, ERDESC1_RBS1_MASK); > > > > - wmb(); > > sc->rxdesc_ring[idx].desc0 = RDESC0_OWN; > > wmb(); > > return (nidx); > > @@ -524,7 +522,6 @@ dma1000_rxfinish_locked(struct dwc_softc *sc) > > > > m = dwc_rxfinish_one(sc, desc, sc->rxbuf_map + idx); > > if (m == NULL) { > > - wmb(); > > desc->desc0 = RDESC0_OWN; > > wmb(); > > } else { > > Hmm, are you sure? I suspect you removed the wrong barrier here. You want the > other writes to update other fields in the desc to post before the write that > sets TDESC0_OWN. The barrier after TDESC0_OWN is useless, but the one you removed > is probably the one that matters. In particular you don't want TDESC0_OWN to be > set when other writes (e.g. setting desc1) are not yet visible. > > -- > John Baldwin > Yeah what you say make sense, the thing is on all the platform I have I've never needed the barrier so it was hard to test for me what was really needed, but you explanation make sense and I'll change the code. Thanks. Cheers, -- Emmanuel Vadot