From patchwork Mon Feb 3 16:58:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 11363123 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 827101398 for ; Mon, 3 Feb 2020 16:59:11 +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 68E592080C for ; Mon, 3 Feb 2020 16:59:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68E592080C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org 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 1iyf3A-0003cH-Km; Mon, 03 Feb 2020 16:58:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iyf39-0003cB-Nk for xen-devel@lists.xenproject.org; Mon, 03 Feb 2020 16:58:15 +0000 X-Inumbo-ID: 5e36606e-46a6-11ea-b211-bc764e2007e4 Received: from mail-wr1-f68.google.com (unknown [209.85.221.68]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5e36606e-46a6-11ea-b211-bc764e2007e4; Mon, 03 Feb 2020 16:58:15 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id a6so19140224wrx.12 for ; Mon, 03 Feb 2020 08:58:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3fm/cut/IlgoCdgjxasn9rl1QQLaFFRxl5RJxUhmQH0=; b=KdMztw+YwwmBi8V9mjV3nnawXfskvcv1py/4WpxzqOIytRcH9t4iIvTyYa2r92tuv3 W6QDruVLAgXGxJx+r2R/tVn69H/ZS4uHTSp2Eg5gXtOTmQhl0KVvL16aMLaE9vSZ3sU/ dsFl8hTGzyYAP2XHLOVul6L2KMXZM9o6zryXKfsbacpWPCo98JN8SSvYh81fqBp0Oz7s hYdZF+3kNH+3MtPBFz1zzTw3lR4omhwPEg38mE6pr+2YA2dl+4JajRwZytYJyk0ZgpNa IT86nrOW4itzuQKQEs5xD/nBVkAuQSzFy2WL2He8Ocaq46/emFKkjMsKdDzsTBo9Dki6 zPfw== X-Gm-Message-State: APjAAAWEiNPPALJQoVZ9g00FANpQXAXuQqmkPpspBAFt2PslfqEdFsET AQm3a3b4LypIRm17GoGPIpb8XCOoH3U= X-Google-Smtp-Source: APXvYqy6r+KH7Bpl9oQJinaHi5EpUQO9rTJro6LVSMOwS9DlKyRQfQ6J+2AWfT8O+DJh7BfA7JoRKA== X-Received: by 2002:a05:6000:8c:: with SMTP id m12mr17009478wrx.142.1580749094235; Mon, 03 Feb 2020 08:58:14 -0800 (PST) Received: from ufe34d9ed68d054.ant.amazon.com (54-240-197-235.amazon.com. [54.240.197.235]) by smtp.gmail.com with ESMTPSA id o2sm23563758wmh.46.2020.02.03.08.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 08:58:13 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 3 Feb 2020 16:58:12 +0000 Message-Id: <20200203165812.21089-1-julien@xen.org> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] xen/x86: p2m: Don't initialize slot 0 of the P2M 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: Wei Liu , George Dunlap , Andrew Cooper , Julien Grall , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall It is not entirely clear why the slot 0 of each p2m should be populated with empty page-tables. The commit introducing it 759af8e3800 "[HVM] Fix 64-bit HVM domain creation." does not contain meaningful explanation except that it was necessary for shadow. As we don't seem to have a good explanation why this is there, drop the code completely. This was tested by successfully booting a HVM with shadow enabled. Signed-off-by: Julien Grall Acked-by: George Dunlap --- I don't know for sure if this is going to break a setup. I have tried HVM guest with hap={0, 1} without any trouble. I am happy to try more setup if you have any in mind. If this break a setup, then please describe the setup and I will send a documentation patch instead. --- xen/arch/x86/mm/p2m.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 49cc138362..961bed0635 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -688,7 +688,6 @@ int p2m_alloc_table(struct p2m_domain *p2m) { mfn_t top_mfn; struct domain *d = p2m->domain; - int rc = 0; p2m_lock(p2m); @@ -721,19 +720,8 @@ int p2m_alloc_table(struct p2m_domain *p2m) if ( hap_enabled(d) ) iommu_share_p2m_table(d); - P2M_PRINTK("populating p2m table\n"); - - /* Initialise physmap tables for slot zero. Other code assumes this. */ - p2m->defer_nested_flush = 1; - rc = p2m_set_entry(p2m, _gfn(0), INVALID_MFN, PAGE_ORDER_4K, - p2m_invalid, p2m->default_access); - p2m->defer_nested_flush = 0; p2m_unlock(p2m); - if ( !rc ) - P2M_PRINTK("p2m table initialised for slot zero\n"); - else - P2M_PRINTK("failed to initialise p2m table for slot zero (%d)\n", rc); - return rc; + return 0; } /*