From patchwork Tue Dec 8 13:08:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 7797371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D8B82BEEE1 for ; Tue, 8 Dec 2015 13:11:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E297B20386 for ; Tue, 8 Dec 2015 13:11:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 037A3204AD for ; Tue, 8 Dec 2015 13:11:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6I18-0003Sr-35; Tue, 08 Dec 2015 13:09:18 +0000 Received: from mail-ig0-x233.google.com ([2607:f8b0:4001:c05::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6I0j-0002nI-Gg for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2015 13:08:58 +0000 Received: by igcmv3 with SMTP id mv3so100734165igc.0 for ; Tue, 08 Dec 2015 05:08:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=CekI+lrDzTcX0UWARQGZrFDv5zma40F+wpY7OBZ3MFE=; b=a/TbR9TwkKeTPoeftm8Vo96+pUGaJ53PttZOAJloTtbeFgHq2Lmv9HIMUBuYKe3Szp qaKeJNFY2+YSlSkbYEb2SpYZ7OKXuXa79YikrVUrKoj1uRZOhPIhGgsfg6Y+gKxiIVvI UXAdCOU04f6apJ1qh0a2pugh1Ba5zmemsOEU0/4w9lnOwthffvww8gc4ZBi7nNsNH2LB Sktgw+7pLeFNXpwHtQaKRj36d0MN/OCMLOI9XBtRleaRbXG03DA7CEcwALRFTKNrzKjx 7T0fApDS2/HTeU88uXVkHvwwDDlIFpZXrPahTQZdMhPOss+xu2FRP2b+5MGp5cJqq4fD G8ZQ== MIME-Version: 1.0 X-Received: by 10.50.90.180 with SMTP id bx20mr4092350igb.9.1449580112472; Tue, 08 Dec 2015 05:08:32 -0800 (PST) Received: by 10.64.125.69 with HTTP; Tue, 8 Dec 2015 05:08:32 -0800 (PST) In-Reply-To: <20151208103013.GA19612@arm.com> References: <20151208103013.GA19612@arm.com> Date: Tue, 8 Dec 2015 21:08:32 +0800 Message-ID: Subject: Re: ARM64: kernel oops in 4.4-rc4+ From: Ming Lei To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_050853_949072_0B71DBA9 X-CRM114-Status: GOOD ( 16.20 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , linux-arm-kernel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Dec 8, 2015 at 6:30 PM, Will Deacon wrote: > On Tue, Dec 08, 2015 at 02:30:33PM +0800, Ming Lei wrote: >> Hi, > > [adding Catalin to cc] > >> The attached kernel oops can be triggered immediately after >> running the following command on APM Mustang: >> >> $stress-ng --all 8 -t 10m >> >> [1] kernel oops log >> stress-ng: info: [5220] 5 failures reached, aborting stress process >> [ 265.782659] kernel BUG at ./arch/arm64/include/asm/pgtable.h:282! > > Yikes, this means we're replacing a writable pte with a clean pte, so > there's a potential race w/ hardware DBM. > > Could you dump pte and *ptep please? They are dumped as so: set_pte_at: addr 470000, ptep fffffe00bc870238, *ptep 680047348a0bd3, pte 680047348a0fd3 with the following change: > >> [ 265.788726] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP >> [ 265.794186] Modules linked in: >> [ 265.797241] CPU: 1 PID: 15830 Comm: stress-ng-cache Tainted: G >> W 4.4.0-rc4+ #54 > > What changes do you have on top of -rc4? Nothing else, and it is just built from the latest linus tree. Thanks, Ming Lei diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 7e074f9..1c5f0ee 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -278,6 +278,12 @@ static inline void set_pte_at(struct mm_struct *mm, unsigne */ if (IS_ENABLED(CONFIG_DEBUG_VM) && IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && pte_valid(*ptep)) { + + if (!pte_young(pte) || (pte_write(*ptep) && !pte_dirty(pte))) + trace_printk("%s: addr %lx, ptep %p, *ptep %llx, pte %ll + __func__, addr, ptep, + (unsigned long long)pte_val(*ptep), + (unsigned long long )pte_val(pte)); BUG_ON(!pte_young(pte)); BUG_ON(pte_write(*ptep) && !pte_dirty(pte));