Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1635351imm; Wed, 16 May 2018 00:24:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo00O5ub1Kw0dH0KI1y5YxfwKSz4Sa6RXrkWq6SylVeuvJCvZYeTPynP1RuHrNes+cTBXQA X-Received: by 2002:a17:902:8:: with SMTP id 8-v6mr17580710pla.287.1526455446856; Wed, 16 May 2018 00:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526455446; cv=none; d=google.com; s=arc-20160816; b=NuOKdU2jVr0Ye4barlUGPNFW9XvSM1KN4/kJUy8twCxENDEQe+hO/lPMz33LeHZXCH bscMQZeuAQPCxCdm/LqHwuBaGx43TvhA6zFPBdJq+FzxRjgdNEa0ousFkYXZb4yDq3b6 dQydGVv5R5mhQNCAqZ1lV2eZuIhESIHTQCrw0RwLPHaxq5pewUHU0Nf7sINeypSMJzrZ dRuM8VJcVnDL4xvTzWGii2h3klKiXny+Xj0c9P51hiU+aIdqGA0Fx3f8f7mGFKQmnmxF 5vHB+X2gksPk0sFmAe2t6774FVnL1ZduoyQ1YPJqsMi2Uznhbu8ng4tzYb1XbZwPi0kO tGpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=aCGcJqAOzgQVVKZ988KO7Ddqb1cOm9rzQX+yDgoikHE=; b=WOvOZ8ug9SBlakzAQTnLjpihVImXYt8f2JLlhARI0tevWbr9FzZfjPvlR5D1fjomuZ SWEpmiEtVjm02k+bWgd1vH1NsvACWFa4CU127d7mc1PaMkr1PhUL7bWXHE7mS83OcJjl tWA4LZXwVMlWXsBYHR/KssaK1W1yyT4WfC6F+WdVQ2rG1YTseb5DgTYF+zb7Wq2cZWq+ Io9Jc3uQtaNCEbDFbY4jyQViAYDDnShyGBvlGqNTjXD9Mtw22huBYQghIxv5nZRWujsx WIrBlgD4cBfZpWzknUZe/9UE7DGdpDeIcDTezFggSRtLBtm8WMYtlj5htmkZcGIomKyr k3XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cnpvtNRp; 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 n6-v6si1933854pla.12.2018.05.16.00.23.52; Wed, 16 May 2018 00:24:06 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cnpvtNRp; 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 S1752424AbeEPHWR (ORCPT + 99 others); Wed, 16 May 2018 03:22:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44918 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752253AbeEPHWP (ORCPT ); Wed, 16 May 2018 03:22:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aCGcJqAOzgQVVKZ988KO7Ddqb1cOm9rzQX+yDgoikHE=; b=cnpvtNRpTmGPh1EB8cGfaISF/ YMz1Gc9KJjah+j7dBpjtAUPtpFfXn9n56xHFSZt2Wgs5sSflpRxp0pnE0DhLL8Qc+3HEqaZuv0iDb aXXz60fvcRpzQ40f4Y/EvM0oeKk5+P29Hfob870k97TUiSb7bYlCyBhFa1CA5XH/rnNa9tsq4fRrK P43pl8AF2Jfav5rvoajGauIsPQKv/iGlUgWfzsQ3UqWwxYx+p4dAQpMPKiB30cOgloW07Qq9ajNzv ZGp27/UqeGltXxq8fcJDWVk925ew9j29BzNgNJzqNx147c9BqbSGOCMc8g4J9p8WSAQt0k0wq1E7B edFyh39Hg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIql9-00089y-UX; Wed, 16 May 2018 07:22:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 655BF2029F1C1; Wed, 16 May 2018 09:22:02 +0200 (CEST) Date: Wed, 16 May 2018 09:22:02 +0200 From: Peter Zijlstra To: Srinivas Pandruvada Cc: tglx@linutronix.de, mingo@redhat.com, bp@suse.de, lenb@kernel.org, rjw@rjwysocki.net, mgorman@techsingularity.net, x86@kernel.org, linux-pm@vger.kernel.org, viresh.kumar@linaro.org, juri.lelli@arm.com, linux-kernel@vger.kernel.org Subject: Re: [RFC/RFT] [PATCH 03/10] cpufreq: intel_pstate: Utility functions to boost HWP performance limits Message-ID: <20180516072202.GV12217@hirez.programming.kicks-ass.net> References: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> <20180516044911.28797-4-srinivas.pandruvada@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180516044911.28797-4-srinivas.pandruvada@linux.intel.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15, 2018 at 09:49:04PM -0700, Srinivas Pandruvada wrote: > Setup necessary infrastructure to be able to boost HWP performance on a > remote CPU. First initialize data structure to be able to use > smp_call_function_single_async(). The boost up function simply set HWP > min to HWP max value and EPP to 0. The boost down function simply restores > to last cached HWP Request value. > > To avoid reading HWP Request MSR during dynamic update, the HWP Request > MSR value is cached in the local memory. This caching is done whenever > HWP request MSR is modified during driver init on in setpolicy() callback > path. The patch does two independent things; best to split that. > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index f686bbe..dc7dfa9 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -221,6 +221,9 @@ struct global_params { > * preference/bias > * @epp_saved: Saved EPP/EPB during system suspend or CPU offline > * operation > + * @hwp_req_cached: Cached value of the last HWP request MSR That's simply not true given the code below. > @@ -763,6 +768,7 @@ static void intel_pstate_hwp_set(unsigned int cpu) > intel_pstate_set_epb(cpu, epp); > } > skip_epp: > + cpu_data->hwp_req_cached = value; > wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); > } > > @@ -1381,6 +1387,39 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) > intel_pstate_set_min_pstate(cpu); > } > > + > +static inline void intel_pstate_hwp_boost_up(struct cpudata *cpu) > +{ > + u64 hwp_req; > + u8 max; > + > + max = (u8) (cpu->hwp_req_cached >> 8); > + > + hwp_req = cpu->hwp_req_cached & ~GENMASK_ULL(31, 24); > + hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | max; > + > + wrmsrl(MSR_HWP_REQUEST, hwp_req); > +} > + > +static inline void intel_pstate_hwp_boost_down(struct cpudata *cpu) > +{ > + wrmsrl(MSR_HWP_REQUEST, cpu->hwp_req_cached); > +} This is not a traditional msr shadow; that would be updated on every wrmsr. There is not a comment in sight explaining why this one is different.