From nobody Sun May 21 22:32:22 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 4QPb1b4QvVz4CZCb for ; Sun, 21 May 2023 22:32:35 +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 4QPb1Z71R4z4Q9f for ; Sun, 21 May 2023 22:32:34 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-307d58b3efbso3337128f8f.0 for ; Sun, 21 May 2023 15:32:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684708353; x=1687300353; 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=auE9RGJvV48lZWdBD4OugXlFGkHJ/9pRUprocpkDo7o=; b=B4syYr+QRDIidVEhFlhRlR+xpNGgQC18Iugu7lmb2GqqpWhqGPoV/C0Fp+uxrZUVSg jfVrah18xcAoZYTYZOWd2L3UndUtYhjTaVS9LyeNbyR1CbVUG3t5DhrY44a74y7beU9D BFOCd1RxoLqWYuYN7oLdAKRmCFFg5Vvu+CH5RDAxRziwYHE8TnwB70wDj+NiXVd6DKdD qYg9a10l+b1oNOdWTLlx+oatvFy0QakYsRKKyvW4e6haOhjud+k1tZ7v0RECAYmmkp1v +7idTMz+1U9jWEJQCSyNjNhcNEAJenouQw8APLpXAYdN1nCKdt8yMz85ImiDtSkFBFKq kzew== X-Gm-Message-State: AC+VfDx9+2hO/fEQjbPc3ZCBGRrODm4x3kkHoOJZJAP2WeGXwGYHDrRt yb9dL1zV5o5/EmJacWXTmxVbAg== X-Google-Smtp-Source: ACHHUZ5/BDqBagqB1NDTKkzi0QJebz3rojQUe0YWx13c3lMS+PwMCHc04PeMUVtEsg8r1O/30q57Jg== X-Received: by 2002:adf:de0e:0:b0:309:395d:8da5 with SMTP id b14-20020adfde0e000000b00309395d8da5mr6555329wrm.22.1684708353422; Sun, 21 May 2023 15:32:33 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id a9-20020a5d5709000000b0030922ba6d0csm5676280wrv.45.2023.05.21.15.32.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 May 2023 15:32:33 -0700 (PDT) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: git: 805d759338a2 - main - mlx4: Move DEFINE_MUTEX() outside function body. From: Jessica Clarke In-Reply-To: <8f46512a-f086-6da0-2fdd-3ffc89f4dfdd@freebsd.org> Date: Sun, 21 May 2023 23:32:22 +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: <1787C08C-AD82-48EC-92E2-49360B1AB8B0@freebsd.org> References: <202305211621.34LGLsup059861@gitrepo.freebsd.org> <54EF67D8-2A79-4EAB-8EFB-232F14FFE792@freebsd.org> <21c9532e-4ca7-a7fe-1ff6-07a94cbad6ab@freebsd.org> <3066464F-E4C6-4B84-ADFF-E578AFAFE622@freebsd.org> <26465813-3B51-4E52-9E9D-F93A0F2AF6BD@freebsd.org> <2BF2F7CF-82E6-4D98-800D-C35D7C29E948@freebsd.org> <8f46512a-f086-6da0-2fdd-3ffc89f4dfdd@freebsd.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3731.500.231) X-Rspamd-Queue-Id: 4QPb1Z71R4z4Q9f X-Spamd-Bar: ---- 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] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 21 May 2023, at 23:13, Hans Petter Selasky = wrote: >=20 > On 5/21/23 23:37, Hans Petter Selasky wrote: >> DEFINE_MUTEX is Linux=E2=80=99s API, implemented in LinuxKPI. So = Linux=E2=80=99s behaviour is absolutely relevant. Any deviation from = Linux=E2=80=99s semantics is an incompatibility that requires patching = any sources that are built for FreeBSD using LinuxKPI. It is generally = best to minimise that. >=20 > Jess, listen: >=20 > Probably at some point, there could be an initialization macro for the = SX locks used in the LinuxKPI, being of type SX_NOWITNESS, simply = plotting in the constants needed in the sx structure, exactly like they = do under Linux. >=20 > Then neither SYSINITs, nor my patch will be needed for the sake of = DEFINE_MUTEX(). Can we wait for that? No. If anything this is another reason why your patch is unnecessary; = you=E2=80=99re giving yet another reason here why it isn=E2=80=99t = needed for the changes you=E2=80=99re proposing. > The reason for this is Linux has a bad habit of not destroying locks, = so FreeBSD cannot add any WITNESS objects for locks that are not = destroyed anyway. Most of the work done by sx_init() is putting a few = constants into various SX structure fields. Only the WITNESS part needs = execution, if you get what I mean. >=20 > This change is made so I can let others easily test another patchset. = Also this change is harmless as such. Once again I will remind you that the FreeBSD tree is not somewhere for = you to play around with experiments. Changes should be properly = justified. This one is completely unjustified today, and should remain = unjustified in future lest LinuxKPI compatibility be broken. > Looking at the whole Linux tree, the most common way is to use = DEFINE_MUTEX() outside macros and functions: Because a lot of the time, mutexes are needed in multiple functions? All = this tells me is there are 57 cases of the pattern you want to break; = i.e. Linux supports this and makes use of it. Unless, and until, there is consensus that `static DEFINE_MUTEX(...);` = within a function body should be broken by LinuxKPI, this patch does not = belong in the tree. So, for the fourth time, please revert it. I do not = want to have to escalate this further; it would be a colossal waste of = everyone=E2=80=99s time. Jess > # grep -r DEFINE_MUTEX * | grep -vE ":static " | grep -vE = ":DEFINE_MUTEX" | wc -l > 57 >=20 > # grep -r DEFINE_MUTEX * | wc -l > 1293 >=20 > --HPS