USB-related problem

Eugene Grosbein eugen at grosbein.net
Thu Nov 12 22:29:08 UTC 2015


On 11.11.2015 01:57, Adrian Chadd wrote:
> + benno, jeff, kib
> 
> cool, so now we know where syncer is hanging. nice work!
> 
> That syncer loop that calls it waiting for the list to be empty is
> also a bit suss; it looks like it could also get stuck in a loop and
> never yield.

I've used new state variables spread all over the kernel
(plus KTR facility) to track this down and came to a result I cannot explain.

First, here is call sequence leading to kernel hang, always the same:

sys/kern/vfs_subr.c, sync_vnode() -> VOP_FSYNC(vp, MNT_LAZY, td) -> VOP_FSYNC_APV()
in generated vnode_if.c in the kernel compile directory.

Here we have KTR_START3(KTR_VOP, ...) that is latest record that DDB shows for
"show ktr /v". There should be KTR_STOP3(KTR_VOP, "VOP", ...) recorded after, but it is not.
In fact, execution proceeds to vop_fsync(a) and never returns, precisely:

vop_fsync(a) -> sys/fs/devfs/devfs_vnops.c, devfs_fsync() ->
"return (vop_stdfsync(ap))" - never returns.

It reaches sys/kern/vfs_default.c, vop_stdfsync() and hangs exactly at this KASSERT:
https://svnweb.freebsd.org/base/head/sys/kern/vfs_default.c?annotate=288451#l683

I've defined another global variable "volatile unsigned vopsfsyncstate",
set it to 15 just before this KASSERT and to 126 just after the KASSERT
and it always equals to 15 when kernel hangs. I tested kernel compiled
with and without WITNESS (and WITHNESS_SKIPSPIN), no changes.

I do not understand how and why does it hang here but that's a fact.
Here I'm stuck.

Eugene Grosbein



More information about the freebsd-mips mailing list