swsusp for 2.5.47 [not for inclusion]
Subsystems (4)
Hi!
This is patch I'm using. With this swsusp in 2.5.47 should work.
Pavel
arch/i386/kernel/Makefile +1 -1
@@ -24,7 +24,7 @@ obj-$(CONFIG_X86_MPPARSE) += mpparse.o obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o -obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o +obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o suspend_asm.o obj-$(CONFIG_X86_NUMAQ) += numaq.o obj-$(CONFIG_PROFILING) += profile.o obj-$(CONFIG_EDD) += edd.o
arch/i386/kernel/acpi.c +1 -0
@@ -542,6 +542,7 @@*/ void acpi_restore_state_mem (void ) { +printk (KERN_CRIT "acpi_restore_state_mem() called\n" );acpi_restore_pmd (); }
arch/i386/kernel/acpi_wakeup.S +50 -3
81 lines not on this page · raw message
arch/i386/kernel/head.S +1 -1
@@ -1,5 +1,5 @@ /* - * linux/arch/i386/head.S -- the 32-bit startup code. + * linux/arch/i386/kernel/head.S -- the 32-bit startup code. * * Copyright (C) 1991, 1992 Linus Torvalds *
arch/i386/kernel/suspend.c +8 -176
237 lines not on this page · raw message
arch/i386/kernel/suspend_asm.S +80 -0
80 lines not on this page · raw message
arch/i386/kernel/traps.c +2 -0
@@ -210,6 +210,7 @@ ss = regs->xss &0xffff ; }print_modules (); +mdelay (1000 );printk ("CPU: %d\nEIP: %04x:[<%08lx>] %s\nEFLAGS: %08lx\n" ,smp_processor_id (),0xffff & regs->xcs, regs->eip,print_tainted (), regs->eflags);
@@ -222,6 +223,7 @@ regs->xds & 0xffff, regs->xes & 0xffff, ss);printk ("Process %s (pid: %d, threadinfo=%p task=%p)" , current->comm, current->pid,current_thread_info (), current); +mdelay (4000 );/* * When in-kernel, we also print out the stack and code at the * time of the fault..
drivers/ide/ide-disk.c +53 -30
125 lines not on this page · raw message
drivers/ide/ide-probe.c +1 -0
@@ -1059,6 +1059,7 @@ "%s","IDE Drive"); drive->gendev.parent = &hwif->gendev; drive->gendev.bus = &ide_bus_type; + drive->gendev.driver_data = drive; sprintf (name, "host%d/bus%d/target%d/lun%d", (hwif->channel && hwif->mate) ? hwif->mate->index : hwif->index,
drivers/ide/ide.c +2 -25
@@ -3122,21 +3122,6 @@#endif } -static int default_standby (ide_drive_t *drive) -{ -return 0 ; -} - -static int default_suspend (ide_drive_t *drive) -{ -return 0 ; -} - -static int default_resume (ide_drive_t *drive) -{ -return 0 ; -} -static int default_flushcache (ide_drive_t *drive) {return 0 ;
@@ -3193,9 +3178,6 @@ {ide_driver_t *d = drive->driver; -if (d->standby ==NULL ) d->standby = default_standby; -if (d->suspend ==NULL ) d->suspend = default_suspend; -if (d->resume ==NULL ) d->resume = default_resume;if (d->flushcache ==NULL ) d->flushcache = default_flushcache;if (d->do_request ==NULL ) d->do_request = default_do_request;if (d->end_request ==NULL ) d->end_request = default_end_request;
@@ -3274,13 +3256,8 @@ide_drive_t * drive =container_of (dev,ide_drive_t,gendev);ide_driver_t * driver = drive->driver; -if (driver) { -if (driver->standby) - driver->standby (drive); -if (driver->cleanup) - driver->cleanup (drive); - } - +if (driver && driver->cleanup) + driver->cleanup (drive);return 0 ; }
drivers/md/md.c +13 -1
@@ -36,6 +36,7 @@#include <linux/bio.h> #include <linux/devfs_fs_kernel.h> #include <linux/buffer_head.h> /* for invalidate_bdev */ +#include <linux/suspend.h> #include <linux/init.h>
@@ -2470,6 +2471,8 @@wait_event_interruptible (thread->wqueue,test_bit (THREAD_WAKEUP , &thread->flags)); +if (current->flags &PF_FREEZE ) +refrigerator (PF_IOTHREAD );clear_bit (THREAD_WAKEUP , &thread->flags);
@@ -2774,7 +2777,7 @@if (!ok) { mddev->recovery_running = -EIO ;md_recover_arrays (); -// stop recovery, signal do_sync .... +/* stop recovery, signal do_sync .... */ } }
@@ -2795,6 +2798,9 @@struct list_head *tmp;unsigned long last_check; +if (current->flags &PF_FREEZE ) +refrigerator (PF_IOTHREAD ); +/* just incase thread restarts... */ if (mddev->recovery_running <=0 )return ;
@@ -2810,6 +2816,9 @@ mddev->curr_resync =2 ; ITERATE_MDDEV(mddev2,tmp) { +if (current->flags &PF_FREEZE ) +refrigerator (PF_IOTHREAD ); +if (mddev2 == mddev)continue ; if (mddev2->curr_resync &&
@@ -2909,6 +2918,9 @@*/ cond_resched (); +if (current->flags &PF_FREEZE ) +refrigerator (PF_IOTHREAD ); + currspeed = (j-mddev->resync_mark_cnt)/2 /((jiffies-mddev->resync_mark)/HZ +1 ) +1 ;if (currspeed > sysctl_speed_limit_min) {
drivers/net/3c59x.c +11 -0
@@ -809,6 +809,9 @@spinlock_t lock;/* Serialise access to device & its vortex_private */ spinlock_t mdio_lock;/* Serialise access to mdio hardware */ u32 power_state[16 ]; +#ifdef CONFIG_PM +int in_suspend; +#endif };/* The action to take with a media selection timer tick.
@@ -893,6 +896,10 @@struct net_device *dev =pci_get_drvdata (pdev);if (dev && dev->priv) { +struct vortex_private *vp = dev->priv; +if (vp->in_suspend) +return 0 ; + vp->in_suspend =1 ;if (netif_running (dev)) {netif_device_detach (dev);vortex_down (dev);
@@ -906,6 +913,10 @@struct net_device *dev =pci_get_drvdata (pdev);if (dev && dev->priv) { +struct vortex_private *vp = dev->priv; +if (!vp->in_suspend) +return 0 ; + vp->in_suspend =1 ;if (netif_running (dev)) {vortex_up (dev);netif_device_attach (dev);
include/asm-i386/suspend.h +6 -3
@@ -15,8 +15,6 @@/* image of the saved processor state */ struct saved_context { -unsigned long eax, ebx, ecx, edx; -unsigned long esp, ebp, esi, edi;u16 es, fs, gs, ss;unsigned long cr0, cr2, cr3, cr4;u16 gdt_pad;
@@ -30,9 +28,14 @@unsigned long tr;unsigned long safety;unsigned long return_address; -unsigned long eflags; } __attribute__((packed)); +/* We'll access these from assembly, so we'd better have them outside struct */ +extern unsigned long saved_context_eax, saved_context_ebx, saved_context_ecx, saved_context_edx; +extern unsigned long saved_context_esp, saved_context_ebp, saved_context_esi, saved_context_edi; +extern unsigned long saved_context_eflags; + +#define loaddebug (thread,register) \ __asm__("movl %0,%%db" #register \ :/* no output */ \
include/linux/ide.h +0 -3
@@ -1189,9 +1189,6 @@ unsigned supports_dma : 1; unsigned supports_dsc_overlap : 1;int (*cleanup)(ide_drive_t *); -int (*standby)(ide_drive_t *); -int (*suspend)(ide_drive_t *); -int (*resume)(ide_drive_t *);int (*flushcache)(ide_drive_t *);ide_startstop_t (*do_request)(ide_drive_t *,struct request *,sector_t );int (*end_request)(ide_drive_t *,int ,int );
kernel/suspend.c +23 -15
@@ -145,10 +145,10 @@/* * Debug */ -#undef DEBUG_DEFAULT +#define DEBUG_DEFAULT #undef DEBUG_PROCESS#undef DEBUG_SLOW -#define TEST_SWSUSP 1/* Set to 1 to reboot instead of halt machine after suspension */ +#define TEST_SWSUSP 0/* Set to 1 to reboot instead of halt machine after suspension */ #ifdef DEBUG_DEFAULT # define PRINTK(f, a...) printk(f, ## a)
@@ -235,6 +235,7 @@ }while (todo);printk ("|\n" ); +BUG_ON (in_atomic ());return 0 ; }
@@ -489,7 +490,6 @@if (PageNosave (page))continue ; -if ((chunk_size=is_head_of_free_region (page))!=0 ) { pfn += chunk_size -1 ;continue ;
@@ -500,9 +500,8 @@/* * Just copy whole code segment. Hopefully it is not that big. */ -if (ADDRESS (pfn) >= (unsigned long ) - &__nosave_begin &&ADDRESS (pfn) < - (unsigned long )&__nosave_end) { +if ((ADDRESS (pfn) >= (unsigned long ) &__nosave_begin) && + (ADDRESS (pfn) < (unsigned long ) &__nosave_end)) {PRINTK ("[nosave %x]" ,ADDRESS (pfn));continue ; }
@@ -549,7 +548,7 @@ pagedir_order =get_bitmask_order (SUSPEND_PD_PAGES (nr_copy_pages)); - p = pagedir = (suspend_pagedir_t *)__get_free_pages (GFP_ATOMIC , pagedir_order); + p = pagedir = (suspend_pagedir_t *)__get_free_pages (GFP_ATOMIC | __GFP_COLD, pagedir_order);if (!pagedir)return NULL ;
@@ -558,11 +557,12 @@SetPageNosave (page++);while (nr_copy_pages--) { - p->address =get_zeroed_page (GFP_ATOMIC ); + p->address =get_zeroed_page (GFP_ATOMIC | __GFP_COLD);if (!p->address) {free_suspend_pagedir ((unsigned long ) pagedir);return NULL ; } +printk ("." );SetPageNosave (virt_to_page (p->address)); p->orig_address =0 ; p++;
@@ -623,7 +623,7 @@static void free_some_memory (void ) {printk ("Freeing memory: " ); -while (try_to_free_pages (&contig_page_data.node_zones[ZONE_HIGHMEM ],GFP_KSWAPD ,0 )) +while (shrink_all_memory (10000 ))printk ("." );printk ("|\n" ); }
@@ -676,7 +676,7 @@ } } -static int suspend_save_image (void ) +static int suspend_prepare_image (void ) {struct sysinfo i;unsigned int nr_needed_pages =0 ;
@@ -725,9 +725,15 @@* * Following line enforces not writing to disk until we choose. */ -drivers_unsuspend (); -spin_unlock_irq (&suspend_pagedir_lock); +printk ("critical section/: done (%d pages copied)\n" , nr_copy_pages ); +spin_unlock_irq (&suspend_pagedir_lock); +return 0 ; +} + +void suspend_save_image (void ) +{ +drivers_unsuspend ();lock_swapdevices ();write_suspend_image ();
@@ -738,7 +744,6 @@* filesystem clean: it is not. (And it does not matter, if we resume * correctly, we'll mark system clean, anyway.) */ -return 0 ; }void suspend_power_down (void )
@@ -788,8 +793,8 @@PRINTK ("Freeing prev allocated pagedir\n" );free_suspend_pagedir ((unsigned long ) pagedir_save); -drivers_resume (RESUME_ALL_PHASES );spin_unlock_irq (&suspend_pagedir_lock); +drivers_resume (RESUME_ALL_PHASES );PRINTK ("Fixing swap signatures... " );mark_swapfiles (((swp_entry_t ) {0 }),MARK_SWAP_RESUME );
@@ -804,14 +809,17 @@ {mb ();barrier (); +BUG_ON (in_atomic ());spin_lock_irq (&suspend_pagedir_lock); }void do_magic_suspend_2 (void ) {read_swapfiles (); -if (!suspend_save_image ()) +if (!suspend_prepare_image ()) {/* suspend_save_image realeses suspend_pagedir_lock */ +suspend_save_image ();suspend_power_down ();/* FIXME: if suspend_power_down is commented out, console is lost after few suspends ?! */ + }printk (KERN_EMERG "%sSuspend failed, trying to recover...\n" , name_suspend);MDELAY (1000 );/* So user can wait and report us messages if armageddon comes :-) */
mm/page_alloc.c +1 -1
@@ -368,7 +368,7 @@unsigned long flags;struct page *page =NULL ; -if (order ==0 ) { +if ((order ==0 ) && !cold) {struct per_cpu_pages *pcp; pcp = &zone->pageset[get_cpu ()].pcp[cold];
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?