From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 541DDC38A29 for ; Fri, 17 Apr 2020 09:52:47 +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 2544521D94 for ; Fri, 17 Apr 2020 09:52:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="g3HnPNSW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2544521D94 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass 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 1jPNfn-0000Qx-KK; Fri, 17 Apr 2020 09:52:35 +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 1jPNfn-0000Qc-18 for xen-devel@lists.xenproject.org; Fri, 17 Apr 2020 09:52:35 +0000 X-Inumbo-ID: 232cfa12-8091-11ea-8c9b-12813bfff9fa Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 232cfa12-8091-11ea-8c9b-12813bfff9fa; Fri, 17 Apr 2020 09:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TtfDNJhA8tjoCGd8nfl59DQgpyHwzck4uvav7srJyZM=; b=g3HnPNSWrF201Ln96S0X0V/JcW wroUnjXehYGLMAV4J6FGf/LZz+Cb5M0eHPm7Uit2Ahbyyp080Cd7ak33v8QUeCSxka8THYJSgwbB7 hXKpv/5fMSRJbedRVuycqIxJJdh5+Ckl6+oU+foZDHO9fLzjdIRZ6B0GGPM0rRpGRNSk=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jPNfb-0002fw-Fo; Fri, 17 Apr 2020 09:52:23 +0000 Received: from 54-240-197-227.amazon.com ([54.240.197.227] helo=u1bbd043a57dd5a.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jPNfb-000304-6P; Fri, 17 Apr 2020 09:52:23 +0000 From: Hongyan Xia To: xen-devel@lists.xenproject.org Subject: [PATCH 4/6] x86/smpboot: map and unmap page tables in cleanup_cpu_root_pgt Date: Fri, 17 Apr 2020 10:52:06 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , julien@xen.org, Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia --- xen/arch/x86/smpboot.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 09264b02d1..275ce7661d 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -858,23 +858,27 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) r < root_table_offset(HYPERVISOR_VIRT_END); ++r ) { l3_pgentry_t *l3t; + mfn_t l3mfn; unsigned int i3; if ( !(root_get_flags(rpt[r]) & _PAGE_PRESENT) ) continue; - l3t = l4e_to_l3e(rpt[r]); + l3mfn = l4e_get_mfn(rpt[r]); + l3t = map_domain_page(l3mfn); for ( i3 = 0; i3 < L3_PAGETABLE_ENTRIES; ++i3 ) { l2_pgentry_t *l2t; + mfn_t l2mfn; unsigned int i2; if ( !(l3e_get_flags(l3t[i3]) & _PAGE_PRESENT) ) continue; ASSERT(!(l3e_get_flags(l3t[i3]) & _PAGE_PSE)); - l2t = l3e_to_l2e(l3t[i3]); + l2mfn = l3e_get_mfn(l3t[i3]); + l2t = map_domain_page(l2mfn); for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; ++i2 ) { @@ -882,13 +886,15 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) continue; ASSERT(!(l2e_get_flags(l2t[i2]) & _PAGE_PSE)); - free_xen_pagetable(l2e_to_l1e(l2t[i2])); + free_xen_pagetable_new(l2e_get_mfn(l2t[i2])); } - free_xen_pagetable(l2t); + unmap_domain_page(l2t); + free_xen_pagetable_new(l2mfn); } - free_xen_pagetable(l3t); + unmap_domain_page(l3t); + free_xen_pagetable_new(l3mfn); } free_xen_pagetable(rpt); @@ -896,11 +902,14 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) /* Also zap the stub mapping for this CPU. */ if ( stub_linear ) { - l3_pgentry_t *l3t = l4e_to_l3e(common_pgt); - l2_pgentry_t *l2t = l3e_to_l2e(l3t[l3_table_offset(stub_linear)]); - l1_pgentry_t *l1t = l2e_to_l1e(l2t[l2_table_offset(stub_linear)]); + l3_pgentry_t l3e = l3e_from_l4e(common_pgt, + l3_table_offset(stub_linear)); + l2_pgentry_t l2e = l2e_from_l3e(l3e, l2_table_offset(stub_linear)); + l1_pgentry_t *l1t = map_l1t_from_l2e(l2e); l1t[l1_table_offset(stub_linear)] = l1e_empty(); + + unmap_domain_page(l1t); } } -- 2.24.1.AMZN