[Suspend2-announce] Test patch 2.1.8.11 for 2.6.12-rc5.

Top Page
Attachments:
Message as email
+ (text/plain)
+ 956-smp-modifications.patch (text/x-patch)
Delete this message
Reply to this message
Author: Nigel Cunningham
Date:  
To: Suspend2-Announce
Subject: [Suspend2-announce] Test patch 2.1.8.11 for 2.6.12-rc5.
Hi all.

I didn't fix SMP support with the .10 patchset. Here is an additional
patch to address that issue. I still have the issue with ReiserFS to
deal with; I'll seek to finish that tonight.

Regards,

Nigel
diff -ruNp 956-smp-modifications.patch-old/arch/i386/power/smp.c 956-smp-modifications.patch-new/arch/i386/power/smp.c
--- 956-smp-modifications.patch-old/arch/i386/power/smp.c    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/arch/i386/power/smp.c    2005-05-30 10:32:47.000000000 +1000
@@ -1,12 +1,27 @@
-#ifdef CONFIG_SMP
-#error SMP is set.
-
#include <linux/init.h>
#include <linux/suspend.h>
-#include <asm/desc.h>
-#include <asm/i387.h>
-#include <asm/tlbflush.h>
+#include <linux/suspend-smp.h>
+#include <asm/suspend2.h>
+//#include <asm/desc.h>
+//#include <asm/i387.h>
+//#include <asm/tlbflush.h>
+#include <asm/atomic.h>
+
+#if defined(CONFIG_SUSPEND2)
+extern atomic_t suspend_cpu_counter __nosavedata;
+volatile unsigned char * my_saved_context __nosavedata;
+volatile static unsigned long c_loops_per_jiffy_ref[NR_CPUS] __nosavedata;
+#endif
+
+struct suspend2_saved_context suspend2_saved_context;    /* temporary storage */
+static struct suspend2_saved_context suspend2_saved_contexts[NR_CPUS];
+
+#if defined(CONFIG_SUSPEND2) || defined(CONFIG_SMP)
+volatile unsigned char * my_saved_context __nosavedata;
+cpumask_t saved_affinity[NR_IRQS];
+#endif

+#ifdef CONFIG_SMP
/*
* Save and restore processor state for secondary processors.
* IRQs (and therefore preemption) are already disabled
@@ -40,7 +55,7 @@ void __smp_suspend_lowlevel(void * data)
         my_saved_context = (unsigned char *) (suspend2_saved_contexts + _smp_processor_id());
        for (loop = sizeof(struct suspend2_saved_context); loop--; loop)
            *(((unsigned char *) &suspend2_saved_context) + loop - 1) = *(my_saved_context + loop - 1);
-        restore_processor_context();
+        suspend2_restore_processor_context();
        cpu_clear(_smp_processor_id(), per_cpu(cpu_tlbstate, _smp_processor_id()).active_mm->cpu_vm_mask);
        load_cr3(swapper_pg_dir);
        wbinvd();
@@ -62,7 +77,7 @@ void __smp_suspend_lowlevel(void * data)
            cpu_relax();
            barrier();
        }
-        save_processor_context();
+        suspend2_save_processor_context();
        my_saved_context = (unsigned char *) (suspend2_saved_contexts + _smp_processor_id());
        for (loop = sizeof(struct suspend2_saved_context); loop--; loop)
            *(my_saved_context + loop - 1) = *(((unsigned char *) &suspend2_saved_context) + loop - 1);
diff -ruNp 956-smp-modifications.patch-old/include/asm-i386/suspend2.h 956-smp-modifications.patch-new/include/asm-i386/suspend2.h
--- 956-smp-modifications.patch-old/include/asm-i386/suspend2.h    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/include/asm-i386/suspend2.h    2005-05-30 10:34:37.000000000 +1000
@@ -7,12 +7,11 @@
*/
#include <linux/init.h>
#include <linux/suspend.h>
+#include <linux/suspend-smp.h>
+#include <linux/irq.h>
#include <asm/desc.h>
#include <asm/i387.h>
#include <asm/tlbflush.h>
-
-extern char __nosavedata swsusp_pg_dir[PAGE_SIZE]
- __attribute__ ((aligned (PAGE_SIZE)));
#include <asm/processor.h>
#undef inline
#define inline    __inline__ __attribute__((always_inline))
@@ -28,33 +27,10 @@ extern void mtrr_restore_finish(void);
#define mtrr_restore_finish() do { } while(0)
#endif
        
