From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbcLJMio (ORCPT ); Sat, 10 Dec 2016 07:38:44 -0500 Received: from mleia.com ([178.79.152.223]:58441 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753093AbcLJMin (ORCPT ); Sat, 10 Dec 2016 07:38:43 -0500 Subject: Re: [PATCH] driver core: flush async calls before testing driver removal To: Greg Kroah-Hartman References: <20161210001519.24870-1-vz@mleia.com> <20161210073245.GA19610@kroah.com> Cc: Rob Herring , linux-kernel@vger.kernel.org From: Vladimir Zapolskiy Message-ID: <4c1eb9e4-3e49-660a-e3c2-d048d3189a26@mleia.com> Date: Sat, 10 Dec 2016 14:38:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161210073245.GA19610@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20161210_123842_132325_EAB73979 X-CRM114-Status: GOOD ( 12.28 ) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Greg, On 12/10/2016 09:32 AM, Greg Kroah-Hartman wrote: > On Sat, Dec 10, 2016 at 02:15:19AM +0200, Vladimir Zapolskiy wrote: >> If CONFIG_DEBUG_TEST_DRIVER_REMOVE option is enabled a number of false >> positives are reported for ATA controller drivers, because ATA port >> probes are done asynchronously, and the same problem may also touch >> other asynchronously probed drivers. >> >> To reduce the rate of false reports on boot call async_synchronize_full() >> before attempting to remove a driver, the same is done in delete_module() >> syscall for all possible drivers and in __device_release_driver() function >> for asynchronously probed drivers. > > __device_release_driver() already calls this function, why call it > again? > __device_release_driver() is not called on test removal of drivers, if CONFIG_DEBUG_TEST_DRIVER_REMOVE option is enabled. This opens a possibility to races like one I've discovered: https://www.spinics.net/lists/linux-ide/msg53473.html Next, async_synchronize_full() from __device_release_driver() is not called in case of removal of ATA controller drivers, because driver_allows_async_probing(drv) return value is false. -- With best wishes, Vladimir