Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3803729ioo; Wed, 25 May 2022 08:26:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya1saLDuk2/Ek7ExOXY6Th74hh8gGPW81SGVtj94GE2+9No++nKIaiqrs9Bbih/W1imm9h X-Received: by 2002:a05:6a00:cd2:b0:518:e103:7cee with SMTP id b18-20020a056a000cd200b00518e1037ceemr5830636pfv.67.1653492403064; Wed, 25 May 2022 08:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653492403; cv=none; d=google.com; s=arc-20160816; b=hv/BKDABLoXWTVBHspiYqN7qdiEXZjTP6v1yzcIC82Fas9CNqlCIZCnp9dXxOuvxQg x8CQb3WDKzwHfuD+QZc0rRSpttysPW2gzr0+q/pG+0alv6dT8GfFgmRlf+CyurAnjRj/ DoP7Mp03palldXBGN+3CW3X/RA0Wa+lHj/quDeRvP0umpzZt10/I6YurJGqTrme5F6Bn 2sPD+4+ez7WL6ajR0dvlcMO+DJN7PKqb1tezmkKUbpehR2uKAWC5WlOfkY/1XCS+fnCL O7OgR+1M/pi0tolUDqYcZlulAWODDEIFh1F510cEcmaf9lPba+ooyNzH6aJO1rZkG3qq iF/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=RdTkIZ3cEsqyS10dEEw3qiwYJ3AMdVC2sCz6/B71Tw0=; b=Iuxve/8JQMf5gmkG9NqvfUMdTa4TYsbRlcDzoN+rPGdK769ZwlszfuDzktyg2bhQze eTiIoeyFmb8ClOyZPvJNktltI0U9lfRGay0HhZJbFGh+f0tUenCTgeNL5RBhbgb3FTlX WW+PvG6By1ERyqWOPEZrPorc4jAXWsGuRO5CHK0tgoCQZM44Xfzrvj2t3hgCwWsTnAPF 7QhmkqEkFa4j2dCBjTFEwxcRmBRU0sWkdtIik5CsKH/7/Fg6W+wzd3ogkjaYFTkPGD82 9452CSMMjmp50ojX/BnzSBGZ47yBho7AtdJ7wxzD/ujFsvs72caxT3B4Va+PdZynUKNJ meaQ== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a170902b20100b001623b7bdd65si7136637plr.335.2022.05.25.08.26.15; Wed, 25 May 2022 08:26:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235815AbiEXLXJ (ORCPT + 99 others); Tue, 24 May 2022 07:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235766AbiEXLXD (ORCPT ); Tue, 24 May 2022 07:23:03 -0400 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D2D78938; Tue, 24 May 2022 04:23:02 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id p190so3384985ybg.4; Tue, 24 May 2022 04:23:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RdTkIZ3cEsqyS10dEEw3qiwYJ3AMdVC2sCz6/B71Tw0=; b=mbsbl191nHbeBRIDJPNVwHmnsKKwAtwGjxnGSzhT/9nNy72Gv5Z0g3ELlVbBj/lo+r uQZ0XTFOhgMDCQTTrb3yRP9A2hAl/YmodG/8gcb54sTNwR9mvgepuvJFaHxxhmHLykO5 8Kl2NwNX1BzDhl/YHH797ZOzcoXSlVR+DpZYI+e939GnCeWboNwXtCXT8YcRc7dvQUg2 Hvcukg2x4VBTCCHS6YgQbSWSRw2mG6JUCwzF1ofITSxkwQg7AOkLGPOwFQFPpkTtkFm5 dP2HWk/oqrqetHssQXR4ZqGvKEgtdnV7MnLetTKfCmZSbainjU4xEvkh4sK0TjveHrSm X95w== X-Gm-Message-State: AOAM5339hcKYjdinqu2hy89ugVn3LOF3919vQXbsqwA1Z46ekifvqvP8 JBXqh25VqiSw7IrnTnYV7/lrarfvy5BoXQPC7g5dREQq X-Received: by 2002:a25:6b50:0:b0:64f:4b33:664 with SMTP id o16-20020a256b50000000b0064f4b330664mr23234419ybm.153.1653391381638; Tue, 24 May 2022 04:23:01 -0700 (PDT) MIME-Version: 1.0 References: <20220510035259.5ep52sgahd2a6rie@vireshk-i7> <20220510154236.88753-1-schspa@gmail.com> <20220511043515.fn2gz6q3kcpdai5p@vireshk-i7> <20220511122114.wccgyur6g3qs6fps@vireshk-i7> <20220512065623.q4aa6y52pst3zpxu@vireshk-i7> <20220513042705.nbnd6vccuiu6lb7a@vireshk-i7> <20220524111456.hw4qugsvt4bm7reh@vireshk-i7> In-Reply-To: <20220524111456.hw4qugsvt4bm7reh@vireshk-i7> From: "Rafael J. Wysocki" Date: Tue, 24 May 2022 13:22:50 +0200 Message-ID: Subject: Re: [PATCH v3] cpufreq: fix race on cpufreq online To: Viresh Kumar Cc: "Rafael J. Wysocki" , Schspa Shi , Linux Kernel Mailing List , Linux PM Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 Tue, May 24, 2022 at 1:15 PM Viresh Kumar wrote: > > On 13-05-22, 09:57, Viresh Kumar wrote: > > On 12-05-22, 12:49, Rafael J. Wysocki wrote: > > > > > Moreover, I'm not sure why the locking dance in store() is necessary. > > > > > > > > commit fdd320da84c6 ("cpufreq: Lock CPU online/offline in cpufreq_register_driver()") > > > > > > I get that, but I'm wondering if locking CPU hotplug from store() is > > > needed at all. I mean, if we are in store(), we are holding an active > > > reference to the policy kobject, so the policy cannot go away until we > > > are done anyway. Thus it should be sufficient to use the policy rwsem > > > for synchronization. > > > > I think after the current patchset is applied and we have the inactive > > policy check in store(), we won't required the dance after all. > > I was writing a patch for this and then thought maybe look at mails > around this time, when you sent the patch, and found the reason why we > need the locking dance :) > > https://lore.kernel.org/lkml/20150729091136.GN7557@n2100.arm.linux.org.uk/ > > I will add a comment for this now. Well, again, if we are in store(), we are holding a reference to the policy kobject, so this is not initialization time.