From patchwork Tue Aug 21 05:28:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10571045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB9BB139B for ; Tue, 21 Aug 2018 05:29:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989682983B for ; Tue, 21 Aug 2018 05:29:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CF0C29852; Tue, 21 Aug 2018 05:29:04 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham 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 D060E2983B for ; Tue, 21 Aug 2018 05:29:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEADF6B1D10; Tue, 21 Aug 2018 01:29:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CC20E6B1D11; Tue, 21 Aug 2018 01:29:02 -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 B8B7C6B1D12; Tue, 21 Aug 2018 01:29:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 70D196B1D10 for ; Tue, 21 Aug 2018 01:29:02 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id l65-v6so4554345pge.17 for ; Mon, 20 Aug 2018 22:29:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :from:date:message-id:mime-version:content-transfer-encoding; bh=Jj5yv6EPPk3lXXkdMp2k1r6jdsRHw0pk9azilrOvKYY=; b=eTDVTOz46K7smOZba8OPDiBewCqCPOcEvYgMK6jubtPICONmvr2OUH1wi/1qmudumP 9oBUAKZkjF4Co4/YcaRhfS42rv+VdmfvnI8vw2r5x1c/RODFp3ffywLwqwWNPRm/VHZx 1RuM8OHu/W88rs71XBEMa9XrOhAJok7uay7dUOhIehKIixu9MnVXWf06FVkp3KKiqeI+ gdAFUk3LZiFqqnL/zOuV+xBgSyMc0X12sz0RUv4CNFIwVzjARpTPCBEpLkqjhd9joeFR vKsvXVLjUWaTb++b+E/rdyMLePC57PejOj8ByEIUd1Pb13Gh/WAi1RpN6//axF1DBSRU VKGw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Gm-Message-State: AOUpUlFXJtnR5Y3CsU4LyBoS4auPjyijHIpW7IBOo7ZQYSwWc7HXwjJE 9zozkc8AIPFIaRnKkI6ZNoWjCpnX7idHuD1K1Hu6QbDd/BrkmbKSzsXy/DFUxEcdSxLuW/hA0HJ euDPOAdS7MbYjqij7byvgBeRQ/dq2G4Y19cZn1nhHu/Bk/oq7SwCEFmDTBpkV85KTAQ== X-Received: by 2002:a63:7d48:: with SMTP id m8-v6mr46410160pgn.0.1534829342064; Mon, 20 Aug 2018 22:29:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyi0+6x2+R0jdehtgp90uUkuUsozBmtGU26/LO2E4zSS9Bzp8E+8quK3wy0WgPPg/Q34Ew5 X-Received: by 2002:a63:7d48:: with SMTP id m8-v6mr46410131pgn.0.1534829341360; Mon, 20 Aug 2018 22:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534829341; cv=none; d=google.com; s=arc-20160816; b=pAAXMPvWOT3pPslfGxMjUNIVk4QQN8PlRaOAkkF0PMn6UJLAzNqRfftLQLEGOF+/ed mrCFDUCKs8gSpcW62lUHB4WWIRmkbAhDSqEDPcRfQvnh//RpFA1Cc/LN53K/q2N0oWmo +voEPPoLmZ2OB4fE/Lh3nIzBmJKEWv2kl8zZcZoVXsyW3gVj9jhZXPcJWU6qrFY3cvhD ix2tEqNNydFO6hbguXBW13tIoPkIK7Z2BbHzBMqZ9xFxbJWx3n6UTB+L3Sg5H0h5hfiJ ZTsm/KZLEeWLBwLAJ3yArlSM+JRP2Y8wkvWKbcJ2Tptt3g49gatm3kxZeqVBB/e8L8Fm DARQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:from:cc:to :subject:arc-authentication-results; bh=Jj5yv6EPPk3lXXkdMp2k1r6jdsRHw0pk9azilrOvKYY=; b=Pn+2NYdT8GZplt1SKqxhgaybK3SNrqi2Hbuyp5j2/7zawrgdxKuyuFmbp1Yg1p5d5s QLDdL5/sUWh4AWxTmHhWmy/tsinxRvQPOXrf1qpOPYxYdrdCbBaP7poDfG627OGCqrvx Ta8fk7xouhX7Dznn5JMgJVsLR8JqSfnk1yxOIvCAvGdBV+ZE6ciZ8duLxIfucukboFV/ Jdo/f/zOpW/e2F3axx6MJ4dlTuQDas70UexM1M2/5N3cGVaI7LY0e8Bd94zU//dCPRDI C2wuaE8/RqapLBkT8w7qjXhs9Kr5YSlkb84JzTdhfUUe3H8S+/43Jvl5eFULumLj1xEX AM0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id bf2-v6si3226202plb.482.2018.08.20.22.29.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 22:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from localhost (5355525A.cm-6-6b.dynamic.ziggo.nl [83.85.82.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 24E69A59; Tue, 21 Aug 2018 05:29:00 +0000 (UTC) Subject: Patch "x86/mm: Simplify p[g4um]d_page() macros" has been added to the 4.9-stable tree To: ak@linux.intel.com,arnd@arndb.de,aryabinin@virtuozzo.com,bp@alien8.de,bp@suse.de,brijesh.singh@amd.com,corbet@lwn.net,dvyukov@google.com,dyoung@redhat.com,e61eb533a6d0aac941db2723d8aa63ef6b882dee.1500319216.git.thomas.lendacky@amd.com,glider@google.com,gregkh@linuxfoundation.org,kasan-dev@googlegroups.com,konrad.wilk@oracle.com,linux-mm@kvack.org,luto@kernel.org,lwoodman@redhat.com,matt@codeblueprint.co.uk,mingo@kernel.org,mst@redhat.com,pbonzini@redhat.com,peterz@infradead.org,riel@redhat.com,rkrcmar@redhat.com,tglx@linutronix.de,thomas.lendacky@amd.com,torvalds@linux-foundation.org,toshi.kani@hpe.com Cc: From: Date: Tue, 21 Aug 2018 07:28:40 +0200 Message-ID: <1534829320208160@kroah.com> MIME-Version: 1.0 X-stable: commit 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 This is a note to let you know that I've just added the patch titled x86/mm: Simplify p[g4um]d_page() macros to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-mm-simplify-pd_page-macros.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From fd7e315988b784509ba3f1b42f539bd0b1fca9bb Mon Sep 17 00:00:00 2001 From: Tom Lendacky Date: Mon, 17 Jul 2017 16:10:06 -0500 Subject: x86/mm: Simplify p[g4um]d_page() macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Tom Lendacky commit fd7e315988b784509ba3f1b42f539bd0b1fca9bb upstream. Create a pgd_pfn() macro similar to the p[4um]d_pfn() macros and then use the p[g4um]d_pfn() macros in the p[g4um]d_page() macros instead of duplicating the code. Signed-off-by: Tom Lendacky Reviewed-by: Thomas Gleixner Reviewed-by: Borislav Petkov Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Borislav Petkov Cc: Brijesh Singh Cc: Dave Young Cc: Dmitry Vyukov Cc: Jonathan Corbet Cc: Konrad Rzeszutek Wilk Cc: Larry Woodman Cc: Linus Torvalds Cc: Matt Fleming Cc: Michael S. Tsirkin Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Radim Krčmář Cc: Rik van Riel Cc: Toshimitsu Kani Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/e61eb533a6d0aac941db2723d8aa63ef6b882dee.1500319216.git.thomas.lendacky@amd.com Signed-off-by: Ingo Molnar [Backported to 4.9 stable by AK, suggested by Michael Hocko] Signed-off-by: Andi Kleen Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/pgtable.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Patches currently in stable-queue which might be from thomas.lendacky@amd.com are queue-4.9/x86-mm-simplify-pd_page-macros.patch --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -190,6 +190,11 @@ static inline unsigned long pud_pfn(pud_ return (pfn & pud_pfn_mask(pud)) >> PAGE_SHIFT; } +static inline unsigned long pgd_pfn(pgd_t pgd) +{ + return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; +} + #define pte_page(pte) pfn_to_page(pte_pfn(pte)) static inline int pmd_large(pmd_t pte) @@ -621,8 +626,7 @@ static inline unsigned long pmd_page_vad * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pmd_page(pmd) \ - pfn_to_page((pmd_val(pmd) & pmd_pfn_mask(pmd)) >> PAGE_SHIFT) +#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd)) /* * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] @@ -690,8 +694,7 @@ static inline unsigned long pud_page_vad * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pud_page(pud) \ - pfn_to_page((pud_val(pud) & pud_pfn_mask(pud)) >> PAGE_SHIFT) +#define pud_page(pud) pfn_to_page(pud_pfn(pud)) /* Find an entry in the second-level page table.. */ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) @@ -731,7 +734,7 @@ static inline unsigned long pgd_page_vad * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT) +#define pgd_page(pgd) pfn_to_page(pgd_pfn(pgd)) /* to find an entry in a page-table-directory. */ static inline unsigned long pud_index(unsigned long address)