Skip to contentSkip to conversation

gic-vgic: fix assert condition

PATCH Superseded Andrii Anisov 5 participants 10 messages Jan 24, 2019 – Feb 5, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gic-vgic: fix assert condition

From: Andrii Anisov <[email protected]>

---
 xen/arch/arm/gic-vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/gic-vgic.c +1 -1
index 48922f5..684f2d1 100644
@@ -443,7 +443,7 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq,
     int ret = 0;
 
     /* "desc" is optional when we disconnect an IRQ. */
-    ASSERT(connect && desc);
+    ASSERT(connect || desc);
 
     /* We are taking to rank lock to prevent parallel connections. */
     vgic_lock_rank(v_target, rank, flags);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 14 lines · Andrii Anisov

From: Andrii Anisov <[email protected]>

---
 xen/arch/arm/gic-vgic.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/gic-vgic.c +0 -0
index 48922f5..684f2d1 100644
@@ -443,7 +443,7 @@ int vgic_connect_hw_irq(struct domain *d, struct
 vcpu *v, unsigned int virq,
      int ret = 0;
Quoted 4 lines


     /* "desc" is optional when we disconnect an IRQ. */ -    ASSERT(connect && desc);
+    ASSERT(connect || desc);

I assume it should be ASSERT(!connect || desc);

- Stefan

Quoted 4 lines


     /* We are taking to rank lock to prevent parallel connections. */
     vgic_lock_rank(v_target, rank, flags);

Signature · 22 lines
Amazon Development Center Germany GmbH
c/o Stefan Nuernberger
Am Brauhaus 12
01099 Dresden
Germany

Amtsgericht Charlottenburg - HRB 149173 B - UStID DE 289 237 879
Managing Directors: Ralf Herbrich, Chris Schlaeger



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw
Quoted 8 lines · Stefan
Quoted 7 lines · Andrii Anisov

From: Andrii Anisov <[email protected]>

---
 xen/arch/arm/gic-vgic.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
Quoted 11 lines
xen/arch/arm/gic-vgic.c +0 -0
index 48922f5..684f2d1 100644
@@ -443,7 +443,7 @@ int vgic_connect_hw_irq(struct domain *d, struct
 vcpu *v, unsigned int virq,
      int ret = 0;


     /* "desc" is optional when we disconnect an IRQ. */ -    ASSERT(connect && desc);
+    ASSERT(connect || desc);

I assume it should be ASSERT(!connect || desc);

Drawing the truth table and throwing all my CS text book boolean knowledge at it :-) Yes, Stefan's version matches the comment.

Plus what Julien said about the commit message.

Cheers,
Andre

Quoted 4 lines
Quoted 4 lines


     /* We are taking to rank lock to prevent parallel connections. */
     vgic_lock_rank(v_target, rank, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Nuernberger, Stefan

Hello Stefan,

You are absolutely correct.

Sent from my Android.

чт, 24 січ. 2019, 20:47 Nuernberger, Stefan користувач [email protected] пише:

xen/arch/arm/gic-vgic.c int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq, · line 446

Quoted 2 lines
xen/arch/arm/gic-vgic.c +1 -1
-    ASSERT(connect && desc);
+    ASSERT(connect || desc);

I assume it should be ASSERT(!connect || desc);

- Stefan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Stefan,

I hope you would not mind if I put your Suggested-by for v2?

Quoted 1 line · Andrii Anisov

You are absolutely correct.

Signature · 7 lines
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

Hi Andrii,

Please send an update soon as I would like to get it in 4.12.

Juergen,

I would like to have your release ack on this.

Quoted 11 lines · Andrii Anisov

Stefan,

I hope you would not mind if I put your Suggested-by for v2?

Quoted 1 line · Andrii Anisov

You are absolutely correct.

Signature · 2 lines
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Hello Stefano,

Quoted 1 line · Stefano Stabellini

Please send an update soon as I would like to get it in 4.12.

It is already there [1] [2].

[1] https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg02048.html
[2] https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=863549158129d326b2e5850f722bfda643264f2b

Signature · 7 lines
Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw
Quoted 10 lines · Andrii Anisov

Hello Stefano,

Quoted 1 line · Stefano Stabellini

Please send an update soon as I would like to get it in 4.12.

It is already there [1] [2].

[1] https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg02048.html
[2]
https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=863549158129d326b2e5850f722bfda643264f2b

Ops, I missed it :-) Even better.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
In reply to Andrii Anisov

(sorry for the formatting)

Quoted 2 lines · On Thu, 24 Jan 2019, 18:35 Andrii Anisov, <[email protected]> wrote:

From: Andrii Anisov <[email protected]>

Empty commit message should only happen when the title provide enough information.

In that case, you should explain how you hit the assert so the reviewers can understand the change.

Quoted 9 lines
---
 xen/arch/arm/gic-vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/gic-vgic.c +0 -0
index 48922f5..684f2d1 100644

xen/arch/arm/gic-vgic.c int vgic_connect_hw_irq(struct domain *d, storuct vcpu · line 447

Quoted 6 lines
xen/arch/arm/gic-vgic.c +1 -1
@@ -443,7 +443,7 @@ int vgic_connect_hw_irq(struct domain *d, storuct vcpu
 *v, unsigned int virq,
     int ret = 0;
 
     /* "desc" is optional when we disconnect an IRQ. */
-    ASSERT(connect && desc);
+    ASSERT(connect || desc);

This looks wrong to me. Now you allow desc to be NULL when connecting an IRQ. This does not even match the comment above.

Without a meaningful commit message, this hard to understand the reasoning behind the modification.

Cheers,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Dear Julien,

чт, 24 січ. 2019, 21:27 Julien Grall користувач [email protected] пише:

Quoted 4 lines

(sorry for the formatting)

On Thu, 24 Jan 2019, 18:35 Andrii Anisov, <[email protected]> wrote:

Quoted 9 lines
Quoted 2 lines

From: Andrii Anisov <[email protected]>

Empty commit message should only happen when the title provide enough information.

In that case, you should explain how you hit the assert so the reviewers can understand the change.

It was an extremely rare an totally unusual use-case, which nobody else needs.
I did reboot a guest domain with a device passthroughed to it.

Quoted 14 lines
Quoted 12 lines
---
 xen/arch/arm/gic-vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/gic-vgic.c +0 -0
index 48922f5..684f2d1 100644
@@ -443,7 +443,7 @@ int vgic_connect_hw_irq(struct domain *d, storuct
 vcpu *v, unsigned int virq,
     int ret = 0;
 
Quoted 8 lines

xen/arch/arm/gic-vgic.c int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq, · line 446

Quoted 3 lines
xen/arch/arm/gic-vgic.c +1 -1
     /* "desc" is optional when we disconnect an IRQ. */
-    ASSERT(connect && desc);
+    ASSERT(connect || desc);

This looks wrong to me. Now you allow desc to be NULL when connecting an IRQ.

Yes, sure, the original check is much better: it doesn't allow disconnecting at all.

This does not even match the comment above.

Quoted 1 line

Being upset I mistakingly set another wrong condition. Stefan instead suggested the right one.

Sent from my Android.

Quoted 1 line

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel