Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2174805imu; Thu, 29 Nov 2018 00:13:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/UhubgkWc39iDTZF6sAUtx94IcJhqNTnX19rfw2H4DYnghl4JeGdRQV+ms1AzQB7FUYPz3F X-Received: by 2002:a63:5a08:: with SMTP id o8mr405911pgb.185.1543479207798; Thu, 29 Nov 2018 00:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543479207; cv=none; d=google.com; s=arc-20160816; b=YMLgSrBGIy7hI7tI3XyeaEx5WeblG4KKVtadmLR/k+7bLNlCfEl1mW9BKfD+8eGCvD TFE3iivC9bTtR+yjrlL0rlNuNUryizMfhnbDGduqxTbBMYB3oxVBHCs4C6+gycfdasM6 R99prdeVNQDWhMh8evFU98lwPgqM7r4s4I6056kF6EKtsUnkv22B8d2WAOFfQE4+qCsM MRy5DPKFjWbqxIvOm9dG9uTIIqY0OLHdc8fsoFRHhy2WaxKEsvZIX+UuleUeCgG6q3fO GK4fBKls2k4BCM5a9wwCVP0OOUWJrkWBpV9BQ8+ibRTcPDe3GbuwBkEV6CDWj8V5Ulce h6sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id; bh=UVwgm2ZK7cvlACK2Lr/IAAR6YC6UDJGQj5QMtucDzf8=; b=Ddn6qkH3EURqJgse3C9zCI/5Uc5mzWnRYhmSiV0YhFXaG6unsCaboGlpbkIX03e68c WI9Mo1WGpLx7IN+L295sw2Y3lJ7EH3BbBs+yKScl20L9yD6HShPTag6+17N6l82wZ8Up Ppfmj7RxmizOvTZSNjTAGCbwDKc+CW41HgwL//uUoOZ4IXIwuWRTPVpo6QHff4bHn2O6 JaaRqAcT2dVC7/F0Nq30EZRr5enF27ArE3O3zVPChv9/eWjQASUl07r7A07NmdSPzZE/ Uz/CHpc0c7Od/xpkOW7O/VYCBaWSsn0NozDJeaxknuDRJJBSMpy/9Dae+V403XqRPoD5 9f+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u72si1236705pgc.360.2018.11.29.00.13.13; Thu, 29 Nov 2018 00:13:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727272AbeK2TOi (ORCPT + 99 others); Thu, 29 Nov 2018 14:14:38 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:4417 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbeK2TOi (ORCPT ); Thu, 29 Nov 2018 14:14:38 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4359DW42jMz9vGlY; Thu, 29 Nov 2018 09:10:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id UxBklOHiYl0N; Thu, 29 Nov 2018 09:10:03 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4359DW3V6Sz9vGlV; Thu, 29 Nov 2018 09:10:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4E6C18B890; Thu, 29 Nov 2018 09:10:04 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id RTNXC_i1oOhJ; Thu, 29 Nov 2018 09:10:04 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 00C2F8B762; Thu, 29 Nov 2018 09:10:03 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id BA96769B13; Thu, 29 Nov 2018 08:10:03 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH v8 00/20] Implement use of HW assistance on TLB table walk on 8xx To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 29 Nov 2018 08:10:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The purpose of this serie is to implement hardware assistance for TLB table walk on the 8xx. First part prepares for using HW assistance in TLB routines: - Trivial fixes: - Remove CONFIG_BOOKE stuff from book3S headers. - Removal of unneeded atomic PTE update requirement for 8xx. - move book3s64 page fragment code in a common part for reusing it by the 8xx as 16k page size mode still uses 4k page tables. - Fixing a bug in memcache handling when standard pages and hugepages share caches of the same size (see original discussion in https://patchwork.ozlabs.org/patch/957565/) - Optimise access to 8xx perf counters (hence reducing number of registers used) Second part implements HW assistance in TLB routines in the following steps: - Disable 16k page size mode and 512k hugepages - Switch 4k to HW assistance - Bring back 512k hugepages - Bring back 16k page size mode. Last part cleans up: - Take benefit of Miss handler size reduction to regroup related parts - Reduce number of registers used in miss handlers, freeing them for future use. Tested successfully on 8xx and 83xx (book3s/32) Changes in v8: - Moved definitions in pgalloc.h to avoid conflicting with memcache patches. - Included the memcache bugfix serie in this serie to avoid conflicts between the two series when coming to the 512k pages patch. - In the 512k HW assistance patch, reduced the #ifdef mess by using IS_ENABLED(CONFIG_PPC_8xx) instead. Changes in v7: - Reordered to get trivial and already reviewed patches in front. - Reordered to regroup all HW assistance related patches together. - Rebased on today merge branch (28 Nov) - Added a helper for access to mm_context_t.frag - Reduced the amount of changes in PPC32 to support pte_fragment - Applied pte_fragment to both nohash/32 and book3s/32 Changes in v6: - Droped the part related to handling GUARD attribute at PGD/PMD level. - Moved the commonalisation of page_fragment in the begining (this part has been reviewed by Aneesh) - Rebased on today merge branch (19 Oct) Changes in v5: - Also avoid useless lock in get_pmd_from_cache() - A new patch to relocate mmu headers in platform specific directories - A new patch to distribute pgtable_t typedefs in platform specific mmu headers instead of the uggly #ifdef - Moved early_pte_alloc_kernel() in platform specific pgalloc - Restricted definition of PTE_FRAG_SIZE and PTE_FRAG_NR to platforms using the pte fragmentation. - arch_exit_mmap() and destroy_pagetable_cache() are now platform specific. Changes in v4: - Reordered the serie to put at the end the modifications which makes L1 and L2 entries independant. - No modifications to ppc64 ioremap (we still have an opportunity to merge them, for a future patch serie) - 8xx code modified to use patch_site instead of patch_instruction to get a clearer code and avoid object pollution with global symbols - Moved perf counters in first 32kb of memory to optimise access - Split the big bang to HW assistance in several steps: 1. Temporarily removes support of 16k pages and 512k hugepages 2. Change TLB routines to use HW assistance for 4k pages and 8M hugepages 3. Add back support for 512k hugepages 4. Add back support for 16k pages (using pte_fragment as page tables are still 4k) Changes in v3: - Fixed an issue in the 09/14 when CONFIG_PIN_TLB_TEXT was not enabled - Added performance measurement in the 09/14 commit log - Rebased on latest 'powerpc/merge' tree, which conflicted with 13/14 Changes in v2: - Removed the 3 first patchs which have been applied already - Fixed compilation errors reported by Michael - Squashed the commonalisation of ioremap functions into a single patch - Fixed the use of pte_fragment - Added a patch optimising perf counting of TLB misses and instructions Christophe Leroy (20): powerpc/book3s32: Remove CONFIG_BOOKE dependent code powerpc/8xx: Remove PTE_ATOMIC_UPDATES powerpc/mm: Move pte_fragment_alloc() to a common location powerpc/mm: Avoid useless lock with single page fragments powerpc/mm: move platform specific mmu-xxx.h in platform directories powerpc/mm: Move pgtable_t into platform headers powerpc/mm: add helpers to get/set mm.context->pte_frag powerpc/mm: Extend pte_fragment functionality to PPC32 powerpc/mm: enable the use of page table cache of order 0 powerpc/mm: replace hugetlb_cache by PGT_CACHE(PTE_T_ORDER) powerpc/mm: fix a warning when a cache is common to PGD and hugepages powerpc/mm: remove unnecessary test in pgtable_cache_init() powerpc/8xx: Move SW perf counters in first 32kb of memory powerpc/8xx: Temporarily disable 16k pages and hugepages powerpc/8xx: Use hardware assistance in TLB handlers powerpc/8xx: Enable 8M hugepage support with HW assistance powerpc/8xx: Enable 512k hugepage support with HW assistance powerpc/8xx: reintroduce 16K pages with HW assistance powerpc/8xx: don't use r12/SPRN_SPRG_SCRATCH2 in TLB Miss handlers powerpc/8xx: regroup TLB handler routines arch/powerpc/include/asm/book3s/32/mmu-hash.h | 5 + arch/powerpc/include/asm/book3s/32/pgalloc.h | 40 +-- arch/powerpc/include/asm/book3s/32/pgtable.h | 19 +- arch/powerpc/include/asm/book3s/64/mmu.h | 9 + arch/powerpc/include/asm/book3s/64/pgalloc.h | 6 +- arch/powerpc/include/asm/hugetlb.h | 6 +- arch/powerpc/include/asm/mmu.h | 14 +- arch/powerpc/include/asm/mmu_context.h | 2 +- arch/powerpc/include/asm/{ => nohash/32}/mmu-40x.h | 0 arch/powerpc/include/asm/{ => nohash/32}/mmu-44x.h | 0 arch/powerpc/include/asm/{ => nohash/32}/mmu-8xx.h | 1 + arch/powerpc/include/asm/nohash/32/mmu.h | 25 ++ arch/powerpc/include/asm/nohash/32/pgalloc.h | 27 +- arch/powerpc/include/asm/nohash/32/pgtable.h | 27 +- arch/powerpc/include/asm/nohash/32/pte-8xx.h | 3 - arch/powerpc/include/asm/nohash/64/mmu.h | 12 + arch/powerpc/include/asm/nohash/64/pgalloc.h | 5 +- arch/powerpc/include/asm/{ => nohash}/mmu-book3e.h | 0 arch/powerpc/include/asm/nohash/mmu.h | 11 + arch/powerpc/include/asm/nohash/pgtable.h | 4 + arch/powerpc/include/asm/page.h | 14 - arch/powerpc/include/asm/pgtable-types.h | 4 + arch/powerpc/include/asm/pgtable.h | 33 +- arch/powerpc/kernel/cpu_setup_fsl_booke.S | 2 +- arch/powerpc/kernel/head_8xx.S | 366 ++++++++------------- arch/powerpc/kvm/e500.h | 2 +- arch/powerpc/mm/8xx_mmu.c | 4 +- arch/powerpc/mm/Makefile | 5 +- arch/powerpc/mm/hugetlbpage.c | 40 +-- arch/powerpc/mm/init-common.c | 56 ++-- arch/powerpc/mm/mmu_context.c | 10 + arch/powerpc/mm/mmu_context_book3s64.c | 15 - arch/powerpc/mm/mmu_context_nohash.c | 2 +- arch/powerpc/mm/pgtable-book3s64.c | 88 +---- arch/powerpc/mm/pgtable-frag.c | 119 +++++++ arch/powerpc/mm/pgtable_32.c | 25 +- 36 files changed, 497 insertions(+), 504 deletions(-) rename arch/powerpc/include/asm/{ => nohash/32}/mmu-40x.h (100%) rename arch/powerpc/include/asm/{ => nohash/32}/mmu-44x.h (100%) rename arch/powerpc/include/asm/{ => nohash/32}/mmu-8xx.h (99%) create mode 100644 arch/powerpc/include/asm/nohash/32/mmu.h create mode 100644 arch/powerpc/include/asm/nohash/64/mmu.h rename arch/powerpc/include/asm/{ => nohash}/mmu-book3e.h (100%) create mode 100644 arch/powerpc/include/asm/nohash/mmu.h create mode 100644 arch/powerpc/mm/pgtable-frag.c -- 2.13.3