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.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,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 C6DA3C4363D for ; Thu, 24 Sep 2020 14:27:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 131602311A for ; Thu, 24 Sep 2020 14:27:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 131602311A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F7FD6B005C; Thu, 24 Sep 2020 10:27:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A9C08E0001; Thu, 24 Sep 2020 10:27:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BEFD6B0062; Thu, 24 Sep 2020 10:27:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id EAC5A6B005C for ; Thu, 24 Sep 2020 10:27:40 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 83FBE3633 for ; Thu, 24 Sep 2020 14:27:40 +0000 (UTC) X-FDA: 77298183480.13.home20_30115502715f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 22461181415A4 for ; Thu, 24 Sep 2020 14:27:39 +0000 (UTC) X-HE-Tag: home20_30115502715f X-Filterd-Recvd-Size: 5449 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Sep 2020 14:27:35 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0U9zEpE4_1600957646; Received: from IT-FVFX43SYHV2H.lan(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U9zEpE4_1600957646) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Sep 2020 22:27:27 +0800 Subject: Re: BUG: Bad page state in process dirtyc0w_child To: Qian Cai , Gerald Schaefer , Linus Torvalds , Peter Xu Cc: Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20200916142806.GD7076@osiris> <20200922190350.7a0e0ca5@thinkpad> <20200923153938.5be5dd2c@thinkpad> <76fef5dfd8efdb4130e41d1811b2a78ce39c8b0d.camel@redhat.com> From: Alex Shi Message-ID: <4bf5597b-2466-29f3-e855-920d5632536f@linux.alibaba.com> Date: Thu, 24 Sep 2020 22:25:13 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <76fef5dfd8efdb4130e41d1811b2a78ce39c8b0d.camel@redhat.com> Content-Type: text/plain; charset=utf-8 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: =E5=9C=A8 2020/9/24 =E4=B8=8A=E5=8D=8810:06, Qian Cai =E5=86=99=E9=81=93: > On Wed, 2020-09-23 at 15:39 +0200, Gerald Schaefer wrote: >> OK, I can now reproduce this, and unfortunately also with the gup_fast >> fix, so it is something different. Bisecting is a bit hard, as it will >> not always show immediately, sometimes takes up to an hour. >> >> Still, I think I found the culprit, merge commit b25d1dc9474e "Merge >> branch 'simplify-do_wp_page'". Without those 4 patches, it works fine, >> running over night. >> >> Not sure why this only shows on s390, should not be architecture-speci= fic, >> but we do often see subtle races earlier than others due to hypervisor >> impact. >=20 > Apparently, someone can reproduce something similar on x86 as well: >=20 > https://lore.kernel.org/linux-mm/c41149a8-211e-390b-af1d-d5eee690fecb@l= inux.alibaba.com/ >=20 > Probably, Alex could revert the bad commits and confirm it there. >=20 >> >> The first commit 09854ba94c6a ("mm: do_wp_page() simplification") alre= ady yes, after revert this commit, the BUG disappears. Thanks Alex >> introduces this error. The dirtyc0w_child test seems to play with cow >> and racing madvise(MADV_DONTNEED), but I have not yet fully understood >> it and also not the changes from commit 09854ba94c6a. As Linus already >> mentioned in the merge commit message, this is some bad timing for suc= h >> a change, so I don't want to delay this further with trying to underst= and >> it better before reporting. Maybe Peter or Linus can spot some obvious >> issue. >> >> One thing that seems strange to me is that the page flags from the >> bad page state output are (uptodate|swapbacked), see below, or >> (referenced|uptodate|dirty|swapbacked) in the original report. But IIU= C, >> that should not qualify for the "PAGE_FLAGS_CHECK_AT_FREE flag(s) set" >> reason. So it seems that the flags have changed between check_free_pag= e() >> and __dump_page(), which would be very odd. Or maybe some issue with >> compound pages, because __dump_page() looks at head->flags. >> >> [ 1863.237707] BUG: Bad page state in process dirtyc0w_child pfn:5852= 7d >> [ 1863.237721] page:000000008866956b refcount:0 mapcount:0 >> mapping:0000000000000000 index:0x0 pfn:0x58527d >> [ 1863.237727] flags: 0x3ffff00000080004(uptodate|swapbacked) >> [ 1863.237734] raw: 3ffff00000080004 0000000000000100 0000000000000122 >> 0000000000000000 >> [ 1863.237738] raw: 0000000000000000 0000000000000000 ffffffff00000000 >> 0000000000000000 >> [ 1863.237742] page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) s= et >> [ 1863.237745] Modules linked in: >> [ 1863.237752] CPU: 16 PID: 9074 Comm: dirtyc0w_child Tainted: >> G B 5.9.0-rc6-00020-geff48ddeab78-dirty #104 >> [ 1863.237756] Hardware name: IBM 3906 M03 703 (LPAR) >> [ 1863.237759] Call Trace: >> [ 1863.237768] [<0000000000115f28>] show_stack+0x100/0x158=20 >> [ 1863.237775] [<000000000096b41a>] dump_stack+0xa2/0xd8=20 >> [ 1863.237781] [<00000000003d497c>] bad_page+0xdc/0x140=20 >> [ 1863.237785] [<00000000003d5b62>] free_pcp_prepare+0x31a/0x360=20 >> [ 1863.237789] [<00000000003d906a>] free_unref_page+0x32/0xb8=20 >> [ 1863.237794] [<00000000003b05f4>] zap_p4d_range+0x64c/0xcf8=20 >> [ 1863.237797] [<00000000003b0e7a>] unmap_page_range+0x9a/0x110=20 >> [ 1863.237801] [<00000000003b0f84>] unmap_single_vma+0x94/0x100=20 >> [ 1863.237805] [<00000000003b14c2>] zap_page_range+0x14a/0x1f0=20 >> [ 1863.237809] [<00000000003e3a24>] do_madvise+0x75c/0x918=20 >> [ 1863.237812] [<00000000003e3c06>] __s390x_sys_madvise+0x26/0x38=20 >> [ 1863.237817] [<0000000000d280d4>] system_call+0xe0/0x2c0=20 >> [ 1863.237820] INFO: lockdep is turned off. >>