From patchwork Wed Oct 9 18:43:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11181829 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 148F014ED for ; Wed, 9 Oct 2019 18:43:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D568A218AC for ; Wed, 9 Oct 2019 18:43:57 +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="S+c3tq+5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D568A218AC 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 0778C8E0005; Wed, 9 Oct 2019 14:43:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 028398E0003; Wed, 9 Oct 2019 14:43:56 -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 E7EF28E0005; Wed, 9 Oct 2019 14:43:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id C10AA8E0003 for ; Wed, 9 Oct 2019 14:43:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 3AB56824CA0A for ; Wed, 9 Oct 2019 18:43:56 +0000 (UTC) X-FDA: 76025120472.16.crib94_5c71478c78762 X-Spam-Summary: 2,0,0,6b54ef596a4c8638,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:198.182.61.142:@synopsys.com:.lbl8.mailshell.net-62.14.0.100 64.201.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:86,LUA_SUMMARY:none X-HE-Tag: crib94_5c71478c78762 X-Filterd-Recvd-Size: 4854 Received: from smtprelay-out1.synopsys.com (dc2-smtprelay2.synopsys.com [198.182.61.142]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 18:43:55 +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 A8F42C0161; Wed, 9 Oct 2019 18:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1570646633; bh=z/IWOeKhq4peAhuuLCtaYHRBzB8hgA55HCXWFihVAJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S+c3tq+5m56Mv/qT4UTC2Ab9/9O4fRh9+OIZx/tFgTUVDPb4WnJWXrsfDr01itju7 +m7+BbfTjV1ovUbeg0yEtktwkujtLbUB3DL+JR9KQPYfZ/csuoulLUqJuGhT1JvlQO lUiIPS0/o5L+rim9+MfoOQCEa3lupHVO3LbWkgwLgAC9pVQxpfTcTQUVW8+Tash/jx 3/MDMAZkbqHhMOXTN2dZYnOpfu3Hr6X236pQ30oDvW10PnTfs5bcflja1NtWQbvT1L yr2Td7dfjdbKUc8732j6Hc/aG6QHCH2D+Lq9YtISpetf/tRK7QmaStRWkPNOMUMjYC 78Xmzw/ugkKtA== 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 94C19A006B; Wed, 9 Oct 2019 18:43:52 +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 v2] ARC: mm: remove __ARCH_USE_5LEVEL_HACK Date: Wed, 9 Oct 2019 11:43:50 -0700 Message-Id: <20191009184350.18323-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: 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 --- 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..69397c884a7b 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, address); + 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);