From nobody Mon Jan 26 18:31:05 2026 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 4f0HDR115Mz6PQKF; Mon, 26 Jan 2026 18:31:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4f0HDQ4QTbz3fJ9; Mon, 26 Jan 2026 18:31:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 60QIV5Qp026262; Mon, 26 Jan 2026 20:31:08 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 60QIV5Qp026262 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 60QIV5so026261; Mon, 26 Jan 2026 20:31:05 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 26 Jan 2026 20:31:05 +0200 From: Konstantin Belousov To: Andriy Gapon Cc: Marius Strobl , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e769bc771843 - main - sym(4): Employ memory barriers also on x86 Message-ID: References: <69778ef9.39b4d.5c480abe@gitrepo.freebsd.org> <78081be3-94c5-4139-8493-2fdf225ecaf3@FreeBSD.org> 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78081be3-94c5-4139-8493-2fdf225ecaf3@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4f0HDQ4QTbz3fJ9 On Mon, Jan 26, 2026 at 08:11:51PM +0200, Andriy Gapon wrote: > On 26/01/2026 18:34, Konstantin Belousov wrote: > > On Mon, Jan 26, 2026 at 03:57:45PM +0000, Marius Strobl wrote: > > > The branch main has been updated by marius: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=e769bc77184312b6137a9b180c97b87c0760b849 > > > > > > commit e769bc77184312b6137a9b180c97b87c0760b849 > > > Author: Marius Strobl > > > AuthorDate: 2026-01-26 13:58:57 +0000 > > > Commit: Marius Strobl > > > CommitDate: 2026-01-26 15:54:48 +0000 > > > > > > sym(4): Employ memory barriers also on x86 > > > In an MP world, it doesn't hold that x86 requires no memory barriers. > > It does hold. x86 is much more strongly ordered than all other arches > > we currently support. > > > > That said, the use of the barriers in drivers is usually not justified > > (I did not looked at this specific case). > > > > Even if needed, please stop using rmb/wmb etc. Use atomic_thread_fence() > > of appropriate kind, see atomic(9). Then on x86 it does the right thing. > I understand that this advice is for the "normal" memory access model. > But does it apply to "special" memory? E.g., to memory-based communication > with devices? Even more so, because rmb/wmb etc are about something very different than 'using special memory'. In this case, you need the 'special memory' properly set up. E.g. on x86 UC memory accesses are strongly ordered, so there is absolutely no need in issuing neither locked instructions nor {L,M,S}FENCE to fence these accesses, at least I have hard times imaging what would it change except slowing CPU down.