lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1316005339.6497.0.camel@marge.simson.net>
Date:	Wed, 14 Sep 2011 15:02:19 +0200
From:	Mike Galbraith <efault@....de>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>,
	linux-rt-users <linux-rt-users@...r.kernel.org>,
	Manfred Spraul <manfred@...orfullife.com>
Subject: Re: [PATCH -rt] ipc/sem: Rework semaphore wakeups

All better.

On Wed, 2011-09-14 at 11:57 +0200, Peter Zijlstra wrote:
> Subject: ipc/sem: Rework semaphore wakeups
> From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Date: Tue Sep 13 15:09:40 CEST 2011
> 
> Current sysv sems have a weird ass wakeup scheme that involves keeping
> preemption disabled over a potential O(n^2) loop and busy waiting on
> that on other CPUs.
> 
> Kill this and simply wake the task directly from under the sem_lock.
> 
> This was discovered by a migrate_disable() debug feature that
> disallows:
> 
>   spin_lock();
>   preempt_disable();
>   spin_unlock()
>   preempt_enable();
> 
> Cc: Manfred Spraul <manfred@...orfullife.com>
> Suggested-by: Thomas Gleixner <tglx@...utronix.de>
> Reported-by: Mike Galbraith <efault@....de>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
>  ipc/sem.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> Index: linux-rt/ipc/sem.c
> ===================================================================
> --- linux-rt.orig/ipc/sem.c
> +++ linux-rt/ipc/sem.c
> @@ -415,6 +415,13 @@ static int try_atomic_semop (struct sem_
>  static void wake_up_sem_queue_prepare(struct list_head *pt,
>  				struct sem_queue *q, int error)
>  {
> +#ifdef CONFIG_PREEMPT_RT_BASE
> +	struct task_struct *p = q->sleeper;
> +	get_task_struct(p);
> +	q->status = error;
> +	wake_up_process(p);
> +	put_task_struct(p);
> +#else
>  	if (list_empty(pt)) {
>  		/*
>  		 * Hold preempt off so that we don't get preempted and have the
> @@ -426,6 +433,7 @@ static void wake_up_sem_queue_prepare(st
>  	q->pid = error;
>  
>  	list_add_tail(&q->simple_list, pt);
> +#endif
>  }
>  
>  /**
> @@ -439,6 +447,7 @@ static void wake_up_sem_queue_prepare(st
>   */
>  static void wake_up_sem_queue_do(struct list_head *pt)
>  {
> +#ifndef CONFIG_PREEMPT_RT_BASE
>  	struct sem_queue *q, *t;
>  	int did_something;
>  
> @@ -451,6 +460,7 @@ static void wake_up_sem_queue_do(struct
>  	}
>  	if (did_something)
>  		preempt_enable();
> +#endif
>  }
>  
>  static void unlink_queue(struct sem_array *sma, struct sem_queue *q)
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