From patchwork Mon Jan 14 17:38:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1973071 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E71D9DF2F3 for ; Mon, 14 Jan 2013 17:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757470Ab3ANRiV (ORCPT ); Mon, 14 Jan 2013 12:38:21 -0500 Received: from mail-vb0-f45.google.com ([209.85.212.45]:35670 "EHLO mail-vb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757176Ab3ANRiS (ORCPT ); Mon, 14 Jan 2013 12:38:18 -0500 Received: by mail-vb0-f45.google.com with SMTP id p1so3784077vbi.18 for ; Mon, 14 Jan 2013 09:38:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=+9RNWEiN6rbooSf/Jn1aT9u+NCjEaVW2OxgDtvHv8Cc=; b=Gquplnx0vrhPtMVgYOTF5p00LoMtGYLqEQ/oioHfJzOcw6l0DU9tAWjV4rP3krQVe4 aS9UNiupRK+daE8Pz5Psi162T+yGHm1GAj4TzDhpJTkF2K+B0eTo/96kL9Fsg0gDgpC1 lh8y75mRLMt0kd9dZ2puXsvsncxWc1tB3gIcz6lrPzeNH+N3CTdOE6vI9oEt3jAUMY9A i4NZeocuXbsQa4tTqVglynwpAcSgzsqMB7RS+LZl60E87XMRcK2lTtb+xamJiZMU6Qtb PqyZuySKgJ1rGXfIiFmC0mVP+97bP1BHUPHBfyV8Di4AXNeJYom8cccOMGm+Tllq6Xaq PTOQ== MIME-Version: 1.0 Received: by 10.52.18.147 with SMTP id w19mr90223194vdd.94.1358185098093; Mon, 14 Jan 2013 09:38:18 -0800 (PST) Received: by 10.221.7.71 with HTTP; Mon, 14 Jan 2013 09:38:17 -0800 (PST) X-Originating-IP: [72.80.83.148] In-Reply-To: <20130114163636.GG23505@n2100.arm.linux.org.uk> References: <20130108183811.46302.58543.stgit@ubuntu> <20130108183931.46302.60921.stgit@ubuntu> <20130114163636.GG23505@n2100.arm.linux.org.uk> Date: Mon, 14 Jan 2013 12:38:17 -0500 Message-ID: Subject: Re: [PATCH v5 08/14] KVM: ARM: Emulation framework and CP15 emulation From: Christoffer Dall To: Russell King - ARM Linux Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Marcelo Tosatti , Rusty Russell X-Gm-Message-State: ALoCoQl3bs7shAihgsnzkAANFgy1X53svJRic24zBMJMO7nxMZqZh5KOf/fdyEZuVB2jc8CNqR7Q Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Jan 14, 2013 at 11:36 AM, Russell King - ARM Linux 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 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 Signed-off-by: Christoffer Dall Acked-by: Russell King --- Thanks, -Christoffer -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }