Skip to content

Commit

Permalink
futex*: remove FUTEX_WAIT_MULTIPLE operation and futex2 patchset
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
xanmod committed Oct 2, 2021
1 parent fe2b40e commit 12aea22
Show file tree
Hide file tree
Showing 29 changed files with 113 additions and 1,845 deletions.
185 changes: 0 additions & 185 deletions Documentation/locking/futex2.rst

This file was deleted.

1 change: 0 additions & 1 deletion Documentation/locking/index.rst
Expand Up @@ -24,7 +24,6 @@ locking
percpu-rw-semaphore
robust-futexes
robust-futex-ABI
futex2

.. only:: subproject and html

Expand Down
3 changes: 0 additions & 3 deletions arch/x86/entry/syscalls/syscall_32.tbl
Expand Up @@ -452,6 +452,3 @@
445 i386 landlock_add_rule sys_landlock_add_rule
446 i386 landlock_restrict_self sys_landlock_restrict_self
447 i386 memfd_secret sys_memfd_secret
448 i386 futex_wait sys_futex_wait compat_sys_futex_wait
449 i386 futex_wake sys_futex_wake
450 i386 futex_waitv sys_futex_waitv compat_sys_futex_waitv
3 changes: 0 additions & 3 deletions arch/x86/entry/syscalls/syscall_64.tbl
Expand Up @@ -369,9 +369,6 @@
445 common landlock_add_rule sys_landlock_add_rule
446 common landlock_restrict_self sys_landlock_restrict_self
447 common memfd_secret sys_memfd_secret
448 common futex_wait sys_futex_wait
449 common futex_wake sys_futex_wake
450 common futex_waitv sys_futex_waitv

#
# Due to a historical design error, certain syscalls are numbered differently
Expand Down
10 changes: 0 additions & 10 deletions include/linux/compat.h
Expand Up @@ -368,12 +368,6 @@ struct compat_robust_list_head {
compat_uptr_t list_op_pending;
};

struct compat_futex_waitv {
compat_uptr_t uaddr;
compat_uint_t val;
compat_uint_t flags;
};

#ifdef CONFIG_COMPAT_OLD_SIGACTION
struct compat_old_sigaction {
compat_uptr_t sa_handler;
Expand Down Expand Up @@ -696,10 +690,6 @@ asmlinkage long
compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
compat_size_t __user *len_ptr);


asmlinkage long compat_sys_futex_waitv(struct compat_futex_waitv *waiters,
compat_uint_t nr_futexes, compat_uint_t flags,
struct __kernel_timespec __user *timo);
/* kernel/itimer.c */
asmlinkage long compat_sys_getitimer(int which,
struct old_itimerval32 __user *it);
Expand Down
104 changes: 0 additions & 104 deletions include/linux/futex.h
Expand Up @@ -50,49 +50,6 @@ union futex_key {
} both;
};

/**
* struct futex_q - The hashed futex queue entry, one per waiting task
* @list: priority-sorted list of tasks waiting on this futex
* @task: the task waiting on the futex
* @lock_ptr: the hash bucket lock
* @key: the key the futex is hashed on
* @pi_state: optional priority inheritance state
* @rt_waiter: rt_waiter storage for use with requeue_pi
* @requeue_pi_key: the requeue_pi target futex key
* @bitset: bitset for the optional bitmasked wakeup
* @uaddr: userspace address of futex
* @uval: expected futex's value
*
* We use this hashed waitqueue, instead of a normal wait_queue_entry_t, so
* we can wake only the relevant ones (hashed queues may be shared).
*
* A futex_q has a woken state, just like tasks have TASK_RUNNING.
* It is considered woken when plist_node_empty(&q->list) || q->lock_ptr == 0.
* The order of wakeup is always to make the first condition true, then
* the second.
*
* PI futexes are typically woken before they are removed from the hash list via
* the rt_mutex code. See unqueue_me_pi().
*/
struct futex_q {
struct plist_node list;

struct task_struct *task;
spinlock_t *lock_ptr;
union futex_key key;
struct futex_pi_state *pi_state;
struct rt_mutex_waiter *rt_waiter;
union futex_key *requeue_pi_key;
u32 bitset;
u32 __user *uaddr;
u32 uval;
} __randomize_layout;

