Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp25613pxw; Thu, 7 Apr 2022 23:26:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/sDPQ7kzLuF+/fw9QPcWgLtG/s8qBYcZVDec+DxlGSCEEMs+bE6q3MGAbV7tT/ler4SyK X-Received: by 2002:a63:ec52:0:b0:39c:b5f3:7b25 with SMTP id r18-20020a63ec52000000b0039cb5f37b25mr8277655pgj.224.1649399193435; Thu, 07 Apr 2022 23:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649399193; cv=none; d=google.com; s=arc-20160816; b=UZfjA9Y1RktXzEXPixGhms5+jOTrg/t9tYAT5VqUm1jewIM5GqV8mKLAT8osRCDNyq rdmGJ69soULYEgxLWZrKp10EsXoO4Nl5/Vnp661HglOW3yc3v4Evg1fY5P9KXyLxsRit 0zcvYifOx8njco3ci0HKvBRwV49eEQEtaVktJiBGecPcan6xhwm6lBCniZGVK0ZCWadI NnnoHXYtWk/2r19sADtp3khzbzhdW/WLFe9owqRly3rZo065xxDHxuzZsbF2QM+jxuGC JXLwXodu4ZH63a/SKxucDA0jjz5oDn5zPJ012lUBSBHENYjOfljmkZ2WJxNPXnr9mRs7 LalQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=eMm3hlpk7JoRfwolyhktq+6EgRac5qtfF9ueVrGFlP4=; b=b7Vf3rYgk4rZOcV6kQwqt5MUrNKYxESwbedQW6iySGkZRTMbs9oDF8D0c8m18yJv/2 m46Yjdq+pfyLCi+f/f1afjQ8ZNGnpcbft7hjSG+E14MsZV3khx5ZUS5BGdtye1CvSLHa 5ZNRG8VXnqNaWeOjyGB42BPso84qDjeeI0EyQvp841UTpNeVcagJ1i11JqUTlnN06XL3 mhDX0KvRoN7vA0J2RjX7oobDTNBzdHnHbgslfrc/AcIlpifsjxgDwiihr48AMztKMsxg QGmgmKHKpMQsLdlGGYH3OFNts5qApra5RSgzbyPEiL/dXeAH+bcv/1NAv/YDnnT4nGgl kCCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 12-20020a630d4c000000b003990dea29dcsi446998pgn.564.2022.04.07.23.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 23:26:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4A2524FF96; Thu, 7 Apr 2022 22:57:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235006AbiDHF7Q (ORCPT + 99 others); Fri, 8 Apr 2022 01:59:16 -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-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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