Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4926744ybl; Wed, 22 Jan 2020 07:12:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyCu7wuTKsYI0Uq4QgMDBbB6Ttc7FNsUdxc30WYYgNevUmIBVyhCI62a5bjD/nzArRUNVYK X-Received: by 2002:a9d:6b89:: with SMTP id b9mr7474915otq.298.1579705922763; Wed, 22 Jan 2020 07:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579705922; cv=none; d=google.com; s=arc-20160816; b=ac0rW/YNotZB1mG6JP7scJYAT/Bn+lf5nBikLUT88jS9s2G2SdfzozPa/fLuhd+B19 kK0H1KQnv5NS91+APoal4BDQKtmPznSBVbBaNwg5Wq0Wz+AhGB3y+HfWs/K0BMQbtPGF 30L9K3jJvHJvChkm3yk2GEM9gF7e8L1i+jBcZZufFsWeFNmu5cVP3RV99NpfSIWSbiAp 4btGtmONrORc9cXyJKf+RAgUa/73UMmJAauAsxSPg23mtsziTF/oMPqdHjfHi5SUgWPF Glez1H21t2CaD01iwMyhyA9DynqlbQRV6V4rSlqO7gw0cq3d+BFsnY/sbcnbjM/EsxWp Pf/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Saxh/6ELbyL+LXiMCLbE5Qk34ENNN1hc65smIa6hEvE=; b=msQATyo+mic1ar6WEyu80djvPPVT6msixjfP2nPmb/IG9Ri0yjafKVGUxCeFrfhQ// f3WPbYFmjLJiHW1ookjFVJJxgG2FO5CJceLPgJGKxXDBLiB9Vl7FGFOgEWSNPLMLGvM+ hb5fXAxWx7t8yftHywfLF+OF1SEOaUtKYSqlYKjSpVc/LlGWrkZZmU48KPOpfFL2Z8/l XcafhRrH3Tl3eWby/nS/hmU+Wg5CJHSNqqNWRtG8YFNkQJw2Y6VOeD7DINp7cPS7Liqv QcQ3feqOX3YebyBkTnEQhwhM4CdhQhMdIZ/nLhzvMt4w/sNomMzFtMnUxC8055RAVVtU b09A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si23806375otk.215.2020.01.22.07.11.50; Wed, 22 Jan 2020 07:12:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbgAVPKh (ORCPT + 99 others); Wed, 22 Jan 2020 10:10:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:39536 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbgAVPKd (ORCPT ); Wed, 22 Jan 2020 10:10:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B490CACD9; Wed, 22 Jan 2020 15:10:31 +0000 (UTC) From: Giovanni Gherdovich To: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Len Brown , "Rafael J . Wysocki" Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mel Gorman , Matt Fleming , Viresh Kumar , Juri Lelli , Paul Turner , Vincent Guittot , Quentin Perret , Dietmar Eggemann , Doug Smythies , Ionela Voinescu , Giovanni Gherdovich Subject: [PATCH v5 4/6] x86,sched: Add support for frequency invariance on ATOM_GOLDMONT* Date: Wed, 22 Jan 2020 16:16:15 +0100 Message-Id: <20200122151617.531-5-ggherdovich@suse.cz> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200122151617.531-1-ggherdovich@suse.cz> References: <20200122151617.531-1-ggherdovich@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scheduler needs the ratio freq_curr/freq_max for frequency-invariant accounting. On GOLDMONT (aka Apollo Lake), GOLDMONT_D (aka Denverton) and GOLDMONT_PLUS CPUs (aka Gemini Lake) set freq_max to the highest frequency reported by the CPU. The encoding of turbo ratios for GOLDMONT* is identical to the one for SKYLAKE_X, but we treat the Atom case apart because we want to set freq_max to a higher value, thus the ratio freq_curr/freq_max to be lower, leading to more conservative frequency selections (favoring power efficiency). Signed-off-by: Giovanni Gherdovich --- arch/x86/kernel/smpboot.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8cb3113377a9..3e32d620f1fb 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1795,6 +1795,10 @@ void native_play_dead(void) * which would ignore the entire turbo range (a conspicuous part, making * freq_curr/freq_max always maxed out). * + * An exception to the heuristic above is the Atom uarch, where we choose the + * highest turbo level for freq_max since Atom's are generally oriented towards + * power efficiency. + * * Setting freq_max to anything less than the 1C turbo ratio makes the ratio * freq_curr / freq_max to eventually grow >1, in which case we clip it to 1. */ @@ -1937,18 +1941,18 @@ static bool intel_set_max_freq_ratio(void) /* * TODO: add support for: * - * - Atom Goldmont * - Atom Silvermont */ u64 base_freq = 1, turbo_freq = 1; - if (x86_match_cpu(has_glm_turbo_ratio_limits)) - return false; - if (turbo_disabled()) goto out; + if (x86_match_cpu(has_glm_turbo_ratio_limits) && + skx_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) + goto out; + if (knl_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) goto out; -- 2.16.4