From patchwork Thu Sep 26 09:46:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11162215 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C708713BD for ; Thu, 26 Sep 2019 09:52:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2CE8222C0 for ; Thu, 26 Sep 2019 09:52:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="PjKzf6xX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2CE8222C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQRE-0002yD-5J; Thu, 26 Sep 2019 09:51:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQRC-0002ve-EE for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 09:51:50 +0000 X-Inumbo-ID: 4202aa34-e043-11e9-964d-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by localhost (Halon) with ESMTPS id 4202aa34-e043-11e9-964d-12813bfff9fa; Thu, 26 Sep 2019 09:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1569491509; x=1601027509; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ekZ3PcHMk4uKY0DEmsTYP5mEVLITbkETFNx6DlWLxjQ=; b=PjKzf6xXRJUcIM0AiOLpftMiYvvlVf+qFZNnPFgZ19LehZRb5kGEHmU7 5E8GXzF7PhydhDHXok+4zFDDhyr2kwvQ+JkUCk1DTKl7apX7mwqsCq+Dn rGFx5tQwxOqRkFm7ry8Q+M8Qh2bk1WwXW2Hpu2AejeOZjAuT60mAw32v6 M=; X-IronPort-AV: E=Sophos;i="5.64,551,1559520000"; d="scan'208";a="704637681" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 26 Sep 2019 09:50:45 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id C1A52A2840; Thu, 26 Sep 2019 09:50:21 +0000 (UTC) Received: from EX13D28EUB002.ant.amazon.com (10.43.166.97) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:49:57 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D28EUB002.ant.amazon.com (10.43.166.97) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 09:49:56 +0000 Received: from u9d785c4ba99158.ant.amazon.com (10.125.106.58) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 09:49:53 +0000 From: To: Date: Thu, 26 Sep 2019 10:46:41 +0100 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [RFC PATCH 78/84] Revert "x86/smpboot: use xenheap pages for rpts in smpboot." X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Wei Liu , Jan Beulich , Hongyan Xia Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Hongyan Xia We have properly handled (un)mapping of pages in restore_all_guests. This hack is no longer required. Signed-off-by: Hongyan Xia --- xen/arch/x86/smpboot.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 7034c699d6..53f9173f37 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -832,20 +832,14 @@ static int setup_cpu_root_pgt(unsigned int cpu) goto out; } - /* - * Unfortunately, some code (especially in assembly) assumes the rpt is in - * the DIRECTMAP region and is always mapped. Making all of them adapt to - * the new page table APIs is non-trivial. For now, make it always mapped - * on the xenheap. - */ - rpt = alloc_xenheap_page(); - if ( !rpt ) + rpt_mfn = alloc_xen_pagetable(); + if ( mfn_eq(rpt_mfn, INVALID_MFN) ) { rc = -ENOMEM; goto out; } - rpt_mfn = _mfn(virt_to_mfn(rpt)); + rpt = map_xen_pagetable(rpt_mfn); clear_page(rpt); per_cpu(root_pgt_mfn, cpu) = rpt_mfn; @@ -890,6 +884,7 @@ static int setup_cpu_root_pgt(unsigned int cpu) rc = clone_mapping((void *)per_cpu(stubs.addr, cpu), rpt); out: + UNMAP_XEN_PAGETABLE(rpt); return rc; } @@ -905,7 +900,7 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) per_cpu(root_pgt_mfn, cpu) = INVALID_MFN; - rpt = mfn_to_virt(mfn_x(rpt_mfn)); + rpt = map_xen_pagetable(rpt_mfn); for ( r = root_table_offset(DIRECTMAP_VIRT_START); r < root_table_offset(HYPERVISOR_VIRT_END); ++r ) @@ -950,8 +945,8 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) free_xen_pagetable(l3t_mfn); } - /* Unlike other levels, the root level is a xenheap page. */ - free_xenheap_page(rpt); + UNMAP_XEN_PAGETABLE(rpt); + free_xen_pagetable(rpt_mfn); /* Also zap the stub mapping for this CPU. */ if ( stub_linear )