Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp399967ybg; Tue, 28 Jul 2020 08:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKLRl7nM4AjMC4/Q2ZzdJTBOEFxzAVJLupMBBNgTwG3CE8kMYfKXj7//eNzZ2BaDhU3+lu X-Received: by 2002:a17:906:384a:: with SMTP id w10mr27353703ejc.235.1595951028483; Tue, 28 Jul 2020 08:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595951028; cv=none; d=google.com; s=arc-20160816; b=YXnt7rp5+zJ+G1NTAJHIO61l8CzX7BH1676FL8ynYLfODzEsmJk/+7yUWv1KtrRevQ kHwD+LpAsElPJrYGMKNvy+mLx9iMjhq07d3AKeoBWvDjoS0koA+hwsv0yaifhx573HOU oX8Q3b2IL0NbjjKNl4vdgKxtjHOwx6qG1Xq2N0rrf9wtakGY2Lt+QzQPUFfsHcX1nZ5d 5C/hmS/XFXmLyI6oq2Jmkb9XaQCLmagOFbMj86LD+w0D45NLZw1JR1yhBBYFgUa5yDBQ Gx+QB9S8W6lrZhkmSLR3LOYQMF9AceY05zpveOySFK2kgyFqZgTxQO2+mRyDJi06y5K1 wNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+8onqCtB2fvl0j+gK5Zx5+ejAOMDKm601u1WQWgqMmE=; b=EHH96ivD1rFozX93EZz55G0plf1EjvyeHbvDz71Jwhxk1yGJ9GbcTOh1xK1WMG9LWi 54ULEvmewHZiScX14tTNWWvpaN0IoKd6cwZKRx+dCDS3DE2ej8Cdm6H9WEG5EvXZ2UKG zUfuAvsvq5mb1C2c2wM4z7QCN51D7bm01mv9LLNRb6L6KlV5e4cWRFEDKuKfeteiBiiB m0p/Z8xL4hBxRaQV2ABs+SggbSFyXihCy2JeRhsUVIfTBinzi8kl06VbG1hKxj8HJT+o 6Z/7W3nmL5oj9GDQGwPX0ZDfkVcUPj0KgmubZ7kLc7lJqQhMXtzk4n7O7awxNfIdpXym Yu0g== 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 l15si839777edr.130.2020.07.28.08.43.26; Tue, 28 Jul 2020 08:43:48 -0700 (PDT) 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 S1731031AbgG1Plq (ORCPT + 99 others); Tue, 28 Jul 2020 11:41:46 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:59548 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731019AbgG1Plp (ORCPT ); Tue, 28 Jul 2020 11:41:45 -0400 Received: from 89-64-88-69.dynamic.chello.pl (89.64.88.69) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.415) id a18b10c115136856; Tue, 28 Jul 2020 17:41:43 +0200 From: "Rafael J. Wysocki" To: Francisco Jerez Cc: "Rafael J. Wysocki" , Linux PM , Linux Documentation , LKML , Peter Zijlstra , Srinivas Pandruvada , Giovanni Gherdovich , Doug Smythies Subject: Re: [PATCH] cpufreq: intel_pstate: Implement passive mode with HWP enabled Date: Tue, 28 Jul 2020 17:41:42 +0200 Message-ID: <1884886.tmXHBG24oC@kreacher> In-Reply-To: <87mu3thiz5.fsf@riseup.net> References: <3955470.QvD6XneCf3@kreacher> <87mu3thiz5.fsf@riseup.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, July 21, 2020 1:20:14 AM CEST Francisco Jerez wrote: > [cut] > > If there is a bug, then what exactly is it, from the users' perspective? > > > > It can be reproduced easily as follows: > > | echo 1 > /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost > | for p in /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference; do echo performance > $p; done > > Let's make sure that the EPP updates landed on the turbostat output: > > |[..] > | Core CPU Avg_MHz Busy% Bzy_MHz HWP_REQ > | - - 1 0.05 2396 0x0000000000000000 > | 0 0 1 0.05 2153 0x0000000000002704 > | 0 4 1 0.04 2062 0x0000000000002704 > | 1 1 1 0.02 2938 0x0000000000002704 > | 1 5 2 0.09 2609 0x0000000000002704 > | 2 2 1 0.04 1857 0x0000000000002704 > | 2 6 1 0.05 2561 0x0000000000002704 > | 3 3 0 0.01 1883 0x0000000000002704 > | 3 7 2 0.07 2703 0x0000000000002704 > |[..] > > Now let's do some non-trivial IO activity in order to trigger HWP > dynamic boost, and watch while random CPUs start losing their EPP > setting requested via sysfs: > > |[..] > | Core CPU Avg_MHz Busy% Bzy_MHz HWP_REQ > | - - 16 0.81 2023 0x0000000000000000 > | 0 0 7 0.66 1069 0x0000000080002704 > ^^ > | 0 4 24 2.19 1116 0x0000000080002704 > ^^ > | 1 1 18 0.68 2618 0x0000000000002704 > | 1 5 1 0.03 2005 0x0000000000002704 > | 2 2 2 0.07 2512 0x0000000000002704 > | 2 6 33 1.35 2402 0x0000000000002704 > | 3 3 1 0.04 2470 0x0000000000002704 > | 3 7 45 1.42 3185 0x0000000080002704 > ^^ Actually, that's because intel_pstate_hwp_boost_up() and intel_pstate_hwp_boost_down() use the hwp_req_cached value for updating the HWP Request MSR and that is only written to by intel_pstate_hwp_set() which is only invoked on policy changes, so the MSR writes from intel_pstate_set_energy_pref_index() basically get discarded. So this is a matter of synchronizing intel_pstate_set_policy() with intel_pstate_set_energy_pref_index() and they both acquire intel_pstate_limits_lock already, so this shouldn't be too difficult to fix. Let me cut a patch for that.