From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [OSSTEST PATCH 1/2] TestSupport.pm: allow creating vNUMA enabled HVM guest configs Date: Fri, 2 Oct 2015 12:32:42 +0100 Message-ID: <20151002113242.GA30122@zion.uk.xensource.com> References: <20151001230750.15271.26071.stgit@Solace.station> <20151001231731.15271.87986.stgit@Solace.station> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZhyaM-0006Rb-O2 for xen-devel@lists.xenproject.org; Fri, 02 Oct 2015 11:33:10 +0000 Content-Disposition: inline In-Reply-To: <20151001231731.15271.87986.stgit@Solace.station> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dario Faggioli Cc: xen-devel@lists.xenproject.org, Wei Liu , Dario Faggioli , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org On Fri, Oct 02, 2015 at 01:17:31AM +0200, Dario Faggioli wrote: > This is done by introducing a new guest runvar, called > 'vnodes', holding, if defined, the number of vNUMA nodes > the guest should have. > > >From that, and basing on the other characteristics of the > guest (namely, amount of RAM and number of vcpus), we build > a vNUMA topology that makes sense. > > For now, we just evenly (well, as evenly as we can) split > resouces between vNUMA nodes. Also, still for now, we > always set things in such a way that all vNUMA nodes are > allocated on physical NUMA node 0. This way, we don't > have to introduce logic to make sure that the test runs > on an actual NUMA host. > > Signed-off-by: Dario Faggioli > --- > Cc: Ian Jackson > Cc: Ian Campbell > Cc: Wei Liu > --- > Osstest/TestSupport.pm | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm > index 2b67e32..bf8bd56 100644 > --- a/Osstest/TestSupport.pm > +++ b/Osstest/TestSupport.pm > @@ -1709,6 +1709,34 @@ sub prepareguest_part_xencfg ($$$$$) { > my $vifmodel= $vif ? "model=$vif," : ''; > my $xoptcfg= $xopts->{ExtraConfig}; > $xoptcfg='' unless defined $xoptcfg; > + > + my $vnumacfg= ''; > + my $vnuma_nodes= guest_var($gho, 'vnodes', $xopts->{DefVnodes} || 1); > + if ($vnuma_nodes > 1 && $vcpus >= $vnuma_nodes) { > + my @vnuma_mem; > + my @vnuma_pnode; > + my @vnuma_vcpus; > + my @vnuma; > + > + my $m= int($ram_mb / $vnuma_nodes); > + @vnuma_mem = map { $_ < $vnuma_nodes ? $m : > + ($ram_mb - ($vnuma_nodes-1) * $m) } (1 .. $vnuma_nodes); > + > + my $v= int($vcpus / $vnuma_nodes); > + @vnuma_vcpus= map { $_ == 0 ? "0-" . ($v-1) : > + $_ == $vnuma_nodes-1 ? ($_ * $v) . "-" . ($vcpus-1) : > + ($_ * $v) . "-" . (($_+1) * $v - 1) } (0 .. $vnuma_nodes-1); > + > + # Let's put all vnodes on pnode 0, as we don't even know (for now) > + # whether or not the host has more NUMA nodes than that! > + @vnuma_pnode = (0) x $vnuma_nodes; > + The thing I worry about putting everything in node 0 is that if we somehow has hardware that has several nodes but each node has relative small amount of ram it would cause this test case to fail. In the current arrangement, HVM guest gets 5G of ram if OSSTest determines the host has enough (2x5G + slack) ram for it. So vnuma test case will fail on a box with 4 nodes but has 16G of ram. Is such hardware configuration not very likely to exist? Wei. > + @vnuma = map { $_ == -1 ? '[' : $_ == $vnuma_nodes ? ']' : > + "[\"pnode=$vnuma_pnode[$_]\",\"size=$vnuma_mem[$_]\",\"vcpus=$vnuma_vcpus[$_]\" ]," } > + (-1 .. $vnuma_nodes); > + $vnumacfg= "vnuma = @vnuma"; > + } > + > my $xencfg= < name = '$gho->{Name}' > memory = ${ram_mb} > @@ -1719,6 +1747,7 @@ on_reboot = '$onreboot' > on_crash = '$oncrash' > # > vcpus = $vcpus > +$vnumacfg > # > $cfgrest > #