From nobody Thu May 25 11:49:28 2023 X-Original-To: freebsd-arch@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 4QRmYl6PdGz4TPNf for ; Thu, 25 May 2023 11:49:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 4QRmYk5s4Qz3whQ; Thu, 25 May 2023 11:49:30 +0000 (UTC) (envelope-from hps@selasky.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org; dmarc=none Received: from [10.36.2.145] (unknown [46.212.121.255]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 64EAE260120; Thu, 25 May 2023 13:49:29 +0200 (CEST) Message-ID: Date: Thu, 25 May 2023 13:49:28 +0200 List-Id: Discussion related to FreeBSD architecture List-Archive: https://lists.freebsd.org/archives/freebsd-arch List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arch@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [RFC] An idea for general kernel post-processing automation in FreeBSD Content-Language: en-US From: Hans Petter Selasky To: Mark Millard Cc: Jessica Clarke , freebsd-arch References: <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4.ref@yahoo.com> <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4@yahoo.com> <6293f06b-927f-432a-3911-808b1d99441b@selasky.org> <9C0CE0A5-150D-4FE1-A838-F1E6A39960F6@yahoo.com> <204FCA67-3FCD-48BA-A373-ABE8AD915D40@yahoo.com> <738F6620-E4FA-4960-87D2-61B93921593C@yahoo.com> <614513c9-06c0-0330-2969-ad4f3ca06569@selasky.org> In-Reply-To: <614513c9-06c0-0330-2969-ad4f3ca06569@selasky.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-3.29 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.993]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-arch@freebsd.org]; FREEMAIL_TO(0.00)[yahoo.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE]; MIME_TRACE(0.00)[0:+]; BLOCKLISTDE_FAIL(0.00)[2a01:4f8:c17:6c4b::2:server fail,46.212.121.255:server fail]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[selasky.org]; RCPT_COUNT_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Queue-Id: 4QRmYk5s4Qz3whQ X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N On 5/25/23 13:42, Hans Petter Selasky wrote: > On 5/25/23 12:57, Mark Millard wrote: >> The pre-existing code expresses explicitly that no other >> routine is allowed to have its own use of the mutex, a >> design choice enforced by the compiler as things are >> written. (The purpose of the limitation to block scope.) >> >> Your proposed change removes the compiler enforcement of >> that design, allowing use of the mutex by other code in >> mlx4_main.c without any notification by the compiler. >> >> Your proposal has a direction of being more fragile for >> bad changes without having to be explicit in code updates >> about the change of status. > > Hi Mark, > > Looking only at the mutex part alone, you are right, but not when also > considering the SYSINIT() part, as implemented in LinuxKPI currently. To be more precise: The static mutex can only be accessed from within the routine itself, when it is part of a block scope. That is expected. However the static sysinit, which is also inside the block scope of the function, is accessed from _outside_ the function. This might be viewed as a violation of the block scope limitation. Therefore the DEFINE_MUTEX() should be outside the block scope, due to how it is implemented in the LinuxKPI currently. --HPS > > --HPS