public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Guenter Roeck <linux@roeck-us.net>,
	Jean Delvare <jdelvare@suse.de>, <linux-hwmon@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <spg_linux_kernel@amd.com>
Subject: Re: [PATCH v5 2/6] hwmon: (fam15h_power) Add compute unit accumulated power
Date: Tue, 29 Mar 2016 11:02:27 +0800	[thread overview]
Message-ID: <20160329030225.GA18406@hr-amur2> (raw)
In-Reply-To: <20160328092952.GB26651@pd.tnic>

On Mon, Mar 28, 2016 at 11:29:52AM +0200, Borislav Petkov wrote:
> On Mon, Mar 28, 2016 at 01:32:12PM +0800, Huang Rui wrote:
> > +
> > +	get_online_cpus();
> > +	this_cpu = get_cpu();
> 
> What now?
> 
> get_online_cpus() is enough.
> 

Will remove get_cpu().

> > +
> > +	/*
> > +	 * Choose the first online core of each compute unit, and then
> > +	 * read their MSR value of power and ptsc in a single IPI,
> > +	 * because the MSR value of CPU core represent the compute
> > +	 * unit's.
> > +	 */
> > +	for_each_online_cpu(cpu) {
> > +		target = cpumask_first(topology_sibling_cpumask(cpu));
> > +		if (!cpumask_test_cpu(target, mask))
> > +			cpumask_set_cpu(target, mask);
> > +	}
> 
> I think you want something like this: iterate over each core and put one
> of them into the mask.
> 
> 	core = -1;
> 
> 	for_each_online_cpu(cpu) {
> 		this_core = topology_core_id(cpu);
> 
> 		if (this_core == core)
> 			continue;
> 
> 		core = this_core;
> 
> 		/* get any CPU on this compute unit */
> 		cpumask_set_cpu(cpumask_any(topology_sibling_cpumask(cpu)), mask);
> 	}
> 

Yep, with new x86 topology for core on AMD, using this way should be
more clear.

Thanks,
Rui

  reply	other threads:[~2016-03-29  3:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28  5:32 [PATCH v5 0/6] hwmon: (fam15h_power) Introduce an accumulated power reporting algorithm Huang Rui
2016-03-28  5:32 ` [PATCH v5 1/6] hwmon: (fam15h_power) Add CPU_SUP_AMD as the dependence Huang Rui
2016-03-28  8:59   ` Borislav Petkov
2016-03-28  5:32 ` [PATCH v5 2/6] hwmon: (fam15h_power) Add compute unit accumulated power Huang Rui
2016-03-28  9:29   ` Borislav Petkov
2016-03-29  3:02     ` Huang Rui [this message]
2016-03-29  7:31     ` Peter Zijlstra
2016-03-29  7:57       ` Borislav Petkov
2016-03-28  5:32 ` [PATCH v5 3/6] hwmon: (fam15h_power) Add ptsc counter value for " Huang Rui
2016-03-28  5:32 ` [PATCH v5 4/6] hwmon: (fam15h_power) Introduce a cpu accumulated power reporting algorithm Huang Rui
2016-03-28  9:33   ` Borislav Petkov
2016-03-29  3:28     ` Huang Rui
2016-03-29  7:25       ` Borislav Petkov
2016-03-28  5:32 ` [PATCH v5 5/6] hwmon: (fam15h_power) Add documentation for TDP and accumulated power algorithm Huang Rui
2016-03-28  5:32 ` [PATCH v5 6/6] hwmon: (fam15h_power) Add platform check function Huang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160329030225.GA18406@hr-amur2 \
    --to=ray.huang@amd.com \
    --cc=bp@alien8.de \
    --cc=jdelvare@suse.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peterz@infradead.org \
    --cc=spg_linux_kernel@amd.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox