Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4126546pxu; Mon, 30 Nov 2020 18:45:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7DvyGFwJAXBqFzTUbMhIsqni1zqwHD2gUENJwaiisjnq2HkUtUZhQWEMxTu42iXwwvVPJ X-Received: by 2002:a17:906:391b:: with SMTP id f27mr894832eje.195.1606790749167; Mon, 30 Nov 2020 18:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606790749; cv=none; d=google.com; s=arc-20160816; b=N2qHFJ0iJ7dTPBe6DXekGnDPNKc7f0RBDJhSk8i06jbkyJauW1SmP7WWI7rWPWLvne sLiNPUy6OnG2U2HCkiMaCkXPfB18UDNaNAheMshuKTvW/6UMHrlaWF8zDB9w9ahpxlLM ZVSLZXmpf3e8mnbSggvJNlZ87VMvxDQEM+Kla1UOAdY/8MSyiM8+JPKV4o7T5sYVNf5g tuNrCjd1kwkC80QXT6t8ERycJM5HmWJzDoFZxSGyyC7QPbW8AjeLSmZXbFH4/irsd5A3 40iBgQmtmApgXm47WozBz56WClfNrWj+eTiwGn78Rvkg4ve6Qk9ATphSxmkABQcjsALt CfHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pgfrNp213PUqGJpsyhnVpIsJf+6NbYjx7aBpXnxJ518=; b=XCudp8zIkb5GyNbIn9hxmTxwSjEm8Fvtx1y42LVHjTvC4MOnEVedWsSDJkneo0sywM VLl1btJHHAuRSgIgsAZSgES01rnrNUvbNXUEqU+j8qUwCsFr+05gNGgJSqENwslTudgN kJoqCVCTSSxTctl2l69Es1uSH6d14sjITEXcqzTXJK53rmzxFYfOfIKQTI+6uRiebP5k sUjVYDXIqZMWCbBbGl/FOzbGY5aGyqHuOcvAYzldijWiNB7zWWYTJEOGbqKWYgqM7Uhx nT4+viCPuDNeooHoq+6Afd+HGf0wDhVReLQa497UOFjr96SuOYbxul4vYp0BRruCE3MD 3xfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=SyEnPcyY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt2si81707ejb.552.2020.11.30.18.45.26; Mon, 30 Nov 2020 18:45:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=SyEnPcyY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726485AbgLACY4 (ORCPT + 99 others); Mon, 30 Nov 2020 21:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbgLACY4 (ORCPT ); Mon, 30 Nov 2020 21:24:56 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31C69C0613CF for ; Mon, 30 Nov 2020 18:24:16 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >