From owner-svn-src-all@freebsd.org Tue Aug 4 18:25:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EFF937C017; Tue, 4 Aug 2020 18:25:51 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLjqd5z0fz3SGh; Tue, 4 Aug 2020 18:25:49 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1596565541; 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=Ds1YB/MuO1zBd8vtCqHp6X9LDxGQCsV7+OMeavWI0q8=; b=pV2IFv7A/q9LV26l1Bt+9SpVlhBiqMXCQIaojrEwuFyjb9G52d3WUiHlkm4HLDkq9GwMHA tC5kQb9GR0ZgAThDub+b5LXgoUSEFIzz7hul6hA8BH6FEUko6xmJY1+ycF6COeNVka5/x2 mMfFam/spyrOr79gYrSQg3NGOiqgnCc= Received: from skull.home.blih.net (lfbn-idf2-1-1138-237.w90-92.abo.wanadoo.fr [90.92.20.237]) by mx.blih.net (OpenSMTPD) with ESMTPSA id ef8f1af6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 4 Aug 2020 18:25:41 +0000 (UTC) Date: Tue, 4 Aug 2020 20:25:41 +0200 From: Emmanuel Vadot To: Alan Cox Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r363842 - head/sys/compat/linuxkpi/common/include/linux Message-Id: <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> In-Reply-To: <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> References: <202008041525.074FPNLh043749@repo.freebsd.org> <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4BLjqd5z0fz3SGh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=pV2IFv7A; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-3.05 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.02)[-1.024]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.50)[-0.497]; NEURAL_HAM_MEDIUM(-1.02)[-1.023]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 18:25:51 -0000 On Tue, 4 Aug 2020 13:11:02 -0500 Alan Cox wrote: >=20 > On 8/4/20 10:25 AM, Emmanuel Vadot wrote: > > Author: manu > > Date: Tue Aug 4 15:25:22 2020 > > New Revision: 363842 > > URL: https://svnweb.freebsd.org/changeset/base/363842 > > > > Log: > > linuxkpi: Add clear_bit_unlock > > =20 > > This calls clear_bit and adds a memory barrier. > > =20 > > Sponsored by: The FreeBSD Foundation > > =20 > > Reviewed by: hselasky > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D25943 > > > > Modified: > > head/sys/compat/linuxkpi/common/include/linux/bitops.h > > > > Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 1= 5:00:02 2020 (r363841) > > +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 1= 5:25:22 2020 (r363842) > > @@ -275,6 +275,13 @@ find_next_zero_bit(const unsigned long *addr, unsi= gned > > #define test_bit(i, a) \ > > !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) = & BIT_MASK(i)) > > =20 > > +static inline void > > +clear_bit_unlock(long bit, volatile unsigned long *var) > > +{ > > + clear_bit(bit, var); > > + wmb(); >=20 >=20 > For an unlock operation, the memory barrier should come before the=20 > clear_bit() call, not after.=A0 See, for example, the alpha implementatio= n=20 > in Linux.=A0 Also, the correct "spelling" for this memory barrier in=20 > FreeBSD would be atomic_thread_fence_rel(). See, for example, the=20 > comment at the top of sys/amd64/include/atomic.h. Ah yes, thanks. I probably got lost looking for the linux implem but that does make sense, I'll fix that probably tomorow. Thanks. >=20 > > +} > > + > > static inline int > > test_and_clear_bit(long bit, volatile unsigned long *var) > > { --=20 Emmanuel Vadot