Thread (80 messages) 80 messages, 8 authors, 2013-01-17
STALE4893d

[PATCH v5 08/14] KVM: ARM: Emulation framework and CP15 emulation

From: Christoffer Dall <hidden>
Date: 2013-01-14 17:38:17
Also in: kvm
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

On Mon, Jan 14, 2013 at 11:36 AM, Russell King - ARM Linux
[off-list ref] wrote:
On Tue, Jan 08, 2013 at 01:39:31PM -0500, Christoffer Dall wrote:
quoted
+     /*
+      * 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 [off-list ref]
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 [off-list ref]
    Signed-off-by: Christoffer Dall [off-list ref]
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help