On Mon, Jan 14, 2013 at 11:36 AM, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx> wrote: > On Tue, Jan 08, 2013 at 01:39:31PM -0500, Christoffer Dall wrote: >> + /* >> + * Check whether this vcpu requires the cache to be flushed on >> + * this physical CPU. This is a consequence of doing dcache >> + * operations by set/way on this vcpu. We do it here to be in >> + * a non-preemptible section. >> + */ >> + if (cpumask_test_cpu(cpu, &vcpu->arch.require_dcache_flush)) { >> + cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush); > > There is cpumask_test_and_clear_cpu() which may be better for this. nice: commit d31686fadb74ad564f6a5acabdebe411de86d77d Author: Christoffer Dall <c.dall@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon Jan 14 12:36:53 2013 -0500 KVM: ARM: Use cpumask_test_and_clear_cpu Nicer shorter cleaner code. Ahhhh. Cc: Russell King <linux@xxxxxxxxxxxxxxxx> Signed-off-by: Christoffer Dall <c.dall@xxxxxxxxxxxxxxxxxxxxxx> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index b5c6ab1..fdd4a7c 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -352,10 +352,8 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) * operations by set/way on this vcpu. We do it here to be in * a non-preemptible section. */ - if (cpumask_test_cpu(cpu, &vcpu->arch.require_dcache_flush)) { - cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush); + if (cpumask_test_and_clear_cpu(cpu, &vcpu->arch.require_dcache_flush)) flush_cache_all(); /* We'd really want v7_flush_dcache_all() */ - } kvm_arm_set_running_vcpu(vcpu); } -- Thanks, -Christoffer -- 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