Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5324657ybp; Tue, 8 Oct 2019 00:43:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGR1j/V7WM2VfCLPPEuvMW0u/P4rVJx69WJo77GYdpvIrU8cvXRaRQs2z6uZtVH7IZqHBZ X-Received: by 2002:a17:906:1c06:: with SMTP id k6mr26980911ejg.217.1570520636711; Tue, 08 Oct 2019 00:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570520636; cv=none; d=google.com; s=arc-20160816; b=URtcxVtXWpOZTvC1OD1GqAk1IurchZcNMcjubhXZPs5bW4cipjSTiZkk+Sa/qqa+Dm Ab2YCZYZ1jU/iY1UTWMHPRI3N/DhwG44zOtnrVCmtn/UJmbrnrN6yGomHYB8puKTWe/M KtAVOvJ1/HnbYaMbADx1rYmtLIkn01zkR1HcucEN4TE4vaVMZo/Y0BCll8YR3cHToBRV qiDJTnAZU4PkhkY1bEsCkLxdecSW0JpjSDabL5ccoZS4SVxRAFVyrKKmRbJ6RGhx1tMs 8Gg1N7FZudr6i56VcQTjzNenVH+wV8R7x7JmpcUzFu8swEOALxEaB4du65RS9+P+aXVr f46g== 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:date:cc:to:from:subject:message-id; bh=+twmZ08tyfd1XM/DQLYN4307jasJehuTnbNws4n2YOs=; b=lI7iSNsCOGWuV0iwShKRHjGfOPfZIDMIEBP5vJXaTZM55KtLyqw9oVZxTMrhIW1m3M 08Q2N954kvMsYnHSPpSPVQD1tNP4i3jlvywxJHYcixACzeLT6yO7ORKPm5NK5QeY6zA8 bUihtFjYNd/3w6cwaGrRJHKkvIAT9U/dpLAuMT72rb+seYxqgoRaYX8nn9mda8BPVdcG G2BYr/CPJnNQ6WkUbEEU7VWLfPO14lPR/Ksgu3f70C1er/eQNA57/ieG53CqWtYQVcJl F5ZtBsApC9EshhbSRX6XaHPy7MxtCY9bP5M3V5E9zunloDlMN58kZPTpjHyxk5WG5Q2y I1/Q== 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 la20si7219238ejb.73.2019.10.08.00.43.32; Tue, 08 Oct 2019 00:43:56 -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; 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 S1730388AbfJHHnI (ORCPT + 99 others); Tue, 8 Oct 2019 03:43:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:39514 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730218AbfJHHnI (ORCPT ); Tue, 8 Oct 2019 03:43:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3AC18AEF1; Tue, 8 Oct 2019 07:43:06 +0000 (UTC) Message-ID: <1570520919.25071.2.camel@suse.cz> Subject: Re: [PATCH v2 1/2] x86,sched: Add support for frequency invariance From: Giovanni Gherdovich To: "Rafael J. Wysocki" , Peter Zijlstra Cc: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Len Brown , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mel Gorman , Matt Fleming , Viresh Kumar , Juri Lelli , Paul Turner , Vincent Guittot , Quentin Perret , Dietmar Eggemann , Doug Smythies Date: Tue, 08 Oct 2019 09:48:39 +0200 In-Reply-To: <1990043.dY4KdrEkPr@kreacher> References: <20191002122926.385-1-ggherdovich@suse.cz> <1906426.HDqaVa71mF@kreacher> <20191003121537.GR4536@hirez.programming.kicks-ass.net> <1990043.dY4KdrEkPr@kreacher> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 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 On Thu, 2019-10-03 at 19:53 +0200, Rafael J. Wysocki wrote: > On Thursday, October 3, 2019 2:15:37 PM CEST Peter Zijlstra wrote: > > On Thu, Oct 03, 2019 at 12:27:52PM +0200, Rafael J. Wysocki wrote: > > > On Wednesday, October 2, 2019 2:29:25 PM CEST Giovanni Gherdovich wrote: > > > > +static bool turbo_disabled(void) > > > > +{ > > > > + u64 misc_en; > > > > + int err; > > > > + > > > > + err = rdmsrl_safe(MSR_IA32_MISC_ENABLE, &misc_en); > > > > + if (err) > > > > + return false; > > > > + > > > > + return (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE); > > > > +} > > > > > > This setting may be updated by the platform firmware (BIOS) in some cases > > > (see kernel.org BZ 200759, for example), so in general checking it once > > > at the init time is not enough. > > > > Is there anything sane we can do if the BIOS frobs stuff like that under > > our feet? Other than yell bloody murder, that is? > > Sane? No, I don't think so. > > Now, in principle *something* could be done to fix things up in the _PPC > notify handler, but I guess we would just end up disabling the scale > invariance code altogether in those cases. I'm looking at how to react to turbo being disabled at run time, assuming a _PPC notification is triggered in that case. I don't think the correct action would be to disable scale invariance: if the turbo range is not available, then max frequency is max_P, and scale invariance can go on using that. The case max_freq=max_P is represented by arch_max_freq=1024 in this patch (because arch_max_freq=max_freq*1024/max_P). Since the variable arch_max_freq is global to all CPUs, the fact that the _PPC notification is sent to just one CPU is not a concern: the CPU receiving the notif will set arch_max_freq=1024 (Srinivas was worried about this in another message). This looks like a job for the ->update_limits callback you added to "struct cpufreq_driver" in response to the mentioned kernel.org BZ 200759. I see that only intel_pstate implements it, it's not clear to me yet if I'll have to give an ->update_limits to acpi_cpufreq as well to treat this case. Giovanni