Page MenuHomeFreeBSD

Improve kernel stack pages check in ZFS module
AbandonedPublic

Authored by smh on Aug 3 2015, 11:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 3:16 PM
Unknown Object (File)
Feb 21 2024, 6:47 PM
Unknown Object (File)
Dec 20 2023, 12:58 AM
Unknown Object (File)
Sep 16 2023, 11:01 PM
Unknown Object (File)
Aug 10 2023, 10:15 PM
Unknown Object (File)
Jun 29 2023, 1:38 AM
Unknown Object (File)
May 7 2023, 2:08 AM
Unknown Object (File)
Mar 22 2023, 6:15 PM
Subscribers

Details

Reviewers
kib
Summary

This switches to testing kstack_pages at runtime instead of at compile time as its thread0 which causes the issue hence its the kernel's kstack_size size not the one which the ZFS module compiled with which needs testing.

This is still just a validation check, it would be good if this could if kernel stack size could be configured on the fly via loader setting, but that's something for another day.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

smh retitled this revision from to Improve kernel stack pages check in ZFS module.
smh updated this object.
smh edited the test plan for this revision. (Show Details)
smh removed subscribers: kib, peter.

I consider it silly to make kernel spit a reprimand to user.

andrew added inline comments.
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
6503โ€“6508

Shouldn't this be curthread->td_kstack_pages? It may be different than kstack_pages.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
6503โ€“6508

Its been noted that its mainly thread0 so no.

This patch is purely about visibility, making the user aware before they hit a kernel panic, not fixing the underlying problem; so yes it is a temporary thing not a fix for the underlying issue.

smh edited edge metadata.

Switched check to thread0 as this is the key issue and r286288 introduced a change to alter thread0 stack size on i386.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
6504

I think the old message is fine (the new contents is useful as comment or commit message), it could be confusing for our average users who does not have idea what thread0 is.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
6504

I'm not sure I like the idea of the message not accurately reflecting the test being performed, which would be the case if we kept it as "KSTACK_PAGES is %d which could result in stack".

The message does include how the user can correct the situation i.e. add options KSTACK_PAGES=4, so even if they don't know what thread0 is, the fix should still be understood, which I think is enough.

What do others think?

Unless any objections? I'm going to get this is in soon...

kib believes this is waste of kernel memory so abandoning this review:

I noted very early in the history of this review, that the task of teaching user how to use the system is usually delegated to the man page, handbook and similar facilities, and not to the kernel. Not to mention that it eats several hundred bytes of the kernel memory.

Also, on arches where use of ZFS is practically feasible, the kern.kstack_pages tunable works.

On i386 there is a quick, which causes thread0 to use much larger stack even if the regular threads stack size is small, so your warning is probably a dead code there.