Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3528338pxa; Wed, 26 Aug 2020 02:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmkQiZro2ly7zgCpBCRZjpUTD2NR0r55L0sqN1p7EFFkFjp+WvHQw2rpnErmZP2qtz0n2H X-Received: by 2002:aa7:df0e:: with SMTP id c14mr14546062edy.200.1598435796602; Wed, 26 Aug 2020 02:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598435796; cv=none; d=google.com; s=arc-20160816; b=QWQoY1r8WHn8hlQZuWVu7SK/xaR/MgTQx9TBx0IE5GygBJDJNTrOkXs73hgeqAe/gC Tdg+DFv+i9coGo0QLBk0oZIJb7u7lhFP5M7XHcMCLulqKd7CZv0vgRF48OeUpYxPVl47 2WgVBx3mMQNM4i6SJXoJ0Q4oVVuNdOtTijCnPvKQlW51+oHOwAquW5agoOCHg0bTcNhh T79YWKOaygxzZEnxfQhpys8tn5Jyu0xlWxDpfh1suFs/NleYy67IKSwHan4QknAo36Av nQP9f4H+PzYUDBMh/8sw0XMrJgQi4FI3HxOvLdRPN0GhmJxCVyVTYzvtv1MRrMBlpuEY UZ2g== 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 :user-agent:references:in-reply-to:date:cc:to:reply-to:from:subject :message-id:ironport-sdr:ironport-sdr; bh=Iuj3G6A0TWTQor3SacTySuSEBVxywXVEurLM9tZyfN8=; b=RA5fov8xfFdz0hgVFSQLrXvKRn3bJI/yK8wvIsPz8mGkAuhzBqZyNoCER/owFh0fZv JUWqN01Iw8TE8ynk5dNsjpGSlKi71lIkkKSgrk4/9s0cM5BZhtqXXbuS6hXKvUNg+HeV sadNZyQz/Pmo7JuKoK6h7hwFfuZcLcda0ORRbUwmTxQD+3FecX+PU1jQdmX6tpSPcTXD dbDHtwxtCU1kM88SCXwSAaNYv4vjTUFMGQAwb2tvr+oFIf+sGXnqiUufdDbcokDS8QCV 9duGkzdDa1RqcWF9PahI0X4TxlHnOPlFi9oB+C3vbb3pE8iHLmGdQmQ7CF8/hk1iZ6bL xB+Q== 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si1189018ejr.684.2020.08.26.02.56.13; Wed, 26 Aug 2020 02:56:36 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728379AbgHZJyW (ORCPT + 99 others); Wed, 26 Aug 2020 05:54:22 -0400 Received: from mga11.intel.com ([192.55.52.93]:14627 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbgHZJyW (ORCPT ); Wed, 26 Aug 2020 05:54:22 -0400 IronPort-SDR: 2/TTzkZ5gG/wQasxgz+TL1FTFMj8gTg+Q4MwT1uvdUfwfM8T+laC2F16LoqFZUdTY5xF763keg uKq/2by4RB8g== X-IronPort-AV: E=McAfee;i="6000,8403,9724"; a="153835283" X-IronPort-AV: E=Sophos;i="5.76,355,1592895600"; d="scan'208";a="153835283" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2020 02:54:18 -0700 IronPort-SDR: aKZ1nbtpzd2mAGNtCYvZa4u9d31Wtw/GoGfc/vEAuEh7HDFwSdsiBaOSutwoQNSWGqXc2g3v+Y 6xI71ibo1P8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,355,1592895600"; d="scan'208";a="373327012" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 26 Aug 2020 02:54:18 -0700 Received: from abityuts-desk1.fi.intel.com (abityuts-desk1.fi.intel.com [10.237.72.186]) by linux.intel.com (Postfix) with ESMTP id D064D5806C4; Wed, 26 Aug 2020 02:54:16 -0700 (PDT) Message-ID: <91190a53b9d78ffe08d4b001d021868ad7ba6d1c.camel@gmail.com> Subject: Re: [PATCH v2 2/5] cpufreq: intel_pstate: Always return last EPP value from sysfs From: Artem Bityutskiy Reply-To: dedekind1@gmail.com To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , Srinivas Pandruvada , LKML , Doug Smythies Date: Wed, 26 Aug 2020 12:54:15 +0300 In-Reply-To: References: <4169555.5IIHXK4Dsd@kreacher> <2064342.aRc67yb0pC@kreacher> <61ea43fce7dd8700d94f12236a86ffec6f76a898.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for answer Rafael, it looks like there are 2 different things now. 1. What kernel returns when I _read_ e_p_p file - truth or "cached" ? 2. How kernel behaves when I _write_ to e_p_p file something it cannot provide - error or success. For #1, I think we need to keep it simple and always return true policy value. Does not matter what someone wrote there. If some process wrote "powersave", but kernel uses EPP 0 anyway, the other process probably wants to know the truth and get "performance" when reading e_p_p. On Tue, 2020-08-25 at 16:51 +0200, Rafael J. Wysocki wrote: > An alternative is to fail writes to energy_performance_preference if > the driver works in the active mode and the scaling algorithm for the > scaling CPU is performance and *then* to make reads from it return the > value in the register. Yes, this is #2. This sounds like the _right_ way to do it. Suppose my script wants to exercise the system with 4 different EPP policies. It changes the policy and runs measurements, each run takes few _days_. Now, my script asks for "powersave". Kernel _knows_ it cannot provide it (performance+active enabled). Why would it not return error ("can't do") instead of success ("yes, Sir!")? Note, I deliberately use simple words like "my script" instead of "a user-space process" to make it easier to convey the idea. Anyway, if kernel returns error, I can go and improve my script WRT controlling the performance+active mode knobs.