tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD thread model: a few questions

Hi list,

I would like to have a few clarification about NetBSD's thread model, concerning kernel preemption (when enabled) and threads scheduling, under particular situations.

These questions relates to my work under Xen, especially suspension of the LWP and CPUs. I know that we are not supporting SMP under Xen currently, but I am preparing for it.

- is it valid for a LWP to call kpreempt_disable() but still use synchronisation primitives in the non-preemptible part, thus resulting in voluntary context switches? KASSERTs in the mutex code in this regard are not particularly clear (yes, I know, the question is somewhat stupid, but I would like to know if such a situation may ever happen)

- when a LWP is bound to a CPU and that CPU is put offline, bound threads may still execute on it. However, Xen only saves the context of CPU0, the rest being at the responsibility of the domain to save/restart the CPU on suspend/resume.

Is there a way to correctly assert that bound threads running on a CPU do not hold any locks when we are about to save the CPU context, to avoid any possible deadlock between bound LWP and LWP waiting for locked ressources? Or is it acceptable to alter the affinity of bound threads arbitrarily and restore it later?

Many thanks in advance for your answers.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index