From patchwork Fri Jun 22 06:08:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 10481307 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 A89C160388 for ; Fri, 22 Jun 2018 06:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9775E28D94 for ; Fri, 22 Jun 2018 06:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A82828E6D; Fri, 22 Jun 2018 06:08:20 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D9F28D94 for ; Fri, 22 Jun 2018 06:08:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AC676B0003; Fri, 22 Jun 2018 02:08:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 85ABA6B0005; Fri, 22 Jun 2018 02:08:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FC4F6B0006; Fri, 22 Jun 2018 02:08:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id 2DE916B0003 for ; Fri, 22 Jun 2018 02:08:18 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id z5-v6so3123883pln.20 for ; Thu, 21 Jun 2018 23:08:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id; bh=NjyTWEyy0AoCvGb9aqCqlmmYgtHs+UdfgBefCp6X4cc=; b=cbvlCaspG99U4FE3R03JUgssRk9FMc7aXmLRY8FnOirHjUGoBHVJCEbXb6dnO3hAb+ T9vdAeBLxfOyeCHnFUv3HC1luktaHNWHbXfJaPuCjPvj4gE127Hs4pbCqeTb0ARcL9Ce f8cTKweOzU1GQLvwrMqmKn6oA3w9Wr8kG0PEFFdrw6uV4kvAaKgkNeWtqtGn7yGcQm0+ yp/8NEdCCFZwhzzov0bknlyYbQfS7zaE9VmM8ShZwtr/FYOK017cojvyALhwNxj1w5Z0 vuSGc1FMy7XVvES7DUmHlcgkX0jlgGJCEXU1S3J0q5cx+pANEsV0aJZ82VhQ5YQ7YoPS Rr4g== X-Gm-Message-State: APt69E2F5zLoKSPpU8xmYb2q2eOqBxKwSSFoFHhKh/GRoc7d2Bf3Ngrb 1ojygnxZ7kG/u9yHo8sb6h8V5yo+XT4oJXVEb/AFV/+luwUyQG2wdEADTynx58lx/DRaRrkF0R7 DyUx47YcM/KDIQS9DoG7AT5YXO9nUo5ZalQ3+SV1zKYemd4Zxv0ozYQuewNOUFI9UNBeKAiG9/5 fNlaY9Adp443suDPbrBleHILT3De66xT9IIEif9Xl+2c5rU6z81Uzri/mk7/bARFDT0pNIAGS/g gXhvrsmBOXmJlqr5ieDuFURlQNrZG+THQPXRuAR/lfHDpqJHwk6vycQAlZKNptBwe7dL3PGbFKd 9Lm/yTUOWdF9EV2LIdPU3ccx97vLvZUEGyTSb4Ud5ZF1pFyhvwFcm7GjlKveZ/ONldcmgLyiwA= = X-Received: by 2002:a62:90db:: with SMTP id q88-v6mr315956pfk.186.1529647697793; Thu, 21 Jun 2018 23:08:17 -0700 (PDT) X-Received: by 2002:a62:90db:: with SMTP id q88-v6mr315905pfk.186.1529647696857; Thu, 21 Jun 2018 23:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529647696; cv=none; d=google.com; s=arc-20160816; b=CmPVXGXyT6ZgBc0FD8R+6eEmeYKY532ZU9JM992XSu9NxNF7qh/UC36qcjLW/rP2MZ MC9CPk63skZE7Fbe7q6UwkY3xSyNbj/HBvZuM7InOpz/YDLEpAkDyPGOFMkSI6aqHjsM d2dfFY9LfMKUnfWBf51cDAO0WpOnQk0sQIXPPhOxBHLJK5D9i7kw//9RaaPPc5BdW08d /CT4xDSgQNWokUVWyvZ3DtkmWU2BS4x4HYrrx+xaWR/Ka0e8Wv8UjcfqBxc+Ol5WLDLg NDgsenhWe/NLlv1EiKUiIg6fOTV2XUNboSctx9f49oB7vwOjTVHj3KtN65nzYu2HGfqj 7Eyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:sender:dkim-signature :arc-authentication-results; bh=NjyTWEyy0AoCvGb9aqCqlmmYgtHs+UdfgBefCp6X4cc=; b=oFE88L2gwNAlouhr6sFKBmFLVY1voftvw64i6/E3jXRD6wQtb1iGPOFtKJ6fLzkc/a 5CtWKjV1/frUDPnWeAJxuAne8k6802aM2Yai5Ee9lsUo6G8YOLlsY3c3P4GowWJ9FZhJ 41ZDqbEORrWO06FSpXwvj2vZPwkZBGrVlun5mbazEmCL6XWaIQSH66h4WGK9QVz/f9zR 20LAKOh/mHH03UPSNrK3j2HfXZ3UcIjacfSLX+9Nc+1cEAKYOU02aMoRxkri/OoZyqEw QEXb4OwFtHbGTWRCSi7GCkdM/huhQk35YFGxPqg+TYA5oWaUuy2f5nBPhf82al0z9PvP 9tsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="I+lmnKZ/"; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w130-v6sor1783310pfd.4.2018.06.21.23.08.16 for (Google Transport Security); Thu, 21 Jun 2018 23:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="I+lmnKZ/"; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=NjyTWEyy0AoCvGb9aqCqlmmYgtHs+UdfgBefCp6X4cc=; b=I+lmnKZ/qDnRbbNl5qIau8OOzWT5LoBNZupG4yLLHwc8UbDubKUHKZZPXBuBsVrRU1 dcXZjl/z+uctB/5HniigBzIeY8ZQI++nuiCVC3tL1BxardeZ3B6oF0hIq2JbCXk7/DN3 6sLp3doTV8kpL0uXOtr/Q3IMlD9dWJXEv2u29ZbawDgE9ABievEoTABxtxtkjyPmrjed WzAKUPkrfL1O7h4YGufx3Pmh5hFKR/sFct0j5O/RXQ/M2mRNwr2Elm5Dwsjb/o0E29An P1K0H15g2MPzoKgGH+XJVGr09tYsHrv8LspWZN5NjTmvt5pK+FMkMnvwNsZrh0kkgiOo +Xiw== X-Google-Smtp-Source: ADUXVKIbQGCSDb6nq4KaW2Am68zbO3uDGuh9+1Exlu5dQtaikpNXAqwti9ZqOuO1Fq2TT6/HPPE9hA== X-Received: by 2002:a62:50d6:: with SMTP id g83-v6mr299751pfj.31.1529647695965; Thu, 21 Jun 2018 23:08:15 -0700 (PDT) Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp. [153.121.56.200]) by smtp.gmail.com with ESMTPSA id g78-v6sm11916196pfe.39.2018.06.21.23.08.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 23:08:14 -0700 (PDT) From: Naoya Horiguchi To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Dan Williams , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Dave Hansen Subject: [PATCH v1] mm: initialize struct page for reserved pages in ZONE_DEVICE Date: Fri, 22 Jun 2018 15:08:03 +0900 Message-Id: <1529647683-14531-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Reading /proc/kpageflags for pfns allocated by pmem namespace triggers kernel panic with a message like "BUG: unable to handle kernel paging request at fffffffffffffffe". The first few pages (controlled by altmap passed to memmap_init_zone()) in the ZONE_DEVICE can skip struct page initialization, which causes the reported issue. This patch simply adds some initialization code for them. Fixes: 4b94ffdc4163 ("x86, mm: introduce vmem_altmap to augment vmemmap_populate()") Signed-off-by: Naoya Horiguchi --- mm/page_alloc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git v4.17-mmotm-2018-06-07-16-59/mm/page_alloc.c v4.17-mmotm-2018-06-07-16-59_patched/mm/page_alloc.c index 1772513..0b36afe 100644 --- v4.17-mmotm-2018-06-07-16-59/mm/page_alloc.c +++ v4.17-mmotm-2018-06-07-16-59_patched/mm/page_alloc.c @@ -5574,8 +5574,16 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, * Honor reservation requested by the driver for this ZONE_DEVICE * memory */ - if (altmap && start_pfn == altmap->base_pfn) + if (altmap && start_pfn == altmap->base_pfn) { + unsigned long i; + + for (i = 0; i < altmap->reserve; i++) { + page = pfn_to_page(start_pfn + i); + __init_single_page(page, start_pfn + i, zone, nid); + SetPageReserved(page); + } start_pfn += altmap->reserve; + } for (pfn = start_pfn; pfn < end_pfn; pfn++) { /*