From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754223AbcKUQ57 (ORCPT ); Mon, 21 Nov 2016 11:57:59 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:45272 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbcKUQ55 (ORCPT ); Mon, 21 Nov 2016 11:57:57 -0500 Date: Mon, 21 Nov 2016 08:57:52 -0800 From: Christoph Hellwig To: Arnd Bergmann Cc: Linus Torvalds , Binoy Jayan , linux-rdma@vger.kernel.org, Mustafa Ismail , Lijun Ou , Nicholas Bellinger , Leon Romanovsky , target-devel@vger.kernel.org, Tatyana E Nikolova , Doug Ledford , Jenny Derzhavetz , Sagi Grimberg , Sean Hefty , Faisal Latif , Hal Rosenstock , linux-kernel@vger.kernel.org, "Wei Hu(Xavier)" , Mark Brown , Mark Bloch , Steve Wise , Ira Weiny , Bart Van Assche , Matan Barak , Sagi Grimberg Subject: Re: [PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait Message-ID: <20161121165752.GA12866@infradead.org> References: <1479708496-9828-1-git-send-email-binoy.jayan@linaro.org> <1479708496-9828-3-git-send-email-binoy.jayan@linaro.org> <4374986.OFD8bCgUa1@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4374986.OFD8bCgUa1@wuerfel> User-Agent: Mutt/1.6.1 (2016-04-27) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 21, 2016 at 05:52:27PM +0100, Arnd Bergmann wrote: > I think a mutex would't work here, since fops->open() and fops->close() > are not called from the same context and lockdep will complain > about that. > > Version of the series had replaced the semaphore with a completion > here, which worked correctly, but one reviewer suggested using > the wait_event() instead since it's confusing to have a completion > starting out in 'completed' state. On the other hand the existing semaphore works perfectly fine, and is way easier to understand than any of the other models, which also don't provide any benefit at all. Please stop messing with perfectly fine semaphores now - there are plenty that are much better replaced with mutexes or completions, but this (and various others are not). Leave them alone and do something useful instead.