Skip to contentSkip to conversation

cpufreq/linux/arch/arm/mach-sa1100 cpu-sa1100.c, 1.5,

DISCUSSION Dominik Brodowski 4 participants 11 messages Aug 29, 2004 – Aug 31, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw
Quoted 9 lines

Review

Quoted 4 lines

static struct cpufreq_driver sa1110_driver = {

(quoted diff) +3 -0
+	.flags		= CPUFREQ_STICKY |
+			  CPUFREQ_PANIC_OUTOFSYNC | 		<<<<
+			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,	<<<<

Erm, _why_ ?

This makes very little sense. If you put the system to sleep at 147MHz and it normally boots at 206.4MHz, you'll resume at 206.4MHz.

I added PANIC_OUTOFSYNC because of the following concern: if the CPU clock is different from what the kernel thinks it is, the RAM and LCD and PCMCIA and ... timings might be horribly broken, so better bail out as soon as this critical state is detetected.

With regard to PANIC_RESUME_OUTOFSYNC:

Quoted 3 lines

It's up to the kernel to reset the clock rate itself. This is nothing new - cpufreq has always done this, so why are we adding this new restriction?

cpufreq still does this. However not during sysdev-resume state [because notifiers can sleep], but later. This means the problematic discrepancy (see above) is there, just for a short period of time. If you think it isn't an issue, Bruno's patch to remove both flags is perfectly valid, otherwise these flags do make some sense.

Quoted 6 lines

And to follow that up, yes, I missed it back in June when I added the CPUFREQ_STICKY here. However, I was completely unaware that this change had been made back in May 2004.

Can we please route changes to architecture files via the architecture people _before_ merging them. Pretty please?

Not sending this patch to you for discussion was an oversight, and I apologize for not having done so. After the first patch series [April 11th] didn't generate negative feedback, I -- incorrectly -- assumed everything was in order and asked Dave to merge.

Dominik

NB: sorry for the out-of-thread reply. Delivery of cpufreq list e-mail to my address stopped during a vacation because my ISP bounced too much (spam) mail.

#1 lore raw

Hi Dominik,

Quoted 31 lines · Dominik Brodowski
Quoted 9 lines

Review

Quoted 4 lines

static struct cpufreq_driver sa1110_driver = {

(quoted diff) +3 -0
+	.flags		= CPUFREQ_STICKY |
+			  CPUFREQ_PANIC_OUTOFSYNC | 		<<<<
+			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,	<<<<

Erm, _why_ ?

This makes very little sense. If you put the system to sleep at 147MHz and it normally boots at 206.4MHz, you'll resume at 206.4MHz.

I added PANIC_OUTOFSYNC because of the following concern: if the CPU clock is different from what the kernel thinks it is, the RAM and LCD and PCMCIA and ... timings might be horribly broken, so better bail out as soon as this critical state is detetected.

With regard to PANIC_RESUME_OUTOFSYNC:

Quoted 3 lines

It's up to the kernel to reset the clock rate itself. This is nothing new - cpufreq has always done this, so why are we adding this new restriction?

cpufreq still does this. However not during sysdev-resume state [because notifiers can sleep], but later. This means the problematic discrepancy (see above) is there, just for a short period of time. If you think it isn't an issue, Bruno's patch to remove both flags is perfectly valid, otherwise these flags do make some sense.

Quoted 4 lines

And to follow that up, yes, I missed it back in June when I added the CPUFREQ_STICKY here. However, I was completely unaware that this change had been made back in May 2004.

Quoted 7 lines
Quoted 2 lines

Can we please route changes to architecture files via the architecture people _before_ merging them. Pretty please?

Not sending this patch to you for discussion was an oversight, and I apologize for not having done so. After the first patch series [April 11th] didn't generate negative feedback, I -- incorrectly -- assumed everything was in order and asked Dave to merge.

Well, I don't see actually your points. IIRC arm suspend/resume is only available via apm, so if something goes wrong on this architecture, it's much more likely a trouble of the firmware. IIRC, the only action taken some times ago was to set the frequency to what think the cpufreq infractucture in the resume path, and this was clearly to make arm folks happy.
I actually was thinking all those flags were added more for the i386 architectures, not for arm, but I am apparently completely wrong, I guess..

Cheers,

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#2 lore raw

Hi Bruno,

Quoted 9 lines · Bruno Ducrot

Well, I don't see actually your points. IIRC arm suspend/resume is only available via apm, so if something goes wrong on this architecture, it's much more likely a trouble of the firmware. IIRC, the only action taken some times ago was to set the frequency to what think the cpufreq infractucture in the resume path, and this was clearly to make arm folks happy.
I actually was thinking all those flags were added more for the i386 architectures, not for arm, but I am apparently completely wrong, I guess..

i386 can adapt to "hidden" changes of CPU frequencies quite well now, as the TSC code tries to detect "changes behind its back"... so these flags were not added out of concern for the x86 architecture, but because they seemed necessary for certain systems. Possibly I'm completely wrong, though...

Thanks,
Dominik

#7 lore raw
In reply to Dominik Brodowski
Quoted 11 lines · Dominik Brodowski

With regard to PANIC_RESUME_OUTOFSYNC:

Quoted 3 lines

It's up to the kernel to reset the clock rate itself. This is nothing new - cpufreq has always done this, so why are we adding this new restriction?

cpufreq still does this. However not during sysdev-resume state [because notifiers can sleep], but later. This means the problematic discrepancy (see above) is there, just for a short period of time. If you think it isn't an issue, Bruno's patch to remove both flags is perfectly valid, otherwise these flags do make some sense.

Typically, the boot loader will have a fixed clock speed and RAM timing setting. This means that whenever we resume, we will resume not at the speed the kernel last set, but what we normally boot at. If we normally boot at 206.4MHz, we will resume at 206.4MHz no matter what.

So, with PANIC_RESUME_OUTOFSYNC that seems to mean that we will _always_ panic on resume if cpufreq has been used. Which kind'a makes cpufreq completely useless on these platforms.

Obviously given this information, this flag needs to be removed from ARM. If ARM is the only user, then the flag and associated code needs to be completely removed.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#3 lore raw
In reply to Dominik Brodowski

Hi,

Quoted 5 lines · Dominik Brodowski

i386 can adapt to "hidden" changes of CPU frequencies quite well now, as the TSC code tries to detect "changes behind its back"... so these flags were not added out of concern for the x86 architecture, but because they seemed necessary for certain systems. Possibly I'm completely wrong, though...

Well, for a strange reason, I was thinking all those stuff were made for speedstep-ich and the (non)-merged speedstep-piix4, and maybe the ownership stuff from ACPI.. I was mistaken I guess.

Cheers,

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#4 lore raw
Quoted 9 lines · Bruno Ducrot

Hi,

Quoted 5 lines · Dominik Brodowski

i386 can adapt to "hidden" changes of CPU frequencies quite well now, as the TSC code tries to detect "changes behind its back"... so these flags were not added out of concern for the x86 architecture, but because they seemed necessary for certain systems. Possibly I'm completely wrong, though...

Quoted 3 lines

Well, for a strange reason, I was thinking all those stuff were made for speedstep-ich and the (non)-merged speedstep-piix4, and maybe the ownership stuff from ACPI.. I was mistaken I guess.

The detection of changes behind cpufreq's back yes -- but for the speedstep-ich case, it was supposed to work around critical situations, not to cause panics... If you see a valid point for the PANIC flag for these drivers, please explain it to me, though.

Thanks,

Dominik

#8 lore raw
In reply to Russell King
Quoted 3 lines · Russell King

Obviously given this information, this flag needs to be removed from ARM. If ARM is the only user, then the flag and associated code needs to be completely removed.

Who shall "push" this patch upstreams? Dave or Russell?

The SA1100 and SA1110 platforms can handle situations well where the CPU frequency is different to the value the cpufreq (and timing) code thinks it is, e.g. when resuming from sleep. So, remove the flags noting the opposite.

---

