[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210423113424.19e26b77@jawa>
Date: Fri, 23 Apr 2021 11:34:24 +0200
From: Lukasz Majewski <lukma@...x.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Adhemerval Zanella <adhemerval.zanella@...aro.org>,
Florian Weimer <fweimer@...hat.com>,
Carlos O'Donell <carlos@...hat.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>,
Davidlohr Bueso <dave@...olabs.net>,
Ingo Molnar <mingo@...nel.org>,
Kurt Kanzenbach <kurt@...utronix.de>,
Darren Hart <dvhart@...radead.org>,
Andrei Vagin <avagin@...il.com>
Subject: Re: [patch 5/6] futex: Prepare futex_lock_pi() for runtime clock
selection
Hi Thomas,
> futex_lock_pi() is the only futex operation which cannot select the
> clock for timeouts (CLOCK_MONOTONIC/CLOCK_REALTIME). That's
> inconsistent and there is no particular reason why this cannot be
> supported.
>
> This was overlooked when CLOCK_REALTIME_FLAG was introduced and
> unfortunately not reported when the inconsistency was discovered in
> glibc.
>
> Prepare the function and enforce the CLOCK_REALTIME_FLAG on
> FUTEX_LOCK_PI so that a new FUTEX_LOCK_PI2 can implement it correctly.
>
> Reported-by: Kurt Kanzenbach <kurt@...utronix.de>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> kernel/futex.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -2786,7 +2786,7 @@ static int futex_lock_pi(u32 __user *uad
> if (refill_pi_state_cache())
> return -ENOMEM;
>
> - to = futex_setup_timer(time, &timeout, FLAGS_CLOCKRT, 0);
> + to = futex_setup_timer(time, &timeout, flags, 0);
>
> retry:
> ret = get_futex_key(uaddr, flags & FLAGS_SHARED, &q.key,
> FUTEX_WRITE); @@ -3711,7 +3711,7 @@ long do_futex(u32 __user *uaddr,
> int op,
> if (op & FUTEX_CLOCK_REALTIME) {
> flags |= FLAGS_CLOCKRT;
> - if (cmd != FUTEX_WAIT_BITSET && cmd !=
> FUTEX_WAIT_REQUEUE_PI)
> + if (cmd != FUTEX_WAIT_BITSET && cmd !=
> FUTEX_WAIT_REQUEUE_PI) return -ENOSYS;
What is the exact change for those two lines above? Looks like some
different tab/spaces...
> }
>
> @@ -3743,6 +3743,7 @@ long do_futex(u32 __user *uaddr, int op,
> case FUTEX_WAKE_OP:
> return futex_wake_op(uaddr, flags, uaddr2, val,
> val2, val3); case FUTEX_LOCK_PI:
> + flags |= FLAGS_CLOCKRT;
> return futex_lock_pi(uaddr, flags, timeout, 0);
> case FUTEX_UNLOCK_PI:
> return futex_unlock_pi(uaddr, flags);
>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@...x.de
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists