Re: __futex(2): use outside Linux compat

2023-12-11 Thread Jason Thorpe


> On Dec 11, 2023, at 5:00 AM, Robert Swindells  wrote:
> 
>> Is it OK to use for NetBSD "native" code since it is not "advertised"
>> by a man page?
> 
> No.

Heavy asterisk here.

Thierry, let’s chat off-list.

-- thorpej



Re: __futex(2): use outside Linux compat

2023-12-11 Thread tlaronde
On Mon, Dec 11, 2023 at 01:00:38PM +, Robert Swindells wrote:
> 
> tlaro...@kergis.com wrote:
> > In Mesa code implementations for futex_wake() and futex_wait() are
> > provided for Linux, Windows, FreeBSD and OpenBSD.
> >
> > There is a __futex(2) syscall in NetBSD, used only for now, if I'm not
> > mistaken, to implement Linux compat.
> 
> The Linux emulation of futexes in NetBSD does not work correctly.
> 
> > Is it OK to use for NetBSD "native" code since it is not "advertised"
> > by a man page?
> 
> No.

OK, thanks for the precisions.

To state the problem: NetBSD userland is probably the sole user of the
non futex code in Mesa. Hence, since userland doesn't follow the same
code path as the same apps on other OSes, and since this code
(!UTIL_FUTEX_SUPPORTED) is a second rate citizen considering that the
 main development (Linux) is taking another path, it could be that
the apps (the various Mesa libs components) are exercising bugs in
this part, the "tearing" or "threaded" (incorrect lines in a window)
that can be observed on NetBSD in certain circumstances being caused by
userlevel concurrent accesses, and not by kernel cache problems (there
have been reports that these defects are decreasing under heavy load
and this is perhaps only because under heavy loads there are less
threads concurrently running for the X clients, and they have no
occasion to trash shared zones that should be, normally, protected by
futexes).

So 3 options:
1) To fix the futex support on NetBSD ("ideal" solution but
quite involved, at leas for me);
2) Debug the non futex code in Mesa (meaning only finding if
the problems seen can come from there);
3) Let it be for now...

I will probably opt for 3) since I wanted to debug Mesa for other more
disastrous infelicities (crashes with xine(1) or vlc(1)---and probably
others since this comes from Mesa libs and probably not from the way
the API is used in the clients).
-- 
Thierry Laronde 
 http://www.kergis.com/
http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Re: __futex(2): use outside Linux compat

2023-12-11 Thread Robert Swindells


tlaro...@kergis.com wrote:
> In Mesa code implementations for futex_wake() and futex_wait() are
> provided for Linux, Windows, FreeBSD and OpenBSD.
>
> There is a __futex(2) syscall in NetBSD, used only for now, if I'm not
> mistaken, to implement Linux compat.

The Linux emulation of futexes in NetBSD does not work correctly.

> Is it OK to use for NetBSD "native" code since it is not "advertised"
> by a man page?

No.


__futex(2): use outside Linux compat

2023-12-11 Thread tlaronde
In Mesa code implementations for futex_wake() and futex_wait() are
provided for Linux, Windows, FreeBSD and OpenBSD.

There is a __futex(2) syscall in NetBSD, used only for now, if I'm not
mistaken, to implement Linux compat.

Is it OK to use for NetBSD "native" code since it is not "advertised"
by a man page?
-- 
Thierry Laronde 
 http://www.kergis.com/
http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C