Linux-parisc archive on lore.kernel.org
 help / color / Atom feed
From: Helge Deller <deller@gmx.de>
To: Mike Rapoport <rppt@kernel.org>
Cc: "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mike Rapoport <rppt@linux.ibm.com>, Meelis Roos <mroos@linux.ee>,
	Jeroen Roovers <jer@gentoo.org>,
	Mikulas Patocka <mpatocka@redhat.com>
Subject: Re: [PATCH] parisc: fix map_pages() to actually populate upper directory
Date: Thu, 9 Jan 2020 07:50:55 +0100
Message-ID: <20200109065055.GA13038@ls3530.fritz.box> (raw)
In-Reply-To: <20200108125852.19823-1-rppt@kernel.org>

> The commit d96885e277b5 ("parisc: use pgtable-nopXd instead of
> 4level-fixup") converted PA-RISC to use folded page tables, but it missed
> the conversion of pgd_populate() to pud_populate() in maps_pages()
> function. This caused the upper page table directory to remain empty and
> the system would crash as a result.
>
> Using pud_populate() that actually populates the page table instead of
> dummy pgd_populate() fixes the issue.
> ...
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index ddca8287d43b..354cf060b67f 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -401,7 +401,7 @@ static void __init map_pages(unsigned long start_vaddr,
>  			pmd = (pmd_t *) __pa(pmd);
>  		}
>
> -		pgd_populate(NULL, pg_dir, __va(pmd));
> +		pud_populate(NULL, (pud_t *)pg_dir, __va(pmd));
>  #endif

Wouldn't the untested patch below be more clean?

Helge

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index ddca8287d43b..73de58f31f5f 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -387,6 +387,8 @@ static void __init map_pages(unsigned long start_vaddr,
 #if PTRS_PER_PMD == 1
 		pmd = (pmd_t *)__pa(pg_dir);
 #else
+		p4d_t *p4d;
+		pud_t *pud;
 		pmd = (pmd_t *)pgd_address(*pg_dir);

 		/*
@@ -401,7 +403,9 @@ static void __init map_pages(unsigned long start_vaddr,
 			pmd = (pmd_t *) __pa(pmd);
 		}

-		pgd_populate(NULL, pg_dir, __va(pmd));
+		p4d = p4d_offset(pg_dir, vaddr);
+		pud = pud_offset(p4d, vaddr);
+		pud_populate(NULL, pud, __va(pmd));
 #endif
 		pg_dir++;


  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 12:58 Mike Rapoport
2020-01-09  6:50 ` Helge Deller [this message]
2020-01-09  8:45   ` Mike Rapoport
2020-01-11 15:53     ` Helge Deller

Reply instructions:

You may reply publically 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=20200109065055.GA13038@ls3530.fritz.box \
    --to=deller@gmx.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jer@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=mroos@linux.ee \
    --cc=rppt@kernel.org \
    --cc=rppt@linux.ibm.com \
    /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

Linux-parisc archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-parisc/0 linux-parisc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-parisc linux-parisc/ https://lore.kernel.org/linux-parisc \
		linux-parisc@vger.kernel.org
	public-inbox-index linux-parisc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-parisc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git