From patchwork Tue Aug 29 17:09:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9927765 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 0E3F3603B4 for ; Tue, 29 Aug 2017 17:10:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E636C289DD for ; Tue, 29 Aug 2017 17:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D857B289D7; Tue, 29 Aug 2017 17:10:14 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY 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 D222C289CE for ; Tue, 29 Aug 2017 17:10:13 +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 1dmjyC-00054G-Fe; Tue, 29 Aug 2017 17:06:32 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmjyA-000535-T8 for xen-devel@lists.xen.org; Tue, 29 Aug 2017 17:06:30 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 44/39-03642-61F95A95; Tue, 29 Aug 2017 17:06:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXSO6nOVVd0/tJ Ig1/PtCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyXC+cwF1wSq7g19RpLA+MzoS5GLg4hgYlM Es+6VzJDOH8ZJS5sP8AG4WxklHjY3sfUxcgJ5PQwSuxfKwxiswkYSZw9Op0RxBYRkJa49vkym M0ssJZJ4nJHQhcjB4ewQIjE2ZnuIGEWAVWJ692LWUFsXgEvicurj4CVSwgoSEx5+J4ZxOYU8J a4O+s+I8QqL4k5y5vZIGoMJT5vXMo8gZFvASPDKkaN4tSistQiXUNDvaSizPSMktzEzBxdQwM zvdzU4uLE9NScxKRiveT83E2MwEBhAIIdjJ+WBRxilORgUhLlrZq6NFKILyk/pTIjsTgjvqg0 J7X4EKMMB4eSBG/cXKCcYFFqempFWmYOMGRh0hIcPEoivOdnAaV5iwsSc4sz0yFSpxgVpcR5r UD6BEASGaV5cG2wOLnEKCslzMsIdIgQT0FqUW5mCar8K0ZxDkYlYd4rIFN4MvNK4Ka/AlrMBL Q41gtscUkiQkqqgVHkZP1lux2PbyrarHee8CrF5ee+sw0Zkx11pmguPHml9vr9SZ82vJxf+P7 TVPM5pVk92YEfls2cb/9HaulmgUdd5mbF/z8cmD09WztkxrGfBtPm+/m3xawN5vrGqzPji6lR lB3/ly+NLvJunLmxjktPlZ03c3e7dXL68gLWJfnCh023e6XUdtxVYinOSDTUYi4qTgQAq0oWR Y4CAAA= X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1504026388!114125958!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10200 invoked from network); 29 Aug 2017 17:06:29 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-9.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Aug 2017 17:06:29 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v7TH6Mv6026259 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Aug 2017 17:06:22 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v7TH6LPt002657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Aug 2017 17:06:21 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v7TH6JjM026723; Tue, 29 Aug 2017 17:06:19 GMT Received: from ovs104.us.oracle.com (/10.149.76.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Aug 2017 10:06:19 -0700 From: Boris Ostrovsky To: xen-devel@lists.xen.org Date: Tue, 29 Aug 2017 13:09:13 -0400 Message-Id: <1504026557-11365-2-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504026557-11365-1-git-send-email-boris.ostrovsky@oracle.com> References: <1504026557-11365-1-git-send-email-boris.ostrovsky@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: 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 , jbeulich@suse.com, Boris Ostrovsky Subject: [Xen-devel] [PATCH 1/5] mm: Initialize lowmem virq when boot-time scrubbing is disabled 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 scrub_heap_pages() does early return if boot-time scrubbing is disabled, neglecting to initialize lowmem VIRQ. Because setup_low_mem_virq() doesn't logically belong in scrub_heap_pages() we put them both into the newly added heap_init_late(). Signed-off-by: Boris Ostrovsky Reviewed-by: Wei Liu --- CC: Julien Grall --- Changes in v2: * Added heap_init_late() which calls setup_low_mem_vir() and scrub_heap_pages() xen/arch/arm/setup.c | 3 +-- xen/arch/x86/setup.c | 3 +-- xen/common/page_alloc.c | 11 +++++++---- xen/include/xen/mm.h | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 3b34855..92f173b 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -861,8 +861,7 @@ void __init start_xen(unsigned long boot_phys_offset, if ( construct_dom0(dom0) != 0) panic("Could not set up DOM0 guest OS"); - /* Scrub RAM that is still free and so may go to an unprivileged domain. */ - scrub_heap_pages(); + heap_init_late(); init_constructors(); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ec96287..bc466e8 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1662,8 +1662,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) cr4_pv32_mask |= X86_CR4_SMAP; } - /* Scrub RAM that is still free and so may go to an unprivileged domain. */ - scrub_heap_pages(); + heap_init_late(); init_trace_bufs(); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 9fa62d2..e1f7cd2 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1839,7 +1839,7 @@ static int __init find_non_smt(unsigned int node, cpumask_t *dest) * Scrub all unallocated pages in all heap zones. This function uses all * online cpu's to scrub the memory in parallel. */ -void __init scrub_heap_pages(void) +static void __init scrub_heap_pages(void) { cpumask_t node_cpus, all_worker_cpus; unsigned int i, j; @@ -1970,12 +1970,15 @@ void __init scrub_heap_pages(void) #ifdef CONFIG_SCRUB_DEBUG boot_scrub_done = true; #endif +} - /* Now that the heap is initialized, run checks and set bounds - * for the low mem virq algorithm. */ +void __init heap_init_late(void) +{ setup_low_mem_virq(); -} + if ( opt_bootscrub ) + scrub_heap_pages(); +} /************************* diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index ddc3fb3..c2f5a08 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -199,7 +199,7 @@ int offline_page(unsigned long mfn, int broken, uint32_t *status); int query_page_offline(unsigned long mfn, uint32_t *status); unsigned long total_free_pages(void); -void scrub_heap_pages(void); +void heap_init_late(void); int assign_pages( struct domain *d,