From patchwork Tue Aug 21 05:28:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10571043 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 560DC139B for ; Tue, 21 Aug 2018 05:28:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43DE62983B for ; Tue, 21 Aug 2018 05:28:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3702629852; Tue, 21 Aug 2018 05:28:58 +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 DA0DD2983B for ; Tue, 21 Aug 2018 05:28:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C28C46B1D0D; Tue, 21 Aug 2018 01:28:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BFEB26B1D0E; Tue, 21 Aug 2018 01:28:55 -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 AC8B16B1D0F; Tue, 21 Aug 2018 01:28:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 683336B1D0D for ; Tue, 21 Aug 2018 01:28:55 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id v9-v6so4920238ply.13 for ; Mon, 20 Aug 2018 22:28:55 -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=0nou9e03n0vt/c4gPE86ObLQPmI8pV/StEJFDKTWTxQ=; b=gXTM0VM/POhppxdoiW4DZ2w7l4KG8Fpaez2MSpDg9QyMEYI1h9oU3kAOYTPZae2zNT lCTShpv1bCuORzF+5F0KOUFLj46/mxJ9l7XEFQR3x8Vetd2ag/PbRvsnt4Jf1dw1bkYp Kw2J+d/juXgc12+U2AkkxPigfAyq9m5jt1fQyVLx2BPQST1Chg9r3bOmQnBS/u2CIccU bDhz5KYk6i3s1NeYQGBjAFSMCIKGgc8PpDFwZ03rnkCihB5y3+NSSYnjHzN2RMn9p0Yw VLd3FcaZlMJBtly3YIKh1iDGRncH5msDgvjXj2xizqqOS/XTVVgPy8DlITKAP7jsV4U9 2fmQ== 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: AOUpUlHdyYkLmtpb8PjJc76XYoNMGdSYOjctHtQTcAa2EACjTyVsKPXH WzfEcI/o3TOJJ0r8LKX4zidDAsEsBAvdTnOQyMcS0xHbXOwUieLzalYbYzUcdqx5a7IwSBm7f+v J5VcY6p6jEN8BfqgqDIyV5TrnlF2Tg3cPDkjbDMs/hXSHxSr3MEmdAn1y1ySKYX6jAw== X-Received: by 2002:a63:844:: with SMTP id 65-v6mr46845779pgi.406.1534829335066; Mon, 20 Aug 2018 22:28:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyQKPxNqnDk7+OFpwOCeEEoNywThuNOzsz1sLoy0yRMqoU5LUwOqIu0dQOpp9T/VAQVKY5E X-Received: by 2002:a63:844:: with SMTP id 65-v6mr46845756pgi.406.1534829334327; Mon, 20 Aug 2018 22:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534829334; cv=none; d=google.com; s=arc-20160816; b=jZ45IfiCS9pfUotHNxWNiuTICZ0Asji3qeKe/LKPZg5MsL3zERkET7E1gUKmn6/Nd0 JPwxg3fYWPX8ByCRimuk9RmLiYchf7xjdLre7Yc2Hue7IwFnK9JB0Kz9ijuFvQadhkOt bQy1j1wgnbKaPGTzjYDvmjFIGZbvFIEuB9o4oYY/EtXG94eEAtCAFNGXhmCcSlKkgj45 LBOWwSxlfmDdTnns9zhnUfORDINbjvekS2QO7gz9uoyrS1LUCteC3G+7COHCTwe2PpoL 75iN7F/FiH7jEsXFIq0GXO/eckgVWTqLddIEUDK9J5tjdFS+fAfO5KoGel3GZNKRubDv bQjQ== 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=0nou9e03n0vt/c4gPE86ObLQPmI8pV/StEJFDKTWTxQ=; b=i2tHdbwwEaYxDHqum/C2h91GVfujxi4hKGUPAAUoP2WC1sDe9cfRlmfXXXGNQqLbhA OqFMglL8AeWLSyhz33NZNhsXWxH/y2oxoJWIGNmaE/LKZt2u0h/SFlyW2mBauhYl/bV4 ctR5tMFeTN7j/sbeGxEHnkNTwPTrMfilnTKRNbzAsMmTBqK+BSSfkYiK72fpJZ+Iah6i zmG8FwGb2BJIjwJfphgWN0KDFHRhJD4gvyyIATxQKSg2K0OsTGwd/q9vrFEhJKuiGnX7 aEZbloWowIWwD8HvH5Zb5MMjct5G4VDsU5PUAlqEvWHJKT1BrwHs1AVrKHgIioDTLnlF Lt+w== 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 c192-v6si11709348pfg.347.2018.08.20.22.28.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 22:28:54 -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 305A2CB2; Tue, 21 Aug 2018 05:28:53 +0000 (UTC) Subject: Patch "x86/mm: Simplify p[g4um]d_page() macros" has been added to the 4.4-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:23 +0200 Message-ID: <153482930314579@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.4-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.4 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.4/x86-mm-simplify-pd_page-macros.patch --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -173,6 +173,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) @@ -578,8 +583,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] @@ -647,8 +651,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) @@ -688,7 +691,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)