Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp945314imu; Tue, 11 Dec 2018 09:59:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/XNFMhbgWgQx6ZyZzNWtVGxd4SiD0Sezdl9nRR+TYkK0XGPy6Vf5UFd15IdOSnvU5gYXV5+ X-Received: by 2002:a63:d450:: with SMTP id i16mr15165822pgj.246.1544551180167; Tue, 11 Dec 2018 09:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544551180; cv=none; d=google.com; s=arc-20160816; b=LEzU0JgRVEMISB431l1QV6G/pHtKfZOatHJokbLehB+gT8YuGj1RUsk3+y3LLicfiN Eot4aqXs2WC0LRWJtlV+6xftvjFdOX4PHN+GaWXIH2bdrouent5UMrTV3UkYPSG534Gy HN/PMVnuBXW/svQuT+JX/sUMU3weukZr6nFnXoahO5rL/TMAI4nJc4ZEyyZI8nw6mZUJ 7GBigQZRGLpit7PDl6w6elNmZ7GXmWMSbEctHPugVeiLrfElVr2Tc0hjbgW2aidnANVO CZVR1txbhSrqeV9zETeD9XYxF1oK0u02t3euHzIH/qp3motXBqGQGrH+apzBUsF0C5Ho I2Ng== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=22/DqVi9p/zBsC9uhEn9IzoqnBjgWUWpxe5cQMxF1p0=; b=gB7XbOfdt0E7dj6DqHocSyX5bM5t+ekWQjaYyUwlVDNqussY7c3z7IIZEOKVvdvMFP u5tk1PfmRNHM+ptzAk1tqjOsUnQyhT11DCI8JlUXvC/SJ3EPfYiZa2xfcHn7q3yXPO5z w2i/I/EkUxhy6sJT3AllhZ1pvVVs7pUOk5jo2jFQnBDeFc07NN0xbwkgBXol+4URfzjc WnUFkd6P64nRfn4cnWAVUxPcCpN0Ws0yrwnDlDbbVa+XSpXA+Q38jxuT0HlnZiPVC0mB rGyJT4bEoDcFvzr1a0MGezWrqg0A3yfe5v46DW7Q+vJ3RhASNbo9PYtKrXCWw7+FR91Y HjLA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r22si11698943pgl.537.2018.12.11.09.59.02; Tue, 11 Dec 2018 09:59:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbeLKR5E convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Dec 2018 12:57:04 -0500 Received: from mga03.intel.com ([134.134.136.65]:61843 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbeLKR5E (ORCPT ); Tue, 11 Dec 2018 12:57:04 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 09:57:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,343,1539673200"; d="scan'208";a="127013498" Received: from schen9-mobl3.jf.intel.com ([10.24.9.33]) by fmsmga004.fm.intel.com with ESMTP; 11 Dec 2018 09:57:03 -0800 Subject: Re: [PATCH v4 2/2] proc: add AVX-512 usage to /proc/pid/status To: Aubrey Li , tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org, hpa@zytor.com Cc: ak@linux.intel.com, dave.hansen@intel.com, arjan@linux.intel.com, linux-kernel@vger.kernel.org, Aubrey Li References: <20181211002448.3520-1-aubrey.li@intel.com> <20181211002448.3520-2-aubrey.li@intel.com> From: Tim Chen Message-ID: <6d6af89a-4490-ffc3-9c16-90cbec2b1300@linux.intel.com> Date: Tue, 11 Dec 2018 09:57:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181211002448.3520-2-aubrey.li@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10/18 4:24 PM, Aubrey Li wrote: > AVX-512 components usage could cause core turbo frequency drop. So > it's useful to expose AVX-512 components usage as a heuristic hint > for the user space job scheduler to cluster the AVX-512 using tasks > together. > > Example: > $ cat /proc/pid/status | grep AVX512_hint > AVX512_hint: 1 > > The hint number '0' indicates the task recently didn't use AVX-512 > components thus unlikely has frequency drop issue. And the number '1' > indicates the task recently used AVX-512 components thus could cause > core frequency drop. User space tools may want to further check by: > > $ perf stat --pid -e core_power.lvl2_turbo_license -- sleep 1 > > Performance counter stats for process id '3558': > > 3,251,565,961 core_power.lvl2_turbo_license > > 1.004031387 seconds time elapsed > > Non-zero counter value confirms that the task causes frequency drop. > > Signed-off-by: Aubrey Li > Cc: Peter Zijlstra > Cc: Andi Kleen > Cc: Tim Chen > Cc: Dave Hansen > Cc: Arjan van de Ven > --- > arch/x86/kernel/fpu/xstate.c | 19 +++++++++++++++++++ > fs/proc/array.c | 5 +++++ > 2 files changed, 24 insertions(+) > > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c > index 87a57b7642d3..98baa47c97b0 100644 > --- a/arch/x86/kernel/fpu/xstate.c > +++ b/arch/x86/kernel/fpu/xstate.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -1245,3 +1246,21 @@ int copy_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf) > > return 0; > } > + > +/* > + * Report CPU specific thread state > + */ > +void arch_task_state(struct seq_file *m, struct task_struct *task) > +{ > + /* > + * Check the processor and build option if AVX512 is supported. > + */ > + if (!cpu_feature_enabled(X86_FEATURE_AVX512F)) > + return; > + /* > + * Report AVX-512 components usage: > + */ > + seq_put_decimal_ull(m, "AVX512_hint:\t", > + task->thread.fpu.avx512_usage ? 1 : 0); I believe you need some kind of documentation of this new interface in kernel's Documentation. So an admin doesn't need to look into the kernel code to figure out what this /proc/pid/status is supposed to do. Tim