Re: Patch for Linux Futexes

2014-05-22 Thread Hans Petter Selasky

On 05/22/14 20:23, Chagin Dmitry wrote:

On Thu, May 22, 2014 at 01:06:22PM +0200, Hans Petter Selasky wrote:

Hi,

When using the Linux Skype client under FreeBSD I sometimes see that the
Audio disappears in the one direction. When I check "ps auxw" I see
skype is stuck on a so-called Futex. I looked into the Linux futex code
and see that wakeup_one() is used instead of wakeup(). Maybe others can
test too and verify if replacing wakeup_one() by wakeup() makes any
difference in for Linux applications using Futexes.



generally speaking the patch is not correct as futex_wake() should
wakeup n waiters which is specified by user space. and i think that
futex_wake() is correct.
so we must take a close look at futex_requeue() and FUTEX_WAKE_OP.




Hi,

I still see the issue with Skype, even when running with my small patch :-(

I'll try to profile the threads in Skype while it is running like 
expected and observe any differences when it is not working, when I have 
some more time, using kgdb. I guess td->td_slptick can be used to figure 
out if a thread has been left behind, because Skype creates many threads ...


Thank you for your time!

--HPS

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Patch for Linux Futexes

2014-05-22 Thread Chagin Dmitry
On Thu, May 22, 2014 at 01:06:22PM +0200, Hans Petter Selasky wrote:
> Hi,
> 
> When using the Linux Skype client under FreeBSD I sometimes see that the 
> Audio disappears in the one direction. When I check "ps auxw" I see 
> skype is stuck on a so-called Futex. I looked into the Linux futex code 
> and see that wakeup_one() is used instead of wakeup(). Maybe others can 
> test too and verify if replacing wakeup_one() by wakeup() makes any 
> difference in for Linux applications using Futexes.
> 

generally speaking the patch is not correct as futex_wake() should
wakeup n waiters which is specified by user space. and i think that
futex_wake() is correct.
so we must take a close look at futex_requeue() and FUTEX_WAKE_OP.


> --HPS
> 
> 
> > diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
> > index 9b4c92f..e893bf4 100644
> > --- a/sys/compat/linux/linux_futex.c
> > +++ b/sys/compat/linux/linux_futex.c
> > @@ -498,7 +498,7 @@ futex_wake(struct futex *f, int n, uint32_t bitset)
> > wp->wp_flags |= FUTEX_WP_REMOVED;
> > TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
> > LIN_SDT_PROBE1(futex, futex_wake, wakeup, wp);
> > -   wakeup_one(wp);
> > +   wakeup(wp);
> > if (++count == n)
> > break;
> > }
> > @@ -525,7 +525,7 @@ futex_requeue(struct futex *f, int n, struct futex *f2, 
> > int n2)
> > wp->wp_flags |= FUTEX_WP_REMOVED;
> > TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
> > LIN_SDT_PROBE1(futex, futex_requeue, wakeup, wp);
> > -   wakeup_one(wp);
> > +   wakeup(wp);
> > } else {
> > LIN_SDT_PROBE3(futex, futex_requeue, requeue,
> > f->f_uaddr, wp, f2->f_uaddr);
> 
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

-- 
Have fun!
chd


pgpJnQTecka1X.pgp
Description: PGP signature


Re: Patch for Linux Futexes

2014-05-22 Thread Hans Petter Selasky

On 05/22/14 14:18, Chagin Dmitry wrote:

On Thu, May 22, 2014 at 01:06:22PM +0200, Hans Petter Selasky wrote:

Hi,

When using the Linux Skype client under FreeBSD I sometimes see that the
Audio disappears in the one direction. When I check "ps auxw" I see
skype is stuck on a so-called Futex. I looked into the Linux futex code
and see that wakeup_one() is used instead of wakeup(). Maybe others can
test too and verify if replacing wakeup_one() by wakeup() makes any
difference in for Linux applications using Futexes.



is it fixes the problem for you?


So far looks better, but I still have to test more.

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Patch for Linux Futexes

2014-05-22 Thread Chagin Dmitry
On Thu, May 22, 2014 at 01:06:22PM +0200, Hans Petter Selasky wrote:
> Hi,
> 
> When using the Linux Skype client under FreeBSD I sometimes see that the 
> Audio disappears in the one direction. When I check "ps auxw" I see 
> skype is stuck on a so-called Futex. I looked into the Linux futex code 
> and see that wakeup_one() is used instead of wakeup(). Maybe others can 
> test too and verify if replacing wakeup_one() by wakeup() makes any 
> difference in for Linux applications using Futexes.
> 

is it fixes the problem for you? as the author of it I should to look
back to find the reason of using wakeup_one(). and check this patch on
nptl tests.


> --HPS
> 
> 
> > diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
> > index 9b4c92f..e893bf4 100644
> > --- a/sys/compat/linux/linux_futex.c
> > +++ b/sys/compat/linux/linux_futex.c
> > @@ -498,7 +498,7 @@ futex_wake(struct futex *f, int n, uint32_t bitset)
> > wp->wp_flags |= FUTEX_WP_REMOVED;
> > TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
> > LIN_SDT_PROBE1(futex, futex_wake, wakeup, wp);
> > -   wakeup_one(wp);
> > +   wakeup(wp);
> > if (++count == n)
> > break;
> > }
> > @@ -525,7 +525,7 @@ futex_requeue(struct futex *f, int n, struct futex *f2, 
> > int n2)
> > wp->wp_flags |= FUTEX_WP_REMOVED;
> > TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
> > LIN_SDT_PROBE1(futex, futex_requeue, wakeup, wp);
> > -   wakeup_one(wp);
> > +   wakeup(wp);
> > } else {
> > LIN_SDT_PROBE3(futex, futex_requeue, requeue,
> > f->f_uaddr, wp, f2->f_uaddr);
> 
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

-- 
Have fun!
chd


pgpaP_dny5N5D.pgp
Description: PGP signature


Patch for Linux Futexes

2014-05-22 Thread Hans Petter Selasky

Hi,

When using the Linux Skype client under FreeBSD I sometimes see that the 
Audio disappears in the one direction. When I check "ps auxw" I see 
skype is stuck on a so-called Futex. I looked into the Linux futex code 
and see that wakeup_one() is used instead of wakeup(). Maybe others can 
test too and verify if replacing wakeup_one() by wakeup() makes any 
difference in for Linux applications using Futexes.


--HPS



diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index 9b4c92f..e893bf4 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -498,7 +498,7 @@ futex_wake(struct futex *f, int n, uint32_t bitset)
wp->wp_flags |= FUTEX_WP_REMOVED;
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
LIN_SDT_PROBE1(futex, futex_wake, wakeup, wp);
-   wakeup_one(wp);
+   wakeup(wp);
if (++count == n)
break;
}
@@ -525,7 +525,7 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int 
n2)
wp->wp_flags |= FUTEX_WP_REMOVED;
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
LIN_SDT_PROBE1(futex, futex_requeue, wakeup, wp);
-   wakeup_one(wp);
+   wakeup(wp);
} else {
LIN_SDT_PROBE3(futex, futex_requeue, requeue,
f->f_uaddr, wp, f2->f_uaddr);


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"