linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Linux MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH v1] mm: initialize struct page for reserved pages in ZONE_DEVICE
Date: Thu, 21 Jun 2018 23:12:01 -0700	[thread overview]
Message-ID: <CAPcyv4hpdvGRi+=psT47ePB6QigJW2JEq-zhbVXsTHb14pWfUQ@mail.gmail.com> (raw)
In-Reply-To: <1529647683-14531-1-git-send-email-n-horiguchi@ah.jp.nec.com>

On Thu, Jun 21, 2018 at 11:08 PM, Naoya Horiguchi
<n-horiguchi@ah.jp.nec.com> wrote:
> 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 <n-horiguchi@ah.jp.nec.com>
> ---
>  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;
> +       }

No, unfortunately this will clobber metadata that lives in that
reserved area, see __nvdimm_setup_pfn().

  reply	other threads:[~2018-06-22  6:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  6:08 [PATCH v1] mm: initialize struct page for reserved pages in ZONE_DEVICE Naoya Horiguchi
2018-06-22  6:12 ` Dan Williams [this message]
2018-06-22  6:13   ` Dan Williams
2018-06-22  6:55   ` Naoya Horiguchi
2018-06-22  7:30     ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPcyv4hpdvGRi+=psT47ePB6QigJW2JEq-zhbVXsTHb14pWfUQ@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@redhat.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).