Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3230627rdh; Thu, 28 Sep 2023 06:28:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0Ns+sDaC68WrvcdiBVTv6dKfQ+wmTdEf+rWgemOR3xu4HLTD1M5/JoahkGOxJkXKT3VQi X-Received: by 2002:a17:902:ea05:b0:1c4:72c9:64fc with SMTP id s5-20020a170902ea0500b001c472c964fcmr1248510plg.22.1695907713874; Thu, 28 Sep 2023 06:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695907713; cv=none; d=google.com; s=arc-20160816; b=hSpf42iR1p+SBBv4jTEwuqpoY+upmZuGxGOMtKGitYpEnpBt+H7P/xWHtim4om18qC QPzdxOr1ZhZpi0I+2QTAd7o15ygLrGOJxT0eYpW4Q4/k7P54N4q/SbF6MrFB3zSO73Pi kQIHB6VUFO3HoINUouV4htSTwI9qZukx5hfQuUwFtyiXmW5MFC+0Ss9rZBkUY/dIymwZ vkwWByK23IpVaMItEXXTg40qr8aUqepfzPnS3LzwrXmZmzdBmN5m/DYgak1HRyrE4Nez awelvlD9+4pdVhiHX363JgSjYHS2531X49OeYTLonwuZLxxhKco9NK6eKS2MfZNyRFWr wgRw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Wocblp/GgL/+IkjGKHPNHCMi4sjoBTFnu35Xe0XHk7I=; fh=iBg7ADss+RL21yWcjEl6gA3f42++xCD3EXhRcX6umLU=; b=i5HnZWaxH7Mm11I5m/XghZOB6BddK7urhzS/g27zS6wgw69dDbfmpgb64WQyLNJWIY skS4E3cf9wJv88SjIE6fhoUjlp0FCcjsdx7u79YJCIExmY7pEQs9siE7qm7yRUFpCSsS P/5ikPHpP1XFOieX+lqvYnsol7+StvN7T5t3d+6I03D+dWQ6rUBOW2r2CtBrAysE9W25 MQb7WDDqqIrmR+LxxWlQRIxM1psF2sUD2yOexGvevtuOLtzGs7MPzhF6XAQyFB3Juc2z a27zjocAk6EdQUsJ12kK27C/lv4plLgHbIZXpqcg0Iihlexye5xpTydjwLnKb4nhH8vp gFNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b18-20020a170903229200b001c62502d9fasi9920964plh.343.2023.09.28.06.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 06:28:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BB5AF825B4B9; Thu, 28 Sep 2023 05:49:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbjI1MtU (ORCPT + 99 others); Thu, 28 Sep 2023 08:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjI1MtT (ORCPT ); Thu, 28 Sep 2023 08:49:19 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C5DE139; Thu, 28 Sep 2023 05:49:17 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5EFDD1FB; Thu, 28 Sep 2023 05:49:55 -0700 (PDT) Received: from [10.34.100.121] (e126645.nice.arm.com [10.34.100.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D5283F5A1; Thu, 28 Sep 2023 05:49:15 -0700 (PDT) Message-ID: <93262faa-7089-f2a2-3df7-058c338adfc6@arm.com> Date: Thu, 28 Sep 2023 14:49:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] cpufreq: Rebuild sched-domains when removing cpufreq driver Content-Language: en-US To: Viresh Kumar , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Shrikanth Hegde , vschneid@redhat.com, "Rafael J. Wysocki" , linux-pm@vger.kernel.org References: <20230918112937.493352-1-pierre.gondois@arm.com> <20230928071810.hkdmuoaasrv4b2oq@vireshk-i7> From: Pierre Gondois In-Reply-To: <20230928071810.hkdmuoaasrv4b2oq@vireshk-i7> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 28 Sep 2023 05:49:31 -0700 (PDT) Hello Viresh, Dietmar, On 9/28/23 09:18, Viresh Kumar wrote: > On 18-09-23, 13:29, Pierre Gondois wrote: >> The Energy Aware Scheduler (EAS) relies on the schedutil governor. >> When moving to/from the schedutil governor, sched domains must be >> rebuilt to allow re-evaluating the enablement conditions of EAS. >> This is done through sched_cpufreq_governor_change(). >> >> Having a cpufreq governor assumes having a cpufreq driver running. >> Inserting/removing a cpufreq driver should trigger a re-evaluation >> of EAS enablement conditions, avoiding to see EAS enabled when >> removing a running cpufreq driver. >> >> Add a sched_cpufreq_governor_change() call in cpufreq driver removal >> path. >> >> Signed-off-by: Pierre Gondois >> --- >> drivers/cpufreq/cpufreq.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c >> index 60ed89000e82..0a4979c34fd1 100644 >> --- a/drivers/cpufreq/cpufreq.c >> +++ b/drivers/cpufreq/cpufreq.c >> @@ -1673,6 +1673,8 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy) >> cpufreq_driver->exit(policy); >> policy->freq_table = NULL; >> } >> + >> + sched_cpufreq_governor_change(policy, policy->governor); > > This is called from many paths. Consider using cpufreq_remove_dev() instead, > before the policy is freed. Another solution would be to call sched_cpufreq_governor_change() from cpufreq_schedutil's init()/exit() callbacks. This would make more sense as EAS/schedutil cpufreq are tightly bound, and it would allow to cover all the possible paths. When tried locally, it seems to cover all scenarios: - insmod/rmmod a cpufreq driver - changing the governor policy - offlining all the CPUs of a pd Dietmar: The function would be static to cpufreq_schedutil, and the name can be changed at the same time to (unless you think of a better name ?): static void sugov_check_eas_state(void); Regards, Pierre