From nobody Mon Feb 9 14:37:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1587117170; cv=none; d=zohomail.com; s=zohoarc; b=ifeLVoWhxttECynnDzV74od9m3MmvDLlKq4zMCDvR443bmsrQrgbGruTVOWV4vcYEdpi9PBnRWg9hw6SzmF2QHeAA4zc5XKoIghzUGjEDIb2AeRQVQPQzXdWCEyuYVkEwffhELR/qusyLm+7xY1r5WHhtzum1CSuKwUD7YWYkf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587117170; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=TtfDNJhA8tjoCGd8nfl59DQgpyHwzck4uvav7srJyZM=; b=ENvWP7U1SGMerwd8N1gR8sbikB1MidgcGxm5GuKRZt0wkIrecipEDRqdnmudNTzpMS5XFdUMeaf8rJu6QHHunnwDr1rJH512TWrUpLTuGAKy8RTH89KO+mmo1n60YejiEAbQ9TxSnbyffdle1HCMuI9vB4JDrY+q+UfG25YDgi8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1587117170064168.9619023309682; Fri, 17 Apr 2020 02:52:50 -0700 (PDT) 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 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) 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 X-Inumbo-ID: 232cfa12-8091-11ea-8c9b-12813bfff9fa 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=; 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Wei Liu Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Acked-by: Jan Beulich Reviewed-by: Julien Grall --- 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; =20 if ( !(root_get_flags(rpt[r]) & _PAGE_PRESENT) ) continue; =20 - l3t =3D l4e_to_l3e(rpt[r]); + l3mfn =3D l4e_get_mfn(rpt[r]); + l3t =3D map_domain_page(l3mfn); =20 for ( i3 =3D 0; i3 < L3_PAGETABLE_ENTRIES; ++i3 ) { l2_pgentry_t *l2t; + mfn_t l2mfn; unsigned int i2; =20 if ( !(l3e_get_flags(l3t[i3]) & _PAGE_PRESENT) ) continue; =20 ASSERT(!(l3e_get_flags(l3t[i3]) & _PAGE_PSE)); - l2t =3D l3e_to_l2e(l3t[i3]); + l2mfn =3D l3e_get_mfn(l3t[i3]); + l2t =3D map_domain_page(l2mfn); =20 for ( i2 =3D 0; i2 < L2_PAGETABLE_ENTRIES; ++i2 ) { @@ -882,13 +886,15 @@ static void cleanup_cpu_root_pgt(unsigned int cpu) continue; =20 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])); } =20 - free_xen_pagetable(l2t); + unmap_domain_page(l2t); + free_xen_pagetable_new(l2mfn); } =20 - free_xen_pagetable(l3t); + unmap_domain_page(l3t); + free_xen_pagetable_new(l3mfn); } =20 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 =3D l4e_to_l3e(common_pgt); - l2_pgentry_t *l2t =3D l3e_to_l2e(l3t[l3_table_offset(stub_linear)]= ); - l1_pgentry_t *l1t =3D l2e_to_l1e(l2t[l2_table_offset(stub_linear)]= ); + l3_pgentry_t l3e =3D l3e_from_l4e(common_pgt, + l3_table_offset(stub_linear)); + l2_pgentry_t l2e =3D l2e_from_l3e(l3e, l2_table_offset(stub_linear= )); + l1_pgentry_t *l1t =3D map_l1t_from_l2e(l2e); =20 l1t[l1_table_offset(stub_linear)] =3D l1e_empty(); + + unmap_domain_page(l1t); } } =20 --=20 2.24.1.AMZN