Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2023 13:49:28 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        Jessica Clarke <jrtc27@freebsd.org>, freebsd-arch <freebsd-arch@freebsd.org>
Subject:   Re: [RFC] An idea for general kernel post-processing automation in FreeBSD
Message-ID:  <da887293-5e29-e06e-bed5-b55acf73220c@selasky.org>
In-Reply-To: <614513c9-06c0-0330-2969-ad4f3ca06569@selasky.org>
References:  <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4.ref@yahoo.com> <2EDDC5DC-81C2-4EB8-B729-66F03A8854E4@yahoo.com> <6293f06b-927f-432a-3911-808b1d99441b@selasky.org> <B8217B6F-DA83-4F90-B87B-37E3397237B2@yahoo.com> <cc078296-76b0-9a27-e037-8a25d1e2e9cd@selasky.org> <C7699C53-4961-4C57-82D0-91B468EAA302@yahoo.com> <9C0CE0A5-150D-4FE1-A838-F1E6A39960F6@yahoo.com> <204FCA67-3FCD-48BA-A373-ABE8AD915D40@yahoo.com> <dc56253b-885c-886d-6658-dd3cf204aac4@selasky.org> <738F6620-E4FA-4960-87D2-61B93921593C@yahoo.com> <614513c9-06c0-0330-2969-ad4f3ca06569@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da887293-5e29-e06e-bed5-b55acf73220c>