From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B795C2BB55 for ; Mon, 13 Apr 2020 02:13:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B606206C3 for ; Mon, 13 Apr 2020 02:13:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B606206C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 702018E00F4; Sun, 12 Apr 2020 22:13:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68BDA8E00D0; Sun, 12 Apr 2020 22:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 553FB8E00F4; Sun, 12 Apr 2020 22:13:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 368E08E00D0 for ; Sun, 12 Apr 2020 22:13:40 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E4E10181AEF31 for ; Mon, 13 Apr 2020 02:13:39 +0000 (UTC) X-FDA: 76701210558.02.crook98_2d2c441c870b X-HE-Tag: crook98_2d2c441c870b X-Filterd-Recvd-Size: 4919 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 02:13:39 +0000 (UTC) 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 7478E30E; Sun, 12 Apr 2020 19:13:38 -0700 (PDT) Received: from [192.168.0.129] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB8D43F73D; Sun, 12 Apr 2020 19:13:30 -0700 (PDT) Subject: Re: [patch 1/1] mm/debug: add tests validating architecture page table helpers To: Linus Torvalds , Andrew Morton Cc: Benjamin Herrenschmidt , Christian Borntraeger , Borislav Petkov , Qian Cai , Catalin Marinas , Christophe Leroy , Gerald Schaefer , Vasily Gorbik , Heiko Carstens , Peter Anvin , "Kirill A . Shutemov" , Linux-MM , Ingo Molnar , Ingo Molnar , mm-commits@vger.kernel.org, Michael Ellerman , Palmer Dabbelt , Paul Walmsley , Paul Mackerras , Mike Rapoport , Thomas Gleixner , vgupta@synopsys.com, Will Deacon References: <20200412004155.1a8f4e081b4e03ef5903abb5@linux-foundation.org> <20200412074250.0cE0EZy6-%akpm@linux-foundation.org> From: Anshuman Khandual Message-ID: <09a03353-459d-f914-eb5f-2b680ebfe483@arm.com> Date: Mon, 13 Apr 2020 07:43:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 04/12/2020 10:03 PM, Linus Torvalds wrote: > On Sun, Apr 12, 2020 at 12:42 AM Andrew Morton > wrote: >> >> Test page table pages are allocated from system memory with required size >> and alignments. The mapped pfns at page table levels are derived from a >> real pfn representing a valid kernel text symbol. This test gets called >> inside kernel_init() right after async_synchronize_full(). > > This last part makes absolutely zero sense to me. > > Why would it be done before the machine is properly up? Why isn't this > just a module with a module_init? What makes this test so important > and magical that it has to be done during early boot? This test first started with being a module_init(), then a late_initcall() before getting called inside kernel_init() in it's current form. During our early review process (https://patchwork.kernel.org/patch/11176831/) Ingo had suggested moving this test earlier during boot to catch potential page table helper problems (if any), which made sense. This test does not particularly need to run during early boot but it might just be preferable to detect potential page table helper problems (if any) earlier before they start getting used some where else. Though I guess it is not absolutely necessary either. > > So not applied, particularly since this apparently caused problems. We > don't randomly break the boot, which is fragile anyway, just for a > test that doesn't look like it should be boot-specific to me. Fair enough, will change this to late_initcall(). Just to give some more historical context.. This test has been validated on all explicitly supported platforms (i.e via enabling ARCH_HAS_DEBUG_VM_PGTABLE) i.e arm64, s390, arc, powerpc (32 and 64), x86 (!X86_PAE). But this can also be enabled via CONFIG_EXPERT on platforms that dont subscribe ARCH_HAS_DEBUG_VM_PGTABLE either because there were no volunteers to run the test or the test might just fail to run. The idea behind allowing this test get enabled via CONFIG_EXPERT was to just facilitate easy experimentation (without really changing Kconfig) on platforms that dont support it just yet through ARCH_HAS_DEBUG_VM_PGTABLE. There was a recent bug report for one such scenarios [1]. But we do expect such scenarios to exist on platforms without ARCH_HAS_DEBUG_VM_PGTABLE and CONFIG_EXPERT method was precisely provided for the very same reason. [1] https://lore.kernel.org/lkml/fb14237e-f973-bc34-4981-280ba5e1eb92@arm.com/ > > If it wants a new clean mm, it should just do a fork. And do so > _looong_ long after boot. > > Linus >