From patchwork Mon Jun 5 11:12:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 9766063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A3576034B for ; Mon, 5 Jun 2017 11:13:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7436C26E56 for ; Mon, 5 Jun 2017 11:13:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 674DD27F86; Mon, 5 Jun 2017 11:13:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E22BD26E56 for ; Mon, 5 Jun 2017 11:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To: Date:References:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LP21yIMJIFCYwPDj7p74N/srZtigakhSgpVlc25vXgQ=; b=Byh109Ft3yrPkY NnwXQ9GGj0JG54p4EbXcBqErabEL35GjreNxMc/cwlTgalsMwM6EyjTLgZ2E89ILkRBuiaYXFdoSd HOmkE5MXRZ5lDU6QrMPuX9mtKx+X9NSzXKjShJuNzrj1xN+KO6xndOAIU9B3RgU5/AwrpqZIRj4Je bHecyXC6b9GmgpIHTfc0qlzHqKzX59FAceBn+BZS7tunxLHv9El8Gd9VO+gO0Exj7lkloqBHSfr1u CDVywshrPJQnnmurlcRZ2XONidxmRYrLQvqHVEcbsQyhenLQn0mUyCz8P9Xtnh0xg37hc3g7y7Fqg w7tWmd6ClRWrrcksBAew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHpwX-00050A-98; Mon, 05 Jun 2017 11:13:05 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHpwU-0004yw-8y for linux-arm-kernel@lists.infradead.org; Mon, 05 Jun 2017 11:13:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B67422B; Mon, 5 Jun 2017 04:12:41 -0700 (PDT) Received: from localhost (e105922-lin.cambridge.arm.com [10.1.207.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85AFC3F578; Mon, 5 Jun 2017 04:12:41 -0700 (PDT) From: Punit Agrawal To: Will Deacon Subject: Re: arm64: segfaults on next-20170602 with LTP tests References: <20170602111151.r2x3364zqabmshzo@yury-thinkpad> <20170602121917.GG6371@arm.com> <20170602123751.3jzdkjwntbce2e6e@yury-thinkpad> <20170602144204.uyvbby5vauxpt6yr@yury-thinkpad> <20170602152440.GQ6371@arm.com> <87k24q4w0m.fsf@e105922-lin.cambridge.arm.com> Date: Mon, 05 Jun 2017 12:12:40 +0100 In-Reply-To: <87k24q4w0m.fsf@e105922-lin.cambridge.arm.com> (Punit Agrawal's message of "Mon, 05 Jun 2017 10:35:37 +0100") Message-ID: <87d1ai4riv.fsf@e105922-lin.cambridge.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170605_041302_332500_20CD234D X-CRM114-Status: GOOD ( 20.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: akpm@linux-foundation.org, Yury Norov , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, steve.capper@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Punit Agrawal writes: > Will Deacon writes: > >> On Fri, Jun 02, 2017 at 05:42:04PM +0300, Yury Norov wrote: >>> On Fri, Jun 02, 2017 at 03:37:51PM +0300, Yury Norov wrote: >>> > On Fri, Jun 02, 2017 at 01:19:18PM +0100, Will Deacon wrote: >>> > > Hi Yury, >>> > > >>> > > [adding Steve and Punit] >>> > > >>> > > On Fri, Jun 02, 2017 at 02:11:51PM +0300, Yury Norov wrote: >>> > > > I see that latest and yesterday's linux-next segfaults with tests pth_str01, >>> > > > pth_str03, rwtest04. Rwtest04 hangs sometimes. Crashes are not always >>> > > > reproducible. About week ago everything was fine. Kernel log and config file >>> > > > are attached. The testing is performed on qemu. >>> > > >>> > > It's weird that these haven't cropped up in our nightly tests, especially >>> > > given that defconfig is very similar to the one you're using. That said, >>> > > I see huge pmds cropping up in the traces below and there have been some >>> > > recent changes from Punit and Steve in that area, in particular things >>> > > like 55f379263bcc ("mm, gup: ensure real head page is ref-counted when using >>> > > hugepages"). >>> > > >>> > > Are you in a position to bisect this, or is it too fiddly to reproduce? >>> >>> I have bisected the bug to exactly this patch. If I revert it, the >>> pth_str01/03 are passed. >> >> Thanks for doing that: I had my suspicion ;) I can also reproduce the >> failure locally on my Juno. >> >> Punit -- please can you investigate this? Otherwise I think we have to >> revert this for now and bring it back after some better testing. > > Apologies for the breakage. It looks like anonymous hugepages are not > happy with the change. Let me dig into this. I've found the issue - in certain scenarios the ref-count was being taken on a page following the one of interest. The below fixup (on top of the patches in next) makes the failures with pth_str0[1|3] go away for me. I'll send an updated patch for Andrew to pick up shortly. Thanks, Punit ---------------->8------------------------ commit ee56e197cd8f3f782e32219f828e04ef0145a1aa Author: Punit Agrawal Date: Mon Jun 5 12:03:55 2017 +0100 fixup! mm, gup: Ensure real head page is ref-counted when using hugepages diff --git a/mm/gup.c b/mm/gup.c index 7d730e4188ce..6bd39264d0e7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1362,7 +1362,7 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, refs++; } while (addr += PAGE_SIZE, addr != end); - head = compound_head(page); + head = compound_head(pmd_page(orig)); if (!page_cache_add_speculative(head, refs)) { *nr -= refs; return 0; @@ -1400,7 +1400,7 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, refs++; } while (addr += PAGE_SIZE, addr != end); - head = compound_head(page); + head = compound_head(pud_page(orig)); if (!page_cache_add_speculative(head, refs)) { *nr -= refs; return 0; @@ -1437,7 +1437,7 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr, refs++; } while (addr += PAGE_SIZE, addr != end); - head = compound_head(page); + head = compound_head(pgd_page(orig)); if (!page_cache_add_speculative(head, refs)) { *nr -= refs; return 0;