From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754151AbcHSEm2 (ORCPT ); Fri, 19 Aug 2016 00:42:28 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:46906 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbcHSEm0 (ORCPT ); Fri, 19 Aug 2016 00:42:26 -0400 Subject: Re: [PATCH] smc91c92_cs : add a spinlock to avoid race condition To: David Miller , andrianov@ispras.ru References: <1471354746-27110-1-git-send-email-andrianov@ispras.ru> <20160818.210734.1003452853595787957.davem@davemloft.net> Cc: mugunthanvnm@ti.com, a@unstable.cc, felipe.balbi@linux.intel.com, fw@strlen.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org From: Vaishali Thakkar Message-ID: <57B68DFC.4070204@oracle.com> Date: Fri, 19 Aug 2016 10:11:32 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20160818.210734.1003452853595787957.davem@davemloft.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 19 August 2016 09:37 AM, David Miller wrote: > From: Pavel Andrianov > Date: Tue, 16 Aug 2016 16:39:06 +0300 > >> smc_reset may be executed in parallel with timer function media_check. >> To avoid data race in smc_set_xcvr a spinlock was added. >> >> Found by Linux Driver Verification project (linuxtesting.org). >> >> Signed-off-by: Pavel Andrianov > > This is not sufficient. > > You have to block basically the entire function, because both > smc_reset and media_check program the bank selection so could > corrupt eachother's register accesses. Hmm, but then there is a use of udelay as well. Would it be still fine to acquire a spinlock on whole function? > -- Vaishali