Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4223748pxb; Tue, 10 Nov 2020 10:48:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFkVFamCPMdSi922KUuwVV3QOJLy3CrfNIa3snE4J9hMfwQNfEY9XLOkhvem0EpOX50lIR X-Received: by 2002:a05:6402:b6e:: with SMTP id cb14mr791041edb.308.1605034114173; Tue, 10 Nov 2020 10:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605034114; cv=none; d=google.com; s=arc-20160816; b=Rp3le5fp3qJauaInmzYLiLhc3I4+ej2B9gopLQ+T+KeZGqzdJF75cl8b6fE+q3S1rM GAEodMKVA8PP18Yzzvyx1diu4EPnYBeodzHWnh0DA8y8h0puJ/jQ9ouZsdLs5FcccesL h/mHe8+1Pyu7lAJh1VUo0oLPWVIU0efJYorpu1VTMBMkMdvu4DW+G3fQrtz1Gl+neier dwbaZCCfZw1VBEtGWgu7hGv4tJS+WFzxkvA5CvKDAkLToflgCssr/k4IYowCuFa99x7m fJ3SE1pVArC0IEuNFDk5zBtHkLTWypHboiW7aDsEcpp3F+R0sEkYUj4//wdr3u+VEBOI 9k4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=GQRybZhzV6+TC9TRQRr9nnzIsgnnUnVnytzXExHDRAg=; b=L7xyTHNfgf42WtdSaPlzGK/SahYed6mz2KxJCz1R2O8mPZskOQZmouaU2DY38Qi+3u +mtCc2qYdrD/cM+y+lilk60JMlm602HPUzFr3esyWsnXyU2fCWZ0prrAl7266LRQpb6k P36qhtDOgQuKA2bf2FV0QRJqZIUpkS/nEuEDP3pm9xTqhrcj3WDZH1TH3vNcYCTEhvSv SDQGVUX5RUrtW2YSf6qraD6cL6WEzka/oWc4yC184SzznNvhO0dKz0SNQfA08ULJnhW5 oVKfA5NCM3tvoj+0YYzw0FKi0a6D9iWa6Q3iDbmKvZ3DEO8/H40Ryy2tw05cAL8dAJdw qXgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si6519035edj.604.2020.11.10.10.48.09; Tue, 10 Nov 2020 10:48:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731309AbgKJSp2 (ORCPT + 99 others); Tue, 10 Nov 2020 13:45:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:49622 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbgKJSp2 (ORCPT ); Tue, 10 Nov 2020 13:45:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8ABCCABD1; Tue, 10 Nov 2020 18:45:26 +0000 (UTC) Message-ID: <1605033925.14855.15.camel@suse.cz> Subject: Re: [PATCH 1/3] x86, sched: Calculate frequency invariance for AMD systems From: Giovanni Gherdovich To: Peter Zijlstra 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 Date: Tue, 10 Nov 2020 19:45:25 +0100 In-Reply-To: <20201110094956.GZ2594@hirez.programming.kicks-ass.net> References: <20201110083936.31994-1-ggherdovich@suse.cz> <20201110083936.31994-2-ggherdovich@suse.cz> <20201110094956.GZ2594@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-11-10 at 10:49 +0100, Peter Zijlstra wrote: > 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. Right. > > 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? I sent a V2 that basically does that, it just makes sure that "init_freq_invariance(secondary=false)" is called only once (the first CPU that gets there), and init_counter_refs() instead is called by all. Which makes me think, I could make better use of the "secondary" argument to init_freq_invariance() and trim a couple of lines from init_freq_invariance_cppc(). Giovanni