-
jbk
oh duh!
-
jbk
let me update
-
jbk
hrm...
-
jbk
when wcopen() is called, we call vt_open() which on the first open calls tem_init() which stashes the queue_t passed in from wcopen()
-
jbk
however wcclose() doesn't call vt_close() if the minor# is 0, which means that queue_t stashed by tem_init() is never cleared
-
jbk
and i'm not sure why we're explicitly skipping this for 0
-
jbk
or if maybe the tem_cleanup should move from vt_close() to vt_clean()
-
sommerfeld
jbk: it occurs to me that the right way to use cpuid leaf 0x15 would be to run the HPET calibration as a sanity check, and if the leaf 0x15 frequency was within some tolerance of the measured value, use the cpuid frequency.
-
jbk
the intel sdm actually states that the TSC frequency is ecx * ebx/eax (if ecx and ebx are 'enumerated' -- not 0)
-
jbk
just there's a fair amount of intel chips where it's not
-
jbk
and of course nothing (AFAIK) for AMD
-
jbk
hrm.. on this tem issue me and tsoome have been looking at...
-
jbk
I'm going to go ahead and file a bug
-
jbk
but apparently we get _really_ lucky
-
jbk
at least most of the time
-
jbk
we're stashing a free'd queue_t, but apparently kmem_cache_alloc() is recycling it so that it ends up getting used for the right thing
-
jbk
at least most of the time
-
jbk
so it mostly works by accident
-
sommerfeld
I would have thought DEBUG kernels would catch that.
-
sommerfeld
or are we not double-freeing it?
-
jbk
well we free it, kmem_cache_alloc() appears to then recycle it so it's once again valid
-
jbk
and most of the time it gets reused for the same thing as it originally was
-
jbk
so by the time you access it again, it's valid
-
jbk
assuming of course it's been recycled
-
jbk
for that use
-
jbk
and not some other stream
-
sommerfeld
ah, dumb luck. is it a queue_t-specific cache?
-
jbk
yeah.. there's a kmem cache for queue_ts
-
jbk
i don't know if there's a way offhand to maybe make kmem use an alternate reuse strategy
-
sommerfeld
the magazine structure means you generally have very fast LIFO reuse
-
sommerfeld
on a per-cpu basis
-
sommerfeld
very cache friendly
-
jbk
ok.. now to grab lunch :)
-
jbk
i guess if I really wanted to, I could try to catch allocq() reusing it, but i think capturing where it's getting saved, and then later passed to freeq(), then later back and all valid looking is I hope enough