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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 ABDDCC54E8D for ; Mon, 11 May 2020 13:42:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76C8F20746 for ; Mon, 11 May 2020 13:42:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76C8F20746 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 125C7900053; Mon, 11 May 2020 09:42:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FD87900036; Mon, 11 May 2020 09:42:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03B42900053; Mon, 11 May 2020 09:42:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id E1149900036 for ; Mon, 11 May 2020 09:42:01 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 99F8140E1 for ; Mon, 11 May 2020 13:42:01 +0000 (UTC) X-FDA: 76804551642.21.leg85_4bdcb7d318911 X-HE-Tag: leg85_4bdcb7d318911 X-Filterd-Recvd-Size: 5602 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 May 2020 13:42:01 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id f23so3908648pgj.4 for ; Mon, 11 May 2020 06:42:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VIDelSWrVMd4wzslSXY+S/8EPWOMtPyA+78GmbBUxQs=; b=kH8Vgi7w2nY3DwQ1/wrhQlItWRzprtwcXVvNE7P1ofeqqE1p9WHUfqKHsj6rQMHJYj sRr+rJUHsW8a9lYmHZJykPOoiaLWxW0611M0hHVJwmUOIwItR4lw1ACBbsnNKV0E20QR jy3UHNeG8XR1K6J+bO0km6jux9PcQJwYZQGXscuCCXrCNWfcOTKAZOAvJ7TNb1iFLcHy Dy191k7fi5DKMdzyTNuEdiUBBAXFBGT66WBYWpMGiMNbiyEiCp8aKH4NWwE92vghBt0C RUKBYGERfhmUepE0/jK3+Fg79i08NDvXBKPXc/9nHguDBPoN8TqSOg5P1ZpkeNVHG6Fm amDA== X-Gm-Message-State: AGi0PuZJBGC+2xVf1WGEbmsBFrcYUh8zJ8R53l2fFe9R8O7v6GcT97N4 6IoaUh51MZsYnITVF3n1VGo= X-Google-Smtp-Source: APiQypIZPBaiUhTo+Rf4nWN5ZuL6XAd113JqiuXFvjEua9tZjOZI8u/9GM/EHMsS8Y4Ci3SNd/frlg== X-Received: by 2002:a63:c109:: with SMTP id w9mr14561069pgf.114.1589204520151; Mon, 11 May 2020 06:42:00 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id y13sm9305612pfc.78.2020.05.11.06.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 06:41:59 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 7423C40605; Mon, 11 May 2020 13:41:58 +0000 (UTC) Date: Mon, 11 May 2020 13:41:58 +0000 From: Luis Chamberlain To: Greg KH 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: <20200511134158.GM11244@42.do-not-panic.com> References: <20200509031058.8239-1-mcgrof@kernel.org> <20200509031058.8239-2-mcgrof@kernel.org> <20200510062058.GA3394360@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200510062058.GA3394360@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Sun, May 10, 2020 at 08:20:58AM +0200, Greg KH wrote: > 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. Sure. Luis