qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to initiate power-off in quest with new microvm machine type


From: Waldek Kozaczuk
Subject: Re: How to initiate power-off in quest with new microvm machine type
Date: Tue, 12 Nov 2019 21:09:22 -0500

Thanks for your help.

Indeed adding '-no-reboot' to QEMU parameters list and triggering triple-fault in guest did the trick.

Actually the guest OS I am testing on QEMU with microvm is OSv. And with your help, I have just managed to boot OSv on it in under 3ms:

OSv v0.54.0-29-g3357ae07
CmdLine: --nopci /hello
Solaris: NOTICE: Cannot find the pool label for '/dev/vblk0.1'
Booted up in 2.92 ms
Cmdline: /hello
Hello from C code

real 0m0.056s
user 0m0.040s
sys 0m0.016s

with following qemu configuration:

qemu-system-x86_64 -M microvm,x-option-roms=off,pit=off,pic=off,rtc=off \
   -enable-kvm -cpu host,+x2apic -m 32m -smp 1 \
   -kernel loader.elf -append "--nopci /hello" \
   -nodefaults -no-user-config -nographic -no-reboot \
   -gdb tcp::1234,server,nowait \
   -serial stdio

As you can see I am not using any virtio-mmio devices as in this case OSv mounts ramfs drive. But it proves it can boot properly.

I have come across another issue that I am going to describe in a separate email to the group.

Regards,
Waldek

On Tue, Nov 12, 2019 at 11:13 AM Sergio Lopez <address@hidden> wrote:

Paolo Bonzini <address@hidden> writes:

> On 12/11/19 16:48, Sergio Lopez wrote:
>>
>> Peter Maydell <address@hidden> writes:
>>
>>> On Tue, 12 Nov 2019 at 15:22, Waldek Kozaczuk <address@hidden> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am referring to the machine type described here - https://github.com/qemu/qemu/blob/master/docs/microvm.rst. I would like to know how to initiate power-off sequence from a guest given that ACPI is not available. On firecracker the only way is generating Ctrl-Alt-Del keyboard event by writing proper value to the keyboard controller port 0xfe like so:
>>>>
>>>> outb(0x64, 0xfe);
>>>>
>>>> What is the corresponding mechanism on QEMU with microvm machine?
>>
>> To shut down the VM from the guest I can think of two options (that we
>> should probably add to the documentation):
>>
>>  1. Add "-no-reboot" to the QEMU command line (you'd also need this for
>>  the keyboard based method) and trigger a triple fault. If you're
>>  running Linux, you can make this the default by passing "reboot=t" to
>>  the kernel command line.
>>
>>  2. Add an isa-debug-exit device and write to its port in a similar way
>>  you do with the keyboard. There's no need for adding "-no-reboot" to
>>  the command line, as this will cause QEMU to exit immediately.
>>
>> That said, we can easily add a knob for attaching a i8042 keyboard to
>> the microvm machine type. I'm not entirely convinced that this is really
>> necessary, but if it makes people's life easier, it may be worth it.
>
> I think we should rather add a minimal i8042 device that can only do
> reset (but wouldn't be detected as i8042 by the guest).  But if reboot=t
> works, we could also add it to the automatically-generated command line.

It works even without "reboot=t", but it takes ~5 seconds because Linux
tries other mechanism first.

Sergio.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]