From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758205AbcCCR7Y (ORCPT ); Thu, 3 Mar 2016 12:59:24 -0500 Received: from www.linutronix.de ([62.245.132.108]:60161 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755484AbcCCR7X (ORCPT ); Thu, 3 Mar 2016 12:59:23 -0500 Date: Thu, 3 Mar 2016 18:57:53 +0100 (CET) From: Thomas Gleixner To: Huang Rui cc: Borislav Petkov , Peter Zijlstra , Ingo Molnar , Andy Lutomirski , Robert Richter , Jacob Shin , Arnaldo Carvalho de Melo , Kan Liang , linux-kernel@vger.kernel.org, spg_linux_kernel@amd.com, x86@kernel.org, Suravee Suthikulpanit , Aravind Gopalakrishnan , Borislav Petkov , Fengguang Wu , Guenter Roeck Subject: Re: [PATCH v6 2/2] perf/x86/amd/power: Add AMD accumulated power reporting mechanism In-Reply-To: <20160303161809.GA2791@hr-amur2> Message-ID: References: <1456992284-4808-1-git-send-email-ray.huang@amd.com> <1456992284-4808-3-git-send-email-ray.huang@amd.com> <20160303151357.GA2154@hr-amur2> <20160303161809.GA2791@hr-amur2> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 4 Mar 2016, Huang Rui wrote: > On Thu, Mar 03, 2016 at 04:26:46PM +0100, Thomas Gleixner wrote: > > Why? You do a full for_each_online_cpu(i) loop after that, which does > > exactly the same thing, right? > > > > But looks like power_cpu_init cannot handle it if we don't take any > action here. > > e. g. > cpu_mask: 0000 and online mask: 1111 -> power_cpu_init(0) -> cpu_mask is still: 0000 > > topology_sibling_cpumask(0): 0011 > target: 1 (i. e. we cannot do cpumask_set_cpu(0, &cpu_mask)) Fair enough, but then you don't need the power_cpu_init() call at all. But your loop does not cover anything beyond the first socket. So you need a separate init function which does: for_each_online_cpu(cpu) { target = cpumask_first(topology_sibling_cpumask(cpu)); if (!cpumask_test_cpu(target, cpumask)) cpumask_set_cpu(target, cpumask); } Thanks, tglx