Re: How is Code in do_sys_settimeofday() safe in case of SMP and Nest Kernel Path?

Christoph Lameter
2006-09-29T16:06:17Z

On Fri, 29 Sep 2006, Dong Feng wrote:

> For my understanding, an assignment between structs should be a
> bit-wise copy. Such operation is not atomic, so it can not be supposed

Byte or Machine word yes.

> SMP-safe. And the subsequent test-and-assign operation on firsttime is
> not atomic, either.

No its not atomic on its own. Correct.

> If the comments mean the subsequent code is SMP-safe and can prevent
> nest-kernel-path, how does it achieves that?

It relies on locking outside of do_sys_settimeofday(). Seems that this
indicates locking is to be performed by the arch before calling
do_sys_settimeofday. Looks suspicious to me. Check that this function is
always called with the same lock.