linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>, 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
Subject: Re: [PATCH v2 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args
Date: Wed, 21 Jul 2021 09:29:43 +1000	[thread overview]
Message-ID: <1d8c1b0f-3102-5a4a-f3fb-a0fc50d281cc@redhat.com> (raw)
In-Reply-To: <ff9766a5-3f4e-f821-daf1-b2779a8c81fc@arm.com>

On 7/20/21 4:42 PM, Anshuman Khandual wrote:
> On 7/19/21 6:31 PM, Gavin Shan wrote:
>>> +    if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
>>> +        has_transparent_hugepage()) {
>>> +        page = alloc_pages(GFP_KERNEL, HPAGE_PMD_ORDER);
>>> +        if (page) {
>>> +            args->pmd_pfn = page_to_pfn(page);
>>> +            args->pte_pfn = args->pmd_pfn;
>>> +            return 0;
>>> +        }
>>> +    }
>>> +
>>
>> 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]
> 

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.

> 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 ?
> 

https://syzkaller.appspot.com/bug?extid=8730ec44a441a434a2c8
https://syzkaller.appspot.com/x/.config?x=29a82c885e192046

The kernel config has the following options:

CONFIG_X86_64=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y
#define PUD_SHIFT        30
#define PMD_SHIFT        21

CONFIG_FORCE_MAX_ZONEORDER=n
#define MAX_ORDER	11

(HPAGE_PUD_SHIFT - PAGE_SHIFT) >= (1 << MAX_ORDER)
(HPAGE_PMD_ORDER)              <  (1 << MAX_ORDER)

The warning is triggered in the following path, __GFP_NOWARN helps to
avoid the WARNING_ON_ONCE(), but NULL is returned as expected.

    alloc_pages
      __alloc_pages

        if (unlikely(order >= MAX_ORDER)) {
                 WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
                 return NULL;
         }

Thanks,
Gavin


  reply	other threads:[~2021-07-20 23:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  5:41 [PATCH v2 00/12] mm/debug_vm_pgtable: Enhancements Gavin Shan
2021-07-19  5:41 ` [PATCH v2 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args Gavin Shan
2021-07-19 13:01   ` Gavin Shan
2021-07-20  6:42     ` Anshuman Khandual
2021-07-20 23:29       ` Gavin Shan [this message]
2021-07-21  4:50         ` Anshuman Khandual
2021-07-21 12:09           ` Gavin Shan
2021-07-19  5:41 ` [PATCH v2 02/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in basic tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 03/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in leaf and savewrite tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 04/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in protnone and devmap tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 05/12] mm/vm_debug_pgtable: Use struct pgtable_debug_args in soft_dirty and swap tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 06/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in migration and thp tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 07/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PTE modifying tests Gavin Shan
2021-07-19  5:41 ` [PATCH v2 08/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PMD Gavin Shan
2021-07-19  5:41 ` [PATCH v2 09/12] mm/vm_debug_pgtable: Use struct pgtable_debug_args in PUD modifying tests Gavin Shan
2021-07-19  9:13   ` kernel test robot
2021-07-19 11:30     ` Gavin Shan
2021-07-20  2:46   ` kernel test robot
2021-07-20 23:09     ` Gavin Shan
2021-07-19  5:41 ` [PATCH v2 10/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PGD and P4D " Gavin Shan
2021-07-19  5:41 ` [PATCH v2 11/12] mm/debug_vm_pgtable: Remove unused code Gavin Shan
2021-07-19  5:41 ` [PATCH v2 12/12] mm/debug_vm_pgtable: Fix corrupted page flag Gavin Shan
2021-07-19 11:34 ` [PATCH v2 00/12] mm/debug_vm_pgtable: Enhancements Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d8c1b0f-3102-5a4a-f3fb-a0fc50d281cc@redhat.com \
    --to=gshan@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shan.gavin@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).