From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbdFLK0K (ORCPT ); Mon, 12 Jun 2017 06:26:10 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8261 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbdFLK0J (ORCPT ); Mon, 12 Jun 2017 06:26:09 -0400 Subject: Re: [PATCH v5 03/23] scsi: hisi_sas: optimise the usage of hisi_hba.lock To: Arnd Bergmann References: <201706110427.UEjoe6NO%fengguang.wu@intel.com> CC: kbuild test robot , , "Martin K. Petersen" , "James E.J. Bottomley" , , , Linux Kernel Mailing List , Christoph Hellwig , "Xiang Chen" From: John Garry Message-ID: Date: Mon, 12 Jun 2017 11:24:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.181.153] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.593E6C00.00C3,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2f53e4e042e19b574dadd2c20115c15d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/06/2017 10:45, Arnd Bergmann wrote: > On Mon, Jun 12, 2017 at 10:26 AM, John Garry wrote: >> On 10/06/2017 21:44, kbuild test robot wrote: >> >> >> I don't think that reusing flags variable is in error, as there would be no >> nested spinlock at this point within the function. >> >> If it is not recommended or not permitted to reuse flags variable for >> separate spinlocks, then that can be changed - I don't know. > > No, look again: coccinelle is right as the locks are nested in > https://github.com/0day-ci/linux/blob/bf95e9cccde4af4ed2012a6ec44d48b545d5ffed/drivers/scsi/hisi_sas/hisi_sas_main.c#L1208 > > dq->lock is already held and you acquire task->task_state_lock in > line 1208, which overwrites the flags. > > Arnd Hi Arnd, Ah, now I see. The error message mislead me, as I straight away checked hisi_sas_task_prep() which does the same locking and also reuses flags for spinlock_irqsave(), but it's safe here. But, as you pointed out, the problem is in hisi_sas_internal_abort_task_exec(). A thought: it would be useful if coccinelle printed explicitly the function name which has the warning/error. Thanks, John > > . >