 arch/arm/mach-sa1100/cpu-sa1100.c |    4 +---
 arch/arm/mach-sa1100/cpu-sa1110.c |    4 +---
 drivers/cpufreq/cpufreq.c         |    9 ---------
 include/linux/cpufreq.h           |    7 -------
 4 files changed, 2 insertions(+), 22 deletions(-)
arch/arm/mach-sa1100/cpu-sa1100.c +1 -3
diff -ruN linux-original/arch/arm/mach-sa1100/cpu-sa1100.c linux/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -230,9 +230,7 @@
 }
 
 static struct cpufreq_driver sa1100_driver = {
-	.flags		= CPUFREQ_STICKY |
-			  CPUFREQ_PANIC_OUTOFSYNC | 
-			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,
+	.flags		= CPUFREQ_STICKY,
 	.verify		= sa11x0_verify_speed,
 	.target		= sa1100_target,
 	.get		= sa11x0_getspeed,
arch/arm/mach-sa1100/cpu-sa1110.c +1 -3
diff -ruN linux-original/arch/arm/mach-sa1100/cpu-sa1110.c linux/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -329,9 +329,7 @@
 }
 
 static struct cpufreq_driver sa1110_driver = {
-	.flags		= CPUFREQ_STICKY |
-			  CPUFREQ_PANIC_OUTOFSYNC | 
-			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,
+	.flags		= CPUFREQ_STICKY,
 	.verify		= sa11x0_verify_speed,
 	.target		= sa1110_target,
 	.get		= sa11x0_getspeed,
drivers/cpufreq/cpufreq.c +0 -9
diff -ruN linux-original/drivers/cpufreq/cpufreq.c linux/drivers/cpufreq/cpufreq.c
@@ -157,9 +157,6 @@
 			    (likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&
 			    (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur)))
 			{
-				if (cpufreq_driver->flags & CPUFREQ_PANIC_OUTOFSYNC)
-					panic("CPU Frequency is out of sync.");
-
 				printk(KERN_WARNING "Warning: CPU frequency is %u, "
 				       "cpufreq assumed %u kHz.\n", freqs->old, cpufreq_cpu_data[freqs->cpu]->cur);
 				freqs->old = cpufreq_cpu_data[freqs->cpu]->cur;
@@ -603,9 +600,6 @@
 {
 	struct cpufreq_freqs freqs;
 
-	if (cpufreq_driver->flags & CPUFREQ_PANIC_OUTOFSYNC)
-		panic("CPU Frequency is out of sync.");
-
 	printk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing "
 	       "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
 
@@ -696,9 +690,6 @@
 		if (unlikely(cur_freq != cpu_policy->cur)) {
 			struct cpufreq_freqs freqs;
 
-			if (cpufreq_driver->flags & CPUFREQ_PANIC_RESUME_OUTOFSYNC)
-				panic("CPU Frequency is out of sync.");
-
 			printk(KERN_WARNING "Warning: CPU frequency is %u, "
 			       "cpufreq assumed %u kHz.\n", cur_freq, cpu_policy->cur);
 
include/linux/cpufreq.h +0 -7
diff -ruN linux-original/include/linux/cpufreq.h linux/include/linux/cpufreq.h
@@ -209,13 +209,6 @@
 #define CPUFREQ_CONST_LOOPS 	0x02	/* loops_per_jiffy or other kernel
 					 * "constants" aren't affected by
 					 * frequency transitions */
-#define CPUFREQ_PANIC_OUTOFSYNC	0x04	/* panic if cpufreq's opinion of
-					 * current frequency differs from
-					 * actual frequency */
-#define CPUFREQ_PANIC_RESUME_OUTOFSYNC 0x08 /* panic if cpufreq's opinion of
-					 * current frequency differs from
-					 * actual frequency on resume
-					 * from sleep. */
 
 
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
#5 lore raw
In reply to Dominik Brodowski
Quoted 5 lines

The detection of changes behind cpufreq's back yes -- but for the speedstep-ich case, it was supposed to work around critical situations, not to cause panics... If you see a valid point for the PANIC flag for these drivers, please explain it to me, though.

My english is too bad: _all_ drivers panics but not speedstep-ich, etc.

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#6 lore raw
Quoted 7 lines · Bruno Ducrot
Quoted 5 lines

The detection of changes behind cpufreq's back yes -- but for the speedstep-ich case, it was supposed to work around critical situations, not to cause panics... If you see a valid point for the PANIC flag for these drivers, please explain it to me, though.

My english is too bad: _all_ drivers panics but not speedstep-ich, etc.

The other drivers panicing doesn't seem to be necessary... so I suggest to remove these flags alltogether, as done in the patch sent a few minutes ago.

Dominik

#9 lore raw
In reply to Dominik Brodowski
Quoted 6 lines · Dominik Brodowski
Quoted 3 lines · Russell King

Obviously given this information, this flag needs to be removed from ARM. If ARM is the only user, then the flag and associated code needs to be completely removed.

Who shall "push" this patch upstreams? Dave or Russell?

The patch looks good, thanks.

I think Dave would be better - Dave has been pushing most cpufreq stuff to Linus anyway. Since this is a bug fix rather than a feature, it's definite 2.6.9-rc material.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#10 lore raw
Quoted 6 lines · Russell King
Quoted 5 lines · Dominik Brodowski
Quoted 3 lines · Russell King

Obviously given this information, this flag needs to be removed from ARM. If ARM is the only user, then the flag and associated code needs to be completely removed.

Quoted 7 lines
Quoted 1 line

Who shall "push" this patch upstreams? Dave or Russell?

The patch looks good, thanks.

I think Dave would be better - Dave has been pushing most cpufreq stuff to Linus anyway. Since this is a bug fix rather than a feature, it's definite 2.6.9-rc material.

Merged. I've a handful of other small bits I'm about to merge, and then I'll send Linus a pull request tonight. Should make it in for -rc2 unless Linus surprises me 8-).

Dave