cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: cpufreq@lists.linux.org.uk
Subject: Re: [PATCH] return error when failing to set minfreq
Date: Tue, 6 Jun 2006 10:32:25 +0200	[thread overview]
Message-ID: <20060606083225.GA9351@dominikbrodowski.de> (raw)
In-Reply-To: <20060605183147.GD8603@inferi.kami.home>

On Mon, Jun 05, 2006 at 08:31:48PM +0200, Mattia Dongili wrote:
> Hello,
> 
> no comment on the following?
> 
> On Fri, May 26, 2006 at 12:34:04AM +0200, Mattia Dongili wrote:
> > Hello,
> > I just stumbled on this bug/feature, this is how to reproduce it:
> > 
> > # echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
> > # echo 450000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
> > # echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> > # cpufreq-info -p
> > 450000 450000 powersave
> > # echo 1800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq ; echo $?
> > 0
> > # cpufreq-info -p             
> > 450000 450000 powersave
> > 
> > Here it is. The kernel refuses to set a min_freq higher than the
> > max_freq but it allows a max_freq lower than min_freq (lowering min_freq
> > also).
> > 
> > I'm unsure if things could be improved here.  The offending instruction
> > is in cpufreq_verify_within_limits (cpufreq.h:241):
> > 
> > 	if (policy->min > policy->max)
> >                 policy->min = policy->max;
> > 
> > This behaviour is pretty straightforward (but undocumented) and it
> > doesn't return an error altough failing to accomplish the requested
> > action (set min_freq).
> > The problem (IMO) is basically that userspace is not allowed to set a
> > full policy atomically while the kernel always does that thus it must
> > enforce an ordering on operations.
> > 
> > The attached patch returns -EINVAL if trying to increase frequencies
> > starting from scaling_min_freq and documents the correct ordering of
> > writes.
> > 
> > Signed-off-by: Mattia Dongili <malattia@linux.it>

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

Thanks,
	Dominik

  reply	other threads:[~2006-06-06  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-25 22:34 [PATCH] return error when failing to set minfreq Mattia Dongili
2006-06-05 18:31 ` Mattia Dongili
2006-06-06  8:32   ` Dominik Brodowski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-07-05 21:12 Mattia Dongili
2006-07-05 21:21 ` Dave Jones

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=20060606083225.GA9351@dominikbrodowski.de \
    --to=linux@dominikbrodowski.net \
    --cc=cpufreq@lists.linux.org.uk \
    /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