From patchwork Wed Sep 27 15:50:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 9974317 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 3AD776037F for ; Wed, 27 Sep 2017 15:51:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 261B8292AF for ; Wed, 27 Sep 2017 15:51:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21A7B2934B; Wed, 27 Sep 2017 15:51:02 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham 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 1CD71292AF for ; Wed, 27 Sep 2017 15:50:28 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mYA7XhJzZK+m+zWn5MjYSgbcMQa3MJgboBley/2oQEU=; b=IaAQ4YHZWgrswT rE8QEtzqxfEgXf6Q3wubii31Ryd93mPQQazd0//TBVFdm24kK9oStMBSantannu/TU2ZC0aIaCQb9 lJNORTitKnBZnQ0COIc59cTYrjZdAfPaDtWj0F58jwFkdA5pLWNZM3sryVinpEUXvwGPL7/0fY2Gi xtfwPmRPCxhHeoJM/hhf7l2maRIaW57N9IDTQoMjzgyamECd6lP6jScp3SCMKzJzideoxajI/R/R1 lJzu9Hyov4U7ygv6gFt3H8qPEl30IpfH05U770xW2XLVhXdY8Y86BL58LEbuwgFbc94e0iFNBqipH OtmoGisQS0H7xlccOpww==; 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 1dxEbL-00040D-EN; Wed, 27 Sep 2017 15:50:19 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dxEbH-0002aZ-Vr for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2017 15:50:17 +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 814BA1435; Wed, 27 Sep 2017 08:49:54 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 521733F53D; Wed, 27 Sep 2017 08:49:54 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 944AC1AE3096; Wed, 27 Sep 2017 16:50:08 +0100 (BST) Date: Wed, 27 Sep 2017 16:50:08 +0100 From: Will Deacon To: "Ruigrok, Richard" Subject: Re: ARM64: kernel panics in DABT in sys_msync path Message-ID: <20170927155007.GA16211@arm.com> References: <20170924213622.75e7r3k56tgxlezh@yury-thinkpad> <20170925105335.GA24042@arm.com> <20170925140240.vl5mvbce5lb37dxe@yury-thinkpad> <20170925190426.6prpcfn7lly26clm@yury-thinkpad> <20170926102324.GC8693@arm.com> <547ed590-3ab4-cc11-cbea-f587541d2b08@codeaurora.org> <20170926173112.GA16650@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170926173112.GA16650@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170927_085016_040148_0E357B64 X-CRM114-Status: GOOD ( 20.23 ) 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: Yury Norov , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 On Tue, Sep 26, 2017 at 06:31:12PM +0100, Will Deacon wrote: > On Tue, Sep 26, 2017 at 08:23:35AM -0600, Ruigrok, Richard wrote: > > On 9/26/2017 4:23 AM, Will Deacon wrote: > > > On Mon, Sep 25, 2017 at 01:54:57PM -0600, Ruigrok, Richard wrote: > > >> I also found this issue with kernels from 4.11 through 4.13. In my tests, I > > >> found that it reproduces only with 4K page and Transparent Huge Pages. With 64K > > >> page I was not able to reproduce. RH also reported it here: https:// > > >> bugzilla.redhat.com/show_bug.cgi?id=1491504 Linaro reported on the RPK kernel > > >> (4.12) on Centriq2400 and ThunderX > > >> > > >> > > >> https://bugs.linaro.org/show_bug.cgi?id=3191 > > >> > > >> https://bugs.linaro.org/show_bug.cgi?id=3068. > > > These two aren't the same bug (that's a forward progress issue that we're > > > currently working on). I don't have permission to look at the redhat one, > > > but is it just an RCU stall or actually the Oops reported by Yury? > > > > > >> I was able to bisect down to a specific commit. > > > I think we're chasing two different things here, so not sure I trust the > > > bisect! > > > > > The RCU stall is side effect.  The issue I'm seeing has the same stack > > trace and same stimulus (rwtest).  Following are the details. > > FWIW, I think I've worked out what's going on here and I should have a patch > tomorrow. Diff below. I'm going to follow up with a separate thread about this, because the proper fix is going to be invasive. I'll keep you on cc. Out of curiosity: what version of GCC are you using to compile the kernel? Will --->8 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index bc4e92337d16..b46e54c2399b 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -401,7 +401,7 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) /* Find an entry in the third-level page table. */ #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset_phys(dir,addr) (pmd_page_paddr(*(dir)) + pte_index(addr) * sizeof(pte_t)) +#define pte_offset_phys(dir,addr) (pmd_page_paddr(READ_ONCE(*(dir))) + pte_index(addr) * sizeof(pte_t)) #define pte_offset_kernel(dir,addr) ((pte_t *)__va(pte_offset_phys((dir), (addr)))) #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))