Skip to contentSkip to conversation

user emulation status?

Qemu-devel Tomasz Chmielewski 9 participants 12 messages Sep 7, 2008 – Sep 9, 2008 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

According to the list of supported guest OSes on http://bellard.org/qemu/status.html, these architectures have "OK/green" status for user emulation:

x86, ARM, SPARC, PPC, MIPS, m68k, SH-4.

If these architectures are really fully supported by Qemu, it should be possible to run a chroot of another architecture (i.e. on x86 we chroot to ARM base filesystem/pcakages).

I thought I'd give it a try, with current Qemu SVN, by installing Debian for different architectures with debootstrap command (debootstrap allows to install base filesystem/packages).

Debian Etch supports ARM, SPARC, PPC and MIPS, so I only tested those on x86 PC.

Results:

1. ARM - support is really great.
debootstrap installs base filesystem/packages without any errors in an ARM chroot made on x86 PC. It's even possible to start some GUI applications.

2. MIPS - support is not so great.
It's not possible to install a base filesystem.
Chrooting from x86 to an already existing MIPS filesystem works, but lots of commands just break (i.e., dpkg exits with "Invalid argument"; some stracing reveals more details).

3. PPC
Chrooting from x86 to a PPC filesystem ends with a segmentation fault.

4. SPARC
Chrooting from x86 to a SPARC filesystem works, but it's only possible to start one command. After that, qemu-sparc process dies with HELPME... (I used the default --sparc_cpu).

Are you people interested in running processes in a foreign chroot (i.e. ARM chroot on x86 PC)?

I wanted to set up some daily automated tests which would fetch current SVN, build for ARM, MIPS, PPC and SPARC targets, try to install Debian with debootstrap in a chroot.

So far I see though, that only ARM would get "OK" result, MIPS would get "partial"; PPC and SPARC would fail.

Does it make sense to trace it on a daily basis?

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org
#1 lore raw
Quoted 2 lines · Tomasz Chmielewski

Are you people interested in running processes in a foreign chroot (i.e. ARM chroot on x86 PC)?

Yes. I port ALT Linux to ARM using qemu-arm.

Quoted 9 lines

I wanted to set up some daily automated tests which would fetch current SVN, build for ARM, MIPS, PPC and SPARC targets, try to install Debian with debootstrap in a chroot.

So far I see though, that only ARM would get "OK" result, MIPS would get "partial"; PPC and SPARC would fail.

Does it make sense to trace it on a daily basis?

Better weekly basis.

linux-user emulation has no active maintainer, so I don't think that something change dramatically in one day. I have posted patches some week ago but have no answer. :(

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/
#2 lore raw
In reply to Tomasz Chmielewski
Quoted 27 lines · Tomasz Chmielewski

According to the list of supported guest OSes on
http://bellard.org/qemu/status.html, these architectures have "OK/green" status for user emulation:

x86, ARM, SPARC, PPC, MIPS, m68k, SH-4.

If these architectures are really fully supported by Qemu, it should be possible to run a chroot of another architecture (i.e. on x86 we chroot to ARM base filesystem/pcakages).

I thought I'd give it a try, with current Qemu SVN, by installing Debian for different architectures with debootstrap command (debootstrap allows to install base filesystem/packages).

Debian Etch supports ARM, SPARC, PPC and MIPS, so I only tested those on x86 PC.

Results:

1. ARM - support is really great.
debootstrap installs base filesystem/packages without any errors in an ARM chroot made on x86 PC.
It's even possible to start some GUI applications.

Quoted 5 lines

2. MIPS - support is not so great.
It's not possible to install a base filesystem.
Chrooting from x86 to an already existing MIPS filesystem works, but lots of commands just break (i.e., dpkg exits with "Invalid argument"; some stracing reveals more details).

I concentrate mostly on the MIPS system emulation. I figure the usermode emulation needs a fair bit of debugging, particularily the 64-bit variants.

Thiemo

#3 lore raw
In reply to Tomasz Chmielewski
Quoted 2 lines · Tomasz Chmielewski

Debian Etch supports ARM, SPARC, PPC and MIPS, so I only tested those on x86 PC.

Notice that etch doesn't use many of new syscalls introduced recently, and doesn't use TLS/NPTL on many archs. So it's not really a very hard test for qemu-user.

Quoted 2 lines

Are you people interested in running processes in a foreign chroot (i.e. ARM chroot on x86 PC)?

Yes. And I need to get my lazy ass off and start cleaning maemo/debian linux-user patches and propose them here.

Quoted 3 lines

