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: 9633765 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 A68CC601E9 for ; Mon, 20 Mar 2017 11:00:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9942027F85 for ; Mon, 20 Mar 2017 11:00:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DF0927FA3; Mon, 20 Mar 2017 11:00:03 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2201A27F85 for ; Mon, 20 Mar 2017 11:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4RR7xIAlebVcQ0KgKPyKFDSRv3wlC+TcGrRiKsFinY4=; b=Q0PisEtBhxJYMwP99SoGAa1vMa hkkP5/7t5uQfRoZ6z7ZLQm+s9ucNQeo0QMwjD49qHELeT+wAzEJStfooXNh5I1S8S/y8xw4spKiLi ny79NlK5MIpOOsbGJ76K8l4jbqsEf/u1rGjqVM5ez9KvQDzpws9cVIWe3CsCk0YEfaVtAc9Q540Kh xdQ/SiMoKJIEKKclebJAQOsPAIhYeTtzYf0O8BfU1TdnhRsbxrQf37tUSn3xXPewKIfZwTeAgKRZ4 PB9YYHkoY2lEvf91YSrP0Y0BY+FhKu7HXFIgp+/Jz5f+2el8SVue0lll6WmWlyQNrAmLb1q/n9T7J BwjcfcaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cpv2a-0007gn-8c; Mon, 20 Mar 2017 10:59:56 +0000 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cpv1Y-00067T-1P for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2017 10:59:00 +0000 Received: by mail-wr0-x230.google.com with SMTP id l37so89628492wrc.1 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=GbGT4B9N8m9wCvzdVLnkhbZNQbu3OMzhRO3d2jbrfQ5FmFH2hYP0T9Y925V5GgVrrO eatCBLyhVWFFkW6xZ+QVuebx6sE/jXbUHLRaDQic9TbgFv3+wUut3AvCaza+LqQf7stU F4X0FBAXjU0S2nN0Ly9TLQK3ObrBET2QrV2yr/c/CnXCzAcouwyoYJZybj+T8nSMANm3 4L9+dGJL/Gasgis1zUztijE8Hx0AqW/TWIbslJJG7tzhn+S1LVT4U7yIjUhJ0NOpePfM x3MevlT1bSGnGtzZqPfMd6lTVbezKhQrim2da4SJd23A+O5NwzeOt8Z+VvE/99bgIZls ZX1Q== X-Gm-Message-State: AFeK/H1GCvqpAInyA/nYYie0GSPKGawuY5EO/ZIULQTutSu40IlBaSHdpTTlPWokiuOWXmIP 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170320_035852_857181_08C1E4E1 X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Andre Przywara , Christoffer Dall , kvm@vger.kernel.org, Eric Auger MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;