this post was submitted on 31 Aug 2024
165 points (94.6% liked)

Linux

48331 readers
563 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 
top 38 comments
sorted by: hot top controversial new old
[–] [email protected] 16 points 2 months ago (2 children)

for the semantically inquisitive folk.

It's worth noting if you are using this on an arm device, this isn't a "virtualization VM" any more, as you are using the emulator backend, so this is far closer to a traditional emulator then anything else.

While the term virtual machine is extremely poorly defined, it could still apply.

also TCG is as slow as molasses, it's a good demo, not actually usable for much, at least unless it's a super beefy phone.

[–] [email protected] 6 points 2 months ago

I might switch to aarch64 to see if it is faster. However, you are right about the slowness. It isn't bad but it is slow.

[–] [email protected] 5 points 2 months ago (1 children)

Looks like it's an x86_64 kernel though? So this is a VM - it's not running as a paravirtualised system, it's having to emulate everything from the CPU up?

[–] [email protected] 5 points 2 months ago

Exactly

I'm running this on a phone running termux

[–] [email protected] 12 points 2 months ago (1 children)

Neat! What are you doing on the vm?

[–] [email protected] 59 points 2 months ago (1 children)
[–] [email protected] 6 points 2 months ago
[–] [email protected] 5 points 2 months ago (1 children)

Interesting running it in QEMU. If possible, it might be better to use a container if the host kernel supports this because performance and resource consumption should both be significantly improved.

However, an emulator provides great flexibility I'll give you that.

[–] [email protected] 9 points 2 months ago (1 children)

I find pretty cool that I can run a x86_64 VM on my phone. Remember it is full machine so I can run actual containers.

[–] [email protected] 5 points 2 months ago (1 children)

It is pretty cool! QEMU can do all kinds of interesting things, although I do wish it had better performance. High performance doesn't appear to be a primary goal for QEMU outside of using KVM.

[–] [email protected] 8 points 2 months ago* (last edited 2 months ago) (1 children)

You need hardware acceleration for any kind of performance. Without it you are just emulating which means you needs lots of hardware instructions for a few emulator instructions

[–] [email protected] 3 points 2 months ago* (last edited 2 months ago) (2 children)

Yes indeed. I develop QEMU at work mainly implementation of new hardware as needed for my employer. It has a software emulator, but it’s not very good. It’s acceptable.

The instruction generation backend does not seem to prioritize performance. Instead, it prioritizes accuracy and ease of maintenance. There is low-hanging fruit for making it faster but there isn’t much interest in doing so for the TCG backend. The attitude seems to be that it’s good enough.

For a small example, you may find it interesting that QEMU does not implement floating point acceleration. It’s done in software even though the host has floating point instructions. It usually doesn’t attempt to use those floating point hardware facilities on the host and instead execute many hundreds of instructions to do floating point using the Berkeley software implementation. Almost never does this matter but it costs a lot of performance. Compare this to the translation performed by projects like FEX and Box64 which do and blow QEMU out of the water for specific use cases.

Another place in the emulator that could be improved is handling of executable pages or cached output of the backend code generator. The executable code caching mechanism is very simple and could probably be much more aggressive on today’s systems.

If you examine change logs, TCG really doesn’t get much TLC last time I checked. It could be a better emulator but performance outside of KVM use case is not as important to the project.

[–] [email protected] 2 points 2 months ago (1 children)

QEMU absolutely will use hardware floating point where it can but only when it will give the correct results. FEX and Box64 are user mode emulators which achieve their speed by avoiding emulation where they can buy thunking at API boundaries.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago) (1 children)

Call it a difference of opinion that I don’t believe it should try to be bit-accurate for floating point. But, it’s a valid position to take. There are many use cases for QEMU. In this case where we emit some host instructions I do believe it’s still within the helper function instead of inline which is not ideal. The guest code using floating point in the first place to me implies some degree of inaccuracy is permissible and this is the position that some cross architecture game emulators take. But again, I suppose it can depend what code you wish to run.

[–] [email protected] 2 points 2 months ago

QEMU is always going to focus on emulation fidelity first and there are few shortcuts. With floating point the differences aren't generally in the numbers but in how the NaNs and other edge cases are handled. If you want to execute FP heavy code you should be cross compiling anyway.

[–] [email protected] 1 points 2 months ago (1 children)

Is there a faster emulator? From my experience qemu is pretty performant. It is especially fast when you use KVM or Hyper-V acceleration

[–] [email protected] 2 points 2 months ago

With KVM performance will be quite good, but when you need to emulate cross architecture? I don’t think there are many alternatives that support the entire VM. I only know of user space tools that are focused on emulating a binary.

[–] [email protected] 4 points 2 months ago (2 children)
[–] [email protected] 24 points 2 months ago (1 children)
[–] [email protected] 22 points 2 months ago
[–] [email protected] 14 points 2 months ago (1 children)
[–] [email protected] 6 points 2 months ago (2 children)

Yeah, but I think the context of why this is a post is lost on me.

[–] [email protected] 15 points 2 months ago* (last edited 2 months ago) (1 children)

Look at the CPU arch. I'm running a x86_64 VM on Arm in termux

[–] [email protected] 2 points 2 months ago

Dude, don't be a killjoy.

[–] [email protected] 4 points 2 months ago (1 children)

Cool! how's the performance?

[–] [email protected] 5 points 2 months ago

Slow...

I think it might be better to use aarch64 for the guest. I'll have to play around

[–] [email protected] 1 points 2 months ago (1 children)

I imagine it runs much more nicely than UTM SE on iOS. I was never able to get UTM JIT to work.

Honestly, I want to jump ship from Apple, but I'm not in a position to do so at this time.

[–] [email protected] 3 points 2 months ago (1 children)

A locked down ecosystem is not exactly good for hacking. Apple aggressively blocks outside software

[–] [email protected] 1 points 2 months ago

Precisely. Spoken like a true 25% Vulcan.

[–] [email protected] 0 points 2 months ago (1 children)

This is cool but how long did this take to install? Would Linux phone OSes be better?

[–] [email protected] 3 points 2 months ago (1 children)

A few minutes. I used the cloud image

[–] [email protected] 1 points 2 months ago

Better than i thought. Thank you for sharing.