qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: lepton <ytht.net@gmail.com>
To: qemu-devel@nongnu.org
Cc: linux-kernel@vger.kernel.org
Subject: [Qemu-devel] Some linux kernel with KAISER/KPTI patch can't work under qemu + haxm.
Date: Thu, 4 Jan 2018 14:08:57 -0800	[thread overview]
Message-ID: <CALqoU4wfxotcrh0EE_JAy1_RsMe29VCY0=YqXf=2b7BNEw-PfA@mail.gmail.com> (raw)

It seems for some reason, some linux kernel with KAISER/KPTI patch can't
work with qemu + haxm.
The mainline kernel from Linus is fine. But the patch to 4.4/4.10 doesn't
work.

I am not familiar with HAXM and KPTI either. so not sure if this is a qemu
bug or KPTI bug or haxm bug.

The same kernel works fine under qemu + kvm.

This is the way to reproduce it:

1. Download qemu for windows, follow instructions here:

https://www.qemu.org/2017/11/22/haxm-usage-windows/

2. Build a kernel with KAISER/KPTI,  I am using kernel here:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=linux-4.4.y
Or follow instruction here to build a 4.10 kernel:
https://github.com/IAIK/KAISER/tree/master/KAISER

3. Build an ext2 image which has a simple init:
dd of=img count=8192 bs=4096 if=/dev/zero
mke2fs img
gcc --static -o init init.c
debugfs -R "write init init" -w img
cat init.c
#include <stdio.h>
#include <time.h>

int main()
{
        while(1) {
                printf("This is init %d\n", time(NULL));
                sleep(3600);
        }
}

4. copy kernel and disk image generated from 3 to windows and run it:
qemu-system-x86_64.exe -kernel bzImage -hda img -append "init=/init
root=/dev/sda" -serial stdio -accel hax

You will see kernel panic or "vpu shutdown reqeust" to qemu.

                 reply	other threads:[~2018-01-04 22:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALqoU4wfxotcrh0EE_JAy1_RsMe29VCY0=YqXf=2b7BNEw-PfA@mail.gmail.com' \
    --to=ytht.net@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).