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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26678C433EF for ; Fri, 8 Apr 2022 05:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235019AbiDHF7R (ORCPT ); Fri, 8 Apr 2022 01:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiDHF7O (ORCPT ); Fri, 8 Apr 2022 01:59:14 -0400 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154281E8177 for ; Thu, 7 Apr 2022 22:57:12 -0700 (PDT) Received: by mail-pj1-f45.google.com with SMTP id fu5so7709868pjb.1 for ; Thu, 07 Apr 2022 22:57:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eMm3hlpk7JoRfwolyhktq+6EgRac5qtfF9ueVrGFlP4=; b=iKf5Qh3ua/YV/5XeKZ+3fe9Jt5+A/QHU/JxygeGQkSOHpIIWS1O7W6H/jGnTtiaGGo 04CjnD6E3cZ+3rpNM1LtRA0GHd424sLab7waHw3begvy1PtxRpD9N/6qJ+HYkstgh5tS ypr2keo24qZDABZSf89gH1HH5nx8yZQurkd6iPu4kLvfHgZzE05/DbH9qHh+bPY/LrIq Wl58WPIFWvCiTPwpyCY3ZuSQUJRBenPoKpxRIEXDnXrTVh2o3MvjYoG96NtWP1h6QV9B TnTWKdQRDnLEtPfspwb5unt8mQAcrAehu3Xr7A2ykQXDTXG/Y6WLMX0f7tra2JhWc/EV 2ioQ== X-Gm-Message-State: AOAM532XVNviv8r/0Kcn37bPMAOvl8+26jNLQzVf27E8/8RfNdlJHxrI Abcrlfjy2xr3Z575A7+yNEpFfJeoWcfm7xSE X-Google-Smtp-Source: ABdhPJz7oKZxcs8tbdwy05UCiDpw9eLdIfkQD1w3/fezoCGqvxmLYQWwvqg0BPCQEF0ikBPuCvsT2g== X-Received: by 2002:a17:90a:c504:b0:1bf:6d9f:65a6 with SMTP id k4-20020a17090ac50400b001bf6d9f65a6mr19798066pjt.204.1649397431491; Thu, 07 Apr 2022 22:57:11 -0700 (PDT) Received: from fedora (136-24-99-118.cab.webpass.net. [136.24.99.118]) by smtp.gmail.com with ESMTPSA id g1-20020a633741000000b0039958c06c53sm9319592pgn.61.2022.04.07.22.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 22:57:10 -0700 (PDT) Date: Thu, 7 Apr 2022 22:57:08 -0700 From: Dennis Zhou To: Qi Zheng Cc: Andrew Morton , Muchun Song , tj@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: Re: [PATCH] percpu_ref: call wake_up_all() after percpu_ref_put() completes Message-ID: References: <20220407103335.36885-1-zhengqi.arch@bytedance.com> <20220407205419.f656419a8f4665a2dc781133@linux-foundation.org> <35195a61-d531-aeb2-5565-146e345f8bf6@bytedance.com> <20220407211018.875696691e4411a7b5c8f63f@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2022 at 12:14:54PM +0800, Qi Zheng wrote: > > > On 2022/4/8 12:10 PM, Andrew Morton wrote: > > On Fri, 8 Apr 2022 12:06:20 +0800 Qi Zheng wrote: > > > > > > > > > > > > > > > Signed-off-by: Qi Zheng > > > > > > > > > > > > Are any users affected by this? If so, I think a Fixes tag > > > > > > is necessary. > > > > > > > > > > Looks all current users(blk_pre_runtime_suspend() and set_in_sync()) are > > > > > affected by this. > > > > > > > > > > I see that this patch has been merged into the mm tree, can Andrew help > > > > > me add the following Fixes tag? > > > > > > > > Andrew is helpful ;) > > > > > > > > Do you see reasons why we should backport this into -stable trees? > > > > It's 8 years old, so my uninformed guess is "no"? > > > > > > Hmm, although the commit 490c79a65708 add wake_up_all(), it is no > > > problem for the usage at that time, maybe the correct Fixes tag is the > > > following: > > > > > > Fixes: 210f7cdcf088 ("percpu-refcount: support synchronous switch to > > > atomic mode.") > > > > > > But in fact, there is no problem with it, but all current users expect > > > the refcount is stable after percpu_ref_switch_to_atomic_sync() returns. > > > > > > I have no idea as which Fixes tag to add. > > > > Well the solution to that problem is to add cc:stable and let Greg > > figure it out ;) > > > > The more serious question is "should we backport this". What is the > > end-user-visible impact of the bug? Do our users need the fix or not? > > The impact on the current user is that it is possible to miss an opportunity > to reach 0 due to the case B in the commit message: > Did you find this bug through code inspection or was the finding motivated by a production incident? The usage in block/blk-pm.c looks problematic, but I'm guessing this is a really, really hard bug to trigger. You need to have the wake up be faster than an atomic decrement. The q_usage_counter allows reinit so it skips the __percpu_ref_exit() call. Thanks, Dennis