Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2023 09:27:29 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ac63f7534d01 - main - arm64, riscv: Use KSTACK_PAGES for the thread0 kstack size designator
Message-ID:  <202310130927.39D9RTS7085618@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac63f7534d0102352bf993ebe2c748ce2ffd432e

commit ac63f7534d0102352bf993ebe2c748ce2ffd432e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-10-09 23:56:37 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-10-13 09:26:45 +0000

    arm64, riscv: Use KSTACK_PAGES for the thread0 kstack size designator
    
    instead of kstack_pages. Although it is correct right now to use
    kstack_pages on amd64 since the kern.kstack_pages tunable is not
    functional on arm64, this is too fragile and wrong on riscv.
    
    Include opt_kstack_pages.h into machdep.c to get the right definition
    for KSTACK_PAGES.
    
    Reviewed by:    jhb, markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D42143
---
 sys/arm64/arm64/machdep.c | 3 ++-
 sys/riscv/riscv/machdep.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 4bfbfcaa91bd..8aa45a86fef4 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -26,6 +26,7 @@
  */
 
 #include "opt_acpi.h"
+#include "opt_kstack_pages.h"
 #include "opt_platform.h"
 #include "opt_ddb.h"
 
@@ -380,7 +381,7 @@ init_proc0(vm_offset_t kstack)
 
 	proc_linkup0(&proc0, &thread0);
 	thread0.td_kstack = kstack;
-	thread0.td_kstack_pages = kstack_pages;
+	thread0.td_kstack_pages = KSTACK_PAGES;
 #if defined(PERTHREAD_SSP)
 	thread0.td_md.md_canary = boot_canary;
 #endif
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 6bc0b996948a..261dc8d6d840 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -33,6 +33,7 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_kstack_pages.h"
 #include "opt_platform.h"
 
 #include <sys/cdefs.h>
@@ -286,7 +287,7 @@ init_proc0(vm_offset_t kstack)
 
 	proc_linkup0(&proc0, &thread0);
 	thread0.td_kstack = kstack;
-	thread0.td_kstack_pages = kstack_pages;
+	thread0.td_kstack_pages = KSTACK_PAGES;
 	thread0.td_pcb = (struct pcb *)(thread0.td_kstack +
 	    thread0.td_kstack_pages * PAGE_SIZE) - 1;
 	thread0.td_pcb->pcb_fpflags = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310130927.39D9RTS7085618>