Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3694057ybg; Sun, 20 Oct 2019 19:43:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+04o+wgZ1DzR0Lfm2/IrbXQDacn7kWd96Ag9pQt1adSiDabI9biAXFJ2SXzSXDop6an4A X-Received: by 2002:a05:6402:1548:: with SMTP id p8mr22593740edx.43.1571625810240; Sun, 20 Oct 2019 19:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571625810; cv=none; d=google.com; s=arc-20160816; b=KB9qB8ZoPR3tWrK688AImvI61KjNg2CIOvS+OszZMqqZbsqOvW/bMB1TrVrZ5NNYqL nPwUUKd2Qfr8lYhQkxPDrPCqFMD/BK/duNMAb3ns7Zu+e7R1TRFLaf4eot04C92/mhkQ pcLs7jwU6+05sxpoR8hem/M9vf8Cm4S8nj+nYDxNJ7xoRD7KpGDCydHNdJIE8FqCnmwH AReNn4EOMYRHgpxVm4bTPpRwocM5Jy6YPSNEzZ0ndx5CdwpfOGlFftBzzR8A49Mx8l7+ Y39IqQHEK4340zmTkw4J1DdkhooTJK7CRKdUcT3EdS2CWGl5B27RndKvLS4fWuGELoqq Y8rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=N8FskMMcVt5YcCXDzN50V+5Njzh4F3K12Tx9UkfoDHk=; b=PZgHbvP/yxYla32gHEC6/7bzvkFz2pVapinCF/+MP+rsmjurSbO7EHNbfa6/J3qCnX 8AuV1hJ7+yv1o465Cc2I5Rat2SYg6g80GhluuJtgtuyviSqD/rvf7hnmp361fqeW6/zR JpU2s6JD/HiGPa9Ib+M08SHxZuS7ttmCy09+e2YO5svNtvHENfd1KNDag62+BHYnGJH9 cvePJSUC50xrkzDlndQIMfSw1Sgwz0ZOVUVmJuZm5x9A2K356H8Jp+gvv/pjR3dCH/Xf jB5UM61XDIGxVAYv/QONU3MAoqZna0tw2tw/TMX7KCanKq9Y/Tks/nDlAkIdzhmSs9nO +C3g== 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 d14si8035001ejr.358.2019.10.20.19.43.06; Sun, 20 Oct 2019 19:43:30 -0700 (PDT) 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 S1727041AbfJUCmu (ORCPT + 99 others); Sun, 20 Oct 2019 22:42:50 -0400 Received: from [217.140.110.172] ([217.140.110.172]:39736 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1726907AbfJUCmt (ORCPT ); Sun, 20 Oct 2019 22:42:49 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4F668369; Sun, 20 Oct 2019 19:42:16 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.2]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0FF163F71F; Sun, 20 Oct 2019 19:42:01 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , Vlastimil Babka , Greg Kroah-Hartman , Thomas Gleixner , Mike Rapoport , Jason Gunthorpe , Dan Williams , Peter Zijlstra , Michal Hocko , Mark Rutland , Mark Brown , Steven Price , Ard Biesheuvel , Masahiro Yamada , Kees Cook , Tetsuo Handa , Matthew Wilcox , Sri Krishna chowdary , Dave Hansen , Russell King - ARM Linux , Michael Ellerman , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , "David S. Miller" , Vineet Gupta , James Hogan , Paul Burton , Ralf Baechle , "Kirill A . Shutemov" , Gerald Schaefer , Christophe Leroy , Mike Kravetz , Ingo Molnar , linux-snps-arc@lists.infradead.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V7] mm/debug: Add tests validating architecture page table helpers Date: Mon, 21 Oct 2019 08:12:18 +0530 Message-Id: <1571625739-29943-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds a test validation for architecture exported page table helpers. Patch in the series adds basic transformation tests at various levels of the page table. This test was originally suggested by Catalin during arm64 THP migration RFC discussion earlier. Going forward it can include more specific tests with respect to various generic MM functions like THP, HugeTLB etc and platform specific tests. https://lore.kernel.org/linux-mm/20190628102003.GA56463@arrakis.emea.arm.com/ Needs to be applied on linux-next (next-20191017) after reverting all commits from V5 of this series. Changes in V7: - Memory allocation and free routines for mapped pages have been droped - Mapped pfns are derived from standard kernel text symbol per Matthew - Moved debug_vm_pgtaable() after page_alloc_init_late() per Michal and Qian - Updated the commit message per Michal - Updated W=1 GCC warning problem on x86 per Qian Cai - Addition of new alloc_contig_pages() helper has been submitted separately Changes in V6: (https://patchwork.kernel.org/project/linux-mm/list/?series=187589) - Moved alloc_gigantic_page_order() into mm/page_alloc.c per Michal - Moved alloc_gigantic_page_order() within CONFIG_CONTIG_ALLOC in the test - Folded Andrew's include/asm-generic/pgtable.h fix into the test patch 2/2 Changes in V5: (https://patchwork.kernel.org/project/linux-mm/list/?series=185991) - Redefined and moved X86 mm_p4d_folded() into a different header per Kirill/Ingo - Updated the config option comment per Ingo and dropped 'kernel module' reference - Updated the commit message and dropped 'kernel module' reference - Changed DEBUG_ARCH_PGTABLE_TEST into DEBUG_VM_PGTABLE per Ingo - Moved config option from mm/Kconfig.debug into lib/Kconfig.debug - Renamed core test function arch_pgtable_tests() as debug_vm_pgtable() - Renamed mm/arch_pgtable_test.c as mm/debug_vm_pgtable.c - debug_vm_pgtable() gets called from kernel_init_freeable() after init_mm_internals() - Added an entry in Documentation/features/debug/ per Ingo - Enabled the test on arm64 and x86 platforms for now Changes in V4: (https://patchwork.kernel.org/project/linux-mm/list/?series=183465) - Disable DEBUG_ARCH_PGTABLE_TEST for ARM and IA64 platforms Changes in V3: (https://lore.kernel.org/patchwork/project/lkml/list/?series=411216) - Changed test trigger from module format into late_initcall() - Marked all functions with __init to be freed after completion - Changed all __PGTABLE_PXX_FOLDED checks as mm_pxx_folded() - Folded in PPC32 fixes from Christophe Changes in V2: https://lore.kernel.org/linux-mm/1568268173-31302-1-git-send-email-anshuman.khandual@arm.com/T/#t - Fixed small typo error in MODULE_DESCRIPTION() - Fixed m64k build problems for lvalue concerns in pmd_xxx_tests() - Fixed dynamic page table level folding problems on x86 as per Kirril - Fixed second pointers during pxx_populate_tests() per Kirill and Gerald - Allocate and free pte table with pte_alloc_one/pte_free per Kirill - Modified pxx_clear_tests() to accommodate s390 lower 12 bits situation - Changed RANDOM_NZVALUE value from 0xbe to 0xff - Changed allocation, usage, free sequence for saved_ptep - Renamed VMA_FLAGS as VMFLAGS - Implemented a new method for random vaddr generation - Implemented some other cleanups - Dropped extern reference to mm_alloc() - Created and exported new alloc_gigantic_page_order() - Dropped the custom allocator and used new alloc_gigantic_page_order() Changes in V1: https://lore.kernel.org/linux-mm/1567497706-8649-1-git-send-email-anshuman.khandual@arm.com/ - Added fallback mechanism for PMD aligned memory allocation failure Changes in RFC V2: https://lore.kernel.org/linux-mm/1565335998-22553-1-git-send-email-anshuman.khandual@arm.com/T/#u - Moved test module and it's config from lib/ to mm/ - Renamed config TEST_ARCH_PGTABLE as DEBUG_ARCH_PGTABLE_TEST - Renamed file from test_arch_pgtable.c to arch_pgtable_test.c - Added relevant MODULE_DESCRIPTION() and MODULE_AUTHOR() details - Dropped loadable module config option - Basic tests now use memory blocks with required size and alignment - PUD aligned memory block gets allocated with alloc_contig_range() - If PUD aligned memory could not be allocated it falls back on PMD aligned memory block from page allocator and pud_* tests are skipped - Clear and populate tests now operate on real in memory page table entries - Dummy mm_struct gets allocated with mm_alloc() - Dummy page table entries get allocated with [pud|pmd|pte]_alloc_[map]() - Simplified [p4d|pgd]_basic_tests(), now has random values in the entries Original RFC V1: https://lore.kernel.org/linux-mm/1564037723-26676-1-git-send-email-anshuman.khandual@arm.com/ Cc: Andrew Morton Cc: Vlastimil Babka Cc: Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Mike Rapoport Cc: Jason Gunthorpe Cc: Dan Williams Cc: Peter Zijlstra Cc: Michal Hocko Cc: Mark Rutland Cc: Mark Brown Cc: Steven Price Cc: Ard Biesheuvel Cc: Masahiro Yamada Cc: Kees Cook Cc: Tetsuo Handa Cc: Matthew Wilcox Cc: Sri Krishna chowdary Cc: Dave Hansen Cc: Russell King - ARM Linux Cc: Michael Ellerman Cc: Paul Mackerras Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: "David S. Miller" Cc: Vineet Gupta Cc: James Hogan Cc: Paul Burton Cc: Ralf Baechle Cc: Kirill A. Shutemov Cc: Gerald Schaefer Cc: Christophe Leroy Cc: Mike Kravetz Cc: Ingo Molnar Cc: linux-snps-arc@lists.infradead.org Cc: linux-mips@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-ia64@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s390@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: sparclinux@vger.kernel.org Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Anshuman Khandual (1): mm/debug: Add tests validating architecture page table helpers .../debug/debug-vm-pgtable/arch-support.txt | 34 ++ arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable_64.h | 6 + include/asm-generic/pgtable.h | 6 + init/main.c | 1 + lib/Kconfig.debug | 21 ++ mm/Makefile | 1 + mm/debug_vm_pgtable.c | 388 +++++++++++++++++++++ 9 files changed, 459 insertions(+) create mode 100644 Documentation/features/debug/debug-vm-pgtable/arch-support.txt create mode 100644 mm/debug_vm_pgtable.c -- 2.7.4