lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230525160813.39408-3-minhuadotchen@gmail.com>
Date:   Fri, 26 May 2023 00:08:12 +0800
From:   Min-Hua Chen <minhuadotchen@...il.com>
To:     Vineet Gupta <vgupta@...nel.org>
Cc:     linux-snps-arc@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Min-Hua Chen <minhuadotchen@...il.com>
Subject: [RESEND PATCH 2/2] ARC: rename 16KSTACKS to DEBUG_STACKS

Rename 16KSTACKS to DEBUG_STACKS.

arch/arc/Kconfig.debug says that the default stack size is 8KB
and it will become 16KB stack if 16KSTACKS is set.

However, the stack size is based on PAGE_SIZE, and it is
configurable by CONFIG_ARC_PAGE_SIZE_16K or CONFIG_ARC_PAGE_SIZE_4K.
When CONFIG_16KSTACKS=y:

PAGE_SHIFT==12 => THREAD_SIZE == (1 << (12 + 1)) = 8KB
PAGE_SHIFT==13 => THREAD_SIZE == (1 << (13 + 1)) = 16KB
PAGE_SHIFT==14 => THREAD_SIZE == (1 << (14 + 1)) = 32KB

We get correct 16KB stack only when PAGE_SHIFT is 13.

See arch/arc/include/uapi/asm/page.h:
/* PAGE_SHIFT determines the page size */
\#if defined(CONFIG_ARC_PAGE_SIZE_16K)
\#define PAGE_SHIFT 14
\#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
\#define PAGE_SHIFT 12
\#else
\#define PAGE_SHIFT 13
\#endif

See arch/arc/include/asm/thread_info.h:
\#ifdef CONFIG_DEBUG_STACKS
\#define THREAD_SIZE_ORDER 1
\#else
\#define THREAD_SIZE_ORDER 0
\#endif

\#define THREAD_SIZE     (PAGE_SIZE << THREAD_SIZE_ORDER)
\#define THREAD_SHIFT	(PAGE_SHIFT + THREAD_SIZE_ORDER)

To make CONFIG_16KSTACKS less confusing, rename it to DEBUG_STACKS
(as it is defined in Kconfig.debug) and modify the Kconfig
description. No functional changes intended.

Signed-off-by: Min-Hua Chen <minhuadotchen@...il.com>
---
 arch/arc/Kconfig.debug             | 7 ++++---
 arch/arc/include/asm/thread_info.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arc/Kconfig.debug b/arch/arc/Kconfig.debug
index 45add86decd5..9a1e140605c4 100644
--- a/arch/arc/Kconfig.debug
+++ b/arch/arc/Kconfig.debug
@@ -1,10 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
-config 16KSTACKS
-	bool "Use 16Kb for kernel stacks instead of 8Kb"
+config DEBUG_STACKS
+	bool "Use double sized kernel stacks"
 	help
-	  If you say Y here the kernel will use a  16Kb stacksize for the
+	  If you say Y here the kernel will use a double sized stack for the
 	  kernel stack attached to each process/thread. The default is 8K.
+	  (depends on CONFIG_ARC_PAGE_SIZE_16K or CONFIG_ARC_PAGE_SIZE_4K)
 	  This increases the resident kernel footprint and will cause less
 	  threads to run on the system and also increase the pressure
 	  on the VM subsystem for higher order allocations.
diff --git a/arch/arc/include/asm/thread_info.h b/arch/arc/include/asm/thread_info.h
index 9f9dd021501c..a7358d1225a6 100644
--- a/arch/arc/include/asm/thread_info.h
+++ b/arch/arc/include/asm/thread_info.h
@@ -15,7 +15,7 @@
 
 #include <asm/page.h>
 
-#ifdef CONFIG_16KSTACKS
+#ifdef CONFIG_DEBUG_STACKS
 #define THREAD_SIZE_ORDER 1
 #else
 #define THREAD_SIZE_ORDER 0
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