Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751974AbdFTRfd (ORCPT ); Tue, 20 Jun 2017 13:35:33 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:39420 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbdFTRfc (ORCPT ); Tue, 20 Jun 2017 13:35:32 -0400 Date: Tue, 20 Jun 2017 13:35:30 -0400 (EDT) Message-Id: <20170620.133530.1607963470682255531.davem@davemloft.net> To: baijiaju1990@163.com Cc: manish.chopra@cavium.com, rahul.verma@cavium.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct From: David Miller In-Reply-To: <1497840533-4894-1-git-send-email-baijiaju1990@163.com> References: <1497840533-4894-1-git-send-email-baijiaju1990@163.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 20 Jun 2017 09:53:48 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1100 Lines: 31 From: Jia-Ju Bai Date: Mon, 19 Jun 2017 10:48:53 +0800 > The driver may sleep under a spin lock, and the function call path is: > netxen_nic_pci_mem_access_direct (acquire the lock by spin_lock) > ioremap --> may sleep > > To fix it, the lock is released before "ioremap", and the lock is > acquired again after this function. > > Signed-off-by: Jia-Ju Bai This style of change you are making is really starting to be a problem. You can't just drop locks like this, especially without explaining why it's ok, and why the mutual exclusion this code was trying to achieve is still going to be OK afterwards. In fact, I see zero analysis of the locking situation here, why it was needed in the first place, and why your change is OK in that context. Any locking change is delicate, and you must put the greatest of care and consideration into it. Just putting "unlock/lock" around the sleeping operation shows a very low level of consideration for the implications of the change you are making. This isn't like making whitespace fixes, sorry...