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 0DFC7C433E0 for ; Mon, 8 Jun 2020 10:56:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2A1A20774 for ; Mon, 8 Jun 2020 10:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591613781; bh=/EWyRdXUA9OwrLvn9UXEgLKbsRPwLHEtU6i47D2IKMQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=JUESeMDq/ntw6WlXkqMCLOtNoTj/uH4ZbpvzhSrLtODxUHBeArPP3BjwDabME4keT 9XZYfG08LyaKCYTG1n6bADK+R5tJwKIoAHD6cD30GDeex6/GxNaa6towvcjT6s1sNz nBYpHGuNM3wEiWc3iJltr36q3/xfi+QwWE5skdpY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729367AbgFHK4V (ORCPT ); Mon, 8 Jun 2020 06:56:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:48158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbgFHK4V (ORCPT ); Mon, 8 Jun 2020 06:56:21 -0400 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 2E4492072F; Mon, 8 Jun 2020 10:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591613779; bh=/EWyRdXUA9OwrLvn9UXEgLKbsRPwLHEtU6i47D2IKMQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bMTrN8bool+w6rNX0rdMsMm1JogTp4BUsZhKFsQYwq3BpniubYpewW4O82WWVyN6F fzsj8EHRqApQ24v7Zab7mbamK6C/daMf7TOQWkgwUZ+i/sINzN1qFWqMAuaufhagDN eoVCOqcWnxcmi1loTqYwTrIj0hhCDoTU2Qm7HvGo= Date: Mon, 8 Jun 2020 12:56:17 +0200 From: Greg KH To: Giuliano Procida Cc: stable@vger.kernel.org, Jianchao Wang , Ming Lei , Jens Axboe Subject: Re: [PATCH] blk-mq: sync the update nr_hw_queues with blk_mq_queue_tag_busy_iter Message-ID: <20200608105617.GA295073@kroah.com> References: <20200608094030.87031-1-gprocida@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608094030.87031-1-gprocida@google.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Jun 08, 2020 at 10:40:30AM +0100, Giuliano Procida wrote: > From: Jianchao Wang > > commit f5bbbbe4d63577026f908a809f22f5fd5a90ea1f upstream. > > For blk-mq, part_in_flight/rw will invoke blk_mq_in_flight/rw to > account the inflight requests. It will access the queue_hw_ctx and > nr_hw_queues w/o any protection. When updating nr_hw_queues and > blk_mq_in_flight/rw occur concurrently, panic comes up. > > Before update nr_hw_queues, the q will be frozen. So we could use > q_usage_counter to avoid the race. percpu_ref_is_zero is used here > so that we will not miss any in-flight request. The access to > nr_hw_queues and queue_hw_ctx in blk_mq_queue_tag_busy_iter are > under rcu critical section, __blk_mq_update_nr_hw_queues could use > synchronize_rcu to ensure the zeroed q_usage_counter to be globally > visible. > > Backporting Notes > > This is a re-backport, landing synchronize_rcu in the right place. You sent this twice? And what stable kernel(s) does it go to? thanks, greg k-h