From patchwork Wed Sep 13 04:52:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9951067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA0CB60360 for ; Wed, 13 Sep 2017 11:02:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB84728655 for ; Wed, 13 Sep 2017 11:02:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFB0128DD1; Wed, 13 Sep 2017 11:02:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C39228655 for ; Wed, 13 Sep 2017 11:02:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds5Oh-0003Na-Ic; Wed, 13 Sep 2017 10:59:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds5Og-0003N2-JG for xen-devel@lists.xen.org; Wed, 13 Sep 2017 10:59:58 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id E9/42-01754-DAF09B95; Wed, 13 Sep 2017 10:59:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXS1taRoruWf2e kwY19LBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a3LceYC5qEK/q63zM2ML7l62Lk5BASqJR4 u6eLHcSWEOCVOLJsBiuE7S9xY9JZ5i5GLqCaDkaJczcugyXYBNQlTiyeyAhiiwhIS1z7fJkRp IhZYD+TxL6GbrCEsECixII3x5hBbBYBVYmOXXfYQGxeAReJ9kf32CA2KEhMefgerIZTwFWi48 0bFoiLXCS+TX3INIGRdwEjwypGjeLUorLUIl1jA72kosz0jJLcxMwcXUMDU73c1OLixPTUnMS kYr3k/NxNjMCAqGdgYNzBOGGV3yFGSQ4mJVHe/Xt2RArxJeWnVGYkFmfEF5XmpBYfYpTh4FCS 4J3MtzNSSLAoNT21Ii0zBxiaMGkJDh4lEd5lIGne4oLE3OLMdIjUKUZdjo6bd/8wCbHk5eelS onzrgEpEgApyijNgxsBi5NLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5l4JM4cnMK4Hb9A roCCagI86c3gFyREkiQkqqgdHwYMGtx+9W3091urV7ac5ezk2C67dLL8rfe8e7ac3XSzu5Eix e3Nuxglu5u2wLR3BG4pU/9y+q7Jh67H3zh8N2t9YwSC1dbshqfnBaUtbt896t4vMsbGe3MLZ/ 2umYWKg5/U+SbNvGiO2/GZKP8JUcerL0hY2AecHsFWk7dqpHJ2/b2cr8VydPiaU4I9FQi7moO BEAiS9Obo4CAAA= X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1505300394!108491835!1 X-Originating-IP: [134.134.136.100] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_06_12 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40596 invoked from network); 13 Sep 2017 10:59:56 -0000 Received: from mga07.intel.com (HELO mga07.intel.com) (134.134.136.100) by server-6.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Sep 2017 10:59:56 -0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 13 Sep 2017 03:59:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,387,1500966000"; d="scan'208";a="151331461" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.141]) by fmsmga006.fm.intel.com with ESMTP; 13 Sep 2017 03:59:51 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Wed, 13 Sep 2017 00:52:47 -0400 Message-Id: <1505278369-21605-2-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1505278369-21605-1-git-send-email-tianyu.lan@intel.com> References: <1505278369-21605-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , kevin.tian@intel.com, sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com, jbeulich@suse.com, roger.pau@citrix.com, chao.gao@intel.com Subject: [Xen-devel] [RFC PATCH V3 1/3] Xen: Increase hap/shadow page pool size to support more vcpus support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch is to increase page pool size when max vcpu number is larger than 128. Signed-off-by: Lan Tianyu --- xen/arch/arm/domain.c | 5 +++++ xen/arch/x86/domain.c | 25 +++++++++++++++++++++++++ xen/common/domctl.c | 3 +++ xen/include/xen/domain.h | 2 ++ 4 files changed, 35 insertions(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 6512f01..94cf70b 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -824,6 +824,11 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } +int arch_domain_set_max_vcpus(struct domain *d) +{ + return 0; +} + static int relinquish_memory(struct domain *d, struct page_list_head *list) { struct page_info *page, *tmp; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index dbddc53..0e230f9 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1161,6 +1161,31 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } +int arch_domain_set_max_vcpus(struct domain *d) +{ + int ret; + + /* Increase page pool in order to support more vcpus. */ + if ( d->max_vcpus > 128 ) + { + unsigned long nr_pages; + + if (hap_enabled(d)) + nr_pages = 1024; + else + nr_pages = 4096; + + ret = paging_set_allocation(d, nr_pages, NULL); + if ( ret != 0 ) + { + paging_set_allocation(d, 0, NULL); + return ret; + } + } + + return 0; +} + long arch_do_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 42658e5..64357a3 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -631,6 +631,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) d->max_vcpus = max; } + if ( arch_domain_set_max_vcpus(d) < 0) + goto maxvcpu_out; + for ( i = 0; i < max; i++ ) { if ( d->vcpu[i] != NULL ) diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 347f264..e1ece3a 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -81,6 +81,8 @@ void arch_dump_domain_info(struct domain *d); int arch_vcpu_reset(struct vcpu *); +int arch_domain_set_max_vcpus(struct domain *d); + extern spinlock_t vcpu_alloc_lock; bool_t domctl_lock_acquire(void); void domctl_lock_release(void);