From patchwork Mon Mar 20 10:58:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9633717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B5F2601E9 for ; Mon, 20 Mar 2017 10:59:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BC8F27FA6 for ; Mon, 20 Mar 2017 10:59:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E00127FAC; Mon, 20 Mar 2017 10:59:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9592027F85 for ; Mon, 20 Mar 2017 10:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753934AbdCTK6q (ORCPT ); Mon, 20 Mar 2017 06:58:46 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:35014 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753775AbdCTK6f (ORCPT ); Mon, 20 Mar 2017 06:58:35 -0400 Received: by mail-wr0-f170.google.com with SMTP id g10so89499047wrg.2 for ; Mon, 20 Mar 2017 03:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dlxZtn3wUtJJhMQEKQOZloJZ0M/AgoKAE31rjnQMHFw=; b=Qjlt+q4ySypBoUH0BEAHwKmT7b44Ujn2zS7U/l8d51ag+i+uZfbFua9V+Xw8Q4R2FA E6BnhQaI+e7zcunE3aZLtVsTho59nYrLhNW28EyKS1gEb4AWQLeGxnZ7X0AcR3gVh4us LIg9LWBkF7Kq0534WBlfkZuZmP+2QJBgCrnGc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dlxZtn3wUtJJhMQEKQOZloJZ0M/AgoKAE31rjnQMHFw=; b=fZasQ3wwutv8F8cVDl0p7Vij42Y/f/swIoh4fgGN4PcNKNU6M6vZBfBSccVV29GOaC //8mWQWBDXrXtGVVUGZarkNLbIJ3/qV0NWkQUB1aQcSX76iGRGamA8RlHF4hwT9b92S7 ProCe4glk2cHAYeI0FmdMLFxgk6a0ACGjfh+UGKkboKpqsvftBL7xHDLSE6eP7C1CaPp pDnEybLifPsPJR/FT3ScU9BBKlVONbGH0tUXY2xsrGz97XUP1y0MiHnFrtKrYR1f0zJw FWBoahDv5d6cBCoYZASTMFx65vP9dB1OEnVrj5TejO/VLPl9WYtbvULMR7Pj0uFzCjxP NxxA== X-Gm-Message-State: AFeK/H0zmzxKsuUdQC0mMkiQM6za8p7Vnr4NWnIeJHhCgqmAreEEvsu+tgxS9A87P5VFcHWW X-Received: by 10.223.143.14 with SMTP id p14mr23310476wrb.120.1490007513308; Mon, 20 Mar 2017 03:58:33 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id q1sm10372065wra.65.2017.03.20.03.58.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 03:58:32 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Andre Przywara , Eric Auger , Christoffer Dall Subject: [PATCH 8/9] KVM: arm/arm64: vgic: Don't check vgic_initialized in flush_hwstate Date: Mon, 20 Mar 2017 11:58:17 +0100 Message-Id: <20170320105818.20481-9-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170320105818.20481-1-cdall@linaro.org> References: <20170320105818.20481-1-cdall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now when we do an early init of the static parts of the VGIC data structures, we can do things like checking if the AP lists are empty directly without having to explicitly check if the vgic is initialized and reduce a bit of work in our criticial path. Note: list_empty is a single atomic read (uses READ_ONCE) and can therefore check if a list is empty or not without the need to take the spinlock protecting the list. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- virt/kvm/arm/vgic/vgic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index f5b3c25..093873e 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -653,9 +653,6 @@ void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) /* Flush our emulation state into the GIC hardware before entering the guest. */ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) { - if (unlikely(!vgic_initialized(vcpu->kvm))) - return; - if (list_empty(&vcpu->arch.vgic_cpu.ap_list_head)) return;