From patchwork Wed Jul 18 09:41:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DA62600F4 for ; Wed, 18 Jul 2018 09:43:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DF6F28FC3 for ; Wed, 18 Jul 2018 09:43:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50F5528FD4; Wed, 18 Jul 2018 09:43:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6FF828FC3 for ; Wed, 18 Jul 2018 09:43:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EE0F6B02A1; Wed, 18 Jul 2018 05:41:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7C5636B02A4; Wed, 18 Jul 2018 05:41:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68BCF6B02A3; Wed, 18 Jul 2018 05:41:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id F3D186B02A6 for ; Wed, 18 Jul 2018 05:41:38 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id c2-v6so1694022edi.20 for ; Wed, 18 Jul 2018 02:41:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=mysNDmrLH3TTHn4FjX4Vwomt7fKOM9XFLpUvuvyrSU4=; b=gDZtpN4uoXKARJws9y8a8KOXrl1WHuDXsZe+8GjvClqWDPfFnPdruA2zaoYku/feul oNjpB2WLIY7CRmOJoSBRDvwpsEtNVKqW6w7dMYEEZuv/0+55luB7WclCWqahh68xDhqV wTQsdavflaHSVbTpv2J2Y5A2vogUtC87lv4DYsmtxR3og3SGjJkzfINTuH6pHneKO1NJ j04QltS4AB1tOB8HscIum/TJ62qiNA9YAd7rxQR0irm6s2EZMXshiTd8hUl8KsEOd3M9 QtfUHMOkUXW+gsgcwnHveK3kNzsUVByGr2NzKh+muRIigULBIbH706GiBFIiGsS2X63Q gvhg== X-Gm-Message-State: AOUpUlGrrSiY5UucER7Ac0cSCJtfXejcYJBvjpiZ2P3PSOtezuzUFzjN rGnnwMgs9G9bS27jHfpUrfh7rBFhoaBfIvXAkcza1jrzCPsGPOgIvl4PFg/7DQuAUYI2GVT6PzA UVI02X22R53KdzOIJEFFJ7vyCFERmw/7jpaAyfGVEkI79cubAS+GWuohIv3sn8H6zhA== X-Received: by 2002:a50:8ca9:: with SMTP id q38-v6mr6284215edq.2.1531906898571; Wed, 18 Jul 2018 02:41:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfvhgSLHUerrzyR+RR3uX+/w6toqYAUteUTVAAtxmzIMjW82xFxSzI3bY4LPZA+BMAHq0pe X-Received: by 2002:a50:8ca9:: with SMTP id q38-v6mr6284180edq.2.1531906897856; Wed, 18 Jul 2018 02:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906897; cv=none; d=google.com; s=arc-20160816; b=QMPhmXFB355VT04ssswdE2FuxXhD7mTfmpQyGBGhP1urXGK2wE/a+DtGJsmM8u3RZP JMrhXdFXjgn6HPhuIlnE7j04Clh2CM6Lbxez9Dv3TmCddejCtCKChz5ljRQgaHkEM0BX OC5TmdAd0/ic8xwfc16QXIizAKGkb8K2w/Nn25feVuhaxQUxmT66JwE5tvh62PvVfRN9 4Vp+ULH9BLOG+nQSEgDPj9eu9wh3QQNXFGPaLiv8nvIAmMlLkk14bHCiJUybGhezs2BY 1HdXZPsK3f0RiIaqTixG09xKEtJb+Xh23x62zI/q0GSOGw+9w1yK1/0y6dNNhbHUo2pF 42xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=mysNDmrLH3TTHn4FjX4Vwomt7fKOM9XFLpUvuvyrSU4=; b=AcEeyaN+QNpcME3HQGAGClBcZ3kUG1qR2yxXatwmn2JRsktlcAdEIDdIVQz1W6k+EG fUyF3Gz7U76/83gHfkXhvAZahdOfoTbLrr4SE46uLwPLXpW7loDr8t+g0IuNjDJOOHbO rKZKxS6hsa7ecLZU1xMyzDH7ALtTeXaFXFRLlcim2u0vTABBFjARtdJU+O3yuZc3agg7 VOlsUVr5/oDj15C6MsWGimcp6WKdN+GGGbvuwQnjIyLCz/wZtSbUg9xLB8ZIYfeO6EAV 5vu2CNxgj4TREmoXl+rQeOFZKhug+rYoo491tFuVLN5TxmwIvpriE74nuwk010Yd4Iol XnYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=KZZypprF; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id e29-v6si2401632eda.181.2018.07.18.02.41.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=KZZypprF; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id E4CEB19F5; Wed, 18 Jul 2018 11:41:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906884; bh=3uNGtXKSPN2zX9Iio6S58drmOOdV4IUS2tivFlQ4Kc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZZypprFruJnB1v6TXsjDTA/7m9qKIFBUuRL15X7TncCtH2sogOMhhMeLzNwfNlub QUDFUvhB77gAcb1B21jVeGOdglk/6AuHHSDBsw8oPNBL0Cqlx3hletMvf/vEhEAq6K T7rzhVBb6xGxgWHZL9vFk+5DUB5ZUtzvL/HDow/4Dndnq0ouop/wigDPDyJX5MgIIc 5MSdxDjw40TFhljaWDUc0kTD65VRxtZaXb4W61xyAN2qhqrkixJ6zkjMHcx654wIof bsHMw4jC3ghAGa012yl4sGRGPPQSHbThBmLaoC5BOx5s9yddnqbFW6DS/RVBEbg3Gc LdpHOocXYj5vQ== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 31/39] x86/mm/dump_pagetables: Define INIT_PGD Date: Wed, 18 Jul 2018 11:41:08 +0200 Message-Id: <1531906876-13451-32-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-1-git-send-email-joro@8bytes.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel Define INIT_PGD to point to the correct initial page-table for 32 and 64 bit and use it where needed. This fixes the build on 32 bit with CONFIG_PAGE_TABLE_ISOLATION enabled. Signed-off-by: Joerg Roedel --- arch/x86/mm/dump_pagetables.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 2f3c919..e6fd0cd 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -111,6 +111,8 @@ static struct addr_marker address_markers[] = { [END_OF_SPACE_NR] = { -1, NULL } }; +#define INIT_PGD ((pgd_t *) &init_top_pgt) + #else /* CONFIG_X86_64 */ enum address_markers_idx { @@ -139,6 +141,8 @@ static struct addr_marker address_markers[] = { [END_OF_SPACE_NR] = { -1, NULL } }; +#define INIT_PGD (swapper_pg_dir) + #endif /* !CONFIG_X86_64 */ /* Multipliers for offsets within the PTEs */ @@ -496,11 +500,7 @@ static inline bool is_hypervisor_range(int idx) static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, bool checkwx, bool dmesg) { -#ifdef CONFIG_X86_64 - pgd_t *start = (pgd_t *) &init_top_pgt; -#else - pgd_t *start = swapper_pg_dir; -#endif + pgd_t *start = INIT_PGD; pgprotval_t prot, eff; int i; struct pg_state st = {}; @@ -566,7 +566,7 @@ EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs); static void ptdump_walk_user_pgd_level_checkwx(void) { #ifdef CONFIG_PAGE_TABLE_ISOLATION - pgd_t *pgd = (pgd_t *) &init_top_pgt; + pgd_t *pgd = INIT_PGD; if (!static_cpu_has(X86_FEATURE_PTI)) return;