Received: by 10.223.164.202 with SMTP id h10csp406279wrb; Thu, 9 Nov 2017 08:08:45 -0800 (PST) X-Google-Smtp-Source: ABhQp+TOpys4TceGE6OrVh12ys8Ae2/ef66+QukHkNA1T8si/sAW4Sc1gVlZ23cz+eN8SG38tFwM X-Received: by 10.159.234.2 with SMTP id be2mr887443plb.125.1510243725494; Thu, 09 Nov 2017 08:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510243725; cv=none; d=google.com; s=arc-20160816; b=t3hVBFei8uYvOOGKd5dLPpDWCNodPRA1oEWVgPx6qveXZ4XLyKrIct39OwLtXRe03J VBUOF/RzmWJsZr7aWNh1RnEga/Id5zXxcdVv4VdI90FAvYLEMYnV5X0EN6cMENpLDJPs RXZcG/pA1xbJqJGr2+QQ3w+gOoZ8xqf073qoeRkBja+rDSPPJAZa9It4Jaz7e6cVXRHl drlPJLb2oBuyjj323Ci93O9B+VePe+yrUrsSql1Kt5fHqjs6nq+MLJoeV8O2gRLNHJPX k6ns/9MxykAmZaeK/Lk64ZCNiQorBqSm2fIsBUSr9zKg9rFPNsFr2Ag08xNEAbrchnhM Ljkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=8wiRA9+dosvcGAD6VtuuuePD60v+f+DGj7sRYPo1KEw=; b=wLiZ2tIk6ws8xM5Ce1ZGB8hjBvS86yiamlPbvaFzYSPLq0xxKsouHEpnZ63H4wr+YT 92GvadgfmIHc26JLzqXstmbSxv+7S7YKGposIPMXDc8ZoNCrq5fu+oUgET/8KUiFue9w QZnDEuN1SG1FDy/9xEoD6LNiBmJrFygDfA9DFx9FagCSDtXFIiESiwG6aRygqXxRICYq ng3FN7ZKM323jXNUoUWynmn9YtDS54c0nhTv6W7yzCYNX7n6jHFXE26Ttvui7jgSGSAc OhFUqM7TB5r2dwtZ/t1nQZ/QMohRLFxDVtOZ+xVblKjOiIYhiV0fRuUcCGyhNM4/Fecp 94bA== 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 v64si6336182pgd.540.2017.11.09.08.08.34; Thu, 09 Nov 2017 08:08:45 -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 S1753311AbdKIQGt (ORCPT + 81 others); Thu, 9 Nov 2017 11:06:49 -0500 Received: from mga06.intel.com ([134.134.136.31]:58332 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbdKIQGq (ORCPT ); Thu, 9 Nov 2017 11:06:46 -0500 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 09 Nov 2017 08:06:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="171678109" Received: from dcasali-mobl1.amr.corp.intel.com (HELO [10.252.33.69]) ([10.252.33.69]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2017 08:06:42 -0800 Subject: Re: [PATCH] x86: use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz" again To: WANG Chao , Linus Torvalds Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Vikas Shivappa , Kate Stewart , Len Brown , Greg Kroah-Hartman , Philippe Ombredanne , Mathias Krause , x86@kernel.org, "Rafael J. Wysocki" , Linux PM References: <20171109103814.70688-1-chao.wang@ucloud.cn> From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: <6583ed1f-3ea3-c7fd-7e69-1430c8387e54@intel.com> Date: Thu, 9 Nov 2017 17:06:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171109103814.70688-1-chao.wang@ucloud.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On 11/9/2017 11:38 AM, WANG Chao wrote: > Commit 941f5f0f6ef5 (x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo) caused > a serious performance issue when reading from /proc/cpuinfo on system > with aperfmperf. > > For each cpu, arch_freq_get_on_cpu() sleeps 20ms to get its frequency. > On a system with 64 cpus, it takes 1.5s to finish running `cat > /proc/cpuinfo`, while it previously was done in 15ms. Honestly, I'm not sure what to do to address this ATM. The last requested frequency is only available in the non-HWP case, so it cannot be used universally. > Some programs use /proc/cpuinfo during startup or runtime, eg. QEMU. > This patch will restore the previous behavior and let user space happy. > > Fixes: 941f5f0f6ef5 (x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo) > Cc: stable@kernel.org # 4.13 > Signed-off-by: WANG Chao > --- > arch/x86/kernel/cpu/Makefile | 2 +- > arch/x86/kernel/cpu/proc.c | 4 +--- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile > index 236999c54edc..c60922a66385 100644 > --- a/arch/x86/kernel/cpu/Makefile > +++ b/arch/x86/kernel/cpu/Makefile > @@ -22,7 +22,7 @@ obj-y += common.o > obj-y += rdrand.o > obj-y += match.o > obj-y += bugs.o > -obj-y += aperfmperf.o > +obj-$(CONFIG_CPU_FREQ) += aperfmperf.o > > obj-$(CONFIG_PROC_FS) += proc.o > obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o > diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c > index 4378a729b933..6b7e17bf0b71 100644 > --- a/arch/x86/kernel/cpu/proc.c > +++ b/arch/x86/kernel/cpu/proc.c > @@ -78,10 +78,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) > seq_printf(m, "microcode\t: 0x%x\n", c->microcode); > > if (cpu_has(c, X86_FEATURE_TSC)) { > - unsigned int freq = arch_freq_get_on_cpu(cpu); > + unsigned int freq = cpufreq_quick_get(cpu); > > - if (!freq) > - freq = cpufreq_quick_get(cpu); > if (!freq) > freq = cpu_khz; > seq_printf(m, "cpu MHz\t\t: %u.%03u\n", From 1583585028718999665@xxx Thu Nov 09 10:46:09 +0000 2017 X-GM-THRID: 1583585028718999665 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread