public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/1] futex: futex_wake_op, fix sign_extend32 sign bits
Date: Mon, 11 Dec 2017 14:56:09 -0800	[thread overview]
Message-ID: <20171211225609.GB27831@fury> (raw)
In-Reply-To: <10cccd1f-76a1-13be-1173-670c3fcdf921@suse.cz>

On Mon, Dec 11, 2017 at 08:37:11AM +0100, Jiri Slaby wrote:
> On 12/10/2017, 09:50 PM, Linus Torvalds wrote:
> > On Thu, Nov 30, 2017 at 6:35 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> >> sign_extend32 counts the sign bit parameter from 0, not from 1. So we
> >> have to use "11" for 12th bit, not "12".
> > 
> > This interface is crap. It really doesn't make much sense. I wonder
> > how many people have gotten this wrong, but it's hard to tell.
> 
> I tend to agree, because it really surprised me. So at that time I
> searched for most (all?) uses of the interface, checked them and all of
> them *seem* to be fine.
> 
> > I'm applying this directly to my tree since I didn't see anybody else
> > react to it, but the whole pattern worries me.
> > 
> > Also, clearly nobody actually uses the odder corners of futex ops
> > anyway. Maybe we should deprecate them entirely?
> > 
> > Jiri, did you notice by testing, or what?
> 
> I noticed it by coincidence while fixing the strace build test failures
> -- e78c38f6bdd9 (futex: futex_wake_op, do not fail on invalid op). I
> compiled a bit modified futex_atomic_op_inuser in userspace to test the
> conversion and the added check and it did not work.
> 
> And yes, somebody (tglx?) noted already that this interface is old and
> perhaps unused.

The only use I know of for FUTEX_WAKE_OP is glibc
lll_futex_wake_unlock(). and that is limited to a single operation.

At the very least, we need to add a futex_wake_op test to the
kselftests, something that's been nagging me for a very long time.
There are some 120 different combinations of op and cmp and condition
value.

Assuming this isn't urgent, I've added it to my projects list.

-- 
Darren Hart
VMware Open Source Technology Center

      reply	other threads:[~2017-12-11 22:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 14:35 [PATCH 1/1] futex: futex_wake_op, fix sign_extend32 sign bits Jiri Slaby
2017-12-10 20:50 ` Linus Torvalds
2017-12-11  7:37   ` Jiri Slaby
2017-12-11 22:56     ` Darren Hart [this message]

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=20171211225609.GB27831@fury \
    --to=dvhart@infradead.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox