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 216ECC12002 for ; Wed, 21 Jul 2021 04:49:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 93CF760E08 for ; Wed, 21 Jul 2021 04:49:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93CF760E08 Authentication-Results: mail.kernel.org; dmarc=fail (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 E86436B0011; Wed, 21 Jul 2021 00:49:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E35CD6B0036; Wed, 21 Jul 2021 00:49:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFD516B006C; Wed, 21 Jul 2021 00:49:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id AECAA6B0011 for ; Wed, 21 Jul 2021 00:49:19 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1FC9D22864 for ; Wed, 21 Jul 2021 04:49:18 +0000 (UTC) X-FDA: 78385365996.13.F5B6BD3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 6F4937001715 for ; Wed, 21 Jul 2021 04:49:17 +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 9CCFC1FB; Tue, 20 Jul 2021 21:49:16 -0700 (PDT) Received: from [10.163.64.235] (unknown [10.163.64.235]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 098023F66F; Tue, 20 Jul 2021 21:49:13 -0700 (PDT) Subject: Re: [PATCH v2 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args To: Gavin Shan , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, chuhu@redhat.com, shan.gavin@gmail.com References: <20210719054138.198373-1-gshan@redhat.com> <20210719054138.198373-2-gshan@redhat.com> <8d754894-5c21-1287-82b6-7ac3b064af3d@redhat.com> <1d8c1b0f-3102-5a4a-f3fb-a0fc50d281cc@redhat.com> From: Anshuman Khandual Message-ID: Date: Wed, 21 Jul 2021 10:20:04 +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: <1d8c1b0f-3102-5a4a-f3fb-a0fc50d281cc@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam05 X-Stat-Signature: hsh6t11wkjx46wmbdjtsbqnecuxdwkrm X-Rspamd-Queue-Id: 6F4937001715 X-HE-Tag: 1626842957-836937 Content-Transfer-Encoding: quoted-printable 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 7/21/21 4:59 AM, Gavin Shan wrote: > On 7/20/21 4:42 PM, Anshuman Khandual wrote: >> On 7/19/21 6:31 PM, Gavin Shan wrote: >>>> +=C2=A0=C2=A0=C2=A0 if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 has_transparent_hugepage= ()) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 page =3D alloc_pages(GFP= _KERNEL, HPAGE_PMD_ORDER); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (page) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = args->pmd_pfn =3D page_to_pfn(page); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = args->pte_pfn =3D args->pmd_pfn; >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = return 0; >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>>> +=C2=A0=C2=A0=C2=A0 } >>>> + >>> >>> As syzbot reported against v1 series, we could allocate pages larger = than (1 << (MAX_ORDER - 1)) here. >>> So __GFP_NOWARN is needed here. I will fix it in v3 series. >> >> I could find the following build error reported from lkp on V2. >> >> mm/debug_vm_pgtable.c:445:8: warning: variable 'pud' set but not used = [-Wunused-but-set-variable] >> >=20 > Yes, The following line is missed in PATCH[v2 09/12] and fixed in > PATCH[v3 09/12]: WARN_ON(!pud_none(pud)). With this line added, > the variable @pud is used in v3. >=20 >> Could you please point to the syzbot reported problem on V1 as you >> have mentioned above. Are there configs where HPAGE_[PMD|PUD]_ORDER >> is greater than (MAX_ORDER - 1) ? If yes, how adding __GFP_NOWARN >> solves the problem ? >> >=20 > https://syzkaller.appspot.com/bug?extid=3D8730ec44a441a434a2c8 > https://syzkaller.appspot.com/x/.config?x=3D29a82c885e192046 >=20 > The kernel config has the following options: >=20 > CONFIG_X86_64=3Dy > CONFIG_TRANSPARENT_HUGEPAGE=3Dy > CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=3Dy > #define PUD_SHIFT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 30 > #define PMD_SHIFT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 21 >=20 > CONFIG_FORCE_MAX_ZONEORDER=3Dn > #define MAX_ORDER=C2=A0=C2=A0=C2=A0 11 >=20 > (HPAGE_PUD_SHIFT - PAGE_SHIFT) >=3D (1 << MAX_ORDER) > (HPAGE_PMD_ORDER)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 <=C2=A0 (1 << MAX_ORDER) >=20 > The warning is triggered in the following path, __GFP_NOWARN helps to > avoid the WARNING_ON_ONCE(), but NULL is returned as expected. >=20 > =C2=A0=C2=A0 alloc_pages > =C2=A0=C2=A0=C2=A0=C2=A0 __alloc_pages >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (unlikely(order >=3D MAX_ORDER)= ) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 WARN_ON_ONCE(!(gfp & __GFP_NOWARN)); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 return NULL; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } But then that does not allocate the PUD element for the test which subsequently will be skipped. Isn't it ? So if the order is greater than MAX_ORDER, allocation needs to happen via alloc_contig_pages() or something similar.