Page MenuHomeFreeBSD

riscv: Fix thread0.td_kstack_pages init
ClosedPublic

Authored by brooks on Jan 14 2023, 12:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 23, 6:33 PM
Unknown Object (File)
Fri, Sep 20, 4:42 PM
Unknown Object (File)
Thu, Sep 19, 9:46 AM
Unknown Object (File)
Tue, Sep 17, 11:02 AM
Unknown Object (File)
Mon, Sep 16, 8:30 PM
Unknown Object (File)
Sun, Sep 15, 6:26 PM
Unknown Object (File)
Thu, Sep 5, 6:46 PM
Unknown Object (File)
Fri, Aug 30, 10:36 AM
Subscribers

Details

Summary

Commit 0ef3ca7ae37c70e9dc83475dc2e68e98e1c2a418 initialized
thread0.td_kstack_pages to KSTACK_PAGES, due to the lack of an
include of opt_kstack_pages.h it used the fallback value of 4 from
machine/param.h. This meant that increasing KSTACK_PAGES in the kernel
config resulted in a panic in _epoch_enter_preempt as the following
assertion was false during network stack setup:

MPASS((vm_offset_t)et >= td->td_kstack &&

	    (vm_offset_t)et + sizeof(struct epoch_tracker) <=
	    td->td_kstack + td->td_kstack_pages * PAGE_SIZE);

Switch to initializing with kstack_pages following other architectures.

Sponsored by: DARPA, AFRL

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 49101
Build 45990: arc lint + arc unit

Event Timeline

Matches other architectures. We set it in kern_proc.c which includes the right opt file. riscv64 includes that file as well, so this will make it match the space reserved for the stack via the usual bootparams method that passes the pointer to the reserved area in locore for the stack that will be KSTACK_PAGES in size. since kern_proc.c and locore.S have the same defintion of KSTACK_PAGES, we'll set the right space.

tl;dr: looks good to me.

This revision is now accepted and ready to land.Jan 14 2023, 12:20 AM
This revision was automatically updated to reflect the committed changes.