Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5072549pxb; Mon, 15 Feb 2021 08:47:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhFMKS4HBF3vT3pTuE+HtQaZ7aX+5Ai9anJYYZp6E4Au/XRJ0grKcJDrX7VshFw8Lp92iV X-Received: by 2002:a17:906:a00e:: with SMTP id p14mr16434449ejy.532.1613407654586; Mon, 15 Feb 2021 08:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407654; cv=none; d=google.com; s=arc-20160816; b=GiJoPdvzV0Mxhp87YSud+7auUJih4CPl0IRbsrHTHZ7hz9a96Mvpqu0KSvzUIENv9O TZH8fLBGsxhMCGahU6ldZbIZ3UB4Rw+WMaEYHKPrDn+6N9DscYxTlj77NjK4vZagexjJ dJDr5nAFYDKq6g5FA+uWw1ODoWVUXuyaEEwP7bFNVOj3ChWG/f1E4B6cSzS2Y/b37tdX RnG2WTs3A9bNL6gjXmMB4IbeqKkFWRCaVDeWLRVPCbTYRRP5Cvy+UNFQ/6fHRAtdrH/B 81bB94J0xGyPvg+DX3CMgClr3tl/g6jdXOVC+Ax72TY1hU4HjKfSBQ7sq2rnNlZGeLRw hFxQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/q+RF8hCk3KF4MVSOJwHa/8nlK253JK++QyiWYkNbf4=; b=U0GhH0yOG/x6zdW5M+1nGLxpZ+XtW52pYkKZ6pqXek9/wEV13zbh51shNOLpd1TUMA jf6woM/Vn87gKg9xw0Dauj/tC8U7qYto9eW5tp7EIBvQBVlYxstw1iUeE4vLxZjGRX3N wbbPnBtL2V0qTQtbTZUdhkWgbtTdLqTDmdiexPKnJE/VJdezu4Zo5Fr0rulDkHvWombv V1FKQrgBiPm4n6K6T1P65Tn4C++Z1oX+s0p+523i/HP6dTX5oXd/Ivx94IxOQmpuxjSd ZhM2nuD3zU7Kz6z6x4rZOLJrCcYTSVhDmqqgZ9E6L3qRnXHwxwqeGHskABDB5uKGPpAx 4Tyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZ3Fq4AS; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hx7si12305246ejc.316.2021.02.15.08.47.11; Mon, 15 Feb 2021 08:47: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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZ3Fq4AS; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231817AbhBOQqk (ORCPT + 99 others); Mon, 15 Feb 2021 11:46:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:50214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbhBOPiL (ORCPT ); Mon, 15 Feb 2021 10:38:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01A3164EB9; Mon, 15 Feb 2021 15:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403265; bh=zy1udX7Uonmn/VPosQuKRzFF8NMvD7CIT/Jg8sMmh9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZ3Fq4ASFnQDA02P6XkPDRgdZzpCbFqWI+ilVqwYuD4vere/sBeRQm1qQjVnXAkXi YDlbR2rFusGnwWKUboGR4Lo/8ngPJhVDAHLZh5a3nFm+fZZK89UIqOtSDJzYeBYPv1 2uE2jlCGWx75T9BsKWaj6ceZWRuiBsxIXbRk0gX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Giovanni Gherdovich , "Peter Zijlstra (Intel)" Subject: [PATCH 5.10 091/104] cpufreq: ACPI: Update arch scale-invariance max perf ratio if CPPC is not there Date: Mon, 15 Feb 2021 16:27:44 +0100 Message-Id: <20210215152722.397273996@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki commit d11a1d08a082a7dc0ada423d2b2e26e9b6f2525c upstream. If the maximum performance level taken for computing the arch_max_freq_ratio value used in the x86 scale-invariance code is higher than the one corresponding to the cpuinfo.max_freq value coming from the acpi_cpufreq driver, the scale-invariant utilization falls below 100% even if the CPU runs at cpuinfo.max_freq or slightly faster, which causes the schedutil governor to select a frequency below cpuinfo.max_freq. That frequency corresponds to a frequency table entry below the maximum performance level necessary to get to the "boost" range of CPU frequencies which prevents "boost" frequencies from being used in some workloads. While this issue is related to scale-invariance, it may be amplified by commit db865272d9c4 ("cpufreq: Avoid configuring old governors as default with intel_pstate") from the 5.10 development cycle which made it extremely easy to default to schedutil even if the preferred driver is acpi_cpufreq as long as intel_pstate is built too, because the mere presence of the latter effectively removes the ondemand governor from the defaults. Distro kernels are likely to include both intel_pstate and acpi_cpufreq on x86, so their users who cannot use intel_pstate or choose to use acpi_cpufreq may easily be affectecd by this issue. If CPPC is available, it can be used to address this issue by extending the frequency tables created by acpi_cpufreq to cover the entire available frequency range (including "boost" frequencies) for each CPU, but if CPPC is not there, acpi_cpufreq has no idea what the maximum "boost" frequency is and the frequency tables created by it cannot be extended in a meaningful way, so in that case make it ask the arch scale-invariance code to to use the "nominal" performance level for CPU utilization scaling in order to avoid the issue at hand. Fixes: db865272d9c4 ("cpufreq: Avoid configuring old governors as default with intel_pstate") Signed-off-by: Rafael J. Wysocki Reviewed-by: Giovanni Gherdovich Acked-by: Peter Zijlstra (Intel) Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/smpboot.c | 1 + drivers/cpufreq/acpi-cpufreq.c | 8 ++++++++ 2 files changed, 9 insertions(+) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1829,6 +1829,7 @@ void arch_set_max_freq_ratio(bool turbo_ arch_max_freq_ratio = turbo_disabled ? SCHED_CAPACITY_SCALE : arch_turbo_freq_ratio; } +EXPORT_SYMBOL_GPL(arch_set_max_freq_ratio); static bool turbo_disabled(void) { --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -806,6 +806,14 @@ static int acpi_cpufreq_cpu_init(struct state_count++; valid_states++; data->first_perf_state = valid_states; + } else { + /* + * If the maximum "boost" frequency is unknown, ask the arch + * scale-invariance code to use the "nominal" performance for + * CPU utilization scaling so as to prevent the schedutil + * governor from selecting inadequate CPU frequencies. + */ + arch_set_max_freq_ratio(true); } freq_table = kcalloc(state_count, sizeof(*freq_table), GFP_KERNEL);