From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbcFKDe6 (ORCPT ); Fri, 10 Jun 2016 23:34:58 -0400 Received: from mail1.bemta12.messagelabs.com ([216.82.251.13]:37352 "EHLO mail1.bemta12.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbcFKDez convert rfc822-to-8bit (ORCPT ); Fri, 10 Jun 2016 23:34:55 -0400 X-Brightmail-Tracker: H4sIAAAAAAAAA1WSb0gTcRjH99ttt0u8ODdtv8zChoXln1okXJL Ri15cIhUlSUrkaZe72qbsptiL0DL/TzPyX1Np6rQQKbM/mNocmZRaWpYVSkSlkEqzrCyyrLsd mr37Ps/n+32+bx4MUZ5GfTEm3cyYjLReg3rInBERbMhoTlzM5plCDTnmzAVkRdkTQF5prkbJ1 4+1ZFb9NZTMz8+Tk+XX1WTLi1KELOz8CMjaHLuMfNbOu4acNimZPV+tIF0/ihSks5+33GgtQ3 YS1B3rawVV3zkhpVwDAwoqq9wup7pqmvld8QU59cHSLaOmHcMo9aV1DfXw7Ff5Po9YOWtMSE6 Pl+uGKueQlF8+6Vc/dSkywbRXAfDAlEQHgG/m+oA4OAGs+jYuFYcWAJt6ahQFYBmGElr4ovE2 KmhvIhBeHxpBBBNCnMFgzegTN1ARB2FB33MgmmJgZlURv8d4HQ5nezhhLSPWwZfDf4Cwxoko2 NUeLHY1SmGDzeXuAsQK+L2vWSpohFDDkbFLbg0JAto7BxFR+8CJ9/NyUW+GtxocMlFr4IPBWZ mYDYa2jhlU1EGwsXbKncUJL9h7ccztURIBsLdjHi0BK6xL6qxL4tYlceuSuA3ImkAgx5jSGFO IdltogolN0pkNNKsP0Wq3hBoYjqOTGD2dwIUmJhtaAf8aGRIJaAOlpyPvgZWYVOOD12XFxSiX JyQfPamjOd0RU6qe4e4BPwzTQDw2m2deJiaJST/G6vn/WsAQ89R448ECxrkU2sCxSSLqA2t91 fh5ARAC0KUaF2MLnzkEVvuqcCCRSJSeKYzJwJr/55NAjQGNCmeFK56s0bx4fZIvlvLFl+/HCM Vm+h/yzQRhzZYTuAWcoo46M292v53YGrt7B5MY79XkX9R+94Dx+FRQZHX4rudo//rK+mFOkv/ NYml9hNyYZU58js74fW5f0CtH2rh9j5/dXrFdmkL93BsQpnINFNjrnhrmpt4frmrLzXPhJR3v nh2K0hZvsvq09bSol+23++s2qKNXhTY4NDJOR2s3IiaO/gvRpec6lAMAAA== X-Env-Sender: Timothy.Sell@unisys.com X-Msg-Ref: server-10.tower-28.messagelabs.com!1465616090!31248122!2 X-Originating-IP: [192.61.61.105] X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked From: "Sell, Timothy C" To: Thomas Gleixner CC: "corbet@lwn.net" , "mingo@redhat.com" , "hpa@zytor.com" , "gregkh@linuxfoundation.org" , "Arfvidson, Erik" , "hofrat@osadl.org" , "dzickus@redhat.com" , "jes.sorensen@redhat.com" , "Curtin, Alexander Paul" , "janani.rvchndrn@gmail.com" , "sudipm.mukherjee@gmail.com" , "prarit@redhat.com" , "Binder, David Anthony" , "nhorman@redhat.com" , "dan.j.williams@intel.com" , "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" , *S-Par-Maintainer , "Kershner, David A" Subject: RE: [PATCH v4 09/29] staging: unisys: visorinput: remove unnecessary locking Thread-Topic: [PATCH v4 09/29] staging: unisys: visorinput: remove unnecessary locking Thread-Index: AQHRwok2LON6nPObPUeONBAgsdQ+tJ/hjf0ggAIPTzA= Date: Sat, 11 Jun 2016 03:34:49 +0000 Message-ID: <99ea03e4be024f1098c4fa410923af84@US-EXCH13-2.na.uis.unisys.com> References: <1465420463-24982-1-git-send-email-david.kershner@unisys.com> <1465420463-24982-10-git-send-email-david.kershner@unisys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.17.127.195] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > From: Thomas Gleixner [mailto:tglx@linutronix.de] > > > > > > > > I think I asked this before, but I might have missed the answer. > > > > > > > > Why is this a rw_sempahore? It's never taken with down_read and > > looking > > > > at the usage sites it's simply a mutex, right? > > > > > > If the semaphore --> mutex change would have been as simple as it > > sounds, > > > we would have had NO problem including it with the next version (v3) of > > this > > > patchset. But unfortunately, this change uncovered a latent defect, > which > > > necessitated yet another patch. (I know... hard to believe that > something > > > this simple would do that, but it did.) Rather than further complicating > > this > > > patchset, we thought it would be better to address the visorinput issues > > via a > > > separate follow-on patchset. > > > > That makes me curious. What's the issue? Functional is the mutex the > same > > thing as the r/w semaphore when the latter is only taken down_write and > > locked > > and released by the same thread, which is the case as far as I can tell. > > > > The issue: using it uninitialized (). > > A semaphore appears to let you get away with it, but a mutex does NOT. > We had to shuffle some things around to get this right. If you're > interested in a preview, you can find a patch in github at > https://github.com/davidker/unisys/commit/039e6e517b4a17e2d135a9df85 > cc1e24a39c2670. > The second bullet in that commit comment describes the scenario > where we were attempting to access the lock in visorinput_open() > before we had actually initialized it: > > * we canNOT get into visorinput_open() until the device > structure is totally initialized, by delaying the > input_register_device() until the end of device initialization > > I.e., before this patch, we WERE getting into visorinput_open() > during the call to input_register_device() that was done before > device initialization was complete, which was BEFORE we initialized > the semaphore. > > There is a 2nd follow-on patch that actually does the simple > semaphore --> mutex conversion at > https://github.com/davidker/unisys/commit/6f57ed62ae206c23c58ce4a016 > b08e15639ce9af. > > > > Is that acceptable for you? > > > > Please fix it before moving the drivers out of staging. > > Absolutely. We will probably push that patchset (containing the > 2 github patches referenced above) within the next few days, > even if this visorbus patchset hasn't moved. > The 2 patches referenced above (which include the bug fix, and the change from semaphore to mutex) are included as patches #27 and #28 in the patchset just submitted by David Kershner: [PATCH RESEND 00/28] staging: unisys: fix visorbus & visorinput issues raised by tglx Thanks. Tim Sell