From patchwork Wed Oct 9 18:57:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11181837 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 13DCA13BD for ; Wed, 9 Oct 2019 18:57:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D546C218AC for ; Wed, 9 Oct 2019 18:57:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="P+q9EXk9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D546C218AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 17DC78E0005; Wed, 9 Oct 2019 14:57:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 12FF38E0003; Wed, 9 Oct 2019 14:57:47 -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 01D358E0005; Wed, 9 Oct 2019 14:57:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id CE1FF8E0003 for ; Wed, 9 Oct 2019 14:57:46 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 61D962C1F for ; Wed, 9 Oct 2019 18:57:46 +0000 (UTC) X-FDA: 76025155332.06.pot10_43b26b8867f0c X-Spam-Summary: 2,0,0,f97ad66c8cb76ee7,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org::vineet.gupta1@synopsys.com:kirill.shutemov@linux.intel.com,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1042:1260:1261:1311:1314:1345:1359:1431:1437:1515:1534:1542:1711:1730:1747:1777:1792:1801:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3870:3871:3872:4250:4321:4385:4605:5007:6119:6261:6653:7208:7903:9113:9121:10004:11026:11473:11657:11658:11914:12043:12114:12297:12438:12517:12519:12555:12895:13161:13229:13894:14096:14181:14394:14721:21080:21324:21451:21627:21772:30003:30012:30054:30070,0,RBL:149.117.87.133:@synopsys.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:235,LUA_SUMMARY:none X-HE-Tag: pot10_43b26b8867f0c X-Filterd-Recvd-Size: 4885 Received: from smtprelay-out1.synopsys.com (us03-smtprelay2.synopsys.com [149.117.87.133]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 18:57:45 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1B40BC04D5; Wed, 9 Oct 2019 18:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1570647460; bh=MgRIVfEAJ94OkyjrBQhZFPU5pG5MPCWR3XI6euyMrTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+q9EXk90lZx9V+thbZSLXi49Y0ooOEh5vUOV8p3jhCTwLzIHl/RZ7ohsPJYil6S5 MX+hMG6F8kJl+0eeDQWxtLCi/cwYPeHsOOdRGya1RISfM9OIOB2RQrkk1GecY+QMjj a/2Pn0fH8yKHPvi1RFOqc+3/3N4OND0/sYKMktnctjKSxiyuv6ceGCKkkh4dSwi6z/ PayIEkKnBy3eEQxM10ruy0N3aFHd8dQOnMMvL5skgVWo+Wkdb7TJKBlw7Idw7ra3Qn nAiX1/VYXOy14er8uHy08AgCTMs9si1hkMijKYZ1o7w0ezfl4kf6mwUKW4hgYHc6SR jZs8RKEqLqEog== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 93B7EA006B; Wed, 9 Oct 2019 18:57:33 +0000 (UTC) From: Vineet Gupta To: linux-snps-arc@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vineet Gupta , "Kirill A . Shutemov" Subject: [PATCH v3] ARC: mm: remove __ARCH_USE_5LEVEL_HACK Date: Wed, 9 Oct 2019 11:57:31 -0700 Message-Id: <20191009185731.25814-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191009184350.18323-1-vgupta@synopsys.com> References: <20191009184350.18323-1-vgupta@synopsys.com> MIME-Version: 1.0 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: Add the intermediate p4d accessors to make it 5 level compliant. This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte) There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately. | bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000% Cc: Kirill A. Shutemov Signed-off-by: Vineet Gupta Acked-by: Kirill A. Shutemov Acked-by: Mike Rapoport --- v3 <- v2 - fix highmem build error v2 <- v1 - fix highmem code --- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- arch/arc/mm/highmem.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 976b5931372e..902d45428cea 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -33,7 +33,6 @@ #define _ASM_ARC_PGTABLE_H #include -#define __ARCH_USE_5LEVEL_HACK #include #include #include /* to propagate CONFIG_ARC_MMU_VER */ diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 3861543b66a0..fb86bc3e9b35 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address) * with the 'reference' page table. */ pgd_t *pgd, *pgd_k; + p4d_t *p4d, *p4d_k; pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; @@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address) if (!pgd_present(*pgd_k)) goto bad_area; - pud = pud_offset(pgd, address); - pud_k = pud_offset(pgd_k, address); + p4d = p4d_offset(pgd, address); + p4d_k = p4d_offset(pgd_k, address); + if (!p4d_present(*p4d_k)) + goto bad_area; + + pud = pud_offset(p4d, address); + pud_k = pud_offset(p4d_k, address); if (!pud_present(*pud_k)) goto bad_area; diff --git a/arch/arc/mm/highmem.c b/arch/arc/mm/highmem.c index a4856bfaedf3..fc8849e4f72e 100644 --- a/arch/arc/mm/highmem.c +++ b/arch/arc/mm/highmem.c @@ -111,12 +111,14 @@ EXPORT_SYMBOL(__kunmap_atomic); static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr) { pgd_t *pgd_k; + p4d_t *p4d_k; pud_t *pud_k; pmd_t *pmd_k; pte_t *pte_k; pgd_k = pgd_offset_k(kvaddr); - pud_k = pud_offset(pgd_k, kvaddr); + p4d_k = p4d_offset(pgd_k, kvaddr); + pud_k = pud_offset(p4d_k, kvaddr); pmd_k = pmd_offset(pud_k, kvaddr); pte_k = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);