From nobody Sun May 19 03:38:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1566906571; cv=none; d=zoho.com; s=zohoarc; b=n0MCqTz5qw+VU8GUt6U5g04Ig1MpRG6btR1MizFp2O1fwMHMKZV9J1Msf6RLGzspkJ5buSHdrP33NB5RbQBtGp9EffZNRUypUnjqmZcGBDNj3O0PuGQPSr/CJU8DWgAiVnpCzvZDdtoie521LVk4vcq9uvCuFUiItN5+I/jxyR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566906571; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=SaDHlwamBhXm4buFd8PYv2AwlCppMYGQor63/uAqxFM=; b=crcMCLAwDJenSIlxZ9KTY059pc06ztrQCSxKDHutOyGEfDhfIUPvdyK3xGEWYL7YAfpmzbkPlfU/w0jjgbD5iVh+h3AmQ4JHBNBTavxnIhyP5dBa6LfwYsqa7r4Lw/fPzQ7P0DwQec4/pCIVGGQ/8NrULm4UsbyD7ek6x8Cx8eA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1566906571310608.5413741810207; Tue, 27 Aug 2019 04:49:31 -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 1i2ZxL-0003w6-Hl; Tue, 27 Aug 2019 11:48:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i2ZxK-0003w1-7a for xen-devel@lists.xenproject.org; Tue, 27 Aug 2019 11:48:10 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8a27a0ca-c8c0-11e9-8980-bc764e2007e4; Tue, 27 Aug 2019 11:48:09 +0000 (UTC) X-Inumbo-ID: 8a27a0ca-c8c0-11e9-8980-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1566906489; h=from:to:cc:subject:date:message-id:mime-version; bh=xQF4Doh6NDJnOkoiuhHA2YLyEFMGdmf6f9naygQWoo0=; b=cp59d4wWPUk8R/V0enqv2VFm/U/k4kMYzrStefzi3WGB5FeDLht1AJ7o fUIZqFYv36swnHNgmvSl5XxmwHRo+LKDTmHtt737sudy+iNf4MAtcT5sc 5M4zWPrffzubokZ7d5vjf4AWgWkTbRu2Mj+jbnuQwLCxUotJT4ghl7zPZ U=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=igor.druzhinin@citrix.com; spf=Pass smtp.mailfrom=igor.druzhinin@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of igor.druzhinin@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of igor.druzhinin@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: KU0xJV+McsfTR8m5cY3NdW7gnLpK5CX31cJauLxbsQBuS0LeP7LsyJRXK6YJLklPA9ZUMkRP7u qn5mIKxbGpBlArfo9V7aiRo0LpsLSl5Nkvib1M7kmb4/5ffOjWvTSGrr2A/WVP8yV8ImWzt74Q ELJznKhnYzG4fzKXoW6KetF7EkJW1bNEwCLnvPy7EBwEaqOLhefGjZ1MLWetcTDyWIdrN6782q sdnfH2JLLYFUElkQUlWssJ7x2NgDmmM105H74nguGgNmUOafotGCzDBN0Ad+86KhrzRYFJqLAY dzw= X-SBRS: 2.7 X-MesageID: 4944202 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,437,1559534400"; d="scan'208";a="4944202" From: Igor Druzhinin To: Date: Tue, 27 Aug 2019 12:48:05 +0100 Message-ID: <1566906485-13731-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/mm: correctly initialize M2P entries on boot 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.cooper3@citrix.com, Igor Druzhinin , wl@xen.org, jbeulich@suse.com, roger.pau@citrix.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Since guest resource management work it's now possible to have a page assigned to a domain without a valid M2P entry. Some pathes in the code rely on the fact a GFN returned from mfn_to_gfn() for such a page is not valid as well, i.e. see arch_iommu_populate_page_table(). For systems without 512GB contiguous RAM M2P entries were already correctly initialized on boot with INVALID_M2P_ENTRY (~0UL) but on systems where M2P could be covered by a single 1GB page directory 0x77 poison was used instead. That eventually resulted in a crash during IOMMU construction on systems without shared PTs enabled. While here fixup compat M2P entries as well. Signed-off-by: Igor Druzhinin Reviewed-by: Andrew Cooper --- xen/arch/x86/x86_64/mm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 1919cae..a741d4e 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -574,8 +574,9 @@ void __init paging_init(void) page_to_mfn(l1_pg), 1UL << (2 * PAGETABLE_ORDER), PAGE_HYPERVISOR); + /* Fill with INVALID_M2P_ENTRY. */ memset((void *)(RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_S= HIFT)), - 0x77, 1UL << L3_PAGETABLE_SHIFT); + 0xFF, 1UL << L3_PAGETABLE_SHIFT); =20 ASSERT(!l2_table_offset(va)); /* NB. Cannot be GLOBAL: guest user mode should not see it= . */ @@ -666,9 +667,10 @@ void __init paging_init(void) page_to_mfn(l1_pg), 1UL << PAGETABLE_ORDER, PAGE_HYPERVISOR); + /* Fill with INVALID_M2P_ENTRY. */ memset((void *)(RDWR_COMPAT_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)), - 0x55, + 0xFF, 1UL << L2_PAGETABLE_SHIFT); /* NB. Cannot be GLOBAL as the ptes get copied into per-VM space. = */ l2e_write(l2_ro_mpt, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT)= ); --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel