Skip to contentSkip to conversation

Longhaul - call suspend(PMSG_FREEZE) before and resume() after

PATCH In review Rafał Bilski 2 participants 2 messages May 27, 2006 – May 28, 2006 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Longhaul - call suspend(PMSG_FREEZE) before and resume() after

I posted this to Dave Jones, but:

Quoted 3 lines

This really should also get posted to linux-kernel, though I don't think people are going to be particularly enthusiastic about exposing these innards to modules.

So I'm posting this patch here too. I'm not subscribed to this list. If You wish email me.
Minor change: preempt_disabled() goto_sleep_pci() and wakeup_pci() causes "sheduling while atomic". So in this patch below it isn't preempt_disabled(). But I think that this should be protected in some way.

How it works:
1. Call suspend(PMSG_FREEZE) for each block device.
2. Call suspend(PMSG_FREEZE) for each PCI device.
3. Change CPU frequency.
4. Call resume() for each PCI device.
5. Call resume() for each block device.

Result: No more broken DMA transfers caused by frequency change.

arch/i386/kernel/cpu/cpufreq/Kconfig +0 -1
diff -uprN -X linux-2.6.16.18-vanilla/Documentation/dontdiff linux-2.6.16.18-vanilla/arch/i386/kernel/cpu/cpufreq/Kconfig linux-2.6.16.18/arch/i386/kernel/cpu/cpufreq/Kconfig
@@ -203,7 +203,6 @@ config X86_LONGRUN
 config X86_LONGHAUL
 	tristate "VIA Cyrix III Longhaul"
 	select CPU_FREQ_TABLE
-	depends on BROKEN
 	help
 	  This adds the CPUFreq driver for VIA Samuel/CyrixIII, 
 	  VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T 
arch/i386/kernel/cpu/cpufreq/longhaul.c +161 -59

271 lines not on this page · raw message

block/genhd.c +5 -3
diff -uprN -X linux-2.6.16.18-vanilla/Documentation/dontdiff linux-2.6.16.18-vanilla/block/genhd.c linux-2.6.16.18/block/genhd.c
@@ -16,9 +16,9 @@
 #include <linux/kobj_map.h>
 #include <linux/buffer_head.h>
 
-static struct subsystem block_subsys;
+struct subsystem block_subsys;
 
-static DECLARE_MUTEX(block_subsys_sem);
+DECLARE_MUTEX(block_subsys_sem);
 
 /*
  * Can be deleted altogether. Later.
@@ -511,8 +511,10 @@ static struct kset_uevent_ops block_ueve
 };
 
 /* declare block_subsys. */
-static decl_subsys(block, &ktype_block, &block_uevent_ops);
+decl_subsys(block, &ktype_block, &block_uevent_ops);
 
+EXPORT_SYMBOL(block_subsys);
+EXPORT_SYMBOL(block_subsys_sem);
 
 /*
  * aggregate disk stat collector.  Uses the same stats that the sysfs

----------------------------------------------------------------------
Tysiace zdjec swietnych samochodow! >>> http://link.interia.pl/f1944

#1 lore raw

Hi!

Quoted 10 lines

I posted this to Dave Jones, but:

Quoted 3 lines

This really should also get posted to linux-kernel, though I don't think people are going to be particularly enthusiastic about exposing these innards to modules.

So I'm posting this patch here too. I'm not subscribed to this list. If You wish email me.
Minor change: preempt_disabled() goto_sleep_pci() and wakeup_pci() causes "sheduling while atomic". So in this patch below it isn't preempt_disabled(). But I think that this should be protected in some way.

Well, suspend/resume is normally called during system suspend/resume, so it has 'interesting' locking requirements.

Quoted 8 lines

How it works:
1. Call suspend(PMSG_FREEZE) for each block device.
2. Call suspend(PMSG_FREEZE) for each PCI device.
3. Change CPU frequency.
4. Call resume() for each PCI device.
5. Call resume() for each block device.

Result: No more broken DMA transfers caused by frequency change.

Result: system hang if userspace tries to do request at the same time -- PCI drivers probably were not designed for _that_... but we probably want to fix them, anyway, so this is probably ok (but expect to do some driver debugging).

But you should really add that preempt_disable and not try this on smp system...
Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.