Il 15/08/2013 09:59, Arthur Chunqi Li ha scritto: >> > volatile u32 stage? And we have barrier() to avoid reordering. > Reordering here is not a big deal here, though it is actually needed > here. I occurred the following problem: > > stage = 1; > do something that causes vmexit; > stage = 2; > > Then the compiler will optimize "stage = 1" and "stage = 2" to one > instruction "stage =2", since instructions between them don't use > "stage". Can volatile solve this problem? I'm not sure if volatile stores are reordered against non-volatile stores. Better keep set_stage() but write it as barrier(); stage = s; barrier(); Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html