-/* image of the saved processor states */
-struct suspend2_saved_context {
-    u32 eax, ebx, ecx, edx;
-    u32 esp, ebp, esi, edi;
-    u16 es, fs, gs, ss;
-    u32 cr0, cr2, cr3, cr4;
-    u16 gdt_pad;
-    u16 gdt_limit;
-    u32 gdt_base;
-    u16 idt_pad;
-    u16 idt_limit;
-    u32 idt_base;
-    u16 ldt;
-    u16 tss;
-    u32 tr;
-    u32 safety;
-    u32 return_address;
-    u32 eflags;
-} __attribute__((packed));
-
-#ifdef CONFIG_SMP
-static struct suspend2_saved_context suspend2_saved_contexts[NR_CPUS];
-#else
+#ifndef CONFIG_SMP
#undef cpu_clear
#define cpu_clear(a, b) do { } while(0)
#endif
-static struct suspend2_saved_context suspend2_saved_context;    /* temporary storage */

/*
* save_processor_context
@@ -235,9 +211,13 @@ static inline void restore_processor_con
    do_fpu_end();
}

+static inline void suspend2_restore_processor_context(void)
+{
+    restore_processor_context();
+}
+
#if defined(CONFIG_SUSPEND2) || defined(CONFIG_SMP)
extern atomic_t suspend_cpu_counter __nosavedata;
-volatile unsigned char * my_saved_context __nosavedata;
volatile static unsigned long c_loops_per_jiffy_ref[NR_CPUS] __nosavedata;
#endif

@@ -271,7 +251,7 @@ extern void suspend_apic_reload_state(vo

extern irq_desc_t irq_desc[];
extern cpumask_t irq_affinity[];
-cpumask_t saved_affinity[NR_IRQS];
+extern cpumask_t saved_affinity[NR_IRQS];

/*
* Routine to save the old irq affinities and change affinities of all irqs to
@@ -411,11 +391,6 @@ static inline void suspend2_pre_copyback
    
}

-static inline void suspend2_restore_processor_context(void)
-{
-    restore_processor_context();
-}
-    
static inline void suspend2_flush_caches(void)
{
    cpu_clear(_smp_processor_id(), per_cpu(cpu_tlbstate, _smp_processor_id()).active_mm->cpu_vm_mask);
diff -ruNp 956-smp-modifications.patch-old/include/linux/suspend2.h 956-smp-modifications.patch-new/include/linux/suspend2.h
--- 956-smp-modifications.patch-old/include/linux/suspend2.h    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/include/linux/suspend2.h    2005-05-30 09:12:49.000000000 +1000
@@ -7,6 +7,9 @@
/* arch/i386/mm/init.c */
extern char __nosave_begin, __nosave_end;

+extern char __nosavedata swsusp_pg_dir[PAGE_SIZE]
+ __attribute__ ((aligned (PAGE_SIZE)));
+
/* kernel/power/process.c */

