[HN Gopher] Huawei ExaGear: x86_64 apps on Arm 64-bit Linux systems
       ___________________________________________________________________
        
       Huawei ExaGear: x86_64 apps on Arm 64-bit Linux systems
        
       Author : my123
       Score  : 95 points
       Date   : 2021-01-12 16:49 UTC (6 hours ago)
        
 (HTM) web link (threedots.ovh)
 (TXT) w3m dump (threedots.ovh)
        
       | danielEM wrote:
       | Does it really matter for Linux world where you jest compile
       | software from open sources anyway?
        
         | HideousKojima wrote:
         | There's plenty of software where the source isn't available,
         | and plenty of open source software where it won't compile for a
         | different architecture without significant work because of
         | runtimes or other dependencies
        
       | Klasiaster wrote:
       | What qemu-user makes so special for me is that is can be pre-
       | loaded by the kernel, allowing any foreign arch chroot to
       | directly work, nice for containers1. I've not read if this here
       | does support it, too.
       | 
       | 1 Once `qemu-user-static` is installed on your system, try
       | `docker run --rm -ti docker.io/arm64v8/alpine` on amd64 or vice
       | versa
        
         | my123 wrote:
         | This supports it too. See the ExaGear4Docker folder in the
         | install archive.
        
       | johndoe0815 wrote:
       | An interesting excerpt from the article:
       | 
       | "ExaGear does not follow TSO completely by default, using
       | heuristics instead." TSO emulation can be enabled fully, using
       | heuristics, or turned off using a configuration option. It would
       | be interesting to see benchmarks that analyze the performance
       | (and correctness) impact of full TSO emulation vs. heuristics.
       | 
       | Another interesting bit that is mentioned is that like Apple's
       | M1, NVidia's Tegra K1 64-bit and Tegra Xavier support sequential
       | consistency as the memory model.
        
         | my123 wrote:
         | Apple M1 has togglable TSO with ACTLR_EL1, not sequential
         | consistency.
         | 
         | You also don't run as TSO by default, has to be toggled on by
         | the kernel when context switching to a given task.
        
       | chmod775 wrote:
       | Note that _Eltech_ 's ExaGear used to be a thing, and has now
       | largely disappeared, along with the company homepage.
       | 
       | I don't know whether they've been bought by Huawei, who is now
       | reviving the product under their own name.
       | 
       | Original announcement of discontinuation:                   ---
       | Eltechs Weekly News Digest ---              We have discontinued
       | ExaGear...         Dear ExaGear users!              We're really
       | sorry to announce our business decision about discontinuing our
       | services and products.              You'll be able to continue
       | using all of your purchased products, the license checking
       | functionality will work.              You can download our most
       | recent ExaGear Desktop version 3.1 below:              ExaGear
       | Desktop for Raspberry Pi 3         ExaGear Desktop for Raspberry
       | Pi 2         ExaGear Desktop for Raspberry Pi 1/Zero
       | ExaGear Desktop for Odroid XU4         ExaGear Desktop for Odroid
       | C2         ExaGear Desktop for Odroid 32bit         ExaGear
       | Desktop for NVIDIA Jetson TX1 / TX2         ExaGear Desktop for
       | NVIDIA Jetson TK1         ExaGear Desktop for CubieBoard
       | ExaGear Desktop for Banana Pi         ExaGear Desktop for ARMv7
       | ExaGear Desktop for ARMv8         We strongly recommend to save
       | ExaGear installation package on your own hard drive because the
       | download won't be available after February 28th, 2019.
       | 
       | Source:
       | https://web.archive.org/web/20190227095445/http://forum.elte...
        
         | my123 wrote:
         | Eltechs' ExaGear at the time only provided x86_32 compatibility
         | on top of 32-bit Arm.
         | 
         | This is a major departure from that, my best guess would be
         | that Huawei purchased the company and then poured lots of
         | resources to it.
        
           | chmod775 wrote:
           | Given the timeline Eltech had likely been shut down for at
           | least a year. Then Apple came around with their x86 to ARM
           | translation layer, prompting Huawei to go shopping for a
           | competitor, seeing the defunct Eltech, and buying their IP.
           | 
           | Sounds like a late happy ending for a failed company that was
           | just a few years too early with their product. I hope the
           | founders got a good deal.
        
         | chmod775 wrote:
         | Some more information:
         | 
         | A chinese-speaking internet user put in some research and
         | according to them it appears to be Eltech's software. They also
         | appear to be somewhat angry that Huawei did not properly credit
         | Eltech.
         | 
         | Note that apparently there was a lot of controversy around this
         | on Chinese boards, with people arguing vehemently for either
         | side (based on Eltech's software vs. not based on it).
         | 
         | Chinese: https://zhuanlan.zhihu.com/p/263519125
         | 
         | Translated:
         | https://translate.google.com/translate?sl=auto&tl=en&u=https...
         | 
         | HN user 'oefrha' managed to find the official project page and
         | documentation:
         | 
         | https://news.ycombinator.com/item?id=25750553
        
       | trizic wrote:
       | Also check out Box86: https://github.com/ptitSeb/box86
       | 
       | Impressive to see people playing Half-Life 2, Unreal Tournament
       | 99 and 2004 on a Raspberry Pi 4.
       | 
       | Curious if this could be extended to Emscripten (JIT for
       | WebAssembly/Emscripten?) which would be perfect for archiving and
       | portability. Closest project I have seen is DOSBox-X which seems
       | to already have an Emscripten port:
       | https://github.com/joncampbell123/dosbox-x
       | 
       | HL2: https://www.youtube.com/watch?v=Lq5dJ0oc_6k
       | 
       | UT2004: https://www.youtube.com/watch?v=4VOAeOQcrdo
        
         | spijdar wrote:
         | Another fun thing about box86 is it isn't specifically limited
         | to ARM. Its JIT translator is ARM-specific, but it includes a
         | pure emulator which will work on any CPU. There's additional
         | work to be done for each port, but I got it working on 32 bit
         | PowerPC LE, allowing one to run x86 apps on IBM's POWER
         | processors. For all the few dozens of people this may be
         | relevant to :-)
        
         | ekianjo wrote:
         | More info here about box86
         | https://www.giantpockets.com/box86-run-x86-code-and-games-on...
        
         | dleslie wrote:
         | Sadly, box86 doesn't support aarch64.
        
       | throwaway4good wrote:
       | I wonder if this is related to Huawei's effort to bring forth
       | desktop PCs and laptops based on their Kirin/Kunpeng ARM CPUs?
       | Running a desktop version of their HarmonyOS with x86 apps in a
       | compability layer.
        
       | paddim8 wrote:
       | This is really interesting.
       | 
       | "ExaGear is a dynamic binary translation layer to run x86_32 and
       | x86_64 applications on Arm 64-bit Linux systems."
       | 
       | Couldn't this eventually be used in combination with Asahi Linux
       | (project aiming to run Linux on Apple M1)? That would be
       | incredible. Too bad it's from Huawei and doesn't seem to be open
       | source though? I'm unable to find any additional information
       | about this.
        
         | StillBored wrote:
         | That is possible today with qemu/TCG. The assumption with
         | exagear and some of these other JITs is that they are faster.
        
           | my123 wrote:
           | And they are, Qemu isn't even remotely in the same
           | performance category.
           | 
           | (it was intended to be easily retargetable to other platforms
           | instead of being tailored to them, not even using the
           | hardware FPU at all for example)
        
       | woodruffw wrote:
       | This is the first I'm hearing of a dynamic binary translation
       | tool from Huawei. This link only has a binary download and search
       | results are scant; does anybody know any more about ExaGear?
        
         | oefrha wrote:
         | Project page is here:
         | https://www.huaweicloud.com/kunpeng/software/exagear.html
         | Google (en-US) stupidly ranks it very low when searching for
         | "Huawei exagear", below some sketchy looking results, possibly
         | due to language?
         | 
         | Documentation is here https://support.huaweicloud.com/ug-
         | exagear-kunpengdevps/kunp... and appear to be Chinese-only.
         | Google Translate does a passable translation though.
        
         | chmod775 wrote:
         | See my comment here:
         | https://news.ycombinator.com/item?id=25750402
        
         | selfhoster11 wrote:
         | ExaGear was originally developed by a company called Eltechs. I
         | presume this must have been somehow acquired by Huawei.
        
       | obilgic wrote:
       | Every time I travel abroad, I'm amazed by how much Huawei has
       | penetrated every major market except U.S.
        
         | coliveira wrote:
         | The reason is obvious: the US is enacting barriers to the
         | internal market. But Huawei is developing all kinds of
         | technology around the world.
        
           | heyflyguy wrote:
           | because spying.
        
           | neither_color wrote:
           | The US is responding to asymmetrical access. Facebook,
           | Google, Twitter, Instagram et al have been blocked for years
           | in China. As of this week I'm ok with that but I digress.
           | Apple's the only foreign cell phone maker that's really done
           | alright in absolute dollar terms, but their market share is
           | rather small. Access to the tantalizing "rising chinese
           | middle class" is tantalizing and highly conditional.
           | https://www.counterpointresearch.com/china-smartphone-share/
        
             | mytailorisrich wrote:
             | > _Facebook, Google, Twitter, Instagram et al have been
             | blocked for years in China._
             | 
             | The Chinese government did not decide this on a whim, these
             | companies are not willing to comply with Chinese rules
             | within China. Whatever we might think of these rules the
             | bottom line is that these companies are not in China
             | because they have decided not to be. And when they try to
             | move in, like Google did, their very employees argue
             | against it.
             | 
             | China is Apple's largest market, iirc, they are doing very
             | well there. For smartphones their market share is 3 times
             | their market share in India. Still, a lot of Chinese still
             | cannot afford iPhones and China has many domestic
             | manufacturers: Actual competition is fierce, this has
             | nothing to do with politics.
             | 
             | The argument that the US are retaliating against China
             | blocking the FAANG is largely for the show but not reality.
        
               | qeternity wrote:
               | That's a bit rich. The same could be argued about Huawei.
               | The rules in the US are don't be agent for a foreign
               | government, but Huawei wouldn't agree to that. So it's
               | also their own choice.
        
               | mytailorisrich wrote:
               | That's (bad) whataboutism, and nothing to do with my
               | comment.
               | 
               | > _The rules in the US are don't be agent for a foreign
               | government, but Huawei wouldn't agree to that._
               | 
               | I'll bite: If you have proof, or even actual evidence, of
               | any part of that statement, I am sure the public at large
               | would be very interested.
               | 
               | Unfortunately this topic always leads to this sort of low
               | effort reply and a sensible discussion is never possible.
        
               | sonotmyname wrote:
               | > https://www.telegraph.co.uk/news/2019/07/05/huawei-
               | staff-cvs...
               | 
               | > https://www.forbes.com/sites/zakdoffman/2019/07/06/huaw
               | ei-em...
               | 
               | > https://www.wsj.com/articles/u-s-officials-say-huawei-
               | can-co...
               | 
               | This is not news.
               | 
               | Aside from the spying, Huawei has zero regard for
               | Intellectual Property law, as demonstrated by numerous
               | cases of stolen code, designs, and even wholesale
               | products.
        
         | the_duke wrote:
         | And Europe.
         | 
         | Sure, there are some Huawei phones and other devices around,
         | but they are not very common.
         | 
         | (mobile phone market share in Europe is ~ 15%, and lower in the
         | western Europe)
        
         | mlacks wrote:
         | I wonder if it's partly due to the US being able to afford
         | alternatives, wether they are cost effective or not.
         | 
         | For many installments, the Huawei option is just cheaper.
         | 
         | Keep in mind China does the same for US technology companies.
        
           | lozaning wrote:
           | Companies in the US largely just dont trust them. Huawei used
           | to be on my line card when I was an SE like 7 years ago, and
           | I'd always give people a quote for the huawei stuff, and then
           | they'd always went with the HP stuff at like 1.5X the price.
        
       | selfhoster11 wrote:
       | Anybody know why this is showing up with Huawei branding after
       | Eltechs shut down? I presume this must be because ExaGear was
       | acquired, but I cannot find any information online about this, at
       | least in English.
        
       | FooBarWidget wrote:
       | Any solutions for doing the reverse, namely running arm64
       | binaries on x86_64? Use case: building ARM software packages
       | (like Docker containers) on x86_64 CI servers.
        
         | Thev00d00 wrote:
         | qemu?
        
           | xuhu wrote:
           | BTW, how does ExaGear compare to qemu for running x86_64 on
           | arm64 hosts ?
        
           | my123 wrote:
           | For something faster than Qemu, there's this:
           | https://threedots.ovh/blog/2020/12/houdini-run-arm-32-bit-
           | an...
        
           | wyldfire wrote:
           | QEMU's sysemu is a little unwieldy for CI, but the linux
           | userspace support is perfect for this use case.
           | 
           | In case you haven't encountered it -- it's terribly clever.
           | Userspace instructions are translated just like they are in
           | full system mode, but when a system call is encountered, the
           | arguments are translated between the host and guest system.
           | So the guest architecture linux program 'just works'. There's
           | also hooks you can enable in binfmt-misc to make the loader
           | invoke the qemu binary automagically.
        
             | codetrotter wrote:
             | Sounds interesting. Do you have a link with more info about
             | these things?
        
               | wyldfire wrote:
               | [1] [2] are handy links.
               | 
               | [1] https://www.qemu.org/docs/master/user/main.html
               | 
               | [2] https://wiki.debian.org/QemuUserEmulation
        
       ___________________________________________________________________
       (page generated 2021-01-12 23:01 UTC)