Re: [DOCUMENTATION] Revised Unreliable Kernel Locking Guide

From: Rob Love
Date: Fri Dec 12 2003 - 16:06:36 EST


On Fri, 2003-12-12 at 10:44, Dave Jones wrote:

> Might be worth mentioning in the Per-CPU data section that code doing
> operations on CPU registers (MSRs and the like) needs to be protected
> by an explicit preempt_disable() / preempt_enable() pair if it's doing
> operations that it expects to run on a specific CPU.
>
> For examples, see arch/i386/kernel/msr.c & cpuid.c

Good point.

I think this can be generalized to "you must remain atomic so long as
you expect the processor state to remain consistent." For example,
while manipulating processor registers or modes.

This means that you must disable kernel preemption and must not sleep
within the critical region.

Rob Love


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/