From nobody Wed Aug 23 05:37:03 2023 X-Original-To: dev-commits-src-main@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 4RVw2j0FL7z4r6pK for ; Wed, 23 Aug 2023 05:37:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RVw2h4zt6z4Jf2 for ; Wed, 23 Aug 2023 05:37:16 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-31aec0a1a8bso2355882f8f.0 for ; Tue, 22 Aug 2023 22:37:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692769034; x=1693373834; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xap7qbhY/6O4Od10d25qlcaj1ncny3uX87NmRkzwNAE=; b=MzITAOj6oPVoV8HxxLWSaSVFbcFLMdYqB3a4lHrsgYgSKv8E6T/kBNAO99kNsXhlFn TNal63zN8ZmR9tZ8si7cRzcYgLHSHmwj93iJAFzcPsgMZFEXfIis1Z2rm+e3LvnHcE1u VXfZd+VBdYDWMcljZ6fHBznwFfnizzARP7K2E4owXt89Xb/xluGNeWuFMC8EhRUpt8Nn A9vlVBIow7vgQ4vUp3bY+s8kWM276bQzPbU24oBisWInu8Lntm9Z3WBSQsXiS+czubaA PG6jiF3mqqTDfFX5mF7zpCsq2lqZgIpuAHU+Rcd9P6hUiyzaq1LL6xbl2QL3B23XqZKj Fosw== X-Gm-Message-State: AOJu0YzhS6GM4RCbhpOsbuDL9a/87ip9cZMWq+Dmsu1Bnmkd87WFWJ+E rDBIuLL985rC8Zq9xQBzV7Qi8w== X-Google-Smtp-Source: AGHT+IG+c5rEqkPJPowukhZCNBWoFesKNE9fmEnvIvY0OWAzZw3ToxQlykzyfaeu3P1kN6URG92/wA== X-Received: by 2002:a5d:6109:0:b0:319:8c99:989a with SMTP id v9-20020a5d6109000000b003198c99989amr10480120wrt.8.1692769034543; Tue, 22 Aug 2023 22:37:14 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id o1-20020a5d58c1000000b003180155493esm17522712wrf.67.2023.08.22.22.37.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Aug 2023 22:37:13 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: git: 4a69fc16a583 - main - Add membarrier(2) From: Jessica Clarke In-Reply-To: Date: Wed, 23 Aug 2023 06:37:03 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <0F3EA94D-6696-471C-ABF6-840B5E92967F@freebsd.org> References: <202308230007.37N07cOK082906@gitrepo.freebsd.org> <748B7A01-5011-44EE-BB04-282AE96F9B5B@freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3731.600.7) X-Rspamd-Queue-Id: 4RVw2h4zt6z4Jf2 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:15169, ipnet:209.85.128.0/17, country:US] On 23 Aug 2023, at 03:38, Konstantin Belousov = wrote: > On Wed, Aug 23, 2023 at 02:18:12AM +0100, Jessica Clarke wrote: >> On 23 Aug 2023, at 01:07, Konstantin Belousov = wrote: >>>=20 >>> The branch main has been updated by kib: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D4a69fc16a583face922319c476f3e739= d9ce9140 >>>=20 >>> commit 4a69fc16a583face922319c476f3e739d9ce9140 >>> Author: Konstantin Belousov >>> AuthorDate: 2021-10-07 21:10:07 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2023-08-23 00:02:21 +0000 >>>=20 >>> Add membarrier(2) >>>=20 >>> This is an attempt at clean-room implementation of the Linux' >>> membarrier(2) syscall. For documentation, you would need to read >>> both membarrier(2) Linux man page, the comments in Linux >>> kernel/sched/membarrier.c implementation and possibly look at >>> actual uses. >>>=20 >>> Sponsored by: The FreeBSD Foundation >>> MFC after: 1 week >>> Differential revision: https://reviews.freebsd.org/D32360 >>> --- >>> ... >>> diff --git a/sys/sys/membarrier.h b/sys/sys/membarrier.h >>> new file mode 100644 >>> index 000000000000..958b769da23e >>> --- /dev/null >>> +++ b/sys/sys/membarrier.h >>> @@ -0,0 +1,70 @@ >>> +/*- >>> + * Copyright (c) 2021 The FreeBSD Foundation >>> + * >>> + * This software were developed by Konstantin Belousov = >>> + * under sponsorship from the FreeBSD Foundation. >>> + * >>> + * Redistribution and use in source and binary forms, with or = without >>> + * modification, are permitted provided that the following = conditions >>> + * are met: >>> + * 1. Redistributions of source code must retain the above = copyright >>> + * notice, this list of conditions and the following disclaimer. >>> + * 2. Redistributions in binary form must reproduce the above = copyright >>> + * notice, this list of conditions and the following disclaimer = in the >>> + * documentation and/or other materials provided with the = distribution. >>> + * >>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE >>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >>> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING = IN ANY WAY >>> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >>> + * SUCH DAMAGE. >>> + */ >>> + >>> +#ifndef __SYS_MEMBARRIER_H__ >>> +#define __SYS_MEMBARRIER_H__ >>> + >>> +#include >>> + >>> +/* >>> + * The enum membarrier_cmd values are bits. The = MEMBARRIER_CMD_QUERY >>> + * command returns a bitset indicating which commands are = supported. >>> + * Also the value of MEMBARRIER_CMD_QUERY is zero, so it is >>> + * effectively not returned by the query. >>> + */ >>> +enum membarrier_cmd { >>> + MEMBARRIER_CMD_QUERY =3D 0x00000000, >>> + MEMBARRIER_CMD_GLOBAL =3D 0x00000001, >>> + MEMBARRIER_CMD_SHARED =3D MEMBARRIER_CMD_GLOBAL, >>> + MEMBARRIER_CMD_GLOBAL_EXPEDITED =3D 0x00000002, >>> + MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED =3D 0x00000004, >>> + MEMBARRIER_CMD_PRIVATE_EXPEDITED =3D 0x00000008, >>> + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED =3D 0x00000010, >>> + MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE =3D 0x00000020, >>> + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE =3D = 0x00000040, >>> + >>> + /* >>> + * RSEQ constants are defined for source compatibility but are >>> + * not yes supported, MEMBARRIER_CMD_QUERY does not return >>> + * them in the mask. >>> + */ >>> + MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ =3D 0x00000080, >>> + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ =3D 0x00000100, >>=20 >> Or we could not define them. membarrier(2) came into Linux in 4.3, = but >> these two are only since 5.10. Defining something we may or may not >> ever implement that code should have compatibility for anyway seems >> like a bad idea. Or should we provide all of the Linux UAPI to = FreeBSD >> processes with ENOSYS stubs? Clearly not. So why is this special? IMO >> these should not be added unless we have an rseq implementation, = which >> has itself received several objections on the review. > The added _RSEQ bits behave according to the membarrier(2) = specification, > they are defined but not returned in the mask of supported operations. So would implementing io_uring_enter(2) as EOPNOTSUPP... > I found that have all of them defined makes compiling some program = easier, > AFAIR. Which programs? I can=E2=80=99t imagine many even try and use this in = the first place, and of those that do a large proportion likely have fallback code for pre-5.10. >> I also don=E2=80=99t see why this is suddenly being landed now = without warning. >> There=E2=80=99s been no activity by you on the review since just over = a year >> ago. And landing new syscalls days before the 14 branch point = doesn=E2=80=99t >> seem like great practice to me... > Would I know that reviewers did not act for a year, I committed the = patch > a year ago. You didn=E2=80=99t even ping the patch once since 16th August 2022, a = day when you did receive reviewer feedback. > The addition does not change any existing code path in the kernel. No, but it commits us to a new syscall being stable just days before 14 branches and has its ABI frozen. Jess