xkaraman left a comment (kamailio/kamailio#4363)

For `aarch64` it fails to build but does build for make. Why this happens.

For old `Makefiles`, `futexlock.h` seems to not have support for it. This 
happens beacuse it needs the `HAVE_ASM_INLINE_ATOMIC_OPS` which is only defined 
for `arm6` or `arm7` in `atomic_arm.h`. 

In `futexlock.h` then it undefines the USE_FUTEX, which is provided (either by 
user or auto), and due to 
https://github.com/kamailio/kamailio/blob/3f315d0f583b253919572498f47371fddca4371f/src/Makefile.defs#L920-L923,
 it falls back to `fast_lock`. If we also disable `FAST_LOCK`, it will fallback 
even more to `USE_PTHREAD_MUTEX` due to 
https://github.com/kamailio/kamailio/blob/3f315d0f583b253919572498f47371fddca4371f/src/Makefile.defs#L1853-L1858.

So, in summary, what i am seeing is inconsisteny that i it's not even visible. 
On `x86_64`, `kamailio` use the `futex` lock method, but `kamailio -I` will 
report `USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT` and `aarch64` (and `arm64` probably 
didn't tested it yet), will use `FAST_LOCK` lock method but report `USE_FUTEX, 
FAST_LOCK-ADAPTIVE_WAIT-NOSMP` (tested on an aarch64 server).

In CMake and this PR, i check for futex availability through 
https://github.com/xkaraman/kamailio/blob/2f1c3d2447dcf860365314e6345b67dde68c0f94/cmake/lock_methods.cmake#L35-L41,
 and since it's the first in priority i passed that one to the build.
Since in this PR we only provide a single method `USE_FUTEX` and no fallbacks, 
the build fails due to ``HAVE_ASM_INLINE_ATOMIC_OPS` which is only defined for 
`arm6` or `arm7` in `atomic_arm.h`, therefore it's `USE_FUTEX` gets undefined 
and does not pick any other lock mechanism.

I know this gets a bit convoluted and bit lower level than i was expecting, so 
up to you what should be the best way to go.

>From my side i would expect consistency across platforms and easily 
>identifiable lock mechanism.
I would also expect respecting the user choice and either error out if not 
available and not fallback without warning or information.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4363#issuecomment-3333730240
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/4363/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to