Skip to contentSkip to conversation

xen/arm: Initialize the domain vgic lock

PATCH Applied Julien Grall 3 participants 7 messages Dec 17, 2014 – Jan 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Initialize the domain vgic lock

The domain vgic lock is used uninitialized.

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

---
 xen/arch/arm/vgic.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/arm/vgic.c +2 -0
index 97061ce..b8bd38b 100644
@@ -90,6 +90,8 @@ int domain_vgic_init(struct domain *d)
         return -ENODEV;
     }
 
+    spin_lock_init(&d->arch.vgic.lock);
+
     d->arch.vgic.shared_irqs =
         xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
     if ( d->arch.vgic.shared_irqs == NULL )
Signature · 1 line
2.1.3
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Julien Grall

The domain vgic lock is used uninitialized.

Quoted 7 lines

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

By your above reasoning there is also no point, is there? That said, I think we should take this since as you say it is harmless and good practice to initialise spinlocks even if not strictly necessary.

Quoted 17 lines
---
 xen/arch/arm/vgic.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/arm/vgic.c +2 -0
index 97061ce..b8bd38b 100644
@@ -90,6 +90,8 @@ int domain_vgic_init(struct domain *d)
         return -ENODEV;
     }
 
+    spin_lock_init(&d->arch.vgic.lock);
+
     d->arch.vgic.shared_irqs =
         xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
     if ( d->arch.vgic.shared_irqs == NULL )
#2 lore raw

Hi Ian,

Quoted 12 lines · Ian Campbell
Quoted 3 lines · Julien Grall

The domain vgic lock is used uninitialized.

Quoted 5 lines

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

Quoted 6 lines
Quoted 2 lines

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

By your above reasoning there is also no point, is there? That said, I think we should take this since as you say it is harmless and good practice to initialise spinlocks even if not strictly necessary.

It's necessary to initialize spinlocks, not all the field of the spinlock is using the value 0 at initialization time.

What I meant if the current usage is fine. But if we want to debug spinlock, it won't work.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw
Quoted 18 lines · Julien Grall

Hi Ian,

Quoted 15 lines · Ian Campbell
Quoted 3 lines · Julien Grall

The domain vgic lock is used uninitialized.

Quoted 7 lines

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

Quoted 6 lines
Quoted 3 lines

By your above reasoning there is also no point, is there? That said, I think we should take this since as you say it is harmless and good practice to initialise spinlocks even if not strictly necessary.

It's necessary to initialize spinlocks, not all the field of the spinlock is using the value 0 at initialization time.

You said "...we only use the field "raw" which is reset to 0...". Was that statement inaccurate?

Quoted 5 lines

What I meant if the current usage is fine. But if we want to debug spinlock, it won't work.

Regards,

#4 lore raw
Quoted 23 lines · Ian Campbell
Quoted 22 lines · Julien Grall

Hi Ian,

Quoted 18 lines · Ian Campbell
Quoted 3 lines · Julien Grall

The domain vgic lock is used uninitialized.

Quoted 7 lines

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

By your above reasoning there is also no point, is there? That said, I think we should take this since as you say it is harmless and good practice to initialise spinlocks even if not strictly necessary.

Quoted 5 lines
Quoted 2 lines

It's necessary to initialize spinlocks, not all the field of the spinlock is using the value 0 at initialization time.

You said "...we only use the field "raw" which is reset to 0...". Was that statement inaccurate?

It's accurate in the current. I should have give more details earlier, sorry.

Regards,

Signature · 1 line
Julien Grall
#5 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Julien Grall

The domain vgic lock is used uninitialized.

Quoted 33 lines
Quoted 8 lines

---
This is a bug fix for Xen 4.5 and Xen 4.4. The vgic lock is used unitialized. Luckily we only use the field "raw" which is reset to 0 during the domain allocation.

There is no harm to apply for Xen 4.5 because it will correctly set the spin_lock structure for a later usage.

By your above reasoning there is also no point, is there? That said, I think we should take this since as you say it is harmless and good practice to initialise spinlocks even if not strictly necessary.

Quoted 17 lines
---
 xen/arch/arm/vgic.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/arm/vgic.c +2 -0
index 97061ce..b8bd38b 100644
@@ -90,6 +90,8 @@ int domain_vgic_init(struct domain *d)
         return -ENODEV;
     }
 
+    spin_lock_init(&d->arch.vgic.lock);
+
     d->arch.vgic.shared_irqs =
         xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
     if ( d->arch.vgic.shared_irqs == NULL )