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: 1973101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 42DFADF2E1 for ; Mon, 14 Jan 2013 17:42:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TunzP-0007T7-8o; Mon, 14 Jan 2013 17:38:27 +0000 Received: from mail-vc0-f175.google.com ([209.85.220.175]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TunzI-0007SK-HU for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2013 17:38:21 +0000 Received: by mail-vc0-f175.google.com with SMTP id fy7so3747028vcb.20 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=I8+8YU2XG7W/lxirhbbzTm3dYaF3cDV7a9jAL9IIexCHwlKecQlX02nltfi2PeVQyv J7X3GIX8/54NHarZ//+zoLc8iKx8GVFgpJws/5x6GkLas702RgiOMcJ6O87x7hkVkqD5 Th+QA3NM8ckJovDf2crQKF+bIVzSVp8wPN/uzlebC3sTOmA5B+Tr9M8/61K2tb1qLaeN t2CPeed8PkLP359O14LZaI0UWT66XYHk8egyJVuGzoREMeC1id6L64OoL06DXZ+2JA2N 1xtlr6C61im6fcspP2kodBkdhOJmJTM27WtQav0Yf+8xfiPUD2HCxZrTJZP9wiYfQTOh eVxQ== 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 X-Gm-Message-State: ALoCoQn7kyT0zlW6YFIaeQpZyu68IlRzt37ZjVqMwv2TlwUjBWr1yb4WDC4CbAYImuGKnHEL+z41 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130114_123820_774175_8354B69E X-CRM114-Status: GOOD ( 14.30 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.175 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Rusty Russell , Marcelo Tosatti , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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); }