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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDA5FC56201 for ; Tue, 10 Nov 2020 09:51:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7474120797 for ; Tue, 10 Nov 2020 09:51:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="L6ve+VJ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731629AbgKJJus (ORCPT ); Tue, 10 Nov 2020 04:50:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730986AbgKJJui (ORCPT ); Tue, 10 Nov 2020 04:50:38 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9BDDC0613CF; Tue, 10 Nov 2020 01:50:37 -0800 (PST) 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=h/QuuhQzJIKNEshRV4JObUP9JnXT6hiQc+XRNbc6EKU=; b=L6ve+VJ8MIdpdfcTUjyU7ACwuQ 62AHj6TjM9s5JBvhkB7HNmByOGo957l2xuEsNCNY+w+dyAL4s7VNEQ13Yp03/lhD00l6L4jQXfEnk 927PF5PU+MA+kJwblYmD2gfpoMdUx1wev1cLvnbk0PXg+8Vg60V8LnrFruKmeF5NRZwUtSufnSh+3 SDljBDkqniGl56ai4fJiW1wtaZ1TKa91b9uo53PXgqB4CN2LQO2l9ER5YDTCSUs7hPEpyBh6I+qIX l13DnBOwvyT2o+8641Hq0bzqt8/K7wHo7Hn+KUZgSvm7WTIlmgsjdZGZt5QDqUKW93+A5LeAJS/kf pUH8Eu+Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcQHr-0003KR-32; Tue, 10 Nov 2020 09:50:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D47A0300238; Tue, 10 Nov 2020 10:49:56 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C13DC23268B86; Tue, 10 Nov 2020 10:49:56 +0100 (CET) Date: Tue, 10 Nov 2020 10:49:56 +0100 From: Peter Zijlstra To: Giovanni Gherdovich Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , Len Brown , "Rafael J . Wysocki" , Jon Grimm , Nathan Fontenot , Yazen Ghannam , Thomas Lendacky , Mel Gorman , Pu Wen , Viresh Kumar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Doug Smythies , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH 1/3] x86, sched: Calculate frequency invariance for AMD systems Message-ID: <20201110094956.GZ2594@hirez.programming.kicks-ass.net> References: <20201110083936.31994-1-ggherdovich@suse.cz> <20201110083936.31994-2-ggherdovich@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110083936.31994-2-ggherdovich@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 09:39:34AM +0100, Giovanni Gherdovich wrote: > +#ifdef CONFIG_ACPI > +void init_freq_invariance_cppc(void) > +{ > + init_freq_invariance(false, true); > + > + if (static_branch_likely(&arch_scale_freq_key)) > + on_each_cpu(init_counter_refs, NULL, 0); > +} > +#endif > + > static void disable_freq_invariance_workfn(struct work_struct *work) > { > static_branch_disable(&arch_scale_freq_key); > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c > index 7a99b19bb893..e1969ff876ff 100644 > --- a/drivers/acpi/cppc_acpi.c > +++ b/drivers/acpi/cppc_acpi.c > @@ -39,6 +39,7 @@ > #include > #include > #include > +#include > > #include > > @@ -850,6 +851,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) > goto out_free; > } > > + /* Only needed once, so call on CPU0 */ > + if (pr->id == 0) > + init_freq_invariance_cppc(); > + This seems broken vs lovely things like booting with maxcpus= or physical hotplug where you add logical CPUs. Given the latter hunk limits it to one invocation (is phys_id 0 guaranteed to exist? Can a BIOS monkey screw us over?) only to then call it on all CPUs, shouldn't this be changed to let acpi_cppc_processor_probe() call it for every CPU that comes online?