struct futex_vector {
struct futex_waitv w;
struct futex_q q;
};

#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } }

#ifdef CONFIG_FUTEX
Expand Down Expand Up @@ -120,67 +77,6 @@ void futex_exec_release(struct task_struct *tsk);

long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
u32 __user *uaddr2, u32 val2, u32 val3);

int futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset);

int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, ktime_t *abs_time,
u32 bitset);

/*
* Futex flags used to encode options to functions and preserve them across
* restarts.
*/
#ifdef CONFIG_MMU
# define FLAGS_SHARED 0x01
#else
/*
* NOMMU does not have per process address space. Let the compiler optimize
* code away.
*/
# define FLAGS_SHARED 0x00
#endif
#define FLAGS_CLOCKRT 0x02
#define FLAGS_HAS_TIMEOUT 0x04

/*
* Hash buckets are shared by all the futex_keys that hash to the same
* location. Each key may have multiple futex_q structures, one for each task
* waiting on a futex.
*/
struct futex_hash_bucket {
atomic_t waiters;
spinlock_t lock;
struct plist_head chain;
} ____cacheline_aligned_in_smp;

void queue_me(struct futex_q *q, struct futex_hash_bucket *hb);

int unqueue_me(struct futex_q *q);

enum futex_access {
FUTEX_READ,
FUTEX_WRITE
};

int get_futex_key(u32 __user *uaddr, bool fshared, union futex_key *key,
enum futex_access rw);

struct futex_hash_bucket *queue_lock(struct futex_q *q);

struct hrtimer_sleeper *futex_setup_timer(ktime_t *time,
struct hrtimer_sleeper *timeout,
int flags, u64 range_ns);

void queue_unlock(struct futex_hash_bucket *hb);

int get_futex_value_locked(u32 *dest, u32 __user *from);

static const struct futex_q futex_q_init = {
/* list gets initialized in queue_me()*/
.key = FUTEX_KEY_INIT,
.bitset = FUTEX_BITSET_MATCH_ANY
};

#else
static inline void futex_init_task(struct task_struct *tsk) { }
static inline void futex_exit_recursive(struct task_struct *tsk) { }
Expand Down
6 changes: 0 additions & 6 deletions include/linux/syscalls.h
Expand Up @@ -623,12 +623,6 @@ asmlinkage long sys_get_robust_list(int pid,
asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
size_t len);

/* kernel/futex2.c */
asmlinkage long sys_futex_wait(void __user *uaddr, u64 val, unsigned int flags,
struct __kernel_timespec __user *timo);
asmlinkage long sys_futex_wake(void __user *uaddr, unsigned int nr_wake,
unsigned int flags);

/* kernel/hrtimer.c */
asmlinkage long sys_nanosleep(struct __kernel_timespec __user *rqtp,
struct __kernel_timespec __user *rmtp);
Expand Down
9 changes: 1 addition & 8 deletions include/uapi/asm-generic/unistd.h
Expand Up @@ -878,15 +878,8 @@ __SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)
__SYSCALL(__NR_memfd_secret, sys_memfd_secret)
#endif

#define __NR_futex_wait 448
__SC_COMP(__NR_futex_wait, sys_futex_wait, compat_sys_futex_wait)
#define __NR_futex_wake 449
__SYSCALL(__NR_futex_wake, sys_futex_wake)
#define __NR_futex_wait 450
__SC_COMP(__NR_futex_waitv, sys_futex_waitv, compat_sys_futex_waitv)

#undef __NR_syscalls
#define __NR_syscalls 451
#define __NR_syscalls 448

/*
* 32 bit systems traditionally used different
Expand Down

0 comments on commit 12aea22

Please sign in to comment.