Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Juergen Gross
On 15/11/17 22:20, Stefano Stabellini wrote: > On Wed, 15 Nov 2017, Boris Ostrovsky wrote: >> On 11/15/2017 02:09 PM, Stefano Stabellini wrote: >>> On Wed, 15 Nov 2017, Juergen Gross wrote: >>> while(mutex_is_locked(>active.in_mutex.owner) || >>>

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Stefano Stabellini
On Wed, 15 Nov 2017, Boris Ostrovsky wrote: > On 11/15/2017 04:50 PM, Stefano Stabellini wrote: > > > > Sorry, code style issue: one missing space in the comment. I'll send it > > again separately > > > I've already fixed this, no worries. Thank you!!

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Stefano Stabellini
On Wed, 15 Nov 2017, Stefano Stabellini wrote: > On Wed, 15 Nov 2017, Boris Ostrovsky wrote: > > On 11/15/2017 02:09 PM, Stefano Stabellini wrote: > > > On Wed, 15 Nov 2017, Juergen Gross wrote: > > > while(mutex_is_locked(>active.in_mutex.owner) || > > >

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Boris Ostrovsky
On 11/15/2017 04:50 PM, Stefano Stabellini wrote: > > Sorry, code style issue: one missing space in the comment. I'll send it > again separately I've already fixed this, no worries. -boris ___ Xen-devel mailing list Xen-devel@lists.xen.org

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Stefano Stabellini
On Wed, 15 Nov 2017, Boris Ostrovsky wrote: > On 11/15/2017 02:09 PM, Stefano Stabellini wrote: > > On Wed, 15 Nov 2017, Juergen Gross wrote: > > while(mutex_is_locked(>active.in_mutex.owner) || > > mutex_is_locked(>active.out_mutex.owner)) > >

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Boris Ostrovsky
On 11/15/2017 02:50 PM, Boris Ostrovsky wrote: > On 11/15/2017 02:09 PM, Stefano Stabellini wrote: >> >> However, I should note that this is a pretty big hammer we are using: >> the refcount is global, while we only need to wait until it's only us >> _on this specific socket_. > Can you explain

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Boris Ostrovsky
On 11/15/2017 02:09 PM, Stefano Stabellini wrote: > On Wed, 15 Nov 2017, Juergen Gross wrote: > while(mutex_is_locked(>active.in_mutex.owner) || > mutex_is_locked(>active.out_mutex.owner)) > cpu_relax(); > > ? I'm not convinced there

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Stefano Stabellini
On Wed, 15 Nov 2017, Juergen Gross wrote: > >>> while(mutex_is_locked(>active.in_mutex.owner) || > >>> mutex_is_locked(>active.out_mutex.owner)) > >>> cpu_relax(); > >>> > >>> ? > >> I'm not convinced there isn't a race. > >> > >> In pvcalls_front_recvmsg()

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-15 Thread Juergen Gross
On 14/11/17 22:46, Boris Ostrovsky wrote: > On 11/14/2017 04:11 AM, Juergen Gross wrote: >> On 13/11/17 19:33, Stefano Stabellini wrote: >>> On Mon, 13 Nov 2017, Juergen Gross wrote: On 11/11/17 00:57, Stefano Stabellini wrote: > On Tue, 7 Nov 2017, Juergen Gross wrote: >> On 06/11/17

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-14 Thread Boris Ostrovsky
On 11/14/2017 04:11 AM, Juergen Gross wrote: > On 13/11/17 19:33, Stefano Stabellini wrote: >> On Mon, 13 Nov 2017, Juergen Gross wrote: >>> On 11/11/17 00:57, Stefano Stabellini wrote: On Tue, 7 Nov 2017, Juergen Gross wrote: > On 06/11/17 23:17, Stefano Stabellini wrote: >>

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-14 Thread Juergen Gross
On 13/11/17 19:33, Stefano Stabellini wrote: > On Mon, 13 Nov 2017, Juergen Gross wrote: >> On 11/11/17 00:57, Stefano Stabellini wrote: >>> On Tue, 7 Nov 2017, Juergen Gross wrote: On 06/11/17 23:17, Stefano Stabellini wrote: > mutex_trylock() returns 1 if you take the lock and 0 if not.

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-13 Thread Stefano Stabellini
On Mon, 13 Nov 2017, Juergen Gross wrote: > On 11/11/17 00:57, Stefano Stabellini wrote: > > On Tue, 7 Nov 2017, Juergen Gross wrote: > >> On 06/11/17 23:17, Stefano Stabellini wrote: > >>> mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > >>> take in_mutex on the first

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-13 Thread Stefano Stabellini
On Fri, 10 Nov 2017, Boris Ostrovsky wrote: > On 11/10/2017 06:57 PM, Stefano Stabellini wrote: > > On Tue, 7 Nov 2017, Juergen Gross wrote: > > > On 06/11/17 23:17, Stefano Stabellini wrote: > > > > mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > > > > take in_mutex on

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-13 Thread Juergen Gross
On 11/11/17 00:57, Stefano Stabellini wrote: > On Tue, 7 Nov 2017, Juergen Gross wrote: >> On 06/11/17 23:17, Stefano Stabellini wrote: >>> mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you >>> take in_mutex on the first try, but you can't take out_mutex. Next times >>> you

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-10 Thread Boris Ostrovsky
On 11/10/2017 06:57 PM, Stefano Stabellini wrote: On Tue, 7 Nov 2017, Juergen Gross wrote: On 06/11/17 23:17, Stefano Stabellini wrote: mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you take in_mutex on the first try, but you can't take out_mutex. Next times you call

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-10 Thread Stefano Stabellini
On Tue, 7 Nov 2017, Juergen Gross wrote: > On 06/11/17 23:17, Stefano Stabellini wrote: > > mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > > take in_mutex on the first try, but you can't take out_mutex. Next times > > you call mutex_trylock() in_mutex is going to fail.

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-06 Thread Juergen Gross
On 06/11/17 23:17, Stefano Stabellini wrote: > mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > take in_mutex on the first try, but you can't take out_mutex. Next times > you call mutex_trylock() in_mutex is going to fail. It's an endless > loop. > > Solve the problem by

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-06 Thread Stefano Stabellini
On Mon, 6 Nov 2017, Boris Ostrovsky wrote: > On 11/06/2017 05:17 PM, Stefano Stabellini wrote: > > mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > > take in_mutex on the first try, but you can't take out_mutex. Next times > > you call mutex_trylock() in_mutex is going to

Re: [Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-06 Thread Boris Ostrovsky
On 11/06/2017 05:17 PM, Stefano Stabellini wrote: > mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you > take in_mutex on the first try, but you can't take out_mutex. Next times > you call mutex_trylock() in_mutex is going to fail. It's an endless > loop. > > Solve the problem

[Xen-devel] [PATCH] xen/pvcalls: fix potential endless loop in pvcalls-front.c

2017-11-06 Thread Stefano Stabellini
mutex_trylock() returns 1 if you take the lock and 0 if not. Assume you take in_mutex on the first try, but you can't take out_mutex. Next times you call mutex_trylock() in_mutex is going to fail. It's an endless loop. Solve the problem by moving the two mutex_trylock calls to two separate loops.