CINXE.COM

LKML: Thomas Renninger: Re: [PATCH 2/2] _PPC frequency change issues

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Thomas Renninger: Re: [PATCH 2/2] _PPC frequency change issues</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Thomas Renninger" href="/groupie.php?aid=24015" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2006"> [2006]</a> 聽 <a class="nb" href="/lkml/2006/1"> [Jan]</a> 聽 <a class="nb" href="/lkml/2006/1/25"> [25]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2006/1/25/173" onclick="this.href='/lkml/headers'+'/2006/1/25/173';">[headers]</a>聽 <a href="/lkml/bounce/2006/1/25/173">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2006/1/24/132">First message in thread</a></li><li><a href="/lkml/2006/1/24/132">"Pallipadi, Venkatesh"</a><ul><li class="origin"><a href="">Thomas Renninger</a></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2006/1/25/173/1">Get diff 1</a></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">From</td><td class="rp" itemprop="author">Thomas Renninger &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: [PATCH 2/2] _PPC frequency change issues</td></tr><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Wed, 25 Jan 2006 18:39:30 +0100</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">On Tuesday 24 January 2006 18:06, Pallipadi, Venkatesh wrote:<br />&gt; Thanks for identifying the issues and sendint these patches Thomas.<br />&gt;<br />&gt; Patch 1 looks clean. New lines seem to contain spaces instead of tabs.<br />&gt; The same issue is there in patch 2 as well. Can you resent it with<br />&gt; indentation fixed.<br />&gt;<br />&gt; Patch 2 I am concenred with following hunk.<br />&gt;<br />&gt; &#64;&#64; -161,16 +158,17 &#64;&#64;<br />&gt; cpu_max_freq[cpu] = policy-&gt;max;<br />&gt; dprintk("limit event for cpu %u: %u - %u kHz, currently<br />&gt; %u kHz, last set to %u kHz\n", cpu, cpu_min_freq[cpu],<br />&gt; cpu_max_freq[cpu], cpu_cur_freq[cpu], cpu_set_freq[cpu]);<br />&gt; if (policy-&gt;max &lt; cpu_set_freq[cpu]) {<br />&gt; - __cpufreq_driver_target(&amp;current_policy[cpu],<br />&gt; policy-&gt;max,<br />&gt; - CPUFREQ_RELATION_H);<br />&gt; + if (!__cpufreq_driver_target(policy, policy-&gt;max,<br />&gt; + CPUFREQ_RELATION_H))<br />&gt; + cpu_cur_freq[cpu] = policy-&gt;max;<br />&gt;<br />&gt; Should this me cpu_cur_freq[cpu] = policy-&gt;cur instead. As the max<br />&gt; setting may not be supported by the driver, it might have set some<br />&gt; closer available freq<br />&gt;<br />&gt; Same comment for below two driver target calls as well.<br />Ok, I all (cpu_max/min/cur_freq) assigned it after setting, this should be OK?<br /><br />Seems as if I had some wrong indentation offset set and had not checked<br />the patch output itself, sorry about that.<br /><br />Tell me if you still see any problems ...<br /><br />Author: Thomas Renninger &lt;trenn&#64;suse.de&gt;<br /><br />userspace governor need not to hold it's own cpufreq_policy,<br />better make use of the global core policy.<br />Also fixes a bug in case of frequency changes via _PPC.<br />Old min/max values have wrongly been passed to __cpufreq_driver_target()<br />(kind of buffered) and when max freq was available again, only the old<br />max(normally lowest freq) was still active.<br /><br />cpufreq_userspace.c | 52 <br />+++++++++++++++++++++++++++-------------------------<br /> 1 files changed, 27 insertions(+), 25 deletions(-)<br /><br />Index: linux-2.6.15/drivers/cpufreq/cpufreq_userspace.c<br />===================================================================<br />--- linux-2.6.15.orig/drivers/cpufreq/cpufreq_userspace.c<br />+++ linux-2.6.15/drivers/cpufreq/cpufreq_userspace.c<br />&#64;&#64; -33,7 +33,6 &#64;&#64; static unsigned int cpu_min_freq[NR_CPUS<br /> static unsigned int cpu_cur_freq[NR_CPUS]; /* current CPU freq */<br /> static unsigned int cpu_set_freq[NR_CPUS]; /* CPU freq desired by userspace <br />*/<br /> static unsigned int cpu_is_managed[NR_CPUS];<br />-static struct cpufreq_policy current_policy[NR_CPUS];<br /> <br /> static DECLARE_MUTEX (userspace_sem); <br /> <br />&#64;&#64; -64,22 +63,22 &#64;&#64; static struct notifier_block userspace_c<br /> *<br /> * Sets the CPU frequency to freq.<br /> */<br />-static int cpufreq_set(unsigned int freq, unsigned int cpu)<br />+static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy)<br /> {<br /> int ret = -EINVAL;<br /> <br />- dprintk("cpufreq_set for cpu %u, freq %u kHz\n", cpu, freq);<br />+ dprintk("cpufreq_set for cpu %u, freq %u kHz\n", policy-&gt;cpu, freq);<br /> <br /> down(&amp;userspace_sem);<br />- if (!cpu_is_managed[cpu])<br />+ if (!cpu_is_managed[policy-&gt;cpu])<br /> goto err;<br /> <br />- cpu_set_freq[cpu] = freq;<br />+ cpu_set_freq[policy-&gt;cpu] = freq;<br /> <br />- if (freq &lt; cpu_min_freq[cpu])<br />- freq = cpu_min_freq[cpu];<br />- if (freq &gt; cpu_max_freq[cpu])<br />- freq = cpu_max_freq[cpu];<br />+ if (freq &lt; cpu_min_freq[policy-&gt;cpu])<br />+ freq = cpu_min_freq[policy-&gt;cpu];<br />+ if (freq &gt; cpu_max_freq[policy-&gt;cpu])<br />+ freq = cpu_max_freq[policy-&gt;cpu];<br /> <br /> /*<br /> * We're safe from concurrent calls to -&gt;target() here<br />&#64;&#64; -88,8 +87,7 &#64;&#64; static int cpufreq_set(unsigned int freq<br /> * A: cpufreq_set (lock userspace_sem) -&gt; cpufreq_driver_target(lock <br />policy-&gt;lock)<br /> * B: cpufreq_set_policy(lock policy-&gt;lock) -&gt; __cpufreq_governor -&gt; <br />cpufreq_governor_userspace (lock userspace_sem)<br /> */<br />- ret = __cpufreq_driver_target(&amp;current_policy[cpu], freq, <br />- CPUFREQ_RELATION_L);<br />+ ret = __cpufreq_driver_target(policy, freq, CPUFREQ_RELATION_L);<br /> <br /> err:<br /> up(&amp;userspace_sem);<br />&#64;&#64; -113,7 +111,7 &#64;&#64; store_speed (struct cpufreq_policy *poli<br /> if (ret != 1)<br /> return -EINVAL;<br /> <br />- cpufreq_set(freq, policy-&gt;cpu);<br />+ cpufreq_set(freq, policy);<br /> <br /> return count;<br /> }<br />&#64;&#64; -141,7 +139,6 &#64;&#64; static int cpufreq_governor_userspace(st<br /> cpu_cur_freq[cpu] = policy-&gt;cur;<br /> cpu_set_freq[cpu] = policy-&gt;cur;<br /> sysfs_create_file (&amp;policy-&gt;kobj, &amp;freq_attr_scaling_setspeed.attr);<br />- memcpy (&amp;current_policy[cpu], policy, sizeof(struct cpufreq_policy));<br /> dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, <br />cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]);<br /> up(&amp;userspace_sem);<br /> break;<br />&#64;&#64; -157,20 +154,25 &#64;&#64; static int cpufreq_governor_userspace(st<br /> break;<br /> case CPUFREQ_GOV_LIMITS:<br /> down(&amp;userspace_sem);<br />- cpu_min_freq[cpu] = policy-&gt;min;<br />- cpu_max_freq[cpu] = policy-&gt;max;<br />- dprintk("limit event for cpu %u: %u - %u kHz, currently %u kHz, last set to <br />%u kHz\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu], <br />cpu_set_freq[cpu]);<br />+ dprintk("limit event for cpu %u: %u - %u kHz,"<br />+ "currently %u kHz, last set to %u kHz\n",<br />+ cpu, policy-&gt;min, policy-&gt;max,<br />+ cpu_cur_freq[cpu], cpu_set_freq[cpu]);<br /> if (policy-&gt;max &lt; cpu_set_freq[cpu]) {<br />- __cpufreq_driver_target(&amp;current_policy[cpu], policy-&gt;max, <br />- CPUFREQ_RELATION_H);<br />- } else if (policy-&gt;min &gt; cpu_set_freq[cpu]) {<br />- __cpufreq_driver_target(&amp;current_policy[cpu], policy-&gt;min, <br />- CPUFREQ_RELATION_L);<br />- } else {<br />- __cpufreq_driver_target(&amp;current_policy[cpu], cpu_set_freq[cpu],<br />- CPUFREQ_RELATION_L);<br />+ __cpufreq_driver_target(policy, policy-&gt;max,<br />+ CPUFREQ_RELATION_H);<br />+ }<br />+ else if (policy-&gt;min &gt; cpu_set_freq[cpu]) {<br />+ __cpufreq_driver_target(policy, policy-&gt;min,<br />+ CPUFREQ_RELATION_L);<br />+ }<br />+ else {<br />+ __cpufreq_driver_target(policy, cpu_set_freq[cpu],<br />+ CPUFREQ_RELATION_L);<br /> }<br />- memcpy (&amp;current_policy[cpu], policy, sizeof(struct cpufreq_policy));<br />+ cpu_min_freq[cpu] = policy-&gt;min;<br />+ cpu_max_freq[cpu] = policy-&gt;max;<br />+ cpu_cur_freq[cpu] = policy-&gt;cur;<br /> up(&amp;userspace_sem);<br /> break;<br /> }<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo&#64;vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2006-01-25 18:41 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10