Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp309059imm; Mon, 4 Jun 2018 18:19:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIC41KDBx6Y5SuFwq1Gl4DuAi4aZqjhF30/gVf4TzLjoMgfUm/A5DDAKrJ6247sAqwnarhH X-Received: by 2002:a63:ae43:: with SMTP id e3-v6mr18566501pgp.181.1528161563133; Mon, 04 Jun 2018 18:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528161563; cv=none; d=google.com; s=arc-20160816; b=n7hSkxDia7fKSg7MmUFklCpY+VRSK8vKT/UCJcihMBdR4MoAl8hRYy60Mo4De1w9oD fJ9hngj3e4wbawelHIbbA4O6JRyboTLTOzvYofhoqR8Fx3xTf9aiPeaULBDRVGEIkF8L df45PJyLkWkCoN2yYcUbbpFqDQ26REDWnLTJ17GK+NFJkEkYyeHOm3t5r5juVdx4Xdtz esol1jkQehddGZ0kTQA+opBGQgJOv5dyd3eOqjw9RAdK7YpxViXJNyfzYKnGtFTJhD90 kIDm4Dt+IHic50G8n8SBbF3BHtpaWXuo/glCCkB25eaCNU7hMPM0PNyqMCvmjsb5ZLE9 D15g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=tR/NzJbIWam+3zAeLlsB8DDpUpb9fJEhYI/+q8ujF+c=; b=W5/iKzos6Paca+5YQB2CBpG7317AuQ8RejoKI/8twrDaHeZt1Bou5VDkNZWdP+I4zp 48ba/b8IQQIshMLnypo7UF/5crlB5saRxX8hquL14b4lR2CqrgFP3HXDGkPr+tnJKAo2 QuNMCEVpjOB6j00XiCcDuoM//S554aH+Om0SJ3+yrrbM4j49oyvJS99ftx/yuVYzdHqQ xjR3epu26chxvgHSYS1zNXCLaQ6RnZKORtBPivlovLICdoadp8rLdWnvhr631JkuXvqT YVZYUV2do5PCBQWLDTj7AKCcuAdoz+eF5ZlhLV52Q9mktmvt+mG5bUgXT7+aVtJTTShu 779w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sFI1YsTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j33-v6si47904994pld.151.2018.06.04.18.19.08; Mon, 04 Jun 2018 18:19:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sFI1YsTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751554AbeFEBSl (ORCPT + 99 others); Mon, 4 Jun 2018 21:18:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52298 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbeFEBSk (ORCPT ); Mon, 4 Jun 2018 21:18:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tR/NzJbIWam+3zAeLlsB8DDpUpb9fJEhYI/+q8ujF+c=; b=sFI1YsTcGVpMK2qf0sqgJUjPY JgZGJNJjGaokTOcZ+w10GZwhaMooDc9aqdEaxBl6rJn4k82DjhIeG9vt8w1Jaq1fEXOD/rJH72i2b LPEr4qLxP6IHHqn5pAEXWpY4mjc6v+LgXIUNHSeljDiW0NbfyFjxgJHyNj+/JwW39gpfpDpJt7RFj YO5a5LYH6iLmF/LWN+EBATFBJhSKbYXMbRjUVdV5vV961GsV9VGHWGKZDZfsPW89PiD641wBwCr2k AbdY3dlNizmOpS3fr+EGKslXqsgFyyO/TSR5LnVe4cA84Uad6jAa+q9JT2rvQPQVTar7KvbuAmn+R oh0XnUYWg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ0cP-0000R6-7l; Tue, 05 Jun 2018 01:18:37 +0000 Date: Mon, 4 Jun 2018 18:18:36 -0700 From: Matthew Wilcox To: Naoya Horiguchi Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , Michal Hocko , "mingo@kernel.org" , "dan.j.williams@intel.com" , Huang Ying Subject: Re: kernel panic in reading /proc/kpageflags when enabling RAM-simulated PMEM Message-ID: <20180605011836.GA32444@bombadil.infradead.org> References: <20180605005402.GA22975@hori1.linux.bs1.fc.nec.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180605005402.GA22975@hori1.linux.bs1.fc.nec.co.jp> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 05, 2018 at 12:54:03AM +0000, Naoya Horiguchi wrote: > Reproduction precedure is like this: > - enable RAM based PMEM (with a kernel boot parameter like memmap=1G!4G) > - read /proc/kpageflags (or call tools/vm/page-types with no arguments) > (- my kernel config is attached) > > I spent a few days on this, but didn't reach any solutions. > So let me report this with some details below ... > > In the critial page request, stable_page_flags() is called with an argument > page whose ->compound_head was somehow filled with '0xffffffffffffffff'. > And compound_head() returns (struct page *)(head - 1), which explains the > address 0xfffffffffffffffe in the above message. Hm. compound_head shares with: struct list_head lru; struct list_head slab_list; /* uses lru */ struct { /* Partial pages */ struct page *next; unsigned long _compound_pad_1; /* compound_head */ unsigned long _pt_pad_1; /* compound_head */ struct dev_pagemap *pgmap; struct rcu_head rcu_head; None of them should be -1. > It seems that this kernel panic happens when reading kpageflags of pfn range > [0xbffd7, 0xc0000), which coresponds to a 'reserved' range. > > [ 0.000000] user-defined physical RAM map: > [ 0.000000] user: [mem 0x0000000000000000-0x000000000009fbff] usable > [ 0.000000] user: [mem 0x000000000009fc00-0x000000000009ffff] reserved > [ 0.000000] user: [mem 0x00000000000f0000-0x00000000000fffff] reserved > [ 0.000000] user: [mem 0x0000000000100000-0x00000000bffd6fff] usable > [ 0.000000] user: [mem 0x00000000bffd7000-0x00000000bfffffff] reserved > [ 0.000000] user: [mem 0x00000000feffc000-0x00000000feffffff] reserved > [ 0.000000] user: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved > [ 0.000000] user: [mem 0x0000000100000000-0x000000013fffffff] persistent (type 12) > > So I guess 'memmap=' parameter might badly affect the memory initialization process. > > This problem doesn't reproduce on v4.17, so some pre-released patch introduces it. > I hope this info helps you find the solution/workaround. Can you try bisecting this? It could be one of my patches to reorder struct page, or it could be one of Pavel's deferred page initialisation patches. Or something else ;-)