From patchwork Wed Jul 11 11:29:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519513 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 4699F603D7 for ; Wed, 11 Jul 2018 11:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AFA226861 for ; Wed, 11 Jul 2018 11:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F54128578; Wed, 11 Jul 2018 11:32:11 +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 DF22126861 for ; Wed, 11 Jul 2018 11:32:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C40D16B028F; Wed, 11 Jul 2018 07:30:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BF2466B0290; Wed, 11 Jul 2018 07:30:21 -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 A45B86B0291; Wed, 11 Jul 2018 07:30:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 3D0676B028F for ; Wed, 11 Jul 2018 07:30:21 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id v26-v6so3469869eds.9 for ; Wed, 11 Jul 2018 04:30:21 -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=HjdWqlh27NOOJ7NWCQUjDx5u5Po/U0AxTPVqJAwLKGlvN/qXmwX2wopu5+4lqzPb4g Ozc6nsbUVKLQcXbCaV14KI+HW37eIl2RlZV+jXed8I3pYNVpPuPT8kuli5S3e5wW+QZ0 pfhASxEwdFivetieVzLLFDcRJ6IhrgIe0WRz75cUhfx7g0/ZqaosNM/ceV/UQFHdoqJH lvjUKtrcgA/MTsKXXwThTzfJuQReGFbepBvjjMfPAJLrfbBvg6wStM7QopFCt729uAjQ dM6SbqtLgjz95FAmdqtXzvWoAM5WJBwNR1qVAo+wIRO7u+l1sU6Fjwho5rXpwM6pFt4X C2Jg== X-Gm-Message-State: APt69E0cLXDvKCLyuM88UoWg0RSzHmhLu54fI9LOsMVH0XDLwiz44sbf uYg53H3liXlY9ulwOEzAYaE3Qx8DicK5T+Ck/ZOSuSSbjNEVP7GoXt+svHyk6adolJuXHxpxKVL ENK7vnH6/RlJgddk0jDDCSEHC2uOtZB1bgQ5WysTTuREwl9HqjZkBTZR7JJQ2fnNPlQ== X-Received: by 2002:aa7:c742:: with SMTP id c2-v6mr31368203eds.231.1531308620814; Wed, 11 Jul 2018 04:30:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcXcJTXXX2mU9u7gkgQ0VmIkjq9d8t9nzi8WvcH7qP1ShcWexakc57LV8dz+8006SXiunaF X-Received: by 2002:aa7:c742:: with SMTP id c2-v6mr31368173eds.231.1531308620196; Wed, 11 Jul 2018 04:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308620; cv=none; d=google.com; s=arc-20160816; b=LJ5pXD5AE15SZ3u9idfrW2DBaoAegeLT4KTgN534rQ2eBQy4SzgZIFlEanz+89I7gI HDn/Ug0kdICLrg211F0mr/Q/TkInfDKMJH3PxleAMVrIQRxVtRO5QsIfC0WkL91KcO1r 6DZnluBxWFJetaPwG6tu7CAU3PVhAFeJOQFogOI0EBKesdXCH8xSPWGAZeEnyxHU8hFv X1FE5TIkRZEMR88XkEc//IgB6a8sTxQwovDMekXPKtT2byknWMhb21wTNwONCTZ2jftB hSfBv4R/Rw1WNx1d3+lkIypA5jvEmGaz/AREy98GRE4GAc2ns/R0jn+pwC4bZnvjirY9 TRMA== 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=VoylVqyt7/jkzBM89rcbPn9vABs2CQHgYz+oESHrlbL1aXhzS+6n+YYuS/w1k2NF8Z 04+lW9veFn/YA7NUTdO2YtiLLstW594XzC7heucnrDQ+8O5xX+joxiuB/TAybNqD5tKo Qt2aVKw/50YAWjM6+4ynmkRA83E3oWhBFYkytnxmyRIiChXtlBP1TWjByCgrundEyyfl zeTzmtHSCMsXk+jLn+/7hdjSvPS+mqendsvaM8H6O4GoyLjYHk1Llha4SgBWjFbyEp0G lZ4n6b2X1hpE+vU5YvUoZltPugIZNVrkpD6hvq89DF+EYUMTctRLAVRGzcBxhSfdtoTi o9kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=JB5p3sWl; 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 g3-v6si3523663edg.360.2018.07.11.04.30.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:20 -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=JB5p3sWl; 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 8C95CAEE; Wed, 11 Jul 2018 13:30:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308607; bh=3uNGtXKSPN2zX9Iio6S58drmOOdV4IUS2tivFlQ4Kc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JB5p3sWlbUR9dzAOq6qKPg4GF0N21hcwENEtdTqeyHbc3h6IxHmknGARj88Cy1eml nvI/eOc1T5HQsGg85dok1zCr3JUg9rSXOn3nA2pk7PgdrFrJAoSeUCFrsz9RIYoJXy IbpgonbkXsb1PRAqL4RG/dfdy7KyAcBJqcv4C8dNz4Z/+5yWyNPaujIMykhE89LUuJ gUGZZ8hTpvXogmd9vBzSUvHwwxjgz2gdkor4zfFwjiT90pFxV6278FQUVvP5w3urK2 iCgtLZL72ByFnsp64S2ctoAWNFXaV1qUmOJvDA3frgFfiHIqPJcmk+EUyi0UyFzaCB S4kefIjM4SJbw== 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, 11 Jul 2018 13:29:38 +0200 Message-Id: <1531308586-29340-32-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-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;