Saturday, January 30, 2016

sun4v in QEMU



Back in 2012 I played with sun4v emulation in QEMU, using it mostly instead of pain killers to get some distraction from a broken leg. The project was considered to be a toy, since I hadn’t expected to get it far enough to be useful for anything. I got it up to the OBP ok prompt, so it’s been sort of already useful at least for playing with post-sun4u OpenBoot and Forth.

Now I’m considering tidying up the code and submitting it upstream.  Tell you what.  Cleaning up the old code is pain. The usual problem with the quick and dirty code that you write once intending to throw it away immediately is that for whatever reasons this code is not thrown away in the 99% of cases. Instead it finds its way into production systems where it lives years and years.

So, a note to myself and the two other guys reading this blog: use a version control system (preferably git :-) ) for any project lasting more than 8 hours. Do it regardless whether you think you never going to need it.  I used to think a week is a good threshold, but even one week is way too much (and if you worked that week something like 16 hours a day, sorting out the mess you created would require some weeks).

Anyway, I’m back to my sun4v experiments.  How many weekends it’ll take to get it into a good shape? Let’s see.

Stay tuned.

12 comments:

veganman said...

I think we're a few more than 2 interested in having sun4v in qemu :)

Anonymous said...

Hi

It would be great to have sun4v in qemu... BTW Have any of you tried building qemu on s SPARC powered machine ? Is KVM geared towards x86 specifically or can we use it in conjunction with qemu also on other architectures ?

Sorry for lame questions... I am just a user not a programmer/geek...

Piotr

Anonymous said...

I am lame to such an extent... Google is (not) my friend...

Wikipedia states:
KVM originally supported x86 processors and has been ported to S/390,[5] PowerPC,[6] and IA-64. An ARM port was merged during the 3.9 kernel merge window.

So regarding KVM, the answer is there... Nevertheless, I still cannot find any info on compiling and using qemu-system-* on a SPARC powered machine... I would imagine it would run suuuuper slow, nevertheless curiosity is still here...

atar said...

In theory there is a SPARC backend for TCG, so it should work. Also afaik it was packaged in MartUX or NataMar OpenSolaris distributions with some patches. I've never tried it and don't know the details, as I usually work on the reverse problem. :-)

Anonymous said...

keep us updated artyom

Anonymous said...

are you currently able to run solaris? if so which version?

atar said...

I think, I'm able to run all Solaris versions from 1.1.2 to 11 (there are some untested versions, for example I think I haven't tried 2.5 as it's known to be buggy and used 2.5.1 instead). The versions 1.1.2 to 9 work under sun4m emulation, the versions 10 and 11 work under a sun4u prototype. The sun4v emulation I'm talking here can not boot Solaris yet.

But once it works it should be capable of booting the OpenSPARC Solaris 10 image.

Why do you ask? ;-)

Anonymous said...

Artyom !

Privet ! I almost missed the this: "... the versions 10 and 11 work under a sun4u prototype."

Damn ! This is great news and now the big question is... When will this see the light ? I assume you and other guilty parties have been working on it for some time...

Did I tell you, how much I admire your skills ?

veganman said...

"But once it works it should be capable of booting the OpenSPARC Solaris 10 image.
Why do you ask? ;-)"

I have some software which runs only on Solaris 10/sparc and above which I would _really_ like to run in a vm; as opposed to bare metal.

Can you run Debian/sparc64 on sunv in qemu?

atar said...

veganman, haven't tried Debian under the sun4v emulation. I think in this particular case it's easier to start directly with Solaris 10 emulation.
I'm collecting the use cases. May I ask what is the software you'd prefer to run virtualized?

anonymous, currently I have no plans on releasing the sun4u prototype.

Partha Pratim Das said...

Hi,

I'm writing to you to seek help.

Let me explain my issue in a bit detail.
The physical server (sun ultrasparc 250) had a sudden mainboard failure.
It was sunning solaris 7 as os , sybase 11 as databse and about 25 forms in sybase as app.

The scsi disks are luckily intact and I have been able to prepare DD images of each of them.
3 disks of 4 gb each & a 8 gb (total 20 gb) .

I think qemu might be a good emulator that will allow me to run the system in emulated mode and boot using the DD images mounted / converted as raw disks.

Thus it would allow us to run the legacy application on modern hardware.

Please share your thoughts as to weather this would be possible ? and if you can assist us with this migration.

Please help us out if possible. We can talk about commercials by mail.

Looking forward to your reply.

Thank you

parthapratimdas@cts.net.in

atar said...

Hi,

yes this is possible. But a migration project for a single server is likely to be too expensive. Used Sun Servers are cheap on eBay.

Will contact you off-line.