From: Noam Camus <noamc@ezchip.com>
To: <linux-snps-arc@lists.infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <cmetcalf@ezchip.com>,
<daniel.lezcano@linaro.org>, <marc.zyngier@arm.com>,
Noam Camus <noamc@ezchip.com>
Subject: [PATCH v5 06/20] ARC: Set vmalloc size from configuration
Date: Sun, 27 Dec 2015 15:23:25 +0200 [thread overview]
Message-ID: <1451222619-3610-7-git-send-email-noamc@ezchip.com> (raw)
In-Reply-To: <1451222619-3610-1-git-send-email-noamc@ezchip.com>
From: Noam Camus <noamc@ezchip.com>
User space use lower 2G of the virtual address space.
However kernel steals upper 512M of this space.
This stolen space is used partially for vmalloc and the rest
serves as gutter between kernel and user space.
The vmalloc size is depend on NR_CPUS since "per cpu" mechanism
use vmalloc to allocate chunks for its use.
Historically vmalloc size was 256M however it is not enough in
case of many CPUs e.g. 4K CPUs. For such case an extra 192M is
allocated.
We are setting default vmalloc size to be 256M, any addtional
space will be taken from kernel/user gutter.
This introduce build error since PGDIR_SIZE() cannot use "1UL"
ibecause it is called from mm/tlbex.S by VMALLOC_START.
Using _BITUL() solves this build error.
Signed-off-by: Noam Camus <noamc@ezchip.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
---
arch/arc/Kconfig | 8 ++++++++
arch/arc/include/asm/pgtable.h | 2 +-
arch/arc/include/asm/processor.h | 10 +++++-----
arch/arc/mm/tlb.c | 6 ++++++
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 6312f60..7be1020 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -469,6 +469,14 @@ config ARCH_PHYS_ADDR_T_64BIT
config ARCH_DMA_ADDR_T_64BIT
bool
+config ARC_VMALLOC_SIZE
+ hex "Vmalloc size (MB)"
+ range 0 512
+ default "256"
+ help
+ By default equals to 256MB and the rest of 512MB is
+ left for gutter between kernel and user space.
+
config ARC_CURR_IN_REG
bool "Dedicate Register r25 for current_task pointer"
default y
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 57af2f0..372a282 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -210,7 +210,7 @@
#define BITS_FOR_PGD (32 - BITS_FOR_PTE - BITS_IN_PAGE)
#define PGDIR_SHIFT (32 - BITS_FOR_PGD)
-#define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* vaddr span, not PDG sz */
+#define PGDIR_SIZE _BITUL(PGDIR_SHIFT) /* vaddr span, not PDG sz */
#define PGDIR_MASK (~(PGDIR_SIZE-1))
#define PTRS_PER_PTE _BITUL(BITS_FOR_PTE)
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index 1d694c1..8a77ccd 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -109,18 +109,18 @@ extern unsigned int get_wchan(struct task_struct *p);
* 0xC000_0000 0xFFFF_FFFF (peripheral uncached space)
* -----------------------------------------------------------------------------
*/
-#define VMALLOC_START 0x70000000
/*
* 1 PGDIR_SIZE each for fixmap/pkmap, 2 PGDIR_SIZE gutter
* See asm/highmem.h for details
*/
-#define VMALLOC_SIZE (PAGE_OFFSET - VMALLOC_START - PGDIR_SIZE * 4)
-#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
+#define VMALLOC_END (PAGE_OFFSET - PGDIR_SIZE * 4)
+#define VMALLOC_SIZE (CONFIG_ARC_VMALLOC_SIZE << 20)
+#define VMALLOC_START (VMALLOC_END - VMALLOC_SIZE)
-#define USER_KERNEL_GUTTER 0x10000000
+#define TASK_SIZE 0x60000000
-#define TASK_SIZE (VMALLOC_START - USER_KERNEL_GUTTER)
+#define USER_KERNEL_GUTTER (VMALLOC_START - TASK_SIZE)
#define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX STACK_TOP
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index daf2bf5..843e1a5 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -814,6 +814,12 @@ void arc_mmu_init(void)
printk(arc_mmu_mumbojumbo(0, str, sizeof(str)));
+ /*
+ * vmalloc size (in MB) sanity check,
+ * Can't be done in processor.h due to header include depenedencies
+ */
+ BUILD_BUG_ON(!IS_ALIGNED((CONFIG_ARC_VMALLOC_SIZE << 20), PMD_SIZE));
+
/* For efficiency sake, kernel is compile time built for a MMU ver
* This must match the hardware it is running on.
* Linux built for MMU V2, if run on MMU V1 will break down because V1
--
1.7.1
next prev parent reply other threads:[~2015-12-27 13:28 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 13:23 [PATCH v5 00/20] Adding plat-eznps to ARC Noam Camus
2015-12-27 13:23 ` [PATCH v5 01/20] Documentation: Add EZchip vendor to binding list Noam Camus
2015-12-27 13:23 ` [PATCH v5 02/20] soc: Support for EZchip SoC Noam Camus
2015-12-27 13:23 ` [PATCH v5 03/20] ARC: [plat-eznps] define IPI_IRQ Noam Camus
2015-12-27 13:23 ` [PATCH v5 04/20] clocksource: Add NPS400 timers driver Noam Camus
2015-12-27 14:55 ` kbuild test robot
2015-12-27 21:41 ` Noam Camus
2015-12-28 9:00 ` Daniel Lezcano
2015-12-28 10:35 ` Vineet Gupta
2015-12-28 10:55 ` Daniel Lezcano
2015-12-28 11:11 ` Vineet Gupta
2016-01-01 10:31 ` Vineet Gupta
2015-12-27 13:23 ` [PATCH v5 05/20] irqchip: add nps Internal and external irqchips Noam Camus
2015-12-30 10:08 ` Vineet Gupta
2015-12-30 10:41 ` Vineet Gupta
2015-12-27 13:23 ` Noam Camus [this message]
2015-12-27 13:23 ` [PATCH v5 07/20] ARC: rwlock: disable interrupts in !LLSC variant Noam Camus
2015-12-27 13:23 ` [PATCH v5 08/20] ARC: Mark secondary cpu online only after all HW setup is done Noam Camus
2015-12-27 13:23 ` [PATCH v5 09/20] ARC: IRQ: use device tree to get timer device configuration Noam Camus
2015-12-28 11:42 ` Vineet Gupta
2015-12-30 11:20 ` Vineet Gupta
2015-12-27 13:23 ` [PATCH v5 10/20] ARC: IRQ: do not use hwirq directly at arch_do_IRQ() Noam Camus
2015-12-30 10:10 ` Vineet Gupta
2015-12-31 5:21 ` Noam Camus
2015-12-27 13:23 ` [PATCH v5 11/20] ARC: IPI: do not use generic IRQ domain Noam Camus
2015-12-30 10:13 ` Vineet Gupta
2015-12-31 5:14 ` Noam Camus
2015-12-27 13:23 ` [PATCH v5 12/20] ARC: [plat-eznps] Add eznps board defconfig and dts Noam Camus
2015-12-27 13:23 ` [PATCH v5 13/20] ARC: [plat-eznps] Add eznps platform Noam Camus
2015-12-27 13:23 ` [PATCH v5 14/20] ARC: [plat-eznps] Use dedicated user stack top Noam Camus
2015-12-27 13:23 ` [PATCH v5 15/20] ARC: [plat-eznps] Use dedicated atomic/bitops/cmpxchg Noam Camus
2015-12-27 13:23 ` [PATCH v5 16/20] ARC: [plat-eznps] Use dedicated SMP barriers Noam Camus
2015-12-27 13:23 ` [PATCH v5 17/20] ARC: [plat-eznps] Use dedicated identity auxiliary register Noam Camus
2015-12-27 13:23 ` [PATCH v5 18/20] ARC: [plat-eznps] Use dedicated cpu_relax() Noam Camus
2015-12-27 13:23 ` [PATCH v5 19/20] ARC: [plat-eznps] Use dedicated COMMAND_LINE_SIZE Noam Camus
2015-12-27 13:23 ` [PATCH v5 20/20] ARC: Add eznps platform to Kconfig and Makefile Noam Camus
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=1451222619-3610-7-git-send-email-noamc@ezchip.com \
--to=noamc@ezchip.com \
--cc=cmetcalf@ezchip.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=marc.zyngier@arm.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
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
all inboxes | Powered by JetHome®