kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 3/3] x86: Support environments without test-devices
Date: Mon, 15 Jul 2019 17:48:12 +0200	[thread overview]
Message-ID: <20190715154812.mlw4toyzkpwsfrfm@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20190628203019.3220-4-nadav.amit@gmail.com>

On Fri, Jun 28, 2019 at 01:30:19PM -0700, Nadav Amit wrote:
> Enable to run the tests when test-device is not present (e.g.,
> bare-metal). Users can provide the number of CPUs and ram size through
> kernel parameters.

Can you provide multiboot a pointer to an initrd (text file) with
environment variables listed instead? Because this works

$ cat x86/params.c 
#include <libcflat.h>
int main(void)
{
    printf("nr_cpus=%ld\n", atol(getenv("NR_CPUS")));
    printf("memsize=%ld\n", atol(getenv("MEMSIZE")));
    return 0;
}

$ cat params.initrd 
NR_CPUS=2
MEMSIZE=256

$ qemu-system-x86_64 -nodefaults -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 -vnc none -serial stdio -device pci-testdev -machine accel=kvm -kernel x86/params.flat -initrd params.initrd
enabling apic
enabling apic
nr_cpus=2
memsize=256


This works because setup_multiboot() looks for an initrd, and then,
if present, it gets interpreted as a list of environment variables
which become the unit tests **envp.

Thanks,
drew

> 
> On Ubuntu, for example, the tests can be run by copying a test to the
> boot directory (/boot) and adding a menuentry to grub (editing
> /etc/grub.d/40_custom):
> 
>   menuentry 'idt_test' {
> 	set root='ROOT'
> 	multiboot BOOT_RELATIVE/idt_test.flat ignore nb_cpus=48 \
> 		ram_size=4294967296 no-test-device
>   }
> 
> Replace ROOT with `grub-probe --target=bios_hints /boot` and
> BOOT_RELATIVE with `grub-mkrelpath /boot`, and run update-grub.
> 
> Note that the first kernel parameter is ignored for compatibility with
> test executions through QEMU.
> 

  parent reply	other threads:[~2019-07-15 15:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 20:30 [kvm-unit-tests PATCH 0/3] x86: Running tests on bare-metal Nadav Amit
2019-06-28 20:30 ` [kvm-unit-tests PATCH 1/3] libcflat: use stdbool Nadav Amit
2019-07-02 16:08   ` Paolo Bonzini
2019-06-28 20:30 ` [kvm-unit-tests PATCH 2/3] x86/vmx: Use plus for positive filters Nadav Amit
2019-06-28 20:30 ` [kvm-unit-tests PATCH 3/3] x86: Support environments without test-devices Nadav Amit
2019-07-02 16:08   ` Paolo Bonzini
2019-07-02 16:43     ` Nadav Amit
2019-07-02 17:24       ` Paolo Bonzini
2019-07-02 17:45         ` Nadav Amit
2019-07-02 18:28           ` Paolo Bonzini
2019-07-02 23:39             ` Nadav Amit
2019-07-02 23:56               ` Nadav Amit
2019-07-03  5:39               ` Paolo Bonzini
2019-07-03  6:09                 ` Nadav Amit
2019-07-15 15:48   ` Andrew Jones [this message]
2019-07-15 18:08     ` Nadav Amit
2019-07-15 18:26       ` Paolo Bonzini
2019-07-15 18:43         ` Nadav Amit
2019-07-15 18:54           ` Paolo Bonzini
2019-07-21 16:40             ` Nadav Amit
2019-07-21 16:51               ` Paolo Bonzini

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=20190715154812.mlw4toyzkpwsfrfm@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=pbonzini@redhat.com \
    /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).