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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 CDAABC433DF for ; Mon, 8 Jun 2020 11:16:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94F282072F for ; Mon, 8 Jun 2020 11:16:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94F282072F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 289416B0003; Mon, 8 Jun 2020 07:16:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 242166B0005; Mon, 8 Jun 2020 07:16:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14F256B0006; Mon, 8 Jun 2020 07:16:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id F2E976B0003 for ; Mon, 8 Jun 2020 07:16:37 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B977317851 for ; Mon, 8 Jun 2020 11:16:37 +0000 (UTC) X-FDA: 76905791634.27.work90_6311ab326db9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 8F22D16330 for ; Mon, 8 Jun 2020 11:16:37 +0000 (UTC) X-HE-Tag: work90_6311ab326db9 X-Filterd-Recvd-Size: 5845 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Mon, 8 Jun 2020 11:16:36 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 058B27NS026343; Mon, 8 Jun 2020 07:16:29 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 31g42s61r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2020 07:16:29 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 058BAXuH012598; Mon, 8 Jun 2020 11:16:27 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 31g2s7shwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2020 11:16:27 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 058BGPhX63045962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2020 11:16:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D240A4055; Mon, 8 Jun 2020 11:16:25 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE2BAA4051; Mon, 8 Jun 2020 11:16:23 +0000 (GMT) Received: from [9.85.88.17] (unknown [9.85.88.17]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2020 11:16:23 +0000 (GMT) Subject: Re: [PATCH] mm/debug_vm_pgtable: Fix kernel crash with page table validate To: Anshuman Khandual , linux-mm@kvack.org Cc: akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au References: <20200608062739.378902-1-aneesh.kumar@linux.ibm.com> <2497c7b7-b5cf-8df4-dc82-efefe2fb6f5a@arm.com> From: "Aneesh Kumar K.V" Message-ID: Date: Mon, 8 Jun 2020 16:46:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <2497c7b7-b5cf-8df4-dc82-efefe2fb6f5a@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-08_07:2020-06-08,2020-06-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 clxscore=1015 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 cotscore=-2147483648 lowpriorityscore=0 adultscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006080082 X-Rspamd-Queue-Id: 8F22D16330 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 6/8/20 4:31 PM, Anshuman Khandual wrote: > Hi Aneesh, > > On 06/08/2020 11:57 AM, Aneesh Kumar K.V wrote: >> Architectures can have CONFIG_TRANSPARENT_HUGEPAGE enabled but >> no THP support enabled based on platforms. For ex: with 4K >> PAGE_SIZE ppc64 supports THP only with radix translation. > > Good catch, never hit this before. > >> >> This results in below crash when running with hash translation and >> 4K PAGE_SIZE. >> >> kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:140! >> cpu 0x61: Vector: 700 (Program Check) at [c000000ff948f860] >> pc: c0000000018810f8: debug_vm_pgtable+0x480/0x8b0 >> lr: c0000000018810ec: debug_vm_pgtable+0x474/0x8b0 >> ... >> [c000000ff948faf0] c000000001880fec debug_vm_pgtable+0x374/0x8b0 (unreliable) >> [c000000ff948fbf0] c000000000011648 do_one_initcall+0x98/0x4f0 >> [c000000ff948fcd0] c000000001843928 kernel_init_freeable+0x330/0x3fc >> [c000000ff948fdb0] c0000000000122ac kernel_init+0x24/0x148 >> [c000000ff948fe20] c00000000000cc44 ret_from_kernel_thread+0x5c/0x78 >> >> Check for THP support correctly > > Makes sense, is this the only configuration which hit the problem ? 4K hash ppc64 is the only config i guess. > >> >> Cc: anshuman.khandual@arm.com >> Fixes: 399145f9eb6c ("mm/debug: add tests validating architecture page table helpers") >> Signed-off-by: Aneesh Kumar K.V >> --- >> mm/debug_vm_pgtable.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c >> index 188c18908964..e60151c5e997 100644 >> --- a/mm/debug_vm_pgtable.c >> +++ b/mm/debug_vm_pgtable.c >> @@ -61,6 +61,9 @@ static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot) >> { >> pmd_t pmd = pfn_pmd(pfn, prot); >> >> + if (!has_transparent_hugepage()) >> + return; >> + > > We should also add this check to pud_basic_tests() as well. Do we have a function that check for runtime support for pud level THP? ppc64 don't do pud level THP yet. So we have CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=n are you suggesting we do the same check for pud level THP too? > >> WARN_ON(!pmd_same(pmd, pmd)); >> WARN_ON(!pmd_young(pmd_mkyoung(pmd_mkold(pmd)))); >> WARN_ON(!pmd_dirty(pmd_mkdirty(pmd_mkclean(pmd)))); >> > > The subject line here should mention about correct THP support > detection which fixes the problem. Probably something like this > or similar ("Fix kernel crash with correct THP support check"). Not sure about that. This fix a kernel crash with page table validate code. -aneesh