Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp40313pxb; Tue, 2 Feb 2021 22:07:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyq2vz2eMFfxll3606rmWhhI+lMRCspmbZaQcPv7ArvWekD/GmVoBf2/xcbsCbXmZHbn2DI X-Received: by 2002:a17:906:8684:: with SMTP id g4mr1654468ejx.186.1612332448121; Tue, 02 Feb 2021 22:07:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612332448; cv=none; d=google.com; s=arc-20160816; b=D7m4DaJPoKoN3YD1IkPVRj5Ed7tQ93eCpiCpw3fwr/HGH7Gp36Fw1claYMc/53dwJW M1Bym1ztAF1xKseehNjjgs1jI16j9OIL9WNO7t7kWiJOIbivRw4wKS2+5KKc3N7jVBXj isHeV9GkfNr0xg6V1aL/TIsmojsW4xI3j6stPb34uII7PfI8ZZFrg0kZONRUnukwZag8 KWq25LuTSW5zlFULFkEanCq2r8MG4kVyzd3yNWLK/rhU5zAwJ9vXzLmrOrqhXuhTDxdF WCzeKv3SAXyxtuj7nCE/V9iLZh5J3bdQ30Wb7ATIJiE4wxcIDTAVwe0NAM43f4ftbXse 7PLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=20vLb8nYoRvjkPixtWI9JyTtznsxFpVmJabeCI3aLrY=; b=nNgoPiUadiue9CFH/FwsA7ByMsQmk461cR3dZY4KrBU8DJ7x9jTltE2Fxpvl5ek66R HDdpvD4qDF60XL6fC5NoQcCLMNcd372tb2hbOuXT4o1jFqgf3JaqNEKDMszOLKtkm3CI VoOkYcLa+ERKxyQ7yAcC6hUSWfmPlADdO462RMiAQF5ysoVoDqeiWF17mcwKIOlqIuiv tjg474GtMM/EHYYqWUwDfavRCuJr/RCq4dkMRuFN11NPELbafSu6Z8mTYv7jYN57hnJS /CS4ADYptas/0DcQX7b+mM2vHN5N9mmWb3qC+sPxRVJPO+DjJNH8J3mYY9lbRJ8Chu7w p3mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zGGMz/uC"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf27si663178ejb.503.2021.02.02.22.07.02; Tue, 02 Feb 2021 22:07:28 -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; dkim=pass header.i=@linaro.org header.s=google header.b="zGGMz/uC"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229969AbhBCGE7 (ORCPT + 99 others); Wed, 3 Feb 2021 01:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbhBCGE6 (ORCPT ); Wed, 3 Feb 2021 01:04:58 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28644C061573 for ; Tue, 2 Feb 2021 22:04:18 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id cl8so2470977pjb.0 for ; Tue, 02 Feb 2021 22:04:18 -0800 (PST) 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:user-agent; bh=20vLb8nYoRvjkPixtWI9JyTtznsxFpVmJabeCI3aLrY=; b=zGGMz/uCsy0DOqmB03VshMAkT5rniOOZV3bCV0tOGZi/hHQ9cjyCqqwzX9DuRBEf4t t8bFIx/1iFpir/3PucbPSQPzBoBje5cXnHmFttoARVScRt6Ifk0qdvFOFirf0DCnyjHT 3xw2XT7YtZ8kkho+WAk1TDgSY4ugVW5QSMheAiTEZCmi5fnS9EU/DHz5lyv1RpVTS9kO RjURqEtHyOvoaAgkcAq1uEhuYUGO99s8tnvqW/7YPYbUXlvVyYBWF7WpLIupc2r8RniM DFv8DAK6Una8oUMAIicu+rNxya7V4tz/08nW5tNd0cgE5ndlinOMP/SDh9q1f/i7Z2Tp +vhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=20vLb8nYoRvjkPixtWI9JyTtznsxFpVmJabeCI3aLrY=; b=FLaTISbKr47nmJoJ8JX2EI/PPHPqguo4KKaxaqL9DVIxUV+ix31HnDBu8hADdufztl cXPcnUzmEDFgXT8us8bCeKWYgcZrPodYbD6lcofn5X/Vj0n0KPVDFdFx6Lrl8iBJWM9V 1MrfqEeK22rQpB7ow5Bss+whUmNEYDDj0SJlCqezk0gEwyyhdVauFKmgHk9E7x8zunS4 iCW8RS2FrYGJYKd8+6HtToEaIVHBLsY3I307wpDCyJ9utnoOjcoHqNyGec7zkCxWW8hx npvcQNTEbNve4zOixfoWCcYxBfcyig8/0jDLUFfvCljWsNdVQRw1v9kr7UoBP7976VzK mSWQ== X-Gm-Message-State: AOAM533vXJTY8Wqxz9bdS5gP4YOc2pcuuRmGBaakyd3Lagbs/jl3hBfX Jxz2I5P2N+cJl29GaIoR8jagmQ== X-Received: by 2002:a17:90b:17c7:: with SMTP id me7mr1583302pjb.205.1612332257550; Tue, 02 Feb 2021 22:04:17 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id f7sm770871pjh.45.2021.02.02.22.04.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2021 22:04:16 -0800 (PST) Date: Wed, 3 Feb 2021 11:34:14 +0530 From: Viresh Kumar To: Giovanni Gherdovich Cc: Borislav Petkov , Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Jon Grimm , Nathan Fontenot , Yazen Ghannam , Thomas Lendacky , Suthikulpanit Suravee , Mel Gorman , Pu Wen , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Michael Larabel , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH v2 1/1] x86,sched: On AMD EPYC set freq_max = max_boost in schedutil invariant formula Message-ID: <20210203060414.hexqlimjol3tdtvq@vireshk-i7> References: <20210122204038.3238-1-ggherdovich@suse.cz> <20210122204038.3238-2-ggherdovich@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210122204038.3238-2-ggherdovich@suse.cz> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am sorry but I wasn't able to get the full picture (not your fault, it is me), but ... On 22-01-21, 21:40, Giovanni Gherdovich wrote: > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index d0a3525ce27f..b96677f6b57e 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -2721,6 +2721,9 @@ int cpufreq_boost_enabled(void) > } > EXPORT_SYMBOL_GPL(cpufreq_boost_enabled); > > +DEFINE_STATIC_KEY_FALSE(cpufreq_amd_max_boost); > +EXPORT_SYMBOL_GPL(cpufreq_amd_max_boost); > + > /********************************************************************* > * REGISTER / UNREGISTER CPUFREQ DRIVER * > *********************************************************************/ > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index 9c8b7437b6cd..341cac76d254 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -40,9 +40,14 @@ enum cpufreq_table_sorting { > CPUFREQ_TABLE_SORTED_DESCENDING > }; > > +DECLARE_STATIC_KEY_FALSE(cpufreq_amd_max_boost); > + > +#define cpufreq_driver_has_max_boost() static_branch_unlikely(&cpufreq_amd_max_boost) > + I am not happy with AMD specific code/changes in common parts.. > struct cpufreq_cpuinfo { > unsigned int max_freq; > unsigned int min_freq; > + unsigned int max_boost; > > /* in 10^(-9) s = nanoseconds */ > unsigned int transition_latency; > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index 6931f0cdeb80..541f3db3f576 100644 > --- a/kernel/sched/cpufreq_schedutil.c > +++ b/kernel/sched/cpufreq_schedutil.c > @@ -159,8 +159,12 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, > unsigned long util, unsigned long max) > { > struct cpufreq_policy *policy = sg_policy->policy; > - unsigned int freq = arch_scale_freq_invariant() ? > - policy->cpuinfo.max_freq : policy->cur; > + unsigned int freq, max_freq; > + > + max_freq = cpufreq_driver_has_max_boost() ? > + policy->cpuinfo.max_boost : policy->cpuinfo.max_freq; Also, can't we update max_freq itself from the cpufreq driver? What troubles will it cost ? > + > + freq = arch_scale_freq_invariant() ? max_freq : policy->cur; > > freq = map_util_freq(util, freq, max); > > -- > 2.26.2 -- viresh