From patchwork Sat Jun 22 01:30:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Rainbolt X-Patchwork-Id: 1951004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W5c9t6rvRz20X6 for ; Sat, 22 Jun 2024 11:30:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sKpaP-0001kM-Mn; Sat, 22 Jun 2024 01:30:37 +0000 Received: from mail-io1-f65.google.com ([209.85.166.65]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sKpaO-0001kE-6d for kernel-team@lists.ubuntu.com; Sat, 22 Jun 2024 01:30:36 +0000 Received: by mail-io1-f65.google.com with SMTP id ca18e2360f4ac-7ebe508fa34so135244839f.2 for ; Fri, 21 Jun 2024 18:30:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719019834; x=1719624634; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wa896tbts8m9w06A4xxfnusz0OcWhRiKM0HFh5/9OvI=; b=jfrF/Fuj73L6JVd/HEUGHLp9J7UjjXx4efDMUpLZU8mJKJIa5BuKpEhX/5dPqezD1+ 4o+jn0WkPouh39hKaBmORScqiJysnUV+U54aZdDv5lMi+++16mOYCW+y4UDbYmEFgoat EANndibMPYNOW50qMh/2tIeGGJ188mMODKKwffi/SxWauAXKSin1y6p1RkBsUQmbnfuL ifnqpBIBqqhx5F5dLdiN/2zvWfFAg+zQNb7qnz6qXVQygJhLxzw8I5VIAjRvcsZzNFAq Blf1CrJx+PGqZewKIO+j0V2relMBGW9EiMyddxeQhNCZnJKLMOCCTOAAI1FpNR9kJxM7 sMiA== X-Gm-Message-State: AOJu0YxLh9wN1j1GRFFstlW0t4ZHICiLyFxHEhDHvVuPOW4ooGR99Pdy TVcSxB3Ty0yevmMpKI/buFGCo6n366AZFzB8T3V/2coQJ0izVvqk6NJJ4MuReylQ00q9wWofdWc lwmmEuMvz X-Google-Smtp-Source: AGHT+IGQw2ICIaEzRfeNmbBV3lpwNqZxZ7DXAAEO9tFIi0zh6LVMKhpvwtEhbU7YT6sQ9/KfhR1Yzg== X-Received: by 2002:a05:6602:1347:b0:7eb:61d5:74ff with SMTP id ca18e2360f4ac-7f13ee2605fmr1214775239f.12.1719019834601; Fri, 21 Jun 2024 18:30:34 -0700 (PDT) Received: from kf-XE ([2607:fb91:111c:4643:b50f:f788:eb4:9dc5]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4b9d10da5fdsm671210173.21.2024.06.21.18.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 18:30:34 -0700 (PDT) Date: Fri, 21 Jun 2024 20:30:32 -0500 From: Aaron Rainbolt To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-6.8][Noble][PATCH 1/1] UBUNTU: SAUCE: cpufreq: intel_pstate: Use HWP to initialize ITMT if CPPC is missing Message-ID: MIME-Version: 1.0 Content-Disposition: inline Received-SPF: pass client-ip=209.85.166.65; envelope-from=arainbolt@kfocus.org; helo=mail-io1-f65.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mmikowski@kfocus.org Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Rafael J. Wysocki BugLink: https://bugs.launchpad.net/bugs/2069988 It is reported that single-thread performance on some hybrid systems dropped significantly after commit 7feec7430edd ("ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked") which prevented _CPC from being used if the support for it had not been confirmed by the platform firmware. The problem is that if the platform firmware does not confirm CPPC v2 support, cppc_get_perf_caps() returns an error which prevents the intel_pstate driver from enabling ITMT. Consequently, the scheduler does not get any hints on CPU performance differences, so in a hybrid system some tasks may run on CPUs with lower capacity even though they should be running on high-capacity CPUs. To address this, modify intel_pstate to use the information from MSR_HWP_CAPABILITIES to enable ITMT if CPPC is not available (which is done already if the highest performance number coming from CPPC is not realistic). Reviewed-by: Mario Limonciello Signed-off-by: Rafael J. Wysocki Signed-off-by: Aaron Rainbolt Reviewed-by: Mario Limonciello Signed-off-by: Rafael J. Wysocki Signed-off-by: Aaron Rainbolt diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 79619227e..01046d666 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -359,15 +359,14 @@ static void intel_pstate_set_itmt_prio(int cpu) int ret; ret = cppc_get_perf_caps(cpu, &cppc_perf); - if (ret) - return; - /* - * On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff. - * In this case we can't use CPPC.highest_perf to enable ITMT. - * In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide. + * If CPPC is not available, fall back to MSR_HWP_CAPABILITIES bits [8:0]. + * + * Also, on some systems with overclocking enabled, CPPC.highest_perf is + * hardcoded to 0xff, so CPPC.highest_perf cannot be used to enable ITMT. + * Fall back to MSR_HWP_CAPABILITIES then too. */ - if (cppc_perf.highest_perf == CPPC_MAX_PERF) + if (ret || cppc_perf.highest_perf == CPPC_MAX_PERF) cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached)); /*