From nobody Sun Feb 8 23:54: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=1586975913; cv=none; d=zohomail.com; s=zohoarc; b=Wg2QrHsDPUPjHI3ffDaipQsH17/zGZAJ/gEF1+27ptVFcaXmnE2/HSb8+CHmH49z/ZuklqGjqPmnE13bReuLbhNOVPlSFBzAix09dlPA55xMcQVeuTcH2qlsgs4W+6icg4/JSeztSlGTv9cX3SlwA+q4nSbc0h1noS5vm4wePFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586975913; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=NjsU0mvN8f3Kkt58hhovqMgTFjoAL4EcJkT/EkRsASw=; b=jFOZicogurGqulOxJkHyyL3D2nrjJFFJVoOrZhYGNWsv7/0NPAwrtvr3mFcR/x+DQ356tlFrwszVK7VQMI8tQAmhr1ADJNnz00PTQPrvtZi8ApqGrDjwneajL6R5tKvGjIe88AWeA1DpfMFkxeaF6nW6+0NfR+MgKaNk1Iii8Bg= 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 1586975912943233.33462109393486; Wed, 15 Apr 2020 11:38:32 -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 1jOmvM-0000Fw-1T; Wed, 15 Apr 2020 18:38:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOmvK-0000Ff-Cm for xen-devel@lists.xenproject.org; Wed, 15 Apr 2020 18:38:10 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3fbf2870-7f48-11ea-b58d-bc764e2007e4; Wed, 15 Apr 2020 18:38:07 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOmvG-00020l-TD; Wed, 15 Apr 2020 18:38:06 +0000 Received: from 54-240-197-234.amazon.com ([54.240.197.234] 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 1jOmvG-0005Md-JN; Wed, 15 Apr 2020 18:38:06 +0000 X-Inumbo-ID: 3fbf2870-7f48-11ea-b58d-bc764e2007e4 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=NjsU0mvN8f3Kkt58hhovqMgTFjoAL4EcJkT/EkRsASw=; b=c7BI++wLiuzUBdO51vXkFZaF1N GtK7GzkoHTVf1NNy4tip3XFLBWm8xW1eedEDpZzh0oZxjQKQTB6PF2iZ0GVysGvceERfJGj3zxaMc PF5JO63vX/WxoZ972Vo/epj51DNq00Jrh6HF/CiluJlFqboVYeWQ/83f25K8K2mY2YnY=; From: Hongyan Xia To: xen-devel@lists.xenproject.org Subject: [PATCH v4 3/4] x86_64/mm: map and unmap page tables in share_hotadd_m2p_table Date: Wed, 15 Apr 2020 19:37:51 +0100 Message-Id: <3e716bbf183f8ecd162c04e1c3f4c44fd292d082.1586975587.git.hongyxia@amazon.com> 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 Fetch lYe by mapping and unmapping lXe instead of using the direct map, which is now done via the lYe_from_lXe() helpers. Signed-off-by: Wei Liu Signed-off-by: Hongyan Xia Reviewed-by: Jan Beulich --- Changed in v2: - the introduction of the macros is now lifted to a previous patch. --- xen/arch/x86/x86_64/mm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 41755ded26..cfaeae84e9 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -166,14 +166,14 @@ static int share_hotadd_m2p_table(struct mem_hotadd_i= nfo *info) v +=3D n << PAGE_SHIFT ) { n =3D L2_PAGETABLE_ENTRIES * L1_PAGETABLE_ENTRIES; - l3e =3D l4e_to_l3e(idle_pg_table[l4_table_offset(v)])[ - l3_table_offset(v)]; + l3e =3D l3e_from_l4e(idle_pg_table[l4_table_offset(v)], + l3_table_offset(v)); if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) continue; if ( !(l3e_get_flags(l3e) & _PAGE_PSE) ) { n =3D L1_PAGETABLE_ENTRIES; - l2e =3D l3e_to_l2e(l3e)[l2_table_offset(v)]; + l2e =3D l2e_from_l3e(l3e, l2_table_offset(v)); if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ) continue; m2p_start_mfn =3D l2e_get_mfn(l2e); @@ -194,11 +194,11 @@ static int share_hotadd_m2p_table(struct mem_hotadd_i= nfo *info) v !=3D RDWR_COMPAT_MPT_VIRT_END; v +=3D 1 << L2_PAGETABLE_SHIFT ) { - l3e =3D l4e_to_l3e(idle_pg_table[l4_table_offset(v)])[ - l3_table_offset(v)]; + l3e =3D l3e_from_l4e(idle_pg_table[l4_table_offset(v)], + l3_table_offset(v)); if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) continue; - l2e =3D l3e_to_l2e(l3e)[l2_table_offset(v)]; + l2e =3D l2e_from_l3e(l3e, l2_table_offset(v)); if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ) continue; m2p_start_mfn =3D l2e_get_mfn(l2e); --=20 2.24.1.AMZN