Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3181511imb; Tue, 5 Mar 2019 03:03:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxUVVshxdo98ZmSf/s2t0U7NWhgcM+bQ/N1E5AzGRSz3L5EPogcJCi8I6bVggGL/aggJUjt X-Received: by 2002:a62:f201:: with SMTP id m1mr1264942pfh.97.1551783812902; Tue, 05 Mar 2019 03:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551783812; cv=none; d=google.com; s=arc-20160816; b=JI1fBLUpGlie07NvHpVix4pg3CY5OGfCQx+sYrf99jW3wdlOnsmxQyVNYwhN1/KZrh eKrWIYUDqUvV9QqyLD+HxnllrTzp5DCL7UERN1IRadTvQ+ze2d2Yod7Z6BPhNGEP1XZX Fvdm6NG/m41pr1jk1P1VTBQAqyWjPb0JekVpkWVge4JXsv2U5CpjxtPJN+duAjxhRI9L wgFxUCn1LWvJ8mFgGRIgXqFVYRYFH88YCx7fig5S3aSDMehC//GuMx9tlObfZDHdWzzo NdOM3Na4FnEGaPxwkG/1dbbHGU/33PmaeYe9sFxvFD44sAcfDjhVIxgKqDnGVv1vGFVO 8xMg== 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; bh=bm7AxWqhyrSBeu2oLhghSfMzOXrJ/mXhWAApYwtE5q0=; b=j5ByLHWZYPI7SCwzeA/hWckva4Ydn99vUukDYwKEMVQ0jOehW2E9pwOL+g+TcwAAjN v+rqMZEhpfQ03TedQ3ujkeHWgX8UB8BOLuz7AkDj1rmCDJoCBj9ICVYX3BmjowSeROIR V45x+mp+iR/e61ufs34z2+mN4FQ5GkXBG1hI8+gWHzbx9j2ao/FswZyHrJhbNq5nt2Rr 2ocK0OtSGIwzU7pm4ydmoA0xqg5TAt3NSEt07WzwTNoyhw0LOo5g9IqjsFlkEiva1NmC mHNaFFLS3+/r1XWhQPX8IorzHPDSQhpvlvXyZUCv/U3x+swq4lo0zUHw+vkSeWCMsDfK bCbg== ARC-Authentication-Results: i=1; mx.google.com; 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 j69si7178607pgd.31.2019.03.05.03.03.17; Tue, 05 Mar 2019 03:03:32 -0800 (PST) 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; 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 S1727492AbfCELBk (ORCPT + 99 others); Tue, 5 Mar 2019 06:01:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46472 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbfCELBk (ORCPT ); Tue, 5 Mar 2019 06:01:40 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48D5DA78; Tue, 5 Mar 2019 03:01:40 -0800 (PST) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C19713F71D; Tue, 5 Mar 2019 03:01:38 -0800 (PST) Date: Tue, 5 Mar 2019 11:01:37 +0000 From: Quentin Perret To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Viresh Kumar , Srinivas Pandruvada , Chen Yu , Gabriele Mazzotta , peterz@infradead.org Subject: Re: [RFT][Update][PATCH 2/2] cpufreq: intel_pstate: Update max CPU frequency on global turbo changes Message-ID: <20190305110135.jdgc6vtdivs5rdjv@queper01-lin> References: <9956076.F4luUDm1Dq@aspire.rjw.lan> <3017597.CVkTxgYgAs@aspire.rjw.lan> <20190305104256.7kvedlttuovmptpc@queper01-lin> <2336151.IZk3Z8DVvP@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2336151.IZk3Z8DVvP@aspire.rjw.lan> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 05 Mar 2019 at 11:50:56 (+0100), Rafael J. Wysocki wrote: > On Tuesday, March 5, 2019 11:42:59 AM CET Quentin Perret wrote: > > > +static void intel_pstate_update_max_freq(unsigned int cpu) > > > +{ > > > + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); > > > + struct cpufreq_policy new_policy; > > > + struct cpudata *cpudata; > > > + > > > + if (!policy) > > > + return; > > > + > > > + down_write(&policy->rwsem); > > > + > > > + if (policy_is_inactive(policy)) > > > + goto unlock; > > > + > > > + cpudata = all_cpu_data[cpu]; > > > + policy->cpuinfo.max_freq = global.turbo_disabled_upd ? > > > + cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; > > > + > > > + memcpy(&new_policy, policy, sizeof(*policy)); > > > + new_policy.max = min(policy->user_policy.max, policy->cpuinfo.max_freq); > > > + new_policy.min = min(policy->user_policy.min, new_policy.max); > > > + > > > + cpufreq_set_policy(policy, &new_policy); > > > > Do you want to force-restart the governor here ? > > cpufreq_set_policy() is expected to take care of the governor. > If it doesn't, there is a bug somewhere. Yes, it does something when there is a governor change, but that's not the case here IIUC. > > Schedutil caches cpuinfo.max_freq for the iowait stuff in sugov_start() [1]. > > If it does so, it should update the cached value in sugov_limits(). > > I guess I can add a patch updating it to this series. Right, I think we've been under the assumption that unlike policy->max, cpuinfo.max_freq should be constant, so there was no need to update the value at run time. But if that assumption doesn't hold any more, then yeah we'll need something more dynamic I guess. > > > I'm not sure about the other governors. > > They don't do that AFAICS. OK > > And just removing sg_cpu->iowait_boost_max to use the cpuinfo struct > > instead will conflict with [2], I think. > > Thanks for pointing this out. N/p :-) Thanks, Quentin