-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cqueues unusable on aarch64 under LuaJIT #241
Comments
Oh, I forgot to copy&paste the error itself!
|
Can you confirm that Could you provide a C stack trace? |
Debian doesn't provide -dbgsym for this platform (no idea why). When I build it myself from master on the same machine, the error disappears :-/ |
Looks like your debian build could be using an old release:
|
No, that cqueues version had this fixed already. And my testing was with this anyway:
|
I'm not close to this project, but have some familiarity with the LuaJIT story on AArch64. MoonJIT has an active AArch64 port - and may be an alternative? |
This is the same with moonjit 2.1.2. I guess this isn't enough "proof"?
|
@vcunat recompile cqueues with |
As I wrote, I can't reproduce the failure when recompiling by hand (so far). Maybe the address layout is sensitive to something that I don't know about. |
Line isn't surprising: https://salsa.debian.org/lua-team/lua-cqueues/-/blob/2eb74cf0/src/cqueues.c#L2940 |
It's the |
For reference, luaossl suffers from the very same (except its version is ancient on Debian anyway). |
sadly that isn't true for 64bit platforms. if they want to share the same build for both lua 5.1 and LuaJIT then they'll need to compile with |
@yac Please have a look once you get to Debian packaging. |
@daurnimator Do you see any reason why not enable |
Then it might be worth fixing debian/rules in this repo as well, though I don't know if anyone uses it. |
Yes: it could result in mysterious errors/failures/undefined behaviour if you manage to map memory with the same trailing 47 bits. |
Hmm, that sounds like a good reason not to enable it everywhere :-( |
If the collision risk is notable and assuming we're OK with focusing on ==48 bits, I'd suggest using right shift by one bit instead of that mask. In most use cases you know for certain that you won't use the hack on two addresses one byte apart. |
One idea I had was to make the contents of the pointer aligned to e.g. 32bytes, so that we can take the pointer of the end of it, and shift right by 5 (and then use the same 47-bit mask). Does e.g. aarch64 on debian ever set the top 12 bits of pointers? |
Well... to get more confidence, I'd look at ARMv8 manual – page 2083 describes what the virtual addresses can look like. If I understand it right, "negative" values are allowed, and thus the total possible space is at most 2x 48 bits or 2x 52 bits. Say we want to focus on 2x 48 only (for now). Right shift by two bits should give us unique values even after masking to 47 bits (assuming no pointers get less than four bytes apart). It's even possible to check whether the passed pointer fits into the 2x48 range (say, in I'm not sure if 64-byte alignment would be realistic in cqueues case, to allow using the same approach even for 2x52. As for current practice, I don't expect the 52 variant is common yet. I haven't seen a "negative" pointer yet but I haven't really looked so far (maybe they're not useful in user-space). |
cqueues on Debian on aarch64 explodes with error:
Full build log:
https://buildd.debian.org/status/fetch.php?pkg=knot-resolver&arch=arm64&ver=5.1.2-1&stamp=1596037546&raw=0
This is probably related to some LuaJIT limitations on aarch64 but it effectivelly makes cqueues unusable for applications where performance matters.
The text was updated successfully, but these errors were encountered: