All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noam Camus <noamc@ezchip.com>
To: <linux-snps-arc@lists.infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <talz@ezchip.com>,
	<gilf@ezchip.com>, <cmetcalf@ezchip.com>,
	Noam Camus <noamc@ezchip.com>
Subject: [PATCH v1 04/20] ARC: Set vmalloc size from configuration
Date: Sat, 31 Oct 2015 15:15:11 +0200	[thread overview]
Message-ID: <1446297327-16298-5-git-send-email-noamc@ezchip.com> (raw)
In-Reply-To: <1446297327-16298-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.

Signed-off-by: Noam Camus <noamc@ezchip.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/Kconfig                 |    8 ++++++++
 arch/arc/include/asm/processor.h |   10 +++++-----
 arch/arc/mm/tlb.c                |    6 ++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 2c2ac3f..689ccb3 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -468,6 +468,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/processor.h b/arch/arc/include/asm/processor.h
index 4454535..a603301 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -113,18 +113,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 0ee7398..0c75a27 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


WARNING: multiple messages have this Message-ID (diff)
From: noamc@ezchip.com (Noam Camus)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v1 04/20] ARC: Set vmalloc size from configuration
Date: Sat, 31 Oct 2015 15:15:11 +0200	[thread overview]
Message-ID: <1446297327-16298-5-git-send-email-noamc@ezchip.com> (raw)
In-Reply-To: <1446297327-16298-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.

Signed-off-by: Noam Camus <noamc at ezchip.com>
Acked-by: Vineet Gupta <vgupta at synopsys.com>
---
 arch/arc/Kconfig                 |    8 ++++++++
 arch/arc/include/asm/processor.h |   10 +++++-----
 arch/arc/mm/tlb.c                |    6 ++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 2c2ac3f..689ccb3 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -468,6 +468,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/processor.h b/arch/arc/include/asm/processor.h
index 4454535..a603301 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -113,18 +113,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 0ee7398..0c75a27 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

  parent reply	other threads:[~2015-10-31 13:18 UTC|newest]

Thread overview: 190+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-31 13:15 [PATCH v1 00/20] eznps a new ARC platform Noam Camus
2015-10-31 13:15 ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 01/20] Documentation: Add EZchip vendor to binding list Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 02/20] clocksource: Add NPS400 timers driver Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-01 20:44   ` Daniel Lezcano
2015-11-01 20:44     ` Daniel Lezcano
2015-11-02  7:57     ` Noam Camus
2015-11-02  7:57       ` Noam Camus
2015-11-02 11:03   ` Vineet Gupta
2015-11-02 11:03     ` Vineet Gupta
2015-11-03 15:18     ` Noam Camus
2015-11-03 15:18       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 03/20] irqchip: add nps Internal and external irqchips Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` Noam Camus [this message]
2015-10-31 13:15   ` [PATCH v1 04/20] ARC: Set vmalloc size from configuration Noam Camus
2015-10-31 13:15 ` [PATCH v1 05/20] ARC: rwlock: disable interrupts in !LLSC variant Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  9:16   ` Peter Zijlstra
2015-11-02  9:16     ` Peter Zijlstra
2015-11-02  9:42   ` Vineet Gupta
2015-11-02  9:42     ` Vineet Gupta
2015-11-02 10:03     ` Peter Zijlstra
2015-11-02 10:03       ` Peter Zijlstra
2015-10-31 13:15 ` [PATCH v1 06/20] ARC: Mark cpu online only after it has executed the per cpu init hook Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 07/20] ARC: mm: use generic macros _BITUL() Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  6:23   ` Vineet Gupta
2015-11-02  6:23     ` Vineet Gupta
2015-11-02  6:27     ` Noam Camus
2015-11-02  6:27       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 08/20] ARC: Use res_service as entry point for secondaries Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  6:38   ` Vineet Gupta
2015-11-02  6:38     ` Vineet Gupta
2015-11-02  8:05     ` Noam Camus
2015-11-02  8:05       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 09/20] ARC: add CONFIG_CLKSRC_OF support to time_init() Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  6:32   ` Vineet Gupta
2015-11-02  6:32     ` Vineet Gupta
2015-10-31 13:15 ` [PATCH v1 10/20] ARC: [plat-eznps] Add eznps board defconfig and dts Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 11/20] ARC: [plat-eznps] Add eznps platform Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02 10:56   ` Vineet Gupta
2015-11-02 10:56     ` Vineet Gupta
2015-11-03 15:59     ` Noam Camus
2015-11-03 15:59       ` Noam Camus
2015-11-04 12:38     ` Noam Camus
2015-11-04 12:38       ` Noam Camus
2015-11-05  5:09   ` Vineet Gupta
2015-11-05  5:09     ` Vineet Gupta
2015-10-31 13:15 ` [PATCH v1 12/20] ARC: [plat-eznps] Use dedicated user stack top Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 13/20] ARC: [plat-eznps] Use dedicated bitops/atomic/cmpxchg Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02 11:56   ` Vineet Gupta
2015-11-02 11:56     ` Vineet Gupta
2015-10-31 13:15 ` [PATCH v1 14/20] ARC: [plat-eznps] Use dedicated SMP barriers Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  8:02   ` Vineet Gupta
2015-11-02  8:02     ` Vineet Gupta
2015-11-02 13:08     ` Noam Camus
2015-11-02 13:08       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 15/20] ARC: [plat-eznps] Use dedicated identity auxiliary register Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 16/20] ARC: [plat-eznps] Use dedicated cpu_relax() Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  7:54   ` Vineet Gupta
2015-11-02  7:54     ` Vineet Gupta
2015-11-02  9:21   ` Peter Zijlstra
2015-11-02  9:21     ` Peter Zijlstra
2015-11-03 14:02     ` Noam Camus
2015-11-03 14:02       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 17/20] ARC: [plat-eznps] Use dedicated COMMAND_LINE_SIZE Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 18/20] ARC: [plat-eznps] define IPI_IRQ Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  7:52   ` Vineet Gupta
2015-11-02  7:52     ` Vineet Gupta
2015-11-02 12:16     ` Noam Camus
2015-11-02 12:16       ` Noam Camus
2015-10-31 13:15 ` [PATCH v1 19/20] ARC: [plat-eznps] replace sync with proper cpu barrier Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02  7:48   ` Vineet Gupta
2015-11-02  7:48     ` Vineet Gupta
2015-11-02  9:26     ` Peter Zijlstra
2015-11-02  9:26       ` Peter Zijlstra
2015-11-17 13:48       ` [PATCH] ARC: remove SYNC from __switch_to() Vineet Gupta
2015-11-17 13:48         ` Vineet Gupta
2015-10-31 13:15 ` [PATCH v1 20/20] ARC: Add eznps platform to Kconfig and Makefile Noam Camus
2015-10-31 13:15   ` Noam Camus
2015-11-02 11:06   ` Vineet Gupta
2015-11-02 11:06     ` Vineet Gupta
2015-11-03 15:32     ` Noam Camus
2015-11-03 15:32       ` Noam Camus
2015-11-04 15:35 ` [PATCH v1 00/20] eznps a new ARC platform Vineet Gupta
2015-11-04 15:35   ` Vineet Gupta
2015-11-04 15:53   ` Noam Camus
2015-11-04 15:53     ` Noam Camus
2015-11-04 17:42     ` Vineet Gupta
2015-11-04 17:42       ` Vineet Gupta
2015-11-07 10:52 ` [PATCH v2 00/19] " Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 01/19] Documentation: Add EZchip vendor to binding list Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 02/19] ARC: [plat-eznps] define IPI_IRQ Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 03/19] clocksource: Add NPS400 timers driver Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 11:26   ` Thomas Gleixner
2015-11-07 11:26     ` Thomas Gleixner
2015-11-20 11:59     ` Noam Camus
2015-11-20 11:59       ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 04/19] irqchip: add nps Internal and external irqchips Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 11:38   ` Thomas Gleixner
2015-11-07 11:38     ` Thomas Gleixner
2015-11-07 20:52     ` Noam Camus
2015-11-07 20:52       ` Noam Camus
2015-11-07 23:52       ` Thomas Gleixner
2015-11-07 23:52         ` Thomas Gleixner
2015-11-07 10:52 ` [PATCH v2 05/19] ARC: Set vmalloc size from configuration Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 06/19] ARC: rwlock: disable interrupts in !LLSC variant Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 07/19] ARC: rename smp operation init_irq_cpu() to init_per_cpu() Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-17 11:15   ` Vineet Gupta
2015-11-17 11:15     ` Vineet Gupta
2015-11-17 11:38     ` Noam Camus
2015-11-17 11:38       ` Noam Camus
2015-11-17 11:42       ` Vineet Gupta
2015-11-17 11:42         ` Vineet Gupta
2015-11-07 10:52 ` [PATCH v2 08/19] ARC: Mark secondary cpu online only after all HW setup is done Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-17 11:17   ` Vineet Gupta
2015-11-17 11:17     ` Vineet Gupta
2015-11-07 10:52 ` [PATCH v2 09/19] ARC: add CONFIG_CLKSRC_OF support to time_init() Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 10/19] ARC: [plat-eznps] Add eznps board defconfig and dts Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 11/19] ARC: [plat-eznps] Add eznps platform Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 12/19] ARC: [plat-eznps] Use dedicated user stack top Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 13/19] ARC: [plat-eznps] Use dedicated atomic/bitops/cmpxchg Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 14/19] ARC: [plat-eznps] Use dedicated SMP barriers Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 15/19] ARC: [plat-eznps] Use dedicated identity auxiliary register Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 16/19] ARC: [plat-eznps] Use dedicated cpu_relax() Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-09 10:05   ` Peter Zijlstra
2015-11-09 10:05     ` Peter Zijlstra
2015-11-09 10:22     ` Vineet Gupta
2015-11-09 10:22       ` Vineet Gupta
2015-11-09 10:45       ` Peter Zijlstra
2015-11-09 10:45         ` Peter Zijlstra
2015-11-09 12:27         ` Vineet Gupta
2015-11-09 12:27           ` Vineet Gupta
2015-11-09 12:51           ` Peter Zijlstra
2015-11-09 12:51             ` Peter Zijlstra
2015-11-07 10:52 ` [PATCH v2 17/19] ARC: [plat-eznps] Use dedicated COMMAND_LINE_SIZE Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-07 10:52 ` [PATCH v2 18/19] ARC: [plat-eznps] replace sync with proper cpu barrier Noam Camus
2015-11-07 10:52   ` Noam Camus
2015-11-17 11:12   ` Vineet Gupta
2015-11-17 11:12     ` Vineet Gupta
2015-11-17 11:23     ` Peter Zijlstra
2015-11-17 11:23       ` Peter Zijlstra
2015-11-17 11:37       ` Vineet Gupta
2015-11-17 11:37         ` Vineet Gupta
2015-11-17 12:22         ` Peter Zijlstra
2015-11-17 12:22           ` Peter Zijlstra
2015-11-17 12:37           ` Vineet Gupta
2015-11-17 12:37             ` Vineet Gupta
2015-11-17 12:44             ` Peter Zijlstra
2015-11-17 12:44               ` Peter Zijlstra
2015-11-17 13:32               ` Vineet Gupta
2015-11-17 13:32                 ` Vineet Gupta
2015-11-17 13:59                 ` Peter Zijlstra
2015-11-17 13:59                   ` Peter Zijlstra
2015-11-07 10:52 ` [PATCH v2 19/19] ARC: Add eznps platform to Kconfig and Makefile Noam Camus
2015-11-07 10:52   ` 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=1446297327-16298-5-git-send-email-noamc@ezchip.com \
    --to=noamc@ezchip.com \
    --cc=cmetcalf@ezchip.com \
    --cc=gilf@ezchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=talz@ezchip.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 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.