I wanted to set up some daily automated tests which would fetch current SVN, build for ARM, MIPS, PPC and SPARC targets, try to install Debian with debootstrap in a chroot.

Since what we are actually emulating, is linux kernel syscall interface, the most exhaustive test would be LTP. but debootstrapping debian is good smoketest. Other nice tests could be perl/python/glibc testsuites.

Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
#4 lore raw
Quoted 6 lines · Riku Voipio
Quoted 1 line · Tomasz Chmielewski

Debian Etch supports ARM, SPARC, PPC and MIPS, so I only tested those on x86 PC.

Notice that etch doesn't use many of new syscalls introduced recently, and doesn't use TLS/NPTL on many archs. So it's not really a very hard test for qemu-user.

Even then, ARM user emulation seem to be the only one fully working. I tried also Lenny on ARM, it had some minor problems, but was working.

I could add Lenny to the testing suite, it's not a problem.

Quoted 10 lines
Quoted 1 line

Are you people interested in running processes in a foreign chroot (i.e. ARM chroot on x86 PC)?

Yes. And I need to get my lazy ass off and start cleaning maemo/debian linux-user patches and propose them here.

Quoted 1 line

I wanted to set up some daily automated tests which would fetch current SVN, build for ARM, MIPS, PPC and SPARC targets, try to install Debian with debootstrap in a chroot.

Since what we are actually emulating, is linux kernel syscall interface, the most exhaustive test would be LTP. but debootstrapping debian is good smoketest. Other nice tests could be perl/python/glibc testsuites.

My motivation for running a "foreign chroot" is basically "apt-get update; apt-get upgrade" for some filesystem images I use on embedded devices running Debian.

It's easier and faster to do so on a PC than on real hardware or in qemu-system emulation.

Running LTP might be a good idea for running on those architectures that pass the "debootstrap smoketest".

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org
#5 lore raw
In reply to Riku Voipio
Quoted 3 lines · Riku Voipio

Since what we are actually emulating, is linux kernel syscall interface, the most exhaustive test would be LTP. but debootstrapping debian is good smoketest. Other nice tests could be perl/python/glibc testsuites.

You can find statically linked LTP binaries for a few architectures at http://qemu.olmeclinux.com/ltp/. These are what I have been using for qemu debugging for a long time now. These are statically linked so they
can be run standalone and not require setting up the chroot, etc.

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Hi,

is there a place to put testresults for svn snapshots?

Martin

Quoted 41 lines · Martin Mohring

Hi,

I am one of the developers of the openSUSE Buildservice (OBS), and also the maintainer of the developer/test packages for OBS. OBS is an automated system for compiling, testing and distributing packages, projects and even complete distribtions on basis of .rpm or .deb architectures (even windows/solaris/macos planned). Currently, we support build for all major linux distribtions Fedora, openSUSE, Debian, RHEL, SLES and Ubuntu.

Recently, I have added support for cross-build to OBS, our first target was Debin:Etch/arm and Maemo 4.1. I could now successfully setup a buildenvironment for Debian:Etch/arm and compile lots of the packages. The cross-build support we have implemented is based on: see these two articles here <http://lizards.opensuse.org/2008/08/31/hackweek-day-2-cross-build-with-obs-part-1/> and here <http://lizards.opensuse.org/2008/09/01/hackweek-day-3-cross-build-with-obs-part-2/>. In the meantime, we have now a completely automated patch, so we can use the normal OBS scheduler and so on (the only remaining issues were the fakeroot-tcp vs. fakeroot-sysv and the /proc/sys/vm/mmap_min_addr issue).

To sum it up, our OBS can instantiate all linux distributions you can think of in a chroot (even on basis of the original prebuild binary .rpm or .deb), and can though be ideally be used for testing qemu in all situations you can think of. Since we do not want to use qemu system emulation for the obvious reasons, we would like qemu user mode to just work.

I would be happy to share with you your patches for qemu-arm user mode to get Debian/Maemo builds working.

I wrote already an e-mail on this here, but no reaction. Also, I am too busy atm with development.

Martin

Quoted 25 lines · Riku Voipio
Quoted 2 lines · Tomasz Chmielewski

Debian Etch supports ARM, SPARC, PPC and MIPS, so I only tested those on x86 PC.

Notice that etch doesn't use many of new syscalls introduced recently, and doesn't use TLS/NPTL on many archs. So it's not really a very hard test for qemu-user.

Quoted 2 lines

Are you people interested in running processes in a foreign chroot (i.e. ARM chroot on x86 PC)?

Yes. And I need to get my lazy ass off and start cleaning maemo/debian linux-user patches and propose them here.

Quoted 2 lines

