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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A32DC433F5 for ; Fri, 8 Apr 2022 05:57:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C6046B0071; Fri, 8 Apr 2022 01:57:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84CC46B0072; Fri, 8 Apr 2022 01:57:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C70E6B0074; Fri, 8 Apr 2022 01:57:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 574B96B0071 for ; Fri, 8 Apr 2022 01:57:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1DC2360644 for ; Fri, 8 Apr 2022 05:57:13 +0000 (UTC) X-FDA: 79332653946.09.DD9F295 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf29.hostedemail.com (Postfix) with ESMTP id A100D120003 for ; Fri, 8 Apr 2022 05:57:12 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id bx5so7679905pjb.3 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=ZJPnEu9to/gWoxR1pzxAH8M8FIlV0pF0dO/v3JRhd6j/+o18yCp2mNQ+lB6uvB1rsd 9wp5WzD5pr37CL5BdrWNSc9BM2lGxPDvBoIdg1js3CR8/Yb6OoTIrbZ4juhaKLc1liRp ii7rOWtuls5uZ3jas1HQiRt+Y/+rQVXGwM2cpD6pC30tKOP5pn02zip2isM3/o3DT1sp a/rHzVKCKVl22Eo3a1vwj4ooUc8l9iNcDWEvPvCdX3TAhcPuQ97W9wNVgG8l82Rjidjl fF8gnhY1vgs0ZvJGULsmgd+l1Bd5KDhfcPz5gaczCGl4LJ4Djx8demns4MOzAr6AgEtc hrfw== X-Gm-Message-State: AOAM530f+TGIGw9UKly176VZ+ibHOUEl3DNHhd4B7PWvBHBJPo683Qts vFexsnxujS2xoYmco2KIA8M= 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: X-Stat-Signature: 5i3fdu6shjcnrqc3ec3dh8a6w44kp6rq X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A100D120003 Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of dennisszhou@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=dennisszhou@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-Rspam-User: X-HE-Tag: 1649397432-366896 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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