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 B343EC32771 for ; Mon, 27 Jan 2020 08:04:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74C772071E for ; Mon, 27 Jan 2020 08:04:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74C772071E 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 09DF56B0007; Mon, 27 Jan 2020 03:04:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 04EAD6B0008; Mon, 27 Jan 2020 03:04:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E88606B000A; Mon, 27 Jan 2020 03:04:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id D1A3F6B0007 for ; Mon, 27 Jan 2020 03:04:56 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 5B482282D for ; Mon, 27 Jan 2020 08:04:56 +0000 (UTC) X-FDA: 76422678192.22.box19_2b07371653a4c X-HE-Tag: box19_2b07371653a4c X-Filterd-Recvd-Size: 3675 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Jan 2020 08:04:55 +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 BF3C41FB; Mon, 27 Jan 2020 00:04:54 -0800 (PST) Received: from [10.162.16.32] (p8cg001049571a15.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 380233F67D; Mon, 27 Jan 2020 00:08:28 -0800 (PST) Subject: Re: [LKP] Re: 87c4696d57 ("mm/debug: Add tests validating architecture page .."): [ 1.395296] kernel BUG at include/linux/mm.h:2007! To: Christophe Leroy , Rong Chen , kernel test robot Cc: Ingo Molnar , Andrew Morton , Linux Memory Management List , LKP References: <20191226084925.GX2760@shao2-debian> <78f5a3f0-7098-0cd9-130d-393c0384b89a@arm.com> <1077e260-d2c3-fcc6-1150-fb46b6273db3@c-s.fr> From: Anshuman Khandual Message-ID: <628ec098-9343-5b92-7bca-ad330533e828@arm.com> Date: Mon, 27 Jan 2020 13:34:50 +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: <1077e260-d2c3-fcc6-1150-fb46b6273db3@c-s.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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 01/24/2020 02:22 PM, Christophe Leroy wrote: >=20 >=20 > Le 24/01/2020 =C3=A0 08:17, Anshuman Khandual a =C3=A9crit=C2=A0: >> >> On 01/07/2020 12:00 PM, Rong Chen wrote: >>> >>> >>> On 1/7/20 1:57 PM, Anshuman Khandual wrote: >>>> On 12/26/2019 02:19 PM, kernel test robot wrote: >> =C2=A0=C2=A0=C2=A0=C2=A0..............................................= . >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 p4d_free(mm, saved_p4= dp); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pud_free(mm, saved_pu= dp); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pmd_free(mm, saved_pm= dp); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pte_free(mm, saved_pt= ep); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_puds(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_pmds(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_ptes(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __mmdrop(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0.............................................. >> >=20 > You should use mmdrop() instead of __mmdrop(), shouldn't you ? Yes, though I am afraid that it does not change much as mm->mm_count gets initialized to 1 through mm_alloc()->mm_init(). But will fix this next time around. Coming back to the original problem, seems like both the reported bugs are probably related and because of CONFIG_X86_PAE. On X86 PAE systems, there are these additional user and kernel PMD pages which are stored in the page table (PREALLOCATED_USER_PMDS and MAX_PREALLOCATED_PMDS). pgd_alloc() preallocate_pmds() __get_free_page() pgtable_pmd_page_ctor() pgd_prepopulate_pmd() p4d =3D p4d_offset(pgd, 0); pud =3D pud_offset(p4d, 0); pud_populate(mm, pud, pmd); /* For each pre-allocated PMD */ The test case explicitly allocates and frees intermittent level page table pages for any given vaddr. So when __mmdrop() --> pgd_free() --> mop_up_pmds() --> mop_up_one_pmd() --> pmd_free(), it tries to free some possible garbage memory (probably caused by the test case) and hits VM_BUG_ON(). The test assumes a bare bones page table to conduct the test and the PAE based page table setup violates that assumption. Will disable this test on x86 platform when CONFIG_X86_PAE is enabled. >=20 > Christophe >=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2170851785124655475==" MIME-Version: 1.0 From: Anshuman Khandual To: lkp@lists.01.org Subject: Re: 87c4696d57 ("mm/debug: Add tests validating architecture page .."): [ 1.395296] kernel BUG at include/linux/mm.h:2007! Date: Mon, 27 Jan 2020 13:34:50 +0530 Message-ID: <628ec098-9343-5b92-7bca-ad330533e828@arm.com> In-Reply-To: <1077e260-d2c3-fcc6-1150-fb46b6273db3@c-s.fr> List-Id: --===============2170851785124655475== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 01/24/2020 02:22 PM, Christophe Leroy wrote: > = > = > Le 24/01/2020 =C3=A0 08:17, Anshuman Khandual a =C3=A9crit=C2=A0: >> >> On 01/07/2020 12:00 PM, Rong Chen wrote: >>> >>> >>> On 1/7/20 1:57 PM, Anshuman Khandual wrote: >>>> On 12/26/2019 02:19 PM, kernel test robot wrote: >> =C2=A0=C2=A0=C2=A0=C2=A0............................................... >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 p4d_free(mm, saved_p4dp= ); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pud_free(mm, saved_pudp= ); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pmd_free(mm, saved_pmdp= ); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pte_free(mm, saved_ptep= ); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_puds(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_pmds(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mm_dec_nr_ptes(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __mmdrop(mm); >> =C2=A0=C2=A0=C2=A0=C2=A0.............................................. >> > = > You should use mmdrop() instead of __mmdrop(), shouldn't you ? Yes, though I am afraid that it does not change much as mm->mm_count gets initialized to 1 through mm_alloc()->mm_init(). But will fix this next time around. Coming back to the original problem, seems like both the reported bugs are probably related and because of CONFIG_X86_PAE. On X86 PAE systems, there are these additional user and kernel PMD pages which are stored in the page table (PREALLOCATED_USER_PMDS and MAX_PREALLOCATED_PMDS). pgd_alloc() preallocate_pmds() __get_free_page() pgtable_pmd_page_ctor() pgd_prepopulate_pmd() p4d =3D p4d_offset(pgd, 0); pud =3D pud_offset(p4d, 0); pud_populate(mm, pud, pmd); /* For each pre-allocated PMD */ The test case explicitly allocates and frees intermittent level page table pages for any given vaddr. So when __mmdrop() --> pgd_free() --> mop_up_pmds() --> mop_up_one_pmd() --> pmd_free(), it tries to free some possible garbage memory (probably caused by the test case) and hits VM_BUG_ON(). The test assumes a bare bones page table to conduct the test and the PAE based page table setup violates that assumption. Will disable this test on x86 platform when CONFIG_X86_PAE is enabled. > = > Christophe >=20 --===============2170851785124655475==--