Skip to contentSkip to conversation

Remove uneeded 'else if' when closing event channels.

PATCH In review Tony Breeds 3 participants 5 messages Dec 2, 2005 – Dec 4, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove uneeded 'else if' when closing event channels.

Hi all,
As far as I can see the remote domain cannot change from
underneath us. Which means that the test for that situation is pointless

This patch removes it.

----------------------

xen/common/event_channel.c +0 -5
diff -r f62f9b1732b9 xen/common/event_channel.c
@@ -342,11 +342,6 @@
                 goto again;
             }
         }
-        else if ( d2 != chn1->u.interdomain.remote_dom )
-        {
-            rc = -EINVAL;
-            goto out;
-        }
     
         port2 = chn1->u.interdomain.remote_port;
         BUG_ON(!port_is_valid(d2, port2));

Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2006.linux.org.au/
Jan 23-28 2006 The Australian Linux Technical Conference!

#1 lore raw
Quoted 8 lines · Tony Breeds

Hi all,
As far as I can see the remote domain cannot change from
underneath us. Which means that the test for that situation is pointless

This patch removes it.

It can change, between lines 340 and 341 (where we have no locks held).

-- Keir

#2 lore raw
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Tony Breeds

Hi all,
As far as I can see the remote domain cannot change from
underneath us. Which means that the test for that situation is pointless

Quoted 5 lines
Quoted 3 lines

This patch removes it.

It can change, between lines 340 and 341 (where we have no locks held).

Hmm, you mean same domain makes another hypercall in parallel to close the event channel then rebind it to a different domain?

In which case, close fails with EINVAL?

Confused,
Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman
#3 lore raw
Quoted 4 lines · Rusty Russell
Quoted 1 line

It can change, between lines 340 and 341 (where we have no locks held).

Hmm, you mean same domain makes another hypercall in parallel to close the event channel then rebind it to a different domain?

Yes. That would be very stupid of the guest, but Xen needs to protect itself.

Quoted 1 line

In which case, close fails with EINVAL?

I'm open to suggestions for a better error code.

-- Keir

#4 lore raw
Quoted 8 lines · Keir Fraser
Quoted 5 lines · Rusty Russell
Quoted 2 lines

It can change, between lines 340 and 341 (where we have no locks held).

Hmm, you mean same domain makes another hypercall in parallel to close the event channel then rebind it to a different domain?

Quoted 6 lines

Yes. That would be very stupid of the guest, but Xen needs to protect itself.

Quoted 1 line

In which case, close fails with EINVAL?

I'm open to suggestions for a better error code.

Technically, they've asked it to be closed, so we should close it. However, since they can't tell the difference between this case and the case where we hit it in ECS_FREE, which would also return -EINVAL.

A comment could elucidate, perhaps?

Rusty.

xen/common/event_channel.c +1 -0
diff -r 4d4cb5e472af xen/common/event_channel.c
@@ -344,6 +344,7 @@
         }
         else if ( d2 != chn1->u.interdomain.remote_dom )
         {
+            /* current closed and rebound, between d1 unlock and d2 lock. */
             rc = -EINVAL;
             goto out;
         }
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman