Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3389869ioo; Tue, 24 May 2022 22:32:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWMH+YMMPa/lGYd5uENV/m8MyWPymLuySuWesOhsLCdG24yGmCP4iuowWVT0oYRhHTc1ft X-Received: by 2002:a65:4904:0:b0:3c6:86c7:317b with SMTP id p4-20020a654904000000b003c686c7317bmr26611194pgs.39.1653456758459; Tue, 24 May 2022 22:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653456758; cv=none; d=google.com; s=arc-20160816; b=QedS7wJ1dDX9YfIX3M+2gGCMWij7Rl+CecwYKUckKhp63mbH4BamirM4SscXUrJ+S6 FhQyfv8JPIrfUFaQNKdy17ykg/zKSvBKXW1e1GyzUqYY8QBaM3eo71B9G+oOTi6RbByp kdrHMf3nZ0d9f+t1Dl3di5/3qDzdn2Q9AdcC/xGiE11/qQCoo0LFhRdS7IlXNY/qPVW3 jyMJJUelERwlKlOptu6+G4YJS37S1sgloB00g+ZRsYLW0IJCRrlywOkSkahGxJ3Cdvti L7UnQb2w5c5kqGCLJoRSoCjoVAe+J5fxr2D3Pgwp5sloxZDWU6QgA9ZnSMMhvshN29Hm YgCg== 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:dkim-signature; bh=IldGxKJY6LO3UJ6O+XkKSV+I8U/lySrgG1o7l9jJtsQ=; b=LO/aiG6zMK9asdiN4DIiytU85MGVfj3ApadFqiDeJhW/k/wrsR7kXb/iSgV62iwZJ8 HBQlh5LV5uWIB05ZnW0oBguMQZ2y+vACB5U2T9xWpv7oh64npb2zQL4OqcX3Ob1fVMmE On2ARKqZ6j9K+TFgWlNQ4uQqbRMZ/dOuJqjoKGyJ5X6Ye6i5aRSjrZPNm1EM1JM7dkKF T/5yzxvAB5lvq233zM6Izv7Re/YSRScKvJSKUpk5uHmx2m5BH9oB6/XdE1srTEpovVZ+ l8LgQUxa8M3JyLBAws2yXQsj/5e/V33I4a1ML97WwIv2g1O0vco7KFaziZ4izH20ItLm vVzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3AP1mzK; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a635801000000b003fa387b1989si11692198pgb.369.2022.05.24.22.32.24; Tue, 24 May 2022 22:32:38 -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; dkim=pass header.i=@linaro.org header.s=google header.b=K3AP1mzK; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236366AbiEXL3W (ORCPT + 99 others); Tue, 24 May 2022 07:29:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbiEXL3V (ORCPT ); Tue, 24 May 2022 07:29:21 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6146287A33 for ; Tue, 24 May 2022 04:29:20 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id r71so16125897pgr.0 for ; Tue, 24 May 2022 04:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IldGxKJY6LO3UJ6O+XkKSV+I8U/lySrgG1o7l9jJtsQ=; b=K3AP1mzKBkpP2s1wvEPgKcIXDy+J8uuf3OY/9pZ0vetpdQO3QCTQ9d2xR3ESFGL5Qk 8NbxT4ovJqlKJO3B8XqM0FJpYywxafJPGDDKR11ruaJRCaihuty47AZ9UJfIXHN7W8Z2 bj3v+r8WAwDgaTpEvzxOIOmF/Du+xMo/K2OAwpo4R8pydlYQPicRILJORFTi7sP8Ma4N 2XpY2kP3VX3vorDulh8I+r9kE1nsY7Ce4uThY0R6NgOyR+QgPhnSsSojzQiCOClqFYE8 Ug0uAt3iReyy+5/WtabDKt/HSQXKuZW480T56peAMB69YQLTBLYCAtv6m74kUcVSR+83 l9bg== 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=IldGxKJY6LO3UJ6O+XkKSV+I8U/lySrgG1o7l9jJtsQ=; b=oCRMvZAwqN+9KdHksBHD6TQXiutjBZ/lzVzWhQwlMW/wnwactZR+AwM7Ytz6R4YxcW KNbPXcd0xrkzL1cX7z9QT4F3rc+W0UhHLLftBPVRA9UgmcHc9pUAlodVKwDWPW7I/D3f dlUtGH1+oQoExN4l+xyW4SxKtFk47n4rxHLEH3OR6VrDMv+oaxQd91aswgAWjUP/cHQN 5O02SPfpmMrDk7fgjykq4eIwUXUC3w0VyVirvQ4rSUA9DqHV9d2vpLTCvTbkD55eWAVI 4siS4+LHjm9tk5Xlquw5Z6XodAZW35+HsCUA+iVfmSxEWK9mTbojHqq+sBuVEOpMnWdM p3jg== X-Gm-Message-State: AOAM531bbvkz1ucLeVspmqZX4K0Esl8DEVuxW/dJVBtsgtkxW5q8Egz2 QW2q4tEjsZFcDRbEfCnjOxaV/g== X-Received: by 2002:aa7:960d:0:b0:518:7139:f85c with SMTP id q13-20020aa7960d000000b005187139f85cmr20365589pfg.40.1653391759901; Tue, 24 May 2022 04:29:19 -0700 (PDT) Received: from localhost ([122.162.234.2]) by smtp.gmail.com with ESMTPSA id iz19-20020a170902ef9300b0016214b6318bsm5399367plb.128.2022.05.24.04.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 04:29:19 -0700 (PDT) Date: Tue, 24 May 2022 16:59:17 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Schspa Shi , Linux Kernel Mailing List , Linux PM Subject: Re: [PATCH v3] cpufreq: fix race on cpufreq online Message-ID: <20220524112917.apcvvvblksg7jdu4@vireshk-i7> References: <20220511043515.fn2gz6q3kcpdai5p@vireshk-i7> <20220511122114.wccgyur6g3qs6fps@vireshk-i7> <20220512065623.q4aa6y52pst3zpxu@vireshk-i7> <20220513042705.nbnd6vccuiu6lb7a@vireshk-i7> <20220524111456.hw4qugsvt4bm7reh@vireshk-i7> 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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 24-05-22, 13:22, Rafael J. Wysocki wrote: > 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/ Actually no, this is for the lock in cpufreq_driver_register(). > Well, again, if we are in store(), we are holding a reference to the > policy kobject, so this is not initialization time. This is the commit which made the change. commit 4f750c930822 ("cpufreq: Synchronize the cpufreq store_*() routines with CPU hotplug") -- viresh