Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2231066ybp; Thu, 10 Oct 2019 04:25:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxe658TKbUtRtTCFtzJesGp/Ytz1hYS7Hm/j/HZjzZurSirnGbdYIknJPYeSsMltURAAIjm X-Received: by 2002:a17:906:309b:: with SMTP id 27mr7445147ejv.243.1570706718378; Thu, 10 Oct 2019 04:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570706718; cv=none; d=google.com; s=arc-20160816; b=dc/0m6wGn1Q1NJiwKarR99ATIksWXncKYRWw0Z8FYTuNHgdEMdAneIULrs/StZpWGH taWbvIB80ko7GQKQwzBCvxVieGGYqtPz/E9eGg1qg0Hs66gcSAovCdH4qyIWTulny9ic FmRPZOG/eJjeYRximBHRtU2ice6fmmhUWTq0yG4Jg3IkewxWdFwprOkStHWYS3JLf/tH fm6/RISUKR23mVGpHzgOQBvuUqGtNOsd2NmeIyeVbhiizfxCzINhjUs3WxGOPuOC6nxG 50eFYnhkGBPWyBeYu/IzUxDggq68v0NK5xOoi2KQEf6U0bI+/afXDzMaHYE2HDaNutYa 6oxQ== 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=uZih3pgsYJlZcssxsF6sSc4qib72xoFP3CCBb3CnhZc=; b=zwVCXm+/egbZXVTVR/XDB8eqz5XD3Cnh42up3m1MINkYega8pkO8a9VndDbiLXnQmd vzOWtiaWfMIx5HYOe/MeroM438Kv5rWqvEGkcw/4hNCAK9Ee26hGai09qy5ijf1cX6aN G1Nvf9yCjnfY5KwRK7nhCvrtK0HSJr/gHMUIoXAbYCGEsHIyrA6ghUyHUIH6pxb7j7l1 y5BmP9uSzT0u8F3KxlgMZhPWiiMR8jzl2B8RB2Ml3+vwCFxqL/xYkwlsczb9ulwKdPop R6jB16H3Q0KkBTflLvSA9a2szkl5oUEnL1WykTkKelFoISf5RN7Q+51DJnlbc+6ROm8B P6fw== 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 f30si3691999ede.435.2019.10.10.04.24.54; Thu, 10 Oct 2019 04:25:18 -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 S1727917AbfJJLWZ (ORCPT + 99 others); Thu, 10 Oct 2019 07:22:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:37464 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726201AbfJJLWY (ORCPT ); Thu, 10 Oct 2019 07:22:24 -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 19ED8AEA1; Thu, 10 Oct 2019 11:22:22 +0000 (UTC) From: Thomas Renninger To: "Natarajan, Janakarajan" Cc: "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , Pu Wen , Shuah Khan , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , Allison Randal , Richard Fontana , Borislav Petkov Subject: Re: [PATCH 1/2] Modify cpupower to schedule itself on cores it is reading MSRs from Date: Thu, 10 Oct 2019 13:22:21 +0200 Message-ID: <3292474.drSXM59XT9@skinner.arch.suse.de> In-Reply-To: References: <20190918163445.129103-1-Janakarajan.Natarajan@amd.com> <1798336.DyNOivuPDK@c100> 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 Monday, October 7, 2019 11:11:30 PM CEST Natarajan, Janakarajan wrote: > On 10/5/2019 7:40 AM, Thomas Renninger wrote: > ... > >> > >> APERF/MPERF from CPL > 0) and avoid using the msr module (patch 2). > > > > And this one only exists on latest AMD cpus, right? > > Yes. The RDPRU instruction exists only on AMD cpus. > > > >> However, for systems that provide an instruction to get register values > >> from userspace, would a command-line parameter be acceptable? > > > > Parameter sounds like a good idea. In fact, there already is such a > > paramter. cpupower monitor --help > > > > -c > > > > Schedule the process on every core before starting and > > ending > > > > measuring. This could be needed for the Idle_Stats monitor when no other > > MSR based monitor (has to be run on the core that is measured) is run in > > parallel. This is to wake up the processors from deeper sleep states and > > let the kernel reaccount its cpuidle (C-state) information before reading > > the cpuidle timings from sysfs. > > > > Best is you exchange the order of your patches. The 2nd looks rather > > straight forward and you can add my reviewed-by. > > The RDPRU instruction reads the APERF/MPERF of the cpu on which it is > running. If we do not schedule it on each cpu specifically, it will read the APERF/MPERF > of the cpu in which it runs/might happen to run on, which will not be the correct behavior. Got it. And I also didn't fully read -c. I now remember.. For C-states accounting you want to have each CPU woken up at measure start and end for accurate measuring. It's a pity that the monitors do the per_cpu calls themselves. So a general idle-monitor param is not possible or can only done by for example by adding a flag to the cpuidle_monitor struct: struct cpuidle_monitor unsigned int needs_root:1 unsigned int per_cpu_schedule:1 not sure whether a: struct { unsigned int needs_root:1 unsigned int per_cpu_schedule:1 } flags should/must be put around in a separate cleanup patch (and needs_root users adjusted). You (and other monitors for which this might make sense) can then implement the per_cpu_schedule flag. In AMD case you might want (you have to) directly set it. All around a -b/-u (--bind-measure-to-cpu, --unbind-measure-to-cpu) parameter could be added at some point of time if it matters. And monitors having this could bind or not. This possibly could nuke out -c param. Or at least the idle state counter monitor could do it itself. But don't mind about this. What do you think? And you should be able to re-use the bind_cpu function used in -c case? Thomas