From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14E39C54E7E for ; Sun, 10 May 2020 06:21:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA1D4208DB for ; Sun, 10 May 2020 06:21:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GsYRtFkS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA1D4208DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1A241900018; Sun, 10 May 2020 02:21:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12BC58E0003; Sun, 10 May 2020 02:21:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3553900018; Sun, 10 May 2020 02:21:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id D43F68E0003 for ; Sun, 10 May 2020 02:21:02 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7C301181AC9CB for ; Sun, 10 May 2020 06:21:02 +0000 (UTC) X-FDA: 76799811564.23.slave52_605a91c562f13 X-HE-Tag: slave52_605a91c562f13 X-Filterd-Recvd-Size: 4425 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sun, 10 May 2020 06:21:02 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A0752082E; Sun, 10 May 2020 06:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589091660; bh=ykU5Chtjjs/h2pWxDILMKNjujFPoh+jfp41AJ916jkU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GsYRtFkS2rH27mGlJmEDwOKT52jC3bQqxZ7jLtVD/igAnz/9nBCUIGfYKHcNcqGnc vmlxkJecvTGwv+zEXIfwYXHaalOEQTI+OhJXsE2eDnxNMF7/Mou/bkudpHECUyMO0m TLqVb8Mynio93dyMpUzgkue+u6aCFLbHxKWIVD9I= Date: Sun, 10 May 2020 08:20:58 +0200 From: Greg KH To: Luis Chamberlain Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org, mhocko@suse.com, yukuai3@huawei.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Omar Sandoval , Hannes Reinecke , Michal Hocko , Christoph Hellwig Subject: Re: [PATCH v4 1/5] block: revert back to synchronous request_queue removal Message-ID: <20200510062058.GA3394360@kroah.com> References: <20200509031058.8239-1-mcgrof@kernel.org> <20200509031058.8239-2-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200509031058.8239-2-mcgrof@kernel.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, May 09, 2020 at 03:10:54AM +0000, Luis Chamberlain wrote: > Commit dc9edc44de6c ("block: Fix a blk_exit_rl() regression") merged on > v4.12 moved the work behind blk_release_queue() into a workqueue after a > splat floated around which indicated some work on blk_release_queue() > could sleep in blk_exit_rl(). This splat would be possible when a driver > called blk_put_queue() or blk_cleanup_queue() (which calls blk_put_queue() > as its final call) from an atomic context. > > blk_put_queue() decrements the refcount for the request_queue kobject, > and upon reaching 0 blk_release_queue() is called. Although blk_exit_rl() > is now removed through commit db6d9952356 ("block: remove request_list code") > on v5.0, we reserve the right to be able to sleep within blk_release_queue() > context. > > The last reference for the request_queue must not be called from atomic > context. *When* the last reference to the request_queue reaches 0 varies, > and so let's take the opportunity to document when that is expected to > happen and also document the context of the related calls as best as possible > so we can avoid future issues, and with the hopes that the synchronous > request_queue removal sticks. > > We revert back to synchronous request_queue removal because asynchronous > removal creates a regression with expected userspace interaction with > several drivers. An example is when removing the loopback driver, one > uses ioctls from userspace to do so, but upon return and if successful, > one expects the device to be removed. Likewise if one races to add another > device the new one may not be added as it is still being removed. This was > expected behavior before and it now fails as the device is still present > and busy still. Moving to asynchronous request_queue removal could have > broken many scripts which relied on the removal to have been completed if > there was no error. Document this expectation as well so that this > doesn't regress userspace again. > > Using asynchronous request_queue removal however has helped us find > other bugs. In the future we can test what could break with this > arrangement by enabling CONFIG_DEBUG_KOBJECT_RELEASE. You are adding documenation and might_sleep() calls all over the place in here, making the "real" change in the patch hard to pick out. How about you split this up into 3 patches, one for documentation, one for might_sleep() and one for the real change? Or maybe just 2 patches, but what you have here seems excessive. thanks, greg k-h