Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6028049ybi; Wed, 12 Jun 2019 12:41:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0ZTqB9MNtqr65x9wNS2HEXXMlVGUfU/5Thgpw9e5ClYHMmsfIg/9bv6hhOkU/SD++IZCf X-Received: by 2002:a65:42c9:: with SMTP id l9mr5144642pgp.32.1560368482947; Wed, 12 Jun 2019 12:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560368482; cv=none; d=google.com; s=arc-20160816; b=dKBt0nQFcWfMhTNKrIn5yzoLjzzxt4q5riA1qmFqLhwcWGuVhlJdtBZvlH2vyTdgUQ I9XLimM9TDucwsoxXvRpn0DcQgaVO2VQshmeaoTFVeAE8YBD7H4LVi/4hj1lZQZdU+dN YcE99IunKAGpz4tF14SGHLwjAE8RsEbzEvUPqoPK8Y7Dupk4UVErMPSXGlE46h0ccz0R UiM96d0+HXZIJjUMlA9+W5o6TP8hzDNCGzjqjbMYzbaqEyxGxfeMYX9q4v8Ktj+f6pPk HtNewNJ1AVJLolOg7JNBPX5ZyoHUEL/GutynjmL+WhgoiHGMXKzXsBuzMIBfvpW2IS2V 72hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V1aXbLm2XL+BepW2uBo1s2vdmZhrMu6a14z0RbbtF8Y=; b=iSaK9rcZlWKt+LCjqIq2B7C2+xasMGtrxgCMMRb8DKeW5+w0rltJ4OrOESMRQK0tGs Wr6ZD6LBkvMXkapuDcCGE+Ww7I63ORXuzxQUXvf20nfnnwAJs8gpXT1MOwtcXtot9J2p eLn6yzHbSUGPq8HLAFN3ozm8NbPOFoJSafXC9q2FLmMnDbx6436TuQVHu3vTGsVdmpOb /+UyWiB90MvZVQS0roAo621ddc332+QB9EVhFDmh8J1dn4bLH800laU4UmuS2RCZPWmW msgPHqIUjdOKjlmLPMUA81kwoEKXoOqmo39895KGsTOdTEARNAlP11i63Y2jyd1vUznJ PR3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=qcJSquud; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si487301pln.98.2019.06.12.12.41.05; Wed, 12 Jun 2019 12:41:22 -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=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=qcJSquud; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728382AbfFLTjG (ORCPT + 99 others); Wed, 12 Jun 2019 15:39:06 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:37254 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbfFLTjF (ORCPT ); Wed, 12 Jun 2019 15:39:05 -0400 Received: by mail-ot1-f66.google.com with SMTP id s20so2277602otp.4 for ; Wed, 12 Jun 2019 12:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V1aXbLm2XL+BepW2uBo1s2vdmZhrMu6a14z0RbbtF8Y=; b=qcJSquudemsKFEajVtPQXtdzVykjJFvERu1WsQL2yRPQw4DTftC0IGNLeFOxRTfsx7 hZwVOYf7FLiivzC0IoARki1mBZz+Eiy47UX/b4+OfOMNZNYP0cUymYaINAy27i9c64RP fCFijGpqoWoO2+qbyDUABTEumIlys0IJjxgwmpp+oASxvBn3KSxm2MLA0ZbMr0AtoJVp q+Ij+3pKAoRyYc7yobSoTIiww21H5hfWlyKorfgaLiIebfrRhm3uqbPk6FNvBsCD2E+b zN09bGYm1KJ7uC/Ct1J9TxqXNQO/Puu1I+1eHeL9jJafzNOzuVJIXFMiBHSUxFTwKavX lVUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V1aXbLm2XL+BepW2uBo1s2vdmZhrMu6a14z0RbbtF8Y=; b=XdnAP+QRrr+7YDpK5QvJEkaTAH59EOpQOAqperfkXX2KDjxJA8Pmngcsg6iWMtZYJ4 BYqa7xrj5JImXjVB1uNboc6neY5T7VDloTfk4tLP0tJfy6gYIt0tlQUGrN2fjXJ1VAYG t/w8eOJwqyo8AawZMMdkwU6Vz6m4DYxS79dW0stmp+w9chvfGzJwc26IjOAq/CnAFQUX rtqBBvBaXykGPyZOE+3SagqzMVsMRoSu2VXDro12zBnEyDtcb9bTeyDfuyt2uhUuHLap L4dpC3I2SWvwWcVHXmWRLB27J4nXGO3dmfK7hzrBs675EZovXyldIuxwv9xDg7OfUmtR zzvA== X-Gm-Message-State: APjAAAWw4wAbjBonvgNdLe9k8O2igMTsF0B2NQEB53qXXTJe+4Stegjk Zl0zs4gb6ihGFIeXWhXhxCk4bEGGs6tvlSKCRIFJSZVd X-Received: by 2002:a9d:470d:: with SMTP id a13mr6590343otf.126.1560368345122; Wed, 12 Jun 2019 12:39:05 -0700 (PDT) MIME-Version: 1.0 References: <1560366952-10660-1-git-send-email-cai@lca.pw> In-Reply-To: From: Dan Williams Date: Wed, 12 Jun 2019 12:38:54 -0700 Message-ID: Subject: Re: [PATCH -next] mm/hotplug: skip bad PFNs from pfn_to_online_page() To: Qian Cai Cc: Andrew Morton , Oscar Salvador , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 12:37 PM Dan Williams wrote: > > On Wed, Jun 12, 2019 at 12:16 PM Qian Cai wrote: > > > > The linux-next commit "mm/sparsemem: Add helpers track active portions > > of a section at boot" [1] causes a crash below when the first kmemleak > > scan kthread kicks in. This is because kmemleak_scan() calls > > pfn_to_online_page(() which calls pfn_valid_within() instead of > > pfn_valid() on x86 due to CONFIG_HOLES_IN_ZONE=n. > > > > The commit [1] did add an additional check of pfn_section_valid() in > > pfn_valid(), but forgot to add it in the above code path. > > > > page:ffffea0002748000 is uninitialized and poisoned > > raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff > > raw: ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff > > page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p)) > > ------------[ cut here ]------------ > > kernel BUG at include/linux/mm.h:1084! > > invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI > > CPU: 5 PID: 332 Comm: kmemleak Not tainted 5.2.0-rc4-next-20190612+ #6 > > Hardware name: Lenovo ThinkSystem SR530 -[7X07RCZ000]-/-[7X07RCZ000]-, > > BIOS -[TEE113T-1.00]- 07/07/2017 > > RIP: 0010:kmemleak_scan+0x6df/0xad0 > > Call Trace: > > kmemleak_scan_thread+0x9f/0xc7 > > kthread+0x1d2/0x1f0 > > ret_from_fork+0x35/0x4 > > > > [1] https://patchwork.kernel.org/patch/10977957/ > > > > Signed-off-by: Qian Cai > > --- > > include/linux/memory_hotplug.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h > > index 0b8a5e5ef2da..f02be86077e3 100644 > > --- a/include/linux/memory_hotplug.h > > +++ b/include/linux/memory_hotplug.h > > @@ -28,6 +28,7 @@ > > unsigned long ___nr = pfn_to_section_nr(___pfn); \ > > \ > > if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr) && \ > > + pfn_section_valid(__nr_to_section(___nr), pfn) && \ > > pfn_valid_within(___pfn)) \ > > ___page = pfn_to_page(___pfn); \ > > ___page; \ > > Looks ok to me: > > Acked-by: Dan Williams > > ...but why is pfn_to_online_page() a multi-line macro instead of a > static inline like all the helper routines it invokes? I do need to send out a refreshed version of the sub-section patchset, so I'll fold this in and give you a Reported-by credit.