All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	Florian Weimer <fweimer@redhat.com>,
	Carlos O'Donell <carlos@redhat.com>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Ingo Molnar <mingo@kernel.org>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Darren Hart <dvhart@infradead.org>,
	Andrei Vagin <avagin@gmail.com>
Subject: Re: [patch 5/6] futex: Prepare futex_lock_pi() for runtime clock selection
Date: Fri, 23 Apr 2021 11:34:24 +0200	[thread overview]
Message-ID: <20210423113424.19e26b77@jawa> (raw)
In-Reply-To: <20210422194705.338657741@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

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@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.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@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-04-23  9:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 19:44 [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2 Thomas Gleixner
2021-04-22 19:44 ` [patch 1/6] Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op") Thomas Gleixner
2021-05-06 18:14   ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 2/6] futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI Thomas Gleixner
2021-05-06 18:14   ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 3/6] futex: Get rid of the val2 conditional dance Thomas Gleixner
2021-04-23 21:40   ` André Almeida
2021-04-23 22:34     ` Thomas Gleixner
2021-04-23 23:21       ` André Almeida
2021-05-06 18:20   ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 4/6] futex: Make syscall entry points less convoluted Thomas Gleixner
2021-05-06 18:20   ` [tip: locking/urgent] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 5/6] futex: Prepare futex_lock_pi() for runtime clock selection Thomas Gleixner
2021-04-23  9:34   ` Lukasz Majewski [this message]
2021-04-23 10:08     ` Thomas Gleixner
2021-06-23  8:19   ` [tip: locking/core] " tip-bot2 for Thomas Gleixner
2021-04-22 19:44 ` [patch 6/6] futex: Provide FUTEX_LOCK_PI2 to support " Thomas Gleixner
2021-04-23 22:20   ` André Almeida
2021-04-23 22:36     ` Thomas Gleixner
2021-06-23  8:19   ` [tip: locking/core] " tip-bot2 for Thomas Gleixner
2021-05-05 12:59 ` [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2 Peter Zijlstra
2021-05-05 13:51   ` Kurt Kanzenbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423113424.19e26b77@jawa \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=avagin@gmail.com \
    --cc=carlos@redhat.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=fweimer@redhat.com \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.