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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,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 BE59BC433ED for ; Mon, 17 May 2021 13:12:48 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 419BF61028 for ; Mon, 17 May 2021 13:12:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 419BF61028 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FkKLQ6GvDz3btD for ; Mon, 17 May 2021 23:12:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=anshuman.khandual@arm.com; receiver=) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4FkKKy07jhz2yZF for ; Mon, 17 May 2021 23:12:20 +1000 (AEST) 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 1E22212FC; Mon, 17 May 2021 06:12:18 -0700 (PDT) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02B303F73B; Mon, 17 May 2021 06:12:16 -0700 (PDT) Subject: Re: Fwd: [Bug 213069] New: kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:147! Oops: Exception in kernel mode, sig: 5 [#1] To: Christophe Leroy , "Aneesh Kumar K.V" , "linuxppc-dev@lists.ozlabs.org" References: <4deb5cd5-c713-b020-9143-c74a031e3fd5@csgroup.eu> <7ebc28ad-61e3-ef43-d670-9b80a61268c4@csgroup.eu> <6fcdf4f2-9bed-4b0f-8ed8-74cb25484ea6@arm.com> <52ab4861-3a77-14da-1179-3ea79964c950@csgroup.eu> From: Anshuman Khandual Message-ID: <69fb90be-8b30-aadc-0fcf-b1ce9fc1a68f@arm.com> Date: Mon, 17 May 2021 18:42:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <52ab4861-3a77-14da-1179-3ea79964c950@csgroup.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 5/17/21 6:29 PM, Christophe Leroy wrote: > > > Le 17/05/2021 à 14:49, Anshuman Khandual a écrit : >> >> >> On 5/17/21 11:25 AM, Aneesh Kumar K.V wrote: >>> On 5/17/21 11:17 AM, Christophe Leroy wrote: >>>> +aneesh >>>> +linuxppc-dev list >>>> >>>> Le 17/05/2021 à 07:44, Anshuman Khandual a écrit : >>>>> Hello Christophe, >>>>> >>>>> DEBUG_VM_PGTABLE has now been re-enabled on powerpc recently ? was not >>>>> aware about this. From the error log, it failed explicitly on 4K page >>>>> size hash config. >>>>> >>>>> static inline pmd_t hash__pmd_mkhuge(pmd_t pmd) >>>>> { >>>>>           BUG();        ------> Failed >>>>>           return pmd; >>>>> } >>>>> >>>>> static inline pmd_t __pmd_mkhuge(pmd_t pmd) >>>>> { >>>>>           if (radix_enabled()) >>>>>                   return radix__pmd_mkhuge(pmd); >>>>>           return hash__pmd_mkhuge(pmd); >>>>> } >>>>> >>>>> pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot) >>>>> { >>>>>           unsigned long pmdv; >>>>> >>>>>           pmdv = (pfn << PAGE_SHIFT) & PTE_RPN_MASK; >>>>> >>>>>           return __pmd_mkhuge(pmd_set_protbits(__pmd(pmdv), pgprot)); >>>>> } >>>>> >>>>> It seems like on powerpc, where pfn_pmd() makes a huge page but which >>>>> is not supported on 4K hash config thus triggering the BUG(). But all >>>>> pfn_pmd() call sites inside the debug_vm_pgtable() test are protected >>>>> with CONFIG_TRANSPARENT_HUGEPAGE. IIUC unlike powerpc, pfn_pmd() does >>>>> not directly make a huge page on other platforms. >>>>> >>>>> Looking at arch/powerpc/include/asm/book3s/64/hash-4k.h, all relevant >>>>> THP helpers has BUG() or 0 which indicates THP might not be supported >>>>> on 4K page size hash config ? >>>>> >>>>> But looking at arch/powerpc/platforms/Kconfig.cputype, it seems like >>>>> HAVE_ARCH_TRANSPARENT_HUGEPAGE is invariably selected on PPC_BOOK3S_64 >>>>> platforms which I assume includes 4K page size hash config as well. >>>>> >>>>> Is THP some how getting enabled on this 4K page size hash config where >>>>> it should not be (thus triggering the BUG) ? OR am I missing something >>>>> here. >>>>> >>>> >>> >>> We should put those  pfn_pmd()  and pfn_pud() after >>> >>>      if (!has_transparent_hugepage()) >>>          return; >> >> The following patch has been lightly tested on arm64 and x86 platforms. >> Could you please verify if this solves the problem on powerpc 4K hash >> config ? Thank you. > > No need to update pmd_advanced_tests() and pud_advanced_tests() ? They already have has_transparent_hugepage() check and all pfn_pxx() instances are after that check. Do you see any other concern ? > > Christophe