From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579FAEE7FF5 for ; Fri, 8 Sep 2023 13:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241005AbjIHNRY (ORCPT ); Fri, 8 Sep 2023 09:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbjIHNRX (ORCPT ); Fri, 8 Sep 2023 09:17:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7467E19B5; Fri, 8 Sep 2023 06:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tYNgQCrpYkOoEOuoU0hVR2Y36XucRBC2ub7wl0zHoG4=; b=fDjhL5KTtkbc8il/az7cU6WOK/ nDskd1sZyNc9XzS5AMX5KVaz+cR/FdanUYOwMyFYLcvdbYpBXbT4EXYmvQ9+xFF30kktgA+5YqbG2 vvlNlIr/SKK+Di/CyOgsqQHo6Gvdqf47shaMDJUxrtabiS4zbrcS/ljljAoIOjnbCOWYB+4b1U6fN LdALdJHKGMDoceqFScUv2Qc3s4dkHNt0cgtlVCvcmX3lZcXsVgZeEjEkqdWXudfd3llx3MfGuh1ig Wyaz827Se7RdSCdjUoMaciH2Fsd31jU8NZO7xi91UHigAFNcv4r7kiRduMePben/a8zl0ObWlW6bV yUmyPnMw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qebM6-000JlF-Lp; Fri, 08 Sep 2023 13:17:02 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 53898300472; Fri, 8 Sep 2023 15:17:02 +0200 (CEST) Date: Fri, 8 Sep 2023 15:17:02 +0200 From: Peter Zijlstra To: Meng Li Cc: "Rafael J . Wysocki" , Huang Rui , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-acpi@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, Nathan Fontenot , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov Subject: Re: [PATCH V5 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. Message-ID: <20230908131702.GF19320@noisy.programming.kicks-ass.net> References: <20230905015116.2268926-1-li.meng@amd.com> <20230905015116.2268926-4-li.meng@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230905015116.2268926-4-li.meng@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 05, 2023 at 09:51:12AM +0800, Meng Li wrote: > +static void amd_pstate_init_prefcore(void) > +{ > + int cpu, ret; > + u64 highest_perf; > + > + if (!prefcore) > + return; > + > + for_each_online_cpu(cpu) { > + ret = amd_pstate_get_highest_perf(cpu, &highest_perf); > + if (ret) > + break; > + > + sched_set_itmt_core_prio(highest_perf, cpu); > + > + /* check if CPPC preferred core feature is enabled*/ > + if (highest_perf == AMD_PSTATE_MAX_CPPC_PERF) { > + hw_prefcore = false; > + prefcore = false; > + return; > + } > + } > + > + /* > + * This code can be run during CPU online under the > + * CPU hotplug locks, so sched_set_amd_prefcore_support() > + * cannot be called from here. Queue up a work item > + * to invoke it. > + */ > + schedule_work(&sched_prefcore_work); > +} > @@ -1506,6 +1593,8 @@ static int __init amd_pstate_init(void) > } > } > > + amd_pstate_init_prefcore(); > + > return ret; > > global_attr_free: I'm confused,... you call amd_pstate_init_prefcore() at device_initcall(). Once per boot. Then it iterates all online CPUs.. But what if you boot with some CPUs offline and bring then online later?