From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754011AbcCAN6o (ORCPT ); Tue, 1 Mar 2016 08:58:44 -0500 Received: from mail.skyhub.de ([78.46.96.112]:47093 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753859AbcCAN6n (ORCPT ); Tue, 1 Mar 2016 08:58:43 -0500 Date: Tue, 1 Mar 2016 14:58:39 +0100 From: Borislav Petkov To: Thomas Gleixner , Huang Rui Cc: 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 , Fengguang Wu , Guenter Roeck Subject: Re: [PATCH v5] perf/x86/amd/power: Add AMD accumulated power reporting mechanism Message-ID: <20160301135838.GA22677@pd.tnic> References: <1456479650-4942-1-git-send-email-ray.huang@amd.com> <20160229180048.GB20610@hr-amur2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 29, 2016 at 12:30:47PM +0100, Thomas Gleixner wrote: > On Tue, 1 Mar 2016, Huang Rui wrote: > > On Fri, Feb 26, 2016 at 11:18:28AM +0100, Thomas Gleixner wrote: > > > > +static int __init amd_power_pmu_init(void) > > > > +{ > > > > + int i, ret; > > > > + u64 tmp; > > > > + > > > > + if (!x86_match_cpu(cpu_match)) > > > > + return 0; > > > > + > > > > + if (!boot_cpu_has(X86_FEATURE_ACC_POWER)) > > > > + return -ENODEV; > > > > + > > > > + cores_per_cu = amd_get_cores_per_cu(); > > > > + cu_num = boot_cpu_data.x86_max_cores / cores_per_cu; > > > > > > Please use the new package management functions which are on the way to tip. > > > > > Can you give me some hints? > > http://git.kernel.org/tip/1f12e32f4cd5243ae46d8b933181be0d022c6793 > > topology_max_packages() is what you want. Rui, I think you want to use smp_num_siblings here. And we did define that amd_get_cores_per_cu() but that's redundant: /* get compute unit information */ smp_num_siblings = ((ebx >> 8) & 3) + 1; c->compute_unit_id = ebx & 0xff; cores_per_cu += ((ebx >> 8) & 3); So if I'm not missing anything else, we don't need that cores_per_cu variable, nor do we need amd_get_cores_per_cu(). I'll zap this patch from my queue. You can use smp_num_siblings in your patch instead which is exported to everything. Thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.