public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Binoy Jayan <binoy.jayan@linaro.org>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/8] infiniband: Remove semaphores
Date: Mon, 17 Oct 2016 22:06:16 +0200	[thread overview]
Message-ID: <6244597.a6XMUIxjP0@wuerfel> (raw)
In-Reply-To: <216461f1-3070-c93a-a560-7560a727cb8d@sandisk.com>

On Monday, October 17, 2016 9:57:34 AM CEST Bart Van Assche wrote:
> On 10/17/2016 09:30 AM, Binoy Jayan wrote:
> > These are a set of patches which removes semaphores from infiniband.
> > These are part of a bigger effort to eliminate all semaphores from the
> > linux kernel.
> 
> Hello Binoy,
> 
> Why do you think it would be a good idea to eliminate all semaphores 
> from the Linux kernel? I don't know anyone who doesn't consider 
> semaphores a useful abstraction.

There are a several reasons why the semaphores as defined in the
kernel are bad and we should get rid of them:

- semaphores cannot be analysed using lockdep, since they don't
  always fit in the simpler 'mutex' semantics

- those that are basically mutexes should be converted to mutexes
  for efficiency and consistency anyway

- the semaphores that are not just used as mutexes are typically
  used as completions and should just be converted to completions
  for simplicity

- when running a preempt-rt kernel, semaphores suffer from priority
  inversion problems, while mutexes use use priority inheritance
  as a countermeasure

There are very few remaining semaphores in the kernel and generally
speaking we'd be better off removing them all so no new users
show up in the future. Most of them are trivial to replace with
mutexes or completions. For the ones that are not trivially replaced,
we have to look at each one and decide what to do about them,
there usually is some solution that actually improves the code.

Using an open-coded semaphore as a replacement is probably just
the last resort that we can consider once we are down to the
last handful of users. I haven't looked at drivers/infiniband/
yet for this, but I believe that drivers/acpi/ is a case for
which I see no better alternative (the AML bytecode requires
counting semaphore semantics).

	Arnd

  reply	other threads:[~2016-10-17 20:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 16:30 [PATCH 0/8] infiniband: Remove semaphores Binoy Jayan
2016-10-17 16:30 ` [PATCH 1/8] IB/core: iwpm_nlmsg_request: Replace semaphore with completion Binoy Jayan
2016-10-17 16:30 ` [PATCH 2/8] IB/core: Replace semaphore sm_sem " Binoy Jayan
2016-10-17 16:30 ` [PATCH 3/8] IB/hns: Replace semaphore poll_sem with mutex Binoy Jayan
2016-10-17 16:30 ` [PATCH 4/8] IB/mthca: " Binoy Jayan
2016-10-17 16:30 ` [PATCH 5/8] IB/isert: Replace semaphore sem with completion Binoy Jayan
2016-10-17 16:31 ` [PATCH 6/8] IB/hns: Replace counting semaphore event_sem with wait condition Binoy Jayan
2016-10-17 16:39   ` Christoph Hellwig
2016-10-17 20:29   ` Arnd Bergmann
2016-10-18  5:16     ` Binoy Jayan
2016-10-19 15:15       ` Arnd Bergmann
2016-10-17 16:31 ` [PATCH 7/8] IB/mthca: " Binoy Jayan
2016-10-17 16:39   ` Christoph Hellwig
2016-10-17 20:32     ` Arnd Bergmann
2016-10-17 16:31 ` [PATCH 8/8] IB/mlx5: Replace counting semaphore sem " Binoy Jayan
2016-10-17 16:40   ` Christoph Hellwig
2016-10-17 16:57 ` [PATCH 0/8] infiniband: Remove semaphores Bart Van Assche
2016-10-17 20:06   ` Arnd Bergmann [this message]
2016-10-17 20:28     ` Bart Van Assche
2016-10-17 20:37       ` Arnd Bergmann

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=6244597.a6XMUIxjP0@wuerfel \
    --to=arnd@arndb.de \
    --cc=bart.vanassche@sandisk.com \
    --cc=binoy.jayan@linaro.org \
    --cc=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.com \
    /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