From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: x86/dom0: limit dom0_max_vcpus value Date: Mon, 12 Mar 2012 15:56:21 +0000 Message-ID: <4F5E1CA5.1060103@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000902070804060904080203" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "xen-devel@lists.xensource.com" , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org --------------000902070804060904080203 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit This caused particularly poor performance when booting a server in uniprocessor mode for debugging reasons, and had 4 dom0 vcpus competing for 1pcpus worth of time. -- Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com --------------000902070804060904080203 Content-Type: text/x-patch; name="limit-dom_max_vcpus.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="limit-dom_max_vcpus.patch" # HG changeset patch # Parent 5d20d2f6ffed0a49f030f04a8870f1926babbcbf x86/dom0: limit dom0_max_vcpus value The command line parameter "dom0_max_vcpus" is useful on large servers where dom0 does not want many vcpus, as an alternative to booting and hot-unplugging down to a sensible number (which is poor memory-wize as many drivers allocate large per-cpu buffers which will never be used after the hot-unplug). However, as the code currently stands, the value for "dom0_max_vcpus" is used as an absolute value rather than a maximum, resulting in dom0 getting more vcpus than pcpus. This can lead to unexpected poor performance. Therefore, augment the "opt_dom0_max_vcpus == 0" test to also check whether the user specified parameter is greater than the number of available pcpus. Signed-off-by: Andrew Cooper diff -r 5d20d2f6ffed xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -87,8 +87,9 @@ integer_param("dom0_max_vcpus", opt_dom0 struct vcpu *__init alloc_dom0_vcpu0(void) { - if ( opt_dom0_max_vcpus == 0 ) - opt_dom0_max_vcpus = num_cpupool_cpus(cpupool0); + int nr_pcpus = num_cpupool_cpus(cpupool0); + if ( opt_dom0_max_vcpus == 0 || opt_dom0_max_vcpus > nr_pcpus) + opt_dom0_max_vcpus = nr_pcpus; if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) opt_dom0_max_vcpus = MAX_VIRT_CPUS; --------------000902070804060904080203 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --------------000902070804060904080203--