From patchwork Fri Jun 13 08:56:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 31868 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 93A982054B for ; Fri, 13 Jun 2014 08:57:23 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf11866017obc.5 for ; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-disposition:content-transfer-encoding; bh=zOEBgdH0j6iOZ7wtNci7NNY7TjG/LZkWTMqh+WK2FUw=; b=KS+F61Xc7BZC7FojyvjnbajQW2+v4HhU1e3UdPbVQLxCSnoukbns30A900KdVDr1+8 tRc9fd3Ljo5XG0hSGD/vzuZnZahmhzZQD1sYWnDx6kVlTiY8/AQRiHfTqom/AnZyzHO2 MZVXvHS70DY9hze8mPLNEUU8390/9lix0VDQULdLbCRgtRhyAuiw5eszYUR5JLUMcKJs 1mbRblqqyili3X67fQZz3f1sA4FwRUNFRNFxP0Ubmm8YYEACzSRgPjG3E9xRf3nkbm+H t8AGfkJqqeO7LnkrAWBI1l++KAZh4eVXjtpDVWTcDpMSBonGCvJ4XLX5FNSpTIenufVQ aGaw== X-Gm-Message-State: ALoCoQmjSGe0i+dVP3wP0RP4lZtBhbHmqHSNtZGBadQG28KTQnENGTcoVLhDwq7R8qJt76zzGWb1 X-Received: by 10.182.252.166 with SMTP id zt6mr544637obc.17.1402649842785; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.33 with SMTP id e30ls3498062qge.89.gmail; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-Received: by 10.58.30.1 with SMTP id o1mr116283veh.37.1402649842675; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id zw4si1195572vdc.60.2014.06.13.01.57.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Jun 2014 01:57:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so1961077vcb.21 for ; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-Received: by 10.52.189.161 with SMTP id gj1mr824617vdc.2.1402649842529; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp470413vcb; Fri, 13 Jun 2014 01:57:22 -0700 (PDT) X-Received: by 10.68.95.225 with SMTP id dn1mr1628094pbb.126.1402649841475; Fri, 13 Jun 2014 01:57:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ah3si4041772pad.52.2014.06.13.01.57.20; Fri, 13 Jun 2014 01:57:20 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753112AbaFMI5H (ORCPT + 27 others); Fri, 13 Jun 2014 04:57:07 -0400 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:46234 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752690AbaFMI5F (ORCPT ); Fri, 13 Jun 2014 04:57:05 -0400 Received: from arm.com (e102109-lin.cambridge.arm.com [10.1.203.182]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id 772C713F7B0; Fri, 13 Jun 2014 03:56:52 -0500 (CDT) Date: Fri, 13 Jun 2014 09:56:40 +0100 From: Catalin Marinas To: Denis Kirjanov Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Naoya Horiguchi , linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Paul Mackerras Subject: Re: kmemleak: Unable to handle kernel paging request Message-ID: <20140613085640.GA21018@arm.com> References: <20140611173851.GA5556@MacBook-Pro.local> <20140612143916.GB8970@arm.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Disposition: inline On Fri, Jun 13, 2014 at 08:12:08AM +0100, Denis Kirjanov wrote: > On 6/12/14, Catalin Marinas wrote: > > On Thu, Jun 12, 2014 at 01:00:57PM +0100, Denis Kirjanov wrote: > >> On 6/12/14, Denis Kirjanov wrote: > >> > On 6/12/14, Catalin Marinas wrote: > >> >> On 11 Jun 2014, at 21:04, Denis Kirjanov > >> >> wrote: > >> >>> On 6/11/14, Catalin Marinas wrote: > >> >>>> On Wed, Jun 11, 2014 at 04:13:07PM +0400, Denis Kirjanov wrote: > >> >>>>> I got a trace while running 3.15.0-08556-gdfb9454: > >> >>>>> > >> >>>>> [ 104.534026] Unable to handle kernel paging request for data at > >> >>>>> address 0xc00000007f000000 > >> >>>> > >> >>>> Were there any kmemleak messages prior to this, like "kmemleak > >> >>>> disabled"? There could be a race when kmemleak is disabled because > >> >>>> of > >> >>>> some fatal (for kmemleak) error while the scanning is taking place > >> >>>> (which needs some more thinking to fix properly). > >> >>> > >> >>> No. I checked for the similar problem and didn't find anything > >> >>> relevant. > >> >>> I'll try to bisect it. > >> >> > >> >> Does this happen soon after boot? I guess it’s the first scan > >> >> (scheduled at around 1min after boot). Something seems to be telling > >> >> kmemleak that there is a valid memory block at 0xc00000007f000000. > >> > > >> > Yeah, it happens after a while with a booted system so that's the > >> > first kmemleak scan. > >> > >> I've bisected to this commit: d4c54919ed86302094c0ca7d48a8cbd4ee753e92 > >> "mm: add !pte_present() check on existing hugetlb_entry callbacks". > >> Reverting the commit fixes the issue > > > > I can't figure how this causes the problem but I have more questions. Is > > 0xc00000007f000000 address always the same in all crashes? If yes, you > > could comment out start_scan_thread() in kmemleak_late_init() to avoid > > the scanning thread starting. Once booted, you can run: > > > > echo dump=0xc00000007f000000 > /sys/kernel/debug/kmemleak > > > > and check the dmesg for what kmemleak knows about that address, when it > > was allocated and whether it should be mapped or not. > > The address is always the same. > > [ 179.466239] kmemleak: Object 0xc00000007f000000 (size 16777216): > [ 179.466503] kmemleak: comm "swapper/0", pid 0, jiffies 4294892300 > [ 179.466508] kmemleak: min_count = 0 > [ 179.466512] kmemleak: count = 0 > [ 179.466517] kmemleak: flags = 0x1 > [ 179.466522] kmemleak: checksum = 0 > [ 179.466526] kmemleak: backtrace: > [ 179.466531] [] .memblock_alloc_range_nid+0x68/0x88 > [ 179.466544] [] .memblock_alloc_base+0x20/0x58 > [ 179.466553] [] .alloc_dart_table+0x5c/0xb0 > [ 179.466561] [] .pmac_probe+0x38/0xa0 > [ 179.466569] [<000000000002166c>] 0x2166c > [ 179.466579] [<0000000000ae0e68>] 0xae0e68 > [ 179.466587] [<0000000000009bc4>] 0x9bc4 OK, so that's the DART table allocated via alloc_dart_table(). Is dart_tablebase removed from the kernel linear mapping after allocation? If that's the case, we need to tell kmemleak to ignore this block (see patch below, untested). But I still can't explain how commit d4c54919ed863020 causes this issue. (also cc'ing the powerpc list and maintainers) ---------------8<-------------------------- >From 09a7f1c97166c7bdca7ca4e8a4ff2774f3706ea3 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 13 Jun 2014 09:44:21 +0100 Subject: [PATCH] powerpc/kmemleak: Do not scan the DART table The DART table allocation is registered to kmemleak via the memblock_alloc_base() call. However, the DART table is later unmapped and dart_tablebase VA no longer accessible. This patch tells kmemleak not to scan this block and avoid an unhandled paging request. Signed-off-by: Catalin Marinas Cc: Benjamin Herrenschmidt Cc: Paul Mackerras --- arch/powerpc/sysdev/dart_iommu.c | 5 +++++ 1 file changed, 5 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 62c47bb76517..9e5353ff6d1b 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -476,6 +476,11 @@ void __init alloc_dart_table(void) */ dart_tablebase = (unsigned long) __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); + /* + * The DART space is later unmapped from the kernel linear mapping and + * accessing dart_tablebase during kmemleak scanning will fault. + */ + kmemleak_no_scan((void *)dart_tablebase); printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); }