Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbdFEBFf (ORCPT ); Sun, 4 Jun 2017 21:05:35 -0400 Received: from m12-14.163.com ([220.181.12.14]:53568 "EHLO m12-14.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbdFEBF3 (ORCPT ); Sun, 4 Jun 2017 21:05:29 -0400 Message-ID: <5934AE51.1040105@163.com> Date: Mon, 05 Jun 2017 09:05:21 +0800 From: Jia-Ju Bai User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 To: Greg KH CC: wporter82@gmail.com, sergio.paracuellos@gmail.com, aquannie@gmail.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss References: <1496288615-29497-1-git-send-email-baijiaju1990@163.com> <20170603085238.GA27539@kroah.com> In-Reply-To: <20170603085238.GA27539@kroah.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: DsCowAA3dWG8rTRZ9DpWJQ--.29410S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtr43Ary3GFWfXF1xXF4UCFg_yoWDtFb_u3 4kt3y7Gw1qqr4DJwsxKwsIgFs5KF4UWFy8Gw45XFy7ArZ8JFZ5tw4Du3saqFyxGa17CFs0 9rnYg34SqF17XjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeLiSPUUUUU== X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiTR3telc69b54kQAAsI Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1191 Lines: 34 On 06/03/2017 04:52 PM, Greg KH wrote: > On Thu, Jun 01, 2017 at 11:43:35AM +0800, Jia-Ju Bai wrote: >> The driver may sleep under a spin lock, and the function call path is: >> rtsx_exclusive_enter_ss (acquire the lock by spin_lock) >> rtsx_enter_ss >> rtsx_power_off_card >> sd_cleanup_work >> sd_stop_seq_mode >> sd_switch_clock >> sd_ddr_tuning >> sd_ddr_pre_tuning_tx >> sd_change_phase >> wait_timeout >> schedule_timeout --> may sleep >> >> To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase. > Nice work, how are you finding these bugs? What tools gives you this > kind of analysis? > > thanks, > > greg k-h Hi, I am very glad to get your praise on my work :) I recently write a static analysis tool for detecting sleep-in-atomic bugs, instead of using existing tools. One reason is that I have encountered these bugs for some times when I writing drivers. I am still improving my tool and detecting other similar bugs in Linux kernel. If you have suggestions or comments on my work, please feel free to contact me :) Thanks, Jia-Ju Bai