diff mbox

[8/9] KVM: arm/arm64: vgic: Don't check vgic_initialized in flush_hwstate

Message ID 20170320105818.20481-9-cdall@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Christoffer Dall March 20, 2017, 10:58 a.m. UTC
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 <cdall@linaro.org>
---
 virt/kvm/arm/vgic/vgic.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Marc Zyngier March 21, 2017, 12:08 p.m. UTC | #1
On 20/03/17 10:58, Christoffer Dall wrote:
> 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.

                                  critical

> 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.

This note might be better placed in patch #2.

> 
> Signed-off-by: Christoffer Dall <cdall@linaro.org>

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
Christoffer Dall March 21, 2017, 12:30 p.m. UTC | #2
On Tue, Mar 21, 2017 at 12:08:15PM +0000, Marc Zyngier wrote:
> On 20/03/17 10:58, Christoffer Dall wrote:
> > 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.
> 
>                                   critical
> 
> > 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.
> 
> This note might be better placed in patch #2.

Agreed.

> 
> > 
> > Signed-off-by: Christoffer Dall <cdall@linaro.org>
> 
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> 

Thanks,
-Christoffer
diff mbox

Patch

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;