I used this gdb macro, to traverse the proc list, and print out the
relevant p_flag's flags:
if $curr_proc == 0
set $curr_proc = allproc.lh_first
set $curr_proc = $curr_proc.p_list.le_next
set $curr_p_flag = $curr_proc->p_flag
set $curr_name = $curr_proc->p_comm
if ($curr_p_flag & 0x00004) != 0
printf "is P_KTHREAD\n"
printf "isn't P_KTHREAD\n"
if ($curr_p_flag & 0x00200) != 0
printf "is P_SYSTEM\n"
printf "isn't P_SYSTEM\n"
And seems like the "kernel" process don't have the P_KTHREAD flag,
which fires the KASSERT in sys/kern/kern_proc.c's stop_all_proc(void)
The relevant part of the code is:
2989 struct proc *cp, *p;
2990 int r, gen;
2991 bool restart, seen_stopped, seen_exiting, stopped_some;
2993 cp = curproc;
2995 * stop_all_proc() assumes that all process which have
2996 * usermode must be stopped, except current process, for
2997 * obvious reasons. Since other threads in the process
2998 * establishing global stop could unstop something, disable
2999 * calls from multithreaded processes as precaution. The
3000 * service must not be user-callable anyway.
*3002 KASSERT((cp->p_flag & P_HADTHREADS) == 0 ||
*3003 (cp->p_flag & P_KTHREAD) != 0, ("mt stop_all_proc"));
If I comment out this KASSERT or just whitelist the "kernel" process,
then I get a completely working suspend to ram and resume on my laptop
(which is a HP 430G1) with one additional small tweak
So the question is that the KASSERT is bogus or too strict, or the
P_KTHREAD flags is missing from "kernel" process?
The gdb macros output is:
$139 = 0xfffff800029773c8 "rand_harvestq"
$140 = 0x10000204
$141 = 0xfffff80002977940 "init"
$142 = 0x10004200
$143 = 0xfffff800029783c8 "audit"
$144 = 0x10000204
$145 = 0xffffffff80f1b4d0 "kernel"
$146 = 0x10000280
I've CC-ed Konstantin to this discussion, because he added this
functionality to the kernel.
If I try to trigger the KASSERT with the debug.stop_all_proc=1 sysctl,
then it's never fires, but when I try to put my machine to S3 with
ctrl+alt+space then it fires.
email@example.com mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"