/* fs/buffer.c */
diff -ruNp 956-smp-modifications.patch-old/include/linux/suspend-smp.h 956-smp-modifications.patch-new/include/linux/suspend-smp.h
--- 956-smp-modifications.patch-old/include/linux/suspend-smp.h    1970-01-01 10:00:00.000000000 +1000
+++ 956-smp-modifications.patch-new/include/linux/suspend-smp.h    2005-05-30 09:55:56.000000000 +1000
@@ -0,0 +1,25 @@
+#ifndef SUSPEND_SMP_H
+#define SUSPEND_SMP_H
+
+/* image of the saved processor states */
+struct suspend2_saved_context {
+    u32 eax, ebx, ecx, edx;
+    u32 esp, ebp, esi, edi;
+    u16 es, fs, gs, ss;
+    u32 cr0, cr2, cr3, cr4;
+    u16 gdt_pad;
+    u16 gdt_limit;
+    u32 gdt_base;
+    u16 idt_pad;
+    u16 idt_limit;
+    u32 idt_base;
+    u16 ldt;
+    u16 tss;
+    u32 tr;
+    u32 safety;
+    u32 return_address;
+    u32 eflags;
+} __attribute__((packed));
+
+extern struct suspend2_saved_context suspend2_saved_context;    /* temporary storage */
+#endif
diff -ruNp 956-smp-modifications.patch-old/kernel/power/suspend2_core/atomic_copy.c 956-smp-modifications.patch-new/kernel/power/suspend2_core/atomic_copy.c
--- 956-smp-modifications.patch-old/kernel/power/suspend2_core/atomic_copy.c    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/kernel/power/suspend2_core/atomic_copy.c    2005-05-30 09:12:49.000000000 +1000
@@ -34,6 +34,7 @@
#include "driver_model.h"
#include "ui.h"
#include "plugins.h"
+#include "atomic_copy.h"

volatile static int state1 __nosavedata = 0;
volatile static int state2 __nosavedata = 0;
@@ -391,4 +392,3 @@ void suspend2_unmap_atomic_copy_pages(vo
    }
}
#endif
-
diff -ruNp 956-smp-modifications.patch-old/kernel/power/suspend2_core/atomic_copy.h 956-smp-modifications.patch-new/kernel/power/suspend2_core/atomic_copy.h
--- 956-smp-modifications.patch-old/kernel/power/suspend2_core/atomic_copy.h    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/kernel/power/suspend2_core/atomic_copy.h    2005-05-30 09:12:49.000000000 +1000
@@ -1,9 +1,2 @@
extern inline void move_stack_to_nonconflicing_area(void);
-extern inline void suspend2_save_processor_context(void);
-extern inline void suspend2_restore_processor_context(int processor_id);
-extern inline void suspend2_pre_copyback(int processor_id);
-extern inline void suspend2_post_copyback(int processor_id);
-extern inline void suspend2_pre_copy(void);
-extern inline void suspend2_post_copy(void);
-
extern int save_image_part1(void);
diff -ruNp 956-smp-modifications.patch-old/kernel/power/suspend2_core/prepare_image.c 956-smp-modifications.patch-new/kernel/power/suspend2_core/prepare_image.c
--- 956-smp-modifications.patch-old/kernel/power/suspend2_core/prepare_image.c    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/kernel/power/suspend2_core/prepare_image.c    2005-05-30 09:12:49.000000000 +1000
@@ -325,7 +325,7 @@ static int update_image(void)
        expected_compression_ratio(),
        MAIN_STORAGE_NEEDED(1));
#endif
-    param_used = MAIN_STORAGE_NEEDED(1) + 100;
+    param_used = MAIN_STORAGE_NEEDED(1);
    if ((result2 = active_writer->ops.writer.allocate_storage(param_used))) {
        printk("Main storage: allocate_storage(%d) returned %d.\n", param_used, result2);
        suspend_message(SUSPEND_EAT_MEMORY, SUSPEND_LOW, 1,
diff -ruNp 956-smp-modifications.patch-old/kernel/power/suspend2_core/version.h 956-smp-modifications.patch-new/kernel/power/suspend2_core/version.h
--- 956-smp-modifications.patch-old/kernel/power/suspend2_core/version.h    2005-05-30 14:01:17.000000000 +1000
+++ 956-smp-modifications.patch-new/kernel/power/suspend2_core/version.h    2005-05-30 13:45:12.000000000 +1000
@@ -1,4 +1,4 @@
-#define SUSPEND_CORE_VERSION "2.1.8.10"
+#define SUSPEND_CORE_VERSION "2.1.8.11"
#ifndef KERNEL_POWER_SWSUSP_C
#define name_suspend "Software Suspend " SUSPEND_CORE_VERSION ": "
#endif