linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the workqueues tree with the pm tree
@ 2012-09-19  3:56 Stephen Rothwell
  2012-09-19 18:38 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2012-09-19  3:56 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-next, linux-kernel, Matthew Garrett, Andre Przywara,
	Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 5090 bytes --]

Hi Tejun,

Today's linux-next merge of the workqueues tree got a conflict in
drivers/cpufreq/powernow-k8.c between commit e1f0b8e9b04a ("cpufreq:
Remove support for hardware P-state chips from powernow-k8") from the pm
tree and commit 5d7efe7bf90f ("cpufreq/powernow-k8: workqueue user
shouldn't migrate the kworker to another CPU") from the workqueues tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/cpufreq/powernow-k8.c
index 0b19faf,1a40935..0000000
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@@ -978,11 -1104,52 +977,18 @@@ static int transition_frequency_fidvid(
  	return res;
  }
  
- /* Driver entry point to switch to the target frequency */
- static int powernowk8_target(struct cpufreq_policy *pol,
- 		unsigned targfreq, unsigned relation)
 -/* Take a frequency, and issue the hardware pstate transition command */
 -static int transition_frequency_pstate(struct powernow_k8_data *data,
 -		unsigned int index)
 -{
 -	u32 pstate = 0;
 -	int res, i;
 -	struct cpufreq_freqs freqs;
 -
 -	pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index);
 -
 -	/* get MSR index for hardware pstate transition */
 -	pstate = index & HW_PSTATE_MASK;
 -	if (pstate > data->max_hw_pstate)
 -		return -EINVAL;
 -
 -	freqs.old = find_khz_freq_from_pstate(data->powernow_table,
 -			data->currpstate);
 -	freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 -
 -	for_each_cpu(i, data->available_cores) {
 -		freqs.cpu = i;
 -		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
 -	}
 -
 -	res = transition_pstate(data, pstate);
 -	freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 -
 -	for_each_cpu(i, data->available_cores) {
 -		freqs.cpu = i;
 -		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 -	}
 -	return res;
 -}
 -
+ struct powernowk8_target_arg {
+ 	struct cpufreq_policy		*pol;
+ 	unsigned			targfreq;
+ 	unsigned			relation;
+ };
+ 
+ static long powernowk8_target_fn(void *arg)
  {
- 	cpumask_var_t oldmask;
+ 	struct powernowk8_target_arg *pta = arg;
+ 	struct cpufreq_policy *pol = pta->pol;
+ 	unsigned targfreq = pta->targfreq;
+ 	unsigned relation = pta->relation;
  	struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
  	u32 checkfid;
  	u32 checkvid;
@@@ -1017,17 -1171,20 +1010,17 @@@
  		pol->cpu, targfreq, pol->min, pol->max, relation);
  
  	if (query_current_values_with_pending_wait(data))
- 		goto err_out;
+ 		return -EIO;
  
 -	if (cpu_family != CPU_HW_PSTATE) {
 -		pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
 -		data->currfid, data->currvid);
 +	pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
 +		 data->currfid, data->currvid);
  
 -		if ((checkvid != data->currvid) ||
 -		    (checkfid != data->currfid)) {
 -			printk(KERN_INFO PFX
 -				"error - out of sync, fix 0x%x 0x%x, "
 -				"vid 0x%x 0x%x\n",
 -				checkfid, data->currfid,
 -				checkvid, data->currvid);
 -		}
 +	if ((checkvid != data->currvid) ||
 +	    (checkfid != data->currfid)) {
 +		pr_info(PFX
 +		       "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n",
 +		       checkfid, data->currfid,
 +		       checkvid, data->currvid);
  	}
  
  	if (cpufreq_frequency_table_target(pol, data->powernow_table,
@@@ -1038,23 -1195,42 +1031,35 @@@
  
  	powernow_k8_acpi_pst_values(data, newstate);
  
 -	if (cpu_family == CPU_HW_PSTATE)
 -		ret = transition_frequency_pstate(data,
 -			data->powernow_table[newstate].index);
 -	else
 -		ret = transition_frequency_fidvid(data, newstate);
 +	ret = transition_frequency_fidvid(data, newstate);
 +
  	if (ret) {
  		printk(KERN_ERR PFX "transition frequency failed\n");
- 		ret = 1;
  		mutex_unlock(&fidvid_mutex);
- 		goto err_out;
+ 		return 1;
  	}
  	mutex_unlock(&fidvid_mutex);
  
 -	if (cpu_family == CPU_HW_PSTATE)
 -		pol->cur = find_khz_freq_from_pstate(data->powernow_table,
 -				data->powernow_table[newstate].index);
 -	else
 -		pol->cur = find_khz_freq_from_fid(data->currfid);
 +	pol->cur = find_khz_freq_from_fid(data->currfid);
- 	ret = 0;
  
- err_out:
- 	set_cpus_allowed_ptr(current, oldmask);
- 	free_cpumask_var(oldmask);
- 	return ret;
+ 	return 0;
+ }
+ 
+ /* Driver entry point to switch to the target frequency */
+ static int powernowk8_target(struct cpufreq_policy *pol,
+ 		unsigned targfreq, unsigned relation)
+ {
+ 	struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq,
+ 					     .relation = relation };
+ 
+ 	/*
+ 	 * Must run on @pol->cpu.  cpufreq core is responsible for ensuring
+ 	 * that we're bound to the current CPU and pol->cpu stays online.
+ 	 */
+ 	if (smp_processor_id() == pol->cpu)
+ 		return powernowk8_target_fn(&pta);
+ 	else
+ 		return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
  }
  
  /* Driver entry point to verify the policy and range of frequencies */

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: linux-next: manual merge of the workqueues tree with the pm tree
  2012-09-19  3:56 linux-next: manual merge of the workqueues tree with the pm tree Stephen Rothwell
@ 2012-09-19 18:38 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2012-09-19 18:38 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-kernel, Matthew Garrett, Andre Przywara,
	Rafael J. Wysocki

On Wed, Sep 19, 2012 at 01:56:25PM +1000, Stephen Rothwell wrote:
> Hi Tejun,
> 
> Today's linux-next merge of the workqueues tree got a conflict in
> drivers/cpufreq/powernow-k8.c between commit e1f0b8e9b04a ("cpufreq:
> Remove support for hardware P-state chips from powernow-k8") from the pm
> tree and commit 5d7efe7bf90f ("cpufreq/powernow-k8: workqueue user
> shouldn't migrate the kworker to another CPU") from the workqueues tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).

Yeap, looks correct to me.  FYI, the change is likely to be pulled
into 3.6-rc6 soonish.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-19 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-19  3:56 linux-next: manual merge of the workqueues tree with the pm tree Stephen Rothwell
2012-09-19 18:38 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).