qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>,
	qemu-devel@nongnu.org, imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH] tests/acpi: speedup acpi tests
Date: Tue, 6 Sep 2016 18:51:09 +0300	[thread overview]
Message-ID: <20160906184921-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5362df9c-00f8-adab-ecd2-481a33e84687@redhat.com>

On Tue, Sep 06, 2016 at 05:47:06PM +0200, Paolo Bonzini wrote:
> 
> 
> On 06/09/2016 16:55, Marcel Apfelbaum wrote:
> > Use kvm acceleration if available.
> > 
> > Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> > ---
> > 
> > Hi,
> > 
> > It saves a few seconds so we'll be able to add more tests.
> > I cc-ed Paolo to get his opinion on the correct way to look
> > for the kvm support.
> 
> Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)
> 
> Paolo

Sounds good, but we really need to skip it when gsi
capability is not there (and when using kernel irqchip)
(because in that case we can't override apic irq0).


> > Thanks,
> > Marcel
> > 
> >  tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
> >  1 file changed, 33 insertions(+), 18 deletions(-)
> > 
> > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > index de4019e..c10b356 100644
> > --- a/tests/bios-tables-test.c
> > +++ b/tests/bios-tables-test.c
> > @@ -114,6 +114,7 @@ typedef struct {
> >  
> >  static const char *disk = "tests/acpi-test-disk.raw";
> >  static const char *data_dir = "tests/acpi-test-data";
> > +static bool kvm_enabled;
> >  #ifdef CONFIG_IASL
> >  static const char *iasl = stringify(CONFIG_IASL);
> >  #else
> > @@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
> >      }
> >  }
> >  
> > -static void test_acpi_one(const char *params, test_data *data)
> > +static void test_acpi_one(const char *machine, const char *params,
> > +                          test_data *data)
> >  {
> >      char *args;
> >  
> > -    args = g_strdup_printf("-net none -display none %s "
> > +    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
> >                             "-drive id=hd0,if=none,file=%s,format=raw "
> >                             "-device ide-hd,drive=hd0 ",
> > +                           machine, kvm_enabled ? "kvm" : "tcg",
> >                             params ? params : "", disk);
> >  
> >      qtest_start(args);
> > @@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
> >      data.machine = MACHINE_PC;
> >      data.required_struct_types = base_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
> > -    test_acpi_one("-machine accel=tcg", &data);
> > +    test_acpi_one("pc", NULL, &data);
> >      free_test_data(&data);
> >  }
> >  
> > @@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
> >      data.variant = ".bridge";
> >      data.required_struct_types = base_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
> > -    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
> > +    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
> >      free_test_data(&data);
> >  }
> >  
> > @@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
> >      data.machine = MACHINE_Q35;
> >      data.required_struct_types = base_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
> > -    test_acpi_one("-machine q35,accel=tcg", &data);
> > +    test_acpi_one("q35", NULL, &data);
> >      free_test_data(&data);
> >  }
> >  
> > @@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
> >      data.variant = ".bridge";
> >      data.required_struct_types = base_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
> > -    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
> > +    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
> >                    &data);
> >      free_test_data(&data);
> >  }
> > @@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
> >      memset(&data, 0, sizeof(data));
> >      data.machine = MACHINE_PC;
> >      data.variant = ".cphp";
> > -    test_acpi_one("-machine accel=tcg"
> > +    test_acpi_one("pc",
> >                    " -smp 2,cores=3,sockets=2,maxcpus=6",
> >                    &data);
> >      free_test_data(&data);
> > @@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
> >      memset(&data, 0, sizeof(data));
> >      data.machine = MACHINE_Q35;
> >      data.variant = ".cphp";
> > -    test_acpi_one("-machine q35,accel=tcg"
> > +    test_acpi_one("q35",
> >                    " -smp 2,cores=3,sockets=2,maxcpus=6",
> >                    &data);
> >      free_test_data(&data);
> > @@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
> >      data.variant = ".ipmibt";
> >      data.required_struct_types = ipmi_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
> > -    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
> > +    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
> >                    " -device isa-ipmi-bt,bmc=bmc0",
> >                    &data);
> >      free_test_data(&data);
> > @@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
> >      data.variant = ".ipmikcs";
> >      data.required_struct_types = ipmi_required_struct_types;
> >      data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
> > -    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
> > +    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
> >                    " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
> >                    &data);
> >      free_test_data(&data);
> >  }
> >  
> > +static void check_kvm(void)
> > +{
> > +    int fd = qemu_open("/dev/kvm", O_RDWR);
> > +
> > +    if (fd > 0) {
> > +        kvm_enabled = true;
> > +        qemu_close(fd);
> > +    }
> > +}
> > +
> >  int main(int argc, char *argv[])
> >  {
> >      const char *arch = qtest_get_arch();
> > @@ -873,17 +886,19 @@ int main(int argc, char *argv[])
> >      if(ret)
> >          return ret;
> >  
> > +    check_kvm();
> > +
> >      g_test_init(&argc, &argv, NULL);
> >  
> >      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> > -        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
> > -        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
> > -        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
> > -        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
> > -        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
> > -        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
> > -        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
> > -        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
> > +        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> > +        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> > +        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> > +        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> > +        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> > +        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> > +        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> > +        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> >      }
> >      ret = g_test_run();
> >      boot_sector_cleanup(disk);
> > 

  reply	other threads:[~2016-09-06 15:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 14:55 [Qemu-devel] [PATCH] tests/acpi: speedup acpi tests Marcel Apfelbaum
2016-09-06 15:13 ` Michael S. Tsirkin
2016-09-06 15:22   ` Marcel Apfelbaum
2016-09-06 15:44 ` Marcel Apfelbaum
2016-09-06 15:47 ` Paolo Bonzini
2016-09-06 15:51   ` Michael S. Tsirkin [this message]
2016-09-06 15:54     ` Paolo Bonzini
2016-09-06 16:10       ` Michael S. Tsirkin
2016-09-06 19:11     ` Paolo Bonzini
2016-09-06 19:21       ` Michael S. Tsirkin
2016-09-06 20:22         ` Paolo Bonzini
2016-09-07  1:18           ` Michael S. Tsirkin
2016-09-09 18:43           ` Michael S. Tsirkin
2020-09-22 17:03           ` Eduardo Habkost
2020-09-22 17:17             ` Paolo Bonzini
2020-09-22 17:29               ` Eduardo Habkost
2020-09-22 17:42                 ` Paolo Bonzini
2016-09-06 15:51   ` Marcel Apfelbaum

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=20160906184921-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).