I wanted to set up some daily automated tests which would fetch current SVN, build for ARM, MIPS, PPC and SPARC targets, try to install Debian with debootstrap in a chroot.

Since what we are actually emulating, is linux kernel syscall interface, the most exhaustive test would be LTP. but debootstrapping debian is good smoketest. Other nice tests could be perl/python/glibc testsuites.

#8 lore raw
In reply to Tomasz Chmielewski
Quoted 2 lines · Tomasz Chmielewski

3. PPC
Chrooting from x86 to a PPC filesystem ends with a segmentation fault.

It works fine for me with non-NPTL binaries. Sadly this is not too useful, since most PPC binary nowadays uses NPTL.

This issue was already reported by me a few weeks ago, as well as by the SuSE guys a bit later.

AFAIK NPTL only works fine only on ARM ATM.

#9 lore raw
Quoted 6 lines · Miklos Vajna
Quoted 3 lines · Tomasz Chmielewski

3. PPC
Chrooting from x86 to a PPC filesystem ends with a segmentation fault.

Quoted 8 lines

It works fine for me with non-NPTL binaries. Sadly this is not too useful, since most PPC binary nowadays uses NPTL.

This issue was already reported by me a few weeks ago, as well as by the SuSE guys a bit later.

AFAIK NPTL only works fine only on ARM ATM.

The guys porting BSD user mode told us that was astonished that syscall handling in linux does not use common code. Now I am a bit stonished too. Are things like syscalls and even more nptl not handled in common code? Or is the non common code just not implemented?

#10 lore raw
Quoted 6 lines
Quoted 1 line

AFAIK NPTL only works fine only on ARM ATM.

The guys porting BSD user mode told us that was astonished that syscall handling in linux does not use common code. Now I am a bit stonished too. Are things like syscalls and even more nptl not handled in common code? Or is the non common code just not implemented?

The kenrel/userspace interface for NPTL is actually very small. There's a few extra arguments to clone, TLS register handling and synchronization primitives.

The clone arguments are pretty much the same on all architectures. Variations tend to be minor tweaks to do with passing a large number of arguments to a syscall.

Pretty much every architecture has its own mechanism for providing a TLS register. Some have dedicated hardware registers for this purpose, others use a variety of tricks to provide the value. qemu needs to support this before even single threaded NPTL applications will work.

Synchronisation primitives operations come in two halves. futex syscalls which are the same on all targets, and atomic operations which are different for each architecture. To make multithreaded applications work you need to ensure these atomic operations actually appear atomic.

Paul

#11 lore raw

Hi,

Quoted 5 lines · Paul Brook

The kenrel/userspace interface for NPTL is actually very small. There's a few extra arguments to clone, TLS register handling and synchronization primitives.

The clone arguments are pretty much the same on all architectures. Variations tend to be minor tweaks to do with passing a large number of arguments to a syscall.

I change a little bit the qemu code for support nptl on the sh4. I try to send a patch for the clone system call in sh4 (maybe is wrong !?!) and a have a simple filesystem to doing test on this architecture.
I may test nptl support for sh4 or contribute on it?

Regards Michael

#12 lore raw
In reply to Paul Brook
Quoted 7 lines · Paul Brook
Quoted 7 lines
Quoted 2 lines

AFAIK NPTL only works fine only on ARM ATM.

The guys porting BSD user mode told us that was astonished that syscall handling in linux does not use common code. Now I am a bit stonished too. Are things like syscalls and even more nptl not handled in common code? Or is the non common code just not implemented?

Btw, I was one of the "SUSE guys". I can offer testing qemu user by setting up every single chroot you whish (with every single linux distro you whish, not only static chroots). We can do that with our buildsystem now. Do you have a place for testresults, which help the developers?

Quoted 7 lines

The kenrel/userspace interface for NPTL is actually very small. There's a few extra arguments to clone, TLS register handling and synchronization primitives.

The clone arguments are pretty much the same on all architectures. Variations tend to be minor tweaks to do with passing a large number of arguments to a syscall.

Pretty much every architecture has its own mechanism for providing a TLS register. Some have dedicated hardware registers for this purpose, others use a variety of tricks to provide the value. qemu needs to support this before even single threaded NPTL applications will work.

OK, understood. Its using the hardware optimizations provided by the processor isa.

Quoted 2 lines

Synchronisation primitives operations come in two halves. futex syscalls which are the same on all targets, and atomic operations which are different for each architecture. To make multithreaded applications work you need to ensure these atomic operations actually appear atomic.

Ok, understood. Another argument was: If multi-threading is provided, qemu user must be thread-safe itself.