[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190510055053.GA9864@jagdpanzerIV>
Date: Fri, 10 May 2019 14:50:53 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Daniel Vetter <daniel.vetter@...ll.ch>
Cc: Intel Graphics Development <intel-gfx@...ts.freedesktop.org>,
DRI Development <dri-devel@...ts.freedesktop.org>,
Daniel Vetter <daniel.vetter@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will.deacon@....com>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Chris Wilson <chris@...is-wilson.co.uk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/locking/semaphore: use wake_q in up()
On (05/09/19 22:06), Daniel Vetter wrote:
[..]
> +/* Functions for the contended case */
> +
> +struct semaphore_waiter {
> + struct list_head list;
> + struct task_struct *task;
> + bool up;
> +};
> +
> /**
> * up - release the semaphore
> * @sem: the semaphore to release
> @@ -179,24 +187,25 @@ EXPORT_SYMBOL(down_timeout);
> void up(struct semaphore *sem)
> {
> unsigned long flags;
> + struct semaphore_waiter *waiter;
> + DEFINE_WAKE_Q(wake_q);
>
> raw_spin_lock_irqsave(&sem->lock, flags);
> - if (likely(list_empty(&sem->wait_list)))
> + if (likely(list_empty(&sem->wait_list))) {
> sem->count++;
> - else
> - __up(sem);
> + } else {
> + waiter = list_first_entry(&sem->wait_list,
> + struct semaphore_waiter, list);
> + list_del(&waiter->list);
> + waiter->up = true;
> + wake_q_add(&wake_q, waiter->task);
> + }
> raw_spin_unlock_irqrestore(&sem->lock, flags);
So the new code still can printk/WARN under sem->lock in some buggy
cases.
E.g.
wake_q_add()
get_task_struct()
refcount_inc_checked()
WARN_ONCE()
Are we fine with that?
-ss
Powered by blists - more mailing lists