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
Multithreaded TCG of x86_64/i386 #257
Comments
But is the comment about incorrect emulation correct? |
And well, specifically, about x86 memory model being unsupported on ARM? |
Give him the link |
Whom did you meant? If that’s to me, then I’m referring to quite a hope-giving response of the bug I linked to earlier: https://bugs.launchpad.net/qemu/+bug/1735049/comments/1 |
I did find the commit they referenced qemu/qemu@b32dc3370a |
So yeah in theory it should work but I'm confused because this piece of code exists in QEMU /*
* We default to false if we know other options have been enabled
* which are currently incompatible with MTTCG. Otherwise when each
* guest (target) has been updated to support:
* - atomic instructions
* - memory ordering primitives (barriers)
* they can set the appropriate CONFIG flags in ${target}-softmmu.mak
*
* Once a guest architecture has been converted to the new primitives
* there are two remaining limitations to check.
*
* - The guest can't be oversized (e.g. 64 bit guest on 32 bit host)
* - The host must have a stronger memory order than the guest
*
* It may be possible in future to support strong guests on weak hosts
* but that will require tagging all load/stores in a guest with their
* implicit memory order requirements which would likely slow things
* down a lot.
*/
static bool check_tcg_memory_orders_compatible(void)
{
#if defined(TCG_GUEST_DEFAULT_MO) && defined(TCG_TARGET_DEFAULT_MO)
return (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) == 0;
#else
return false;
#endif
} That function will return false for x86_64 on ARM64. On #define TCG_TARGET_DEFAULT_MO (0) On /* The x86 has a strong memory model with some store-after-load re-ordering */
#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) |
Yeah someone should contact the QEMU developer for clarification because the above code will default x86 on ARM64 to disable MTTCG. And we know from experience that forcing MTTCG results in random issues. |
https://www.qemu.org/support/ you can check out their mailing list |
@professorIsaac yeah I think we all know what it means to contact |
I will do it |
Ahm, is that some sort of inside knowledge? Could you please enlighten me about that well, supposed skepticism about contacting QEMU devs? |
In short they explained to me that since the host arm64 is a weaker memory order than the guest x86 they disabled mttcg because if they would implement it would slow everything down but the good news is that if the guest is the same memory order it is not disabled and if it is weaker memory order it is not disabled also. |
Right, that's what I figured from the code. So basically the launchpad comment was incorrect. There is no MTTCG support for x86 on ARM64. |
I found it intriguing that Apple added support for x86 memory ordering to the M1 CPU. |
Unfortunately there’s no public APIs for that yet. @saagarjha did you ever manage to benchmark the performance and see if it’s worth implementing? |
TSO’s overhead is something like 20% for most applications, tending towards 50% if you hit contended memory a lot. |
Adding a cross link to the trollstore ios code PR: #4866 |
This one implies that subject should be possible since qemu 3.1. Is that true?
The text was updated successfully, but these errors were encountered: