From patchwork Wed Dec 11 10:58:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11284725 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 4BC4E14E3 for ; Wed, 11 Dec 2019 10:59:41 +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 2871B2073B for ; Wed, 11 Dec 2019 10:59:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="nrXEPDHP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2871B2073B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com 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 1iezhe-0005gC-Di; Wed, 11 Dec 2019 10:58:46 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iezhc-0005g1-Ui for xen-devel@lists.xenproject.org; Wed, 11 Dec 2019 10:58:44 +0000 X-Inumbo-ID: 31e05e46-1c05-11ea-a914-bc764e2007e4 Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 31e05e46-1c05-11ea-a914-bc764e2007e4; Wed, 11 Dec 2019 10:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1576061924; x=1607597924; h=from:to:cc:subject:date:message-id:mime-version; bh=io835R3o7ahHB+R5NFra8z6rIj8HJ2mI+egH6cUjZOw=; b=nrXEPDHPJYfnB5hvHrqdAalCYUBbClTYxXr9VxQFjq14UQKWPudH1Xny cANxi7kQQKHPGJ3u//dEv6M7+f0lsp5jTBJDOONsyjQpdCiZwP7B6M5kZ xm6hAML05cECCLIHgNp47siV3Q2apSb1n9gMxFRACs2YJgreIabITA8Ar Q=; IronPort-SDR: YJ80ejIz51KDRSuHD7YYqwuogzF39yHzrkFySGqAYiXbDOyAu8fv0HNhuTXqh0/g+avELx+3ke lyI9maRR/1aA== X-IronPort-AV: E=Sophos;i="5.69,301,1571702400"; d="scan'208";a="14255737" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-397e131e.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 11 Dec 2019 10:58:33 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2c-397e131e.us-west-2.amazon.com (Postfix) with ESMTPS id D1DE2A2656; Wed, 11 Dec 2019 10:58:31 +0000 (UTC) Received: from EX13D37EUA003.ant.amazon.com (10.43.165.7) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 11 Dec 2019 10:58:31 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D37EUA003.ant.amazon.com (10.43.165.7) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 11 Dec 2019 10:58:30 +0000 Received: from u60d575063b1f53.ant.amazon.com (10.125.106.64) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 11 Dec 2019 10:58:27 +0000 From: Hongyan Xia To: Date: Wed, 11 Dec 2019 10:58:25 +0000 Message-ID: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v3 0/2] Refactor super page shattering X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , jgrall@amazon.com, Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_?= =?utf-8?q?Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" map_pages_to_xen and modify_xen_mappings use almost exactly the same page shattering logic, and the code is mingled with other PTE manipulations so it is less obvious that the intention is page shattering. Factor out the functions to make them reusable and to make the intention more obvious. Of course, there is not much difference between the shattering logic of each level, so we could further turn the per-level functions into a single macro, although this is not that simple since we have per-level functions and macros all over the place and there are slight differences between levels. Keep it per-level for now. tree: https://xenbits.xen.org/git-http/people/hx242/xen.git shatter-refactor --- Changes in v3: - style and indentation fixes. Changes in v2: - rebase. - improve asm code. - avoid stale values when taking the lock. - move allocation of PTE tables inside the shatter function. Hongyan Xia (2): x86/mm: factor out the code for shattering an l3 PTE x86/mm: factor out the code for shattering an l2 PTE xen/arch/x86/mm.c | 194 +++++++++++++++++++++++----------------------- 1 file changed, 98 insertions(+), 96 deletions(-)