Tony Breeds
2005-Dec-02 05:05 UTC
[Xen-devel] [PATCH] 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. Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> ---------------------- diff -r f62f9b1732b9 xen/common/event_channel.c --- a/xen/common/event_channel.c Thu Dec 1 19:43:04 2005 +++ b/xen/common/event_channel.c Fri Dec 2 15:54:25 2005 @@ -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! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Dec-02 10:17 UTC
[Xen-devel] Re: [PATCH] Remove uneeded ''else if'' when closing event channels.
On 2 Dec 2005, at 05:05, Tony Breeds wrote:> 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. > > Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>It can change, between lines 340 and 341 (where we have no locks held). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Rusty Russell
2005-Dec-02 23:31 UTC
[Xen-devel] Re: [PATCH] Remove uneeded ''else if'' when closing event channels.
On Fri, 2005-12-02 at 10:17 +0000, Keir Fraser wrote:> On 2 Dec 2005, at 05:05, Tony Breeds wrote: > > > 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. > > > > Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> > > 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. -- A bad analogy is like a leaky screwdriver -- Richard Braakman _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Dec-03 09:12 UTC
[Xen-devel] Re: [PATCH] Remove uneeded ''else if'' when closing event channels.
On 2 Dec 2005, at 23:31, Rusty Russell wrote:>> 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.> In which case, close fails with EINVAL?I''m open to suggestions for a better error code. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Rusty Russell
2005-Dec-04 10:13 UTC
[Xen-devel] Re: [PATCH] Remove uneeded ''else if'' when closing event channels.
On Sat, 2005-12-03 at 09:12 +0000, Keir Fraser wrote:> On 2 Dec 2005, at 23:31, Rusty Russell wrote: > > >> 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. > > > 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. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff -r 4d4cb5e472af xen/common/event_channel.c --- a/xen/common/event_channel.c Thu Dec 1 07:26:33 2005 +++ b/xen/common/event_channel.c Sun Dec 4 21:10:17 2005 @@ -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; } -- A bad analogy is like a leaky screwdriver -- Richard Braakman _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel