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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 31F0FC63777 for ; Tue, 1 Dec 2020 02:24:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECFA220857 for ; Tue, 1 Dec 2020 02:24:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SyEnPcyY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECFA220857 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 144286B0036; Mon, 30 Nov 2020 21:24:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CDBF8D0002; Mon, 30 Nov 2020 21:24:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F00438D0001; Mon, 30 Nov 2020 21:24:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id D69BD6B0036 for ; Mon, 30 Nov 2020 21:24:18 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 915791EFD for ; Tue, 1 Dec 2020 02:24:18 +0000 (UTC) X-FDA: 77543118996.30.part79_1c0ed1b273a6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 6F50F180B3AA7 for ; Tue, 1 Dec 2020 02:24:18 +0000 (UTC) X-HE-Tag: part79_1c0ed1b273a6 X-Filterd-Recvd-Size: 4205 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Dec 2020 02:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pgfrNp213PUqGJpsyhnVpIsJf+6NbYjx7aBpXnxJ518=; b=SyEnPcyYwWC9XFUMx9ImmuzGNH M6FVqe1DAzcUTh6aJ/7iDt7VVZrElY0TNucZLpWskIOwqJ6lp69e9c3k2xNp3yzXKq7e4DrRRZXlD AvcFu8F2iTwKb9gZdEt+qP6WCwbC+B269Xt/xd2CdFWLXiKFG954nPrSXCYp/UaXuLSOqLEUHVayk q0ydwJ2uiySMemCQJw7nvK576n5/6DQVg6MjAOOnrvZTDNwulgQ7gWda2U6vSJ9Mb2DtJleSVSyAg ip0W7/3Yma1+3z2SB9ggdGPHQMq78MgmZj4TJOcsyLKrmrSwlkwGbRFrsgHNbZqVAH5RO/q3Dk6uY lL7jNOAw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjvKu-0001qU-Q9; Tue, 01 Dec 2020 02:24:12 +0000 Date: Tue, 1 Dec 2020 02:24:12 +0000 From: Matthew Wilcox To: Dan Williams Cc: "Shutemov, Kirill" , Linux Kernel Mailing List , Linux MM , linux-nvdimm , Vlastimil Babka Subject: Re: mapcount corruption regression Message-ID: <20201201022412.GG4327@casper.infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Nov 30, 2020 at 05:20:25PM -0800, Dan Williams wrote: > Kirill, Willy, compound page experts, > > I am seeking some debug ideas about the following splat: > > BUG: Bad page state in process lt-pmem-ns pfn:121a12 > page:0000000051ef73f7 refcount:0 mapcount:-1024 > mapping:0000000000000000 index:0x0 pfn:0x121a12 Mapcount of -1024 is the signature of: #define PG_guard 0x00000400 (the bits are inverted, so this turns into 0xfffffbff which is reported as -1024) I assume you have debug_pagealloc enabled? > flags: 0x2ffff800000000() > raw: 002ffff800000000 dead000000000100 0000000000000000 0000000000000000 > raw: 0000000000000000 ffff8a6914886b48 00000000fffffbff 0000000000000000 > page dumped because: nonzero mapcount > [..] > CPU: 26 PID: 6127 Comm: lt-pmem-ns Tainted: G OE 5.10.0-rc4+ #450 > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 > Call Trace: > dump_stack+0x8b/0xb0 > bad_page.cold+0x63/0x94 > free_pcp_prepare+0x224/0x270 > free_unref_page+0x18/0xd0 > pud_free_pmd_page+0x146/0x160 > ioremap_pud_range+0xe3/0x350 > ioremap_page_range+0x108/0x160 > __ioremap_caller.constprop.0+0x174/0x2b0 > ? memremap+0x7a/0x110 > memremap+0x7a/0x110 > devm_memremap+0x53/0xa0 > pmem_attach_disk+0x4ed/0x530 [nd_pmem] > > It triggers on v5.10-rc4 not on v5.9, but the bisect comes up with an > ambiguous result. I've run the bisect 3 times and landed on: > > 032c7ed95817 Merge tag 'arm64-upstream' of > git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux > > ...which does not touch anything near _mapcount. I suspect there is > something unique about the build that lines up the corruption to > happen or not happen. > > The test is a simple namespace creation test that results in an > memremap() / ioremap() over several gigabytes of memory capacity. The > -1024 was interesting because that's the GUP_PIN_COUNTING_BIAS, but > that's the _refcount, I did not see any questionable changes to how > _mapcount is manipulated post v5.9. Problem should be reproducible by > running: > > make -j TESTS="pmem-ns" check > > ...in qemu-kvm with some virtual pmem defined: > > -object memory-backend-file,id=mem1,share,mem-path=${mem}1,size=$((mem_size+label_size)) > -device nvdimm,memdev=mem1,id=nv1,label-size=${label_size} > > ...where ${mem}1 is a 128GB sparse file $mem_size is 127GB and > $label_size is 128KB. >