[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 22/27] ts-bench-hostcmp-host-prep: new script
From: Dario Faggioli <raistlin@xxxxxxxx> the goal is to run a benchmark both in a guest and on baremetal, to investigate the performances loss due to the virtualization overhead. In order to help accomplishing this, the new script introduced by this commit modifies the host's boot configuration as follows: - it makes it boot baremetal Linux, rather than Xen and a Dom0 kernel; - it limits the host's pcpus and amount of memory to the values contained in the specific runvars (if defined). This is done under the assumption that the benchmark will (or has been already) run on one (or more) guest(s) too. If the runvars for limiting host's resources are defined, it is assumed that they will be (were) defined, and that they will have (had) the same values, also when prepping the run of the benchmark in the guest. The test script only alter the host's boot config; it is left to the caller to actually reboot the host, and also to restore the old config, if wanted, after the benchmark has been run. Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- Osstest/Debian.pm | 17 ++++++++-- ts-bench-hostcmp-host-prep | 74 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 3 deletions(-) create mode 100755 ts-bench-hostcmp-host-prep diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 70afaec..418d9f2 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -32,6 +32,9 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(debian_boot_setup + setupboot_uboot + setupboot_grub1 + setupboot_grub2 %preseed_cmds preseed_base preseed_create @@ -112,7 +115,7 @@ sub bl_getmenu_open ($$$) { return $f; } -sub setupboot_uboot ($$$) { +sub setupboot_uboot ($$$$) { my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_; my $bl= { }; @@ -194,7 +197,7 @@ END return $bl; } -sub setupboot_grub1 ($$$) { +sub setupboot_grub1 ($$$$) { my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_; my $bl= { }; @@ -274,7 +277,7 @@ sub setupboot_grub1 ($$$) { return $bl; } -sub setupboot_grub2 ($$$) { +sub setupboot_grub2 ($$$$) { my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_; my $bl= { }; @@ -387,6 +390,14 @@ END my $v= $k{$k}; $v =~ s/\bquiet\b//; $v =~ s/\b(?:console|xencons)=[0-9A-Za-z,]+//; + # Get rid of any host/dom0 resource constraining. Idea is: + # (1) in the dom0 case, something like that should be achieved + # via Xen boot parameters; (2) in any case, if it is important + # to have something like these in Linux's boot cmd line by + # default, that should be put into the 'linux_boot_append' + # runvar, which won't be affected by this. + $v =~ s/\bmaxcpus=[0-9A-Za-z,]+//; + $v =~ s/\bmem=[0-9A-Za-z,]+//; $v .= " $xenkopt" if $k eq 'GRUB_CMDLINE_LINUX'; print ::EO "$k=\"$v\"\n" or die $!; } diff --git a/ts-bench-hostcmp-host-prep b/ts-bench-hostcmp-host-prep new file mode 100755 index 0000000..493d948 --- /dev/null +++ b/ts-bench-hostcmp-host-prep @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2014 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict qw(vars); +use DBI; +use Osstest; +use Osstest::Debian; +use Osstest::TestSupport; + +tsreadconfig(); + +our ($whhost) = @ARGV; +$whhost ||= 'host'; +our $ho= selecthost($whhost); + +# We want to boot baremetal Linux on the host, +# to compare against it. +sub fixup () { + my ($bl,$bootkern); + my ($hcpus,$hmem,$hnodes); + my ($bcpus,$bmem); + + target_install_packages_norec($ho, "numactl"); + + $hcpus= get_host_cpus($ho); + $hmem= get_host_memory($ho); + die unless (defined $hcpus and defined $hmem); + + $hnodes= get_host_numanodes($ho); + if (defined $hnodes and $hnodes > 1) { + logm("WARNING: the host has $hnodes NUMA nodes. This may spoil results"); + } + + $bcpus= (!defined($r{'max_bench_cpus'})) ? $hcpus : + ($r{'max_bench_cpus'} > $hcpus) ? $hcpus : $r{'max_bench_cpus'}; + $bmem= (!defined($r{'max_bench_mem'})) ? $hmem : + ($r{'max_bench_mem'} > $hmem) ? $hmem : $r{'max_bench_mem'}; + die unless (defined $bcpus and defined $bmem); + + logm("Will run the benchmark on host with: $bcpus vcpus and $bmem MB RAM"); + + my $kernver= get_runvar('kernel_ver',$r{'kernbuildjob'}); + my $kopt= "maxcpus=$bcpus mem=$bmem" . "M"; + + if ($ho->{Flags}{'need-uboot-bootscr'}) { + $bl= setupboot_uboot($ho,$kernver,undef,$kopt); + } elsif ($ho->{Suite} =~ m/lenny/) { + $bl= setupboot_grub1($ho,$kernver,undef,$kopt); + } else { + $bl= setupboot_grub2($ho,$kernver,undef,$kopt); + } + + $bootkern= $bl->{PreFinalUpdate}(); + $bl->{UpdateConfig}($ho); + + $bootkern= $bl->{GetBootKern}(); + logm("$ho->{Name} will reboot on kernel $bootkern with '$kopt' as options"); +} + +fixup(); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |