Received: by 2002:a05:6a10:3150:0:0:0:0 with SMTP id m16csp751786pxc; Thu, 7 Apr 2022 21:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBHNx5juD3P/+XwEZubGz/Bza8hmuLEZ0rGaUrSTuUyVTBAiPSdjLtVa3BUXwDyTxfJNOs X-Received: by 2002:a63:7d4a:0:b0:398:dad:6963 with SMTP id m10-20020a637d4a000000b003980dad6963mr13800085pgn.329.1649393456156; Thu, 07 Apr 2022 21:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649393456; cv=none; d=google.com; s=arc-20160816; b=kpo/U/PyHb64EOwsc3qqAEVz+33da+TMxKHIDWkXu+W9lSYbzeOTZ/Qz3/uBbEAfWf QZMzqPyUdMm4/c9E6NUck1QCA1wceN2SjjBTrtBmEs961R8at7h0HmwSG3LcS27yqmGP b0KHO7CO2Nen8JkkZCH2vZBF8M0K14mtTVeEoK4Xh9p0TIRMPLsJftodYNcMLqNPfIjD ECIKoxUkFXpdso/1Teb1uDW6FDFgU6MCihNAi5FRp7OUivy7q5wfTD7udLIZm2HvFWcp 3Kfg+qVpWilnKkDzvDe/ennNMwRmWoqveFXELcSurot+7tYOPLZ1xn6sqKl84WzzQMx1 m1tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=ahIvTqLjbXRzNKd9L9AZ6yqiUOeFsB+LyTwpIETN3bw=; b=wxclUPbz77XJqgc50lV4HDepv4AgSllKBsGfcp4D5GdloTFn4dI8iLFPaWP4OMhwOh UmEyfofi52WCW9qqGm8XSBoUEgE+1P14brn3TMwA1bRXp3DmZBMrk7j9hujIecpOE2Sw SULjbgSYmn+WDX74yZaE8b0DaFLcwWqYTLj2qT0sRPRqDCU6HLE0p7Ci3syNRrdn0ljG midI7orTApf1x3sQ39FW/a+kae2l1lTeY8bhBozfGXAlYaHapLyOSECOmwJJIUsDyjPx 7HQgQGYvQlmR21tS/UID0QVOAFdF74JpU+Dm039yGBl4cSZgFOJZn4jGvvm+0padTBOJ +OQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ydNJB3c7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q2-20020a056a00150200b004fa3a8e0018si81194pfu.207.2022.04.07.21.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 21:50:56 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ydNJB3c7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71DAE2E4F36; Thu, 7 Apr 2022 21:17:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234310AbiDHES7 (ORCPT + 99 others); Fri, 8 Apr 2022 00:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234167AbiDHES5 (ORCPT ); Fri, 8 Apr 2022 00:18:57 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2517C2190 for ; Thu, 7 Apr 2022 21:16:55 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id a42so824060pfx.7 for ; Thu, 07 Apr 2022 21:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=ahIvTqLjbXRzNKd9L9AZ6yqiUOeFsB+LyTwpIETN3bw=; b=ydNJB3c7gF/8QAKJJITL+Pw+A+Gzh3b8MGAy4GcKtMXy+rimoOfva+sGxfzfS9vCWj mNik6sB/prq6r8a+UJ4xypTN6Po558fMa6L7vHtqC4CAgPqCb68elKST/vkCO6JhmyQ2 5UsLTcF0cjGcxCST4DGimacF0cINev1hdGGeElChQDN3RR9bCoCjqFWhAXpX+Po43xKv a6kr1sZ0B70ECX8U14brDt5jRJzIgCewMp6RwNg0YcIp/YsLaITnkwKCiFE6rTCEwpYc YhXXxdzG77PQptmFcjK2lcJDpflxgU0FWZsmeo1mEnPyzOufDrWmfwc4F439OQVuNhee KObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=ahIvTqLjbXRzNKd9L9AZ6yqiUOeFsB+LyTwpIETN3bw=; b=artfKhP3smi9bNYNaEo4MqeMfBSzSc/5jrI/1QygDNcoZDDWSqnEmrEsDThBQGHEbo NlKktWapH5+5gLg8M/lSQ/W+r+YYoEzR+FlYFAsCqTSE6zcoCyxKSY93BPlhOC7cm8X3 g0vKLq89Oa7f6Bzkfebb0RyfRSQMd0QZvoSb81KmwM7KPNnL6fvvsacadHTiJ5Jdc8+F vO3P6ZmSCEZuw3kjCkeYHXAaFdrCYR7a2f8fSo99XCNY1vA1+Mo4k0f876B9GsbxDjcJ wvGPef8/vdt/H3JAw2gUthIa/2h3e1+kmhljyuwJMq/v5bLb58BLis5q/fIa3hjHOdMk Inpw== X-Gm-Message-State: AOAM532IjyO1wU9nhMF/gzEeDF6Iz1mBmOL0CLfKlW3D/bS6hXtHVztk Cu/2vXLcdqemaE8Pg+2oXd+OSg== X-Received: by 2002:a63:af47:0:b0:398:4be1:ce1d with SMTP id s7-20020a63af47000000b003984be1ce1dmr14021742pgo.514.1649391414251; Thu, 07 Apr 2022 21:16:54 -0700 (PDT) Received: from [10.255.182.146] ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id v24-20020a634818000000b0036407db4728sm20072849pga.26.2022.04.07.21.16.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Apr 2022 21:16:53 -0700 (PDT) Message-ID: <60c4b8a3-e526-d51e-c880-cd14ce23d718@bytedance.com> Date: Fri, 8 Apr 2022 12:16:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] percpu_ref: call wake_up_all() after percpu_ref_put() completes Content-Language: en-US From: Qi Zheng To: Andrew Morton Cc: Muchun Song , dennis@kernel.org, tj@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 2022/4/8 12:14 PM, 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: There may be performance issues, but should not cause serious bugs. > > /* The value of &ref is unstable! */ > percpu_ref_is_zero(&ref) >                         (B)percpu_ref_put(ref); > > Thanks, > Qi > >> > -- Thanks, Qi