From patchwork Mon Dec 9 11:48:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xia, Hongyan" X-Patchwork-Id: 11279217 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 5958513B6 for ; Mon, 9 Dec 2019 11:49:35 +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 36250207FD for ; Mon, 9 Dec 2019 11:49:35 +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="Ynu5Fr/5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36250207FD 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 1ieHWq-0000Zu-9F; Mon, 09 Dec 2019 11:48:40 +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 1ieHWp-0000Ze-LG for xen-devel@lists.xenproject.org; Mon, 09 Dec 2019 11:48:39 +0000 X-Inumbo-ID: d594fdf4-1a79-11ea-87bf-12813bfff9fa Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d594fdf4-1a79-11ea-87bf-12813bfff9fa; Mon, 09 Dec 2019 11:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575892117; x=1607428117; h=from:to:cc:subject:date:message-id:mime-version; bh=j+wF7bTo/l8UjtS6L5U+uXYMVRNysLbxs2hoFdAwEdk=; b=Ynu5Fr/5XIA/DSiG49AMAhlWjYWZYBJKgff6/ULsAl0Ry7A2dtlZzdN7 5cULQaB6clcd7mVoKHCgE+fJYomxVT/2YshT/uCA3yZT65tYsG6wse7js PuO5tc8ONB8WhW0TJhsgjtYp0MJbGZ2fGRv6GfZMfU2/BqBmdYGP0LZYn s=; IronPort-SDR: UHoTuEzEn7e0uayn47lda9Ugsr2YNIRaUCVYWlwKEftCPJ5RpbdHiKbqSrfZ65WCZYH/o2i1SG 3vizqsGkuuHw== X-IronPort-AV: E=Sophos;i="5.69,294,1571702400"; d="scan'208";a="13789273" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1e-27fb8269.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 09 Dec 2019 11:48:16 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1e-27fb8269.us-east-1.amazon.com (Postfix) with ESMTPS id 48EB4A1BF1; Mon, 9 Dec 2019 11:48:14 +0000 (UTC) Received: from EX13D37EUB001.ant.amazon.com (10.43.166.31) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Dec 2019 11:48:13 +0000 Received: from EX13MTAUEE001.ant.amazon.com (10.43.62.200) by EX13D37EUB001.ant.amazon.com (10.43.166.31) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 9 Dec 2019 11:48:12 +0000 Received: from u60d575063b1f53.ant.amazon.com (10.125.106.64) by mail-relay.amazon.com (10.43.62.226) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 9 Dec 2019 11:48:11 +0000 From: Hongyan Xia To: Date: Mon, 9 Dec 2019 11:48:08 +0000 Message-ID: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v2 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 int_review --- 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 | 192 +++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 96 deletions(-)