From nobody Sun May 21 17:44:24 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 4QPSdS0sFwz4CGRC for ; Sun, 21 May 2023 17:44:44 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4QPSdQ3DPBz3p92 for ; Sun, 21 May 2023 17:44:42 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=DtSFf9XQ; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.147 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684691080; bh=yfPW/bIgT6+5s6Pa1iiNnz8sUaoNAMuaXp4osWZDdmI=; h=From:Subject:Date:References:To:In-Reply-To:From:Subject:Reply-To; b=DtSFf9XQJ0JMlBknZ3bc0xnZ/OyYeg2UJBguf/D5oPv3OxMoLXvUwp/R6ccwjq7+4maGFOyBpYECUjUaGppSB9UxXXP7wW7rRfefi3ko4PYKOX9XsUEi28/hubSkNpjj5PCa3K8YuZfnsAI60u3ygW2eiSZKkf0QACpUKsmvy1o/rwDU7zVai9EQYo+zhI/VGNBDpCqSnMW8JOiC6G3SbqekZ98qV9ytefspZCcMZiIH1bQWKfp/s5BlCyFnwJbcOZagRvufdNTBNCq8i4cZueRHXfVfcDvowRY5GxDwdZRwBquJ1w8DZ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EUBp7ILEf.WdxmFjiXZpUUfPjby.YMmTun37k2nqy8dpE_pPQGdqde nXBKweOMDUH9wOlFI6_5OjUGt2NXj9Ipfj.BL2ANZOUwgFe9RGzC6gl_7JE3SH6niea6oXAYkuCS WlIoSuJgP8FuXzzeioTjqxI2COY1boPTHdf_dkZJTGipJ2fH.t.pwV5TqvzL_5_HsPAGRw892L.n fEF6GES47r._iHlAPMWkD3MY9QklBK3mH4CFr6poVHXdaoafriEyqjTd_.ZncMjnq3wp3U5PHit8 R0Q70YWt8E_nO2ucUUSUxeCqQsmtX9aGG7P3_vXMOncfbTjZ5yPuGjLzJAiVh0Q4bl2Db0r9q7sd kVEj9dkBVnnVMtmd2nBoATN4glxtrVvlzXAtwGI5d7sP2oj6L.UCdjNLMDw5bSbmKQgN6PNfGl3J t6gYxmtGTuueCYMVcL7cJ2xdn87R41cW5WwELRMZKW7G6Qk2cLeioQmlu6lPJayit54DrndIvk4Y WdCCmfisHJn.ONgSSfdvG1VoMEmm74ui82AUwc7ZFuTUJUMVXmtQ8_2l_t6knyUwF.M6iAKKCGUR 6zHYxDQYlaO2DPhJudLce9.1HjYQV5zRgdlFdNRTidgqOzheuXn.jPIQXQUQOxCau2baqthTtAld ZYnNKcZvSgvFp8bINj.S1q.X3kM1NFDGnqH.BeBUKS1yRAxpK4fDN5zcNUEQN X-Sonic-MF: X-Sonic-ID: d595e3c0-dc79-4492-b83a-7ab631444897 Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Sun, 21 May 2023 17:44:40 +0000 Received: by hermes--production-bf1-54475bbfff-xzdff (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 36f47a24694af5df4357bc199e5c103f; Sun, 21 May 2023 17:44:36 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.400.51.1.1\)) Subject: Re: git: 805d759338a2 - main - mlx4: Move DEFINE_MUTEX() outside function body. Date: Sun, 21 May 2023 10:44:24 -0700 References: To: dev-commits-src-main@freebsd.org In-Reply-To: Message-Id: <333A3097-9FD1-4FE2-B7D1-5CE85F208C82@yahoo.com> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Spamd-Result: default: False [-3.12 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.62)[-0.619]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.147:from]; BLOCKLISTDE_FAIL(0.00)[98.137.65.147:server fail]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.147:from] X-Rspamd-Queue-Id: 4QPSdQ3DPBz3p92 X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N On May 21, 2023, at 10:14, Mark Millard wrote: > Hans Petter Selasky wrote on > Date: Sun, 21 May 2023 16:57:47 UTC : >=20 >> On 5/21/23 18:33, Jessica Clarke wrote: >>> On 21 May 2023, at 17:21, Hans Petter Selasky = wrote: >>>>=20 >>>> The branch main has been updated by hselasky: >>>>=20 >>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D805d759338a2be939fffc8bf3f25cfaa= b981a9be >>>>=20 >>>> commit 805d759338a2be939fffc8bf3f25cfaab981a9be >>>> Author: Hans Petter Selasky >>>> AuthorDate: 2023-05-21 11:25:28 +0000 >>>> Commit: Hans Petter Selasky >>>> CommitDate: 2023-05-21 16:20:16 +0000 >>>>=20 >>>> mlx4: Move DEFINE_MUTEX() outside function body. >>>>=20 >>>> Move static mutex declaration outside function body, to avoid = global >>>> variables being declared on the stack, when using SYSINITs. >>>=20 >>> What? This is nonsense. It=E2=80=99s not on the stack either way = round. >>>=20 >>> Please revert this. >>>=20 >>> Jess >>=20 >> Hi Jess, >>=20 >> I think this is a false positive of yours. You need to look through = all=20 >> the macros used there. >>=20 >> Basically DEFINE_MUTEX() expands to a bunch of structures, which are = not=20 >> in any block. >=20 > DEFINE_MUTEX is from/for linux related code: >=20 > # grep -r "define.*DEFINE_MUTEX" /usr/main-src/sys/ | more > /usr/main-src/sys/compat/linuxkpi/common/include/linux/mutex.h:#define = DEFINE_MUTEX(lock) \ >=20 > and looks like: >=20 > #define DEFINE_MUTEX(lock) = \ > mutex_t lock; = \ > SX_SYSINIT_FLAGS(lock, &(lock).sx, mutex_name(#lock), SX_DUPOK) Never mind: starting with mutex_t was not essential. >> The "static" you see in patch just covers the first mutex structure. >>=20 >> SYSINITs use "static" in front of all structure definitions. >> If you want to change from static structures to global symbols, then = my=20 >> change is correct. >>=20 >> Before: >>=20 >> static DEFINE_MUTEX(xxx); >>=20 >> Expands to something like: >>=20 >> static struct yyy xxx; static struct sysinit zzz; .... >=20 > Not true. Never mind: starting with mutex_t was not essential, despite it not having a "struct" explicitly. Sorry for the noise. >> If you want to change from "static struct sysinit zzz;" to "extern=20 >> struct sysinit zzz" and also initialize the structure there, then = that=20 >> won't work, based on what I currently know about C-programming. I = tried,=20 >> but clang gave me a warning about it. >>=20 >>=20 >>=20 >> You can't declare global variables inside a function or it is not = good=20 >> style. >>=20 >>=20 >>=20 >> =46rom what I can see, this location is the only place I've come = accross=20 >> in the FreeBSD kernel, where a SYSINIT() is used inside a function, = and=20 >> I thought I would just move that outside the function instead. >>=20 >> This change also allows for: >>=20 >> https://reviews.freebsd.org/D40193 >>=20 >=20 >=20 =3D=3D=3D Mark Millard marklmi at yahoo.com