Skip to contentSkip to conversation

hvm-stub for ia64

RFC [email protected] 3 participants 14 messages Nov 22, 2007 – Nov 27, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

this is my initial work on hvm-stub domains.
HVM-stub domains are a mix of PV and HVM: it requires VT extension but look externally as a PV domain.

All the io emulation is done within the domain by a stub firmware. This layer translates raw IO accesses to PV commands, ie it can run unmodified linux without running qemu-dm.

Currently it works only for ia64 and can boot linux (serial console). I cross-post to xen-devel because I can be of a general interest.

I'd plan to submit patches soon but here is a preview.

Part 1: tools/ - modification to start an hvmstub domain (small) Part 2: xen/ - IO reflection (small)
Part 3: extra/stubfw - stub firmware (large)

Change to common files are rather small and this is a good news. The stub firmware is more a proof of concept and need serious enhancement. It is just minimal to be able to boot linux (ie serial console and one ide disk).

I am not sure where should go stubfw, so if anyone has suggestions...

Comments are welcome,
Tristan.

#1 lore raw
Quoted 10 lines · On 22/11/07 03:59, "[email protected]" <[email protected]> wrote:

Part 1: tools/ - modification to start an hvmstub domain (small) Part 2: xen/ - IO reflection (small)
Part 3: extra/stubfw - stub firmware (large)

Change to common files are rather small and this is a good news. The stub firmware is more a proof of concept and need serious enhancement. It is just minimal to be able to boot linux (ie serial console and one ide disk).

I am not sure where should go stubfw, so if anyone has suggestions...

Does the hvmstub have to look different to an hvm guest from the p.o.v. of the tools? It's rather a shame to introduce a third kind of domain at that level.

How do you think this appraoch compares with a separate stub domain per HVM guest? That's the approach being developed on the x86 side, but it would be nice to not increase divergence between x86 and ia64.

-- Keir

#2 lore raw

Quoting Keir Fraser <[email protected]>:

Quoted 3 lines

Does the hvmstub have to look different to an hvm guest from the p.o.v. of the tools? It's rather a shame to introduce a third kind of domain at that level.

There are of course differences: qemu shouldn't be started. And the builder C function is different. I can try to merge with the hvm builder function but I am not sure it is worth. The amount of new code is still rather small for tools.

Quoted 3 lines

How do you think this appraoch compares with a separate stub domain per HVM guest? That's the approach being developed on the x86 side, but it would be nice to not increase divergence between x86 and ia64.

I think my approach is much more simpler. Just look at the amount of new code for hypervisor and tools: very small.

There is nothing ia64 specific in hvmstub. For performance, it requires cheap virtual to physical (ie switching paging on and off) transitions in the guest, but I think this is already true for x86.

The real work is in the stub firmware which could be partially shared between x86 and ia64. However I'd also like to implement more realistic machine emulation for ia64 in order to be able to run more OSes.

Tristan.

#3 lore raw
Quoted 7 lines · On 22/11/07 09:31, "[email protected]" <[email protected]> wrote:
Quoted 3 lines

Does the hvmstub have to look different to an hvm guest from the p.o.v. of the tools? It's rather a shame to introduce a third kind of domain at that level.

There are of course differences: qemu shouldn't be started. And the builder C function is different. I can try to merge with the hvm builder function but I am not sure it is worth. The amount of new code is still rather small for tools.

Presumably the old HVM builder for ia64 becomes dead code though? So really this is the 'new' hvm building path. Do you need to support the old way (on ia64) if this is checked in?

Quoted 5 lines
Quoted 3 lines

How do you think this appraoch compares with a separate stub domain per HVM guest? That's the approach being developed on the x86 side, but it would be nice to not increase divergence between x86 and ia64.

I think my approach is much more simpler. Just look at the amount of new code for hypervisor and tools: very small.

I doubt the magnitude of changes in tools/hypervisor is different between the two approaches. It might even be smaller in the separate domain approach.

-- Keir

#4 lore raw

Quoting Keir Fraser <[email protected]>:

Quoted 5 lines · On 22/11/07 09:31, "[email protected]" <[email protected]> wrote:

Presumably the old HVM builder for ia64 becomes dead code though? So really this is the 'new' hvm building path. Do you need to support the old way (on ia64) if this is checked in?

Yes, I don't plan to remove the old way on ia64. I have not implemented a VGA in the stub firmware and I don't plan to do it soon. Only Windows requires a VGA and I don't have Windows for ia64.

Quoted 3 lines

I doubt the magnitude of changes in tools/hypervisor is different between the two approaches. It might even be smaller in the separate domain approach.

We are speaking about around 200 lines of code in the hypervisor and slightly more for tools (300 lines mostly ia64 specific), right ?

Is the stub domain code already available ? I'd like to have a look.

Tristan.

#5 lore raw
Quoted 7 lines · On 22/11/07 10:00, "[email protected]" <[email protected]> wrote:
Quoted 3 lines

I doubt the magnitude of changes in tools/hypervisor is different between the two approaches. It might even be smaller in the separate domain approach.

We are speaking about around 200 lines of code in the hypervisor and slightly more for tools (300 lines mostly ia64 specific), right ?

Is the stub domain code already available ? I'd like to have a look.

No, it's not released yet. But same as your approach, all the complexity is in the stub.

-- Keir

#6 lore raw
In reply to [email protected]
Quoted 9 lines · [email protected], le Thu 22 Nov 2007 11:00:24 +0100, a écrit :

Quoting Keir Fraser <[email protected]>:

Quoted 5 lines · On 22/11/07 09:31, "[email protected]" <[email protected]> wrote:

Presumably the old HVM builder for ia64 becomes dead code though? So really this is the 'new' hvm building path. Do you need to support the old way (on ia64) if this is checked in?

Yes, I don't plan to remove the old way on ia64. I have not implemented a VGA in the stub firmware and I don't plan to do it soon.

That's the main difference between your approach (reimplement a firmware) and the approach being developped here at XenSource (embed qemu in a tiny stubdomain). Your VMX work in Xen is most probably something useful, but reimplementing the hardware emulation support of qemu looks to me like duplicate work. I haven't ported my stubdomain to ia64 yet, but that shouldn't be very hard now that it works for x86.

Samuel

#7 lore raw

Quoting Samuel Thibault <[email protected]>:

Quoted 5 lines

That's the main difference between your approach (reimplement a firmware) and the approach being developped here at XenSource (embed qemu in a tiny stubdomain). Your VMX work in Xen is most probably something useful, but reimplementing the hardware emulation support of qemu looks to me like duplicate work.

Of course it doesn't reimplement the emulation. The current biggest emulation is the IDE and I have copied ide.c from qemu and made almost no modification.

The advantage is my approach is no need for scheduling between two domains for hardware emulation. With the current hvm model, I reach the EFI prompt in about 10sec. With my hvmstub it took less than 2 seconds. Very pleasant to use!

Tristan.

#8 lore raw
Quoted 10 lines · [email protected], le Thu 22 Nov 2007 12:12:31 +0100, a écrit :

Quoting Samuel Thibault <[email protected]>:

Quoted 5 lines

That's the main difference between your approach (reimplement a firmware) and the approach being developped here at XenSource (embed qemu in a tiny stubdomain). Your VMX work in Xen is most probably something useful, but reimplementing the hardware emulation support of qemu looks to me like duplicate work.

Of course it doesn't reimplement the emulation. The current biggest emulation is the IDE and I have copied ide.c from qemu and made almost no modification.

That's still forking. And you'll also need to do it for vga, network, ...

Quoted 2 lines

The advantage is my approach is no need for scheduling between two domains for hardware emulation.

Ah, yes, on ia64 you have room to load your firmware in the domain itself, which makes an extra benefit (with the stubdomain we avoid the need for linux scheduling, but not the need for xen scheduling).

Quoted 2 lines

With the current hvm model, I reach the EFI prompt in about 10sec. With my hvmstub it took less than 2 seconds.

And I wonder how much it would take with a stub domain, probably somewhere in between.

Samuel

#9 lore raw

Quoting Samuel Thibault <[email protected]>:

Quoted 9 lines
Quoted 2 lines · [email protected], le Thu 22 Nov 2007 12:12:31 +0100, a écrit :

Quoting Samuel Thibault <[email protected]>:
Of course it doesn't reimplement the emulation. The current biggest

emulation

Quoted 1 line

is the IDE and I have copied ide.c from qemu and made almost no

modification.

That's still forking. And you'll also need to do it for vga, network, ...

To be fair, I'd need to know better how stubdomain is implemented.

Quoted 6 lines
Quoted 2 lines

The advantage is my approach is no need for scheduling between two domains for hardware emulation.

Ah, yes, on ia64 you have room to load your firmware in the domain itself, which makes an extra benefit (with the stubdomain we avoid the need for linux scheduling, but not the need for xen scheduling).

Should be the same on x86. Firmware is loaded between 4GB-16MB and 4GB. Enough room for stub firmware and EFI.

Tristan.

#10 lore raw

Hi,

Quoted 4 lines · [email protected], le Thu 22 Nov 2007 14:04:47 +0100, a écrit :

Quoting Samuel Thibault <[email protected]>:

Quoted 3 lines
Quoted 2 lines · [email protected], le Thu 22 Nov 2007 12:12:31 +0100, a écrit :

Quoting Samuel Thibault <[email protected]>:
Of course it doesn't reimplement the emulation. The current biggest

Quoted 8 lines
Quoted 6 lines

emulation

Quoted 1 line

is the IDE and I have copied ide.c from qemu and made almost no

modification.

That's still forking. And you'll also need to do it for vga, network, ...

To be fair, I'd need to know better how stubdomain is implemented.

It's actually "just" a matter of compiling qemu against newlib, mini-os and lwIP and make that run as a kernel in its own domain. That way it's just the same code as the usual dm approach and mini-os, with some #ifdefs.

Samuel

#11 lore raw
Quoted 6 lines · Samuel Thibault

Hi,

It's actually "just" a matter of compiling qemu against newlib, mini-os and lwIP and make that run as a kernel in its own domain. That way it's just the same code as the usual dm approach and mini-os, with some #ifdefs.

I suppose you had to add vbd and full vif to mini-os ? VGA will only be available with vnc ?

I suppose you also have to do a double save-and-restore ?

Tristan.

#12 lore raw

Hello,

Quoted 6 lines · Tristan Gingold, le Fri 23 Nov 2007 04:30:53 +0100, a écrit :
Quoted 4 lines · Samuel Thibault

It's actually "just" a matter of compiling qemu against newlib, mini-os and lwIP and make that run as a kernel in its own domain. That way it's just the same code as the usual dm approach and mini-os, with some #ifdefs.

I suppose you had to add vbd and full vif to mini-os ?

Yes, and they will profit whichever project using mini-os.

Quoted 1 line

VGA will only be available with vnc ?

I only tested vnc for now, but I can't see a reason why vfb shouldn't work.

Quoted 1 line

I suppose you also have to do a double save-and-restore ?

Of the domain states when saving/restoring them you mean?

Samuel