All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Subject: [PATCH 2/3] MIPS: highmem: ensure that we don't use more than one page for PTEs
Date: Tue, 11 Apr 2017 09:00:35 +0200	[thread overview]
Message-ID: <1491894036-5440-3-git-send-email-marcin.nowakowski@imgtec.com> (raw)
In-Reply-To: <1491894036-5440-1-git-send-email-marcin.nowakowski@imgtec.com>

All PTEs used by PKMAP should be allocated in a contiguous memory area,
but we do not currently have a mechanism to enforce that, so ensure that
we don't try to allocate more entries than would fit in a single page.

Current fixed value of 1024 would not work with XPA enabled when
sizeof(pte_t)==8 and we need two pages to store pte tables.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 arch/mips/include/asm/highmem.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
index d34536e..279b6d1 100644
--- a/arch/mips/include/asm/highmem.h
+++ b/arch/mips/include/asm/highmem.h
@@ -35,7 +35,12 @@ extern pte_t *pkmap_page_table;
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
+#define LAST_PKMAP 512
+#else
 #define LAST_PKMAP 1024
+#endif
+
 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
 #define PKMAP_NR(virt)	((virt-PKMAP_BASE) >> PAGE_SHIFT)
 #define PKMAP_ADDR(nr)	(PKMAP_BASE + ((nr) << PAGE_SHIFT))
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Subject: [PATCH 2/3] MIPS: highmem: ensure that we don't use more than one page for PTEs
Date: Tue, 11 Apr 2017 09:00:35 +0200	[thread overview]
Message-ID: <1491894036-5440-3-git-send-email-marcin.nowakowski@imgtec.com> (raw)
Message-ID: <20170411070035.LYPsIan0QDLJ14h403LieKi0AR56-3U-QIC7Li4IZjs@z> (raw)
In-Reply-To: <1491894036-5440-1-git-send-email-marcin.nowakowski@imgtec.com>

All PTEs used by PKMAP should be allocated in a contiguous memory area,
but we do not currently have a mechanism to enforce that, so ensure that
we don't try to allocate more entries than would fit in a single page.

Current fixed value of 1024 would not work with XPA enabled when
sizeof(pte_t)==8 and we need two pages to store pte tables.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 arch/mips/include/asm/highmem.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
index d34536e..279b6d1 100644
--- a/arch/mips/include/asm/highmem.h
+++ b/arch/mips/include/asm/highmem.h
@@ -35,7 +35,12 @@ extern pte_t *pkmap_page_table;
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
+#define LAST_PKMAP 512
+#else
 #define LAST_PKMAP 1024
+#endif
+
 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
 #define PKMAP_NR(virt)	((virt-PKMAP_BASE) >> PAGE_SHIFT)
 #define PKMAP_ADDR(nr)	(PKMAP_BASE + ((nr) << PAGE_SHIFT))
-- 
2.7.4

  parent reply	other threads:[~2017-04-11  7:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  7:00 [PATCH 0/3] mips highmem fixes Marcin Nowakowski
2017-04-11  7:00 ` Marcin Nowakowski
2017-04-11  7:00 ` [PATCH 1/3] MIPS: mm: fixed mappings: correct initialisation Marcin Nowakowski
2017-04-11  7:00   ` Marcin Nowakowski
2017-04-11  7:00 ` Marcin Nowakowski [this message]
2017-04-11  7:00   ` [PATCH 2/3] MIPS: highmem: ensure that we don't use more than one page for PTEs Marcin Nowakowski
2017-04-11  7:00 ` [PATCH 3/3] MIPS: mm: adjust PKMAP location Marcin Nowakowski
2017-04-11  7:00   ` Marcin Nowakowski
2017-04-11  9:49   ` Sergei Shtylyov

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=1491894036-5440-3-git-send-email-marcin.nowakowski@imgtec.com \
    --to=marcin.nowakowski@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.