Re: sparc packages?

Romain Dolbeau <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc
Message-ID <CADuzgboGscUrNCCHK7fqyXcGXaGSvEejdRdo6egJmdXT8bGhiQ@mail.gmail.com>
Le sam. 4 mars 2023 à 17:58, Martin Husemann <[email protected]> a écrit :
> I was thinking of the _lock_hash "Interlock hash table" in
> sys/arch/sparc/sparc/lock_stubs.s.

Mmmm, as far as I can tell the "_lock_hash" is just 1024 byte-size
entries to have 1024 interlocks depending on the 8-bytes granularity
of the address of the 'real' lock.
That makes sense to mitigate false contention.

It also should work from my reading, provided all accesses to a given
lock are using addresses that have the same alignment (same
"(addr/8)%1024)").
Thinking about it, is that property preserved if the lock is used by
different processes? With 4K pages, isn't it theoretically possible
for the same physical page to be mapped twice using a different 8K
alignment? In that case the same lock would use two different
_lock_hash entry?

I'm not sure why the input address is shifted by 3 instead of 2 for
32-bytes value. Are there cases where it's needed for two consecutive
(and properly aligned) 32-bits values to share the interlock? If not
then a shift by 2 would avoid the issue. If yes then restricting to
512 entries the table would also avoid the issue. Assuming I
understand the code and there is an issue, that is :-)

Cordially,

-- 
Romain Dolbeau
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.