Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933623AbcJTJQj (ORCPT ); Thu, 20 Oct 2016 05:16:39 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:55066 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932739AbcJTJQf (ORCPT ); Thu, 20 Oct 2016 05:16:35 -0400 From: Arnd Bergmann To: Binoy Jayan Cc: Ariel Elior , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bnx2x: Replace semaphore stats_lock with mutex Date: Thu, 20 Oct 2016 11:16:26 +0200 Message-ID: <4099305.ehHuhIimPk@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1476953532-2019-1-git-send-email-binoy.jayan@linaro.org> References: <1476953532-2019-1-git-send-email-binoy.jayan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:xw4izEAqfD4WGZfDm7WApNpy1dtPi+D2Iq1D7RGcMn9LLOaoMzB ZUkSJLAaTrI+iUcNDmsI2laT+DmWZGanqOBKKY9xRVvb1SRGtFGnWI5c0nyy6TT5sJTugi9 ryF7Sa4GhrF4pVwJSNEMQFB5BiTcbc96AIfy+8qZGusi9Ywc96Bt58h0EkwNXcLcnzTo+oZ DEVX8RfpG6M2MXlpF3Zyg== X-UI-Out-Filterresults: notjunk:1;V01:K0:BTqQRU6IooQ=:IL0ioi3eSD5I3hP/O1Q72Y 45h+k0TlUOhrO5KT+oW+E6B6CbXlR8IBeJRWQRzr3/uk6oJ47L10lBFPqk/7GH2BbXJ6q7oBp 851/Bnitz3g7d4aJg2g7umUTwX9Bw8FaA/VyNYDzAX7o3lDaJDn49hddsCmgTT/Q48p/ZKv7H YvAW96uFHz8YCy7Bgv2SOJqisfxyvWb91XoxY/+mY+5zqeWE7c2x56eCaIA6zSN7/cb+J9k2i qhjsh4dHaZvH9Beion9a9Jpt+ZsMLnNWnDvub9xDvoZfNGNAe/eCcGnt2k3oJpsi/tNN1jr4O v0WMQGMV3H5iF+Z9eHO0haWhiCs+WnSVnyVaTLvR7uDwtz3im3sLczE9Kh9ub8kjOnRB+IbOj d/rid9I0YoyBu9pVIX6d1e1WQvpNAfFWlXvF/T1zZ5FPNSIN/6PjXECfWoVVKcA1PqWzPSP3a UPwvzbL+hZ/nEw2VQybvdKkNcaSAGIdrhzsIduVweD2yMSn4y7lgPkxzKUA0peeROf340eylq pgF17Bx4jJklV2Q5FIduPEIBVSMDn+9BdezEuMOsvGRWetlgP4XFiRk7cJVTuq5veW0yVdI+g zNpKSNcV5JLuNj5zpfVuXl6ES7D9pbmQHxd8RvA8AueM4RRpdi5UBtIJ9h2lqPzkNLiSeXph2 i9MMhIEUsKlzcUWBzTOQEVCJfoIcI/HMvS8POfQgKl8ZxpjDtFkoyNxqhTKq0pbTStiwnNQTa qNtkmygarhg9XIIv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1023 Lines: 23 On Thursday, October 20, 2016 2:22:12 PM CEST Binoy Jayan wrote: > @@ -1976,8 +1973,8 @@ int bnx2x_stats_safe_exec(struct bnx2x *bp, > /* Wait for statistics to end [while blocking further requests], > * then run supplied function 'safely'. > */ > - rc = down_timeout(&bp->stats_lock, HZ / 10); > - if (unlikely(rc)) { > + rc = mutex_trylock(&bp->stats_lock); > + if (unlikely(!rc)) { > BNX2X_ERR("Failed to take statistics lock for safe execution\n"); > goto out_no_lock; > } This conversion looks suspicious, your changelog text does not mention at all why would be to remove the timeout and fail immediately. In fact, you don't seem to have any mutex_lock() call left, just mutex_trylock(), and everything that tries to get the mutex fails immediately if someone else holds it. The existing behavior of the driver is not much better (it always gives up after 100ms), but I think this needs some more thought put into it. Arnd