Merge branches 'softirq-for-linus', 'x86-debug-for-linus', 'x86-numa-for-linus',...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Oct 2010 15:25:36 +0000 (08:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Oct 2010 15:25:36 +0000 (08:25 -0700)
* 'softirq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  softirqs: Make wakeup_softirqd static

* 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, asm: Restore parentheses around one pushl_cfi argument
  x86, asm: Fix ancient-GAS workaround
  x86, asm: Fix CFI macro invocations to deal with shortcomings in gas

* 'x86-numa-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, numa: Assign CPUs to nodes in round-robin manner on fake NUMA

* 'x86-quirks-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: HPET force enable for CX700 / VIA Epia LT

* 'x86-setup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, setup: Use string copy operation to optimze copy in kernel compression

* 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, UV: Use allocated buffer in tlb_uv.c:tunables_read()

* 'x86-vm86-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, vm86: Fix preemption bug for int1 debug and int3 breakpoint handlers.

15 files changed:
Kbuild
arch/x86/boot/compressed/misc.c
arch/x86/include/asm/calling.h
arch/x86/include/asm/entry_arch.h
arch/x86/include/asm/segment.h
arch/x86/kernel/asm-offsets_32.c
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/entry_32.S
arch/x86/kernel/entry_64.S
arch/x86/kernel/quirks.c
arch/x86/kernel/tlb_uv.c
arch/x86/kernel/traps.c
arch/x86/kernel/vm86_32.c
include/linux/interrupt.h
kernel/softirq.c

diff --git a/Kbuild b/Kbuild
index e3737ad..431f7ca 100644 (file)
--- a/Kbuild
+++ b/Kbuild
@@ -53,6 +53,7 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
        "/^->/{s:->#\(.*\):/* \1 */:; \
+       s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 (\2) /* \3 */:; \
        s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
        s:->::; p;}"
 endef
index 8f7bef8..23f315c 100644 (file)
@@ -229,18 +229,35 @@ void *memset(void *s, int c, size_t n)
                ss[i] = c;
        return s;
 }
-
+#ifdef CONFIG_X86_32
 void *memcpy(void *dest, const void *src, size_t n)
 {
-       int i;
-       const char *s = src;
-       char *d = dest;
+       int d0, d1, d2;
+       asm volatile(
+               "rep ; movsl\n\t"
+               "movl %4,%%ecx\n\t"
+               "rep ; movsb\n\t"
+               : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+               : "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
+               : "memory");
 
-       for (i = 0; i < n; i++)
-               d[i] = s[i];
        return dest;
 }
+#else
+void *memcpy(void *dest, const void *src, size_t n)
+{
+       long d0, d1, d2;
+       asm volatile(
+               "rep ; movsq\n\t"
+               "movq %4,%%rcx\n\t"
+               "rep ; movsb\n\t"
+               : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+               : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src)
+               : "memory");
 
+       return dest;
+}
+#endif
 
 static void error(char *x)
 {
index 0e63c9a..30af5a8 100644 (file)
@@ -48,36 +48,38 @@ For 32-bit we have the following conventions - kernel is built with
 
 
 /*
- * 64-bit system call stack frame layout defines and helpers,
- * for assembly code:
+ * 64-bit system call stack frame layout defines and helpers, for
+ * assembly code (note that the seemingly unnecessary parentheses
+ * are to prevent cpp from inserting spaces in expressions that get
+ * passed to macros):
  */
 
-#define R15              0
-#define R14              8
-#define R13             16
-#define R12             24
-#define RBP             32
-#define RBX             40
+#define R15              (0)
+#define R14              (8)
+#define R13             (16)
+#define R12             (24)
+#define RBP             (32)
+#define RBX             (40)
 
 /* arguments: interrupts/non tracing syscalls only save up to here: */
-#define R11             48
-#define R10             56
-#define R9              64
-#define R8              72
-#define RAX             80
-#define RCX             88
-#define RDX             96
-#define RSI            104
-#define RDI            112
-#define ORIG_RAX       120       /* + error_code */
+#define R11             (48)
+#define R10             (56)
+#define R9              (64)
+#define R8              (72)
+#define RAX             (80)
+#define RCX             (88)
+#define RDX             (96)
+#define RSI            (104)
+#define RDI            (112)
+#define ORIG_RAX       (120)       /* + error_code */
 /* end of arguments */
 
 /* cpu exception frame or undefined in case of fast syscall: */
-#define RIP            128
-#define CS             136
-#define EFLAGS         144
-#define RSP            152
-#define SS             160
+#define RIP            (128)
+#define CS             (136)
+#define EFLAGS         (144)
+#define RSP            (152)
+#define SS             (160)
 
 #define ARGOFFSET      R11
 #define SWFRAME                ORIG_RAX
@@ -111,7 +113,7 @@ For 32-bit we have the following conventions - kernel is built with
        .endif
        .endm
 
-#define ARG_SKIP       9*8
+#define ARG_SKIP       (9*8)
 
        .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \
                            skipr8910=0, skiprdx=0
@@ -169,7 +171,7 @@ For 32-bit we have the following conventions - kernel is built with
        .endif
        .endm
 
-#define REST_SKIP      6*8
+#define REST_SKIP      (6*8)
 
        .macro SAVE_REST
        subq $REST_SKIP, %rsp
index b8e96a1..57650ab 100644 (file)
@@ -16,22 +16,11 @@ BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
 BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR)
 BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR)
 
-BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6,
-                smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7,
+.irpc idx, "01234567"
+BUILD_INTERRUPT3(invalidate_interrupt\idx,
+                (INVALIDATE_TLB_VECTOR_START)+\idx,
                 smp_invalidate_interrupt)
+.endr
 #endif
 
 BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR)
index 14e0ed8..231f1c1 100644 (file)
 
 #define GDT_ENTRY_DEFAULT_USER_DS      15
 
-#define GDT_ENTRY_KERNEL_BASE  12
+#define GDT_ENTRY_KERNEL_BASE          (12)
 
-#define GDT_ENTRY_KERNEL_CS            (GDT_ENTRY_KERNEL_BASE + 0)
+#define GDT_ENTRY_KERNEL_CS            (GDT_ENTRY_KERNEL_BASE+0)
 
-#define GDT_ENTRY_KERNEL_DS            (GDT_ENTRY_KERNEL_BASE + 1)
+#define GDT_ENTRY_KERNEL_DS            (GDT_ENTRY_KERNEL_BASE+1)
 
-#define GDT_ENTRY_TSS                  (GDT_ENTRY_KERNEL_BASE + 4)
-#define GDT_ENTRY_LDT                  (GDT_ENTRY_KERNEL_BASE + 5)
+#define GDT_ENTRY_TSS                  (GDT_ENTRY_KERNEL_BASE+4)
+#define GDT_ENTRY_LDT                  (GDT_ENTRY_KERNEL_BASE+5)
 
-#define GDT_ENTRY_PNPBIOS_BASE         (GDT_ENTRY_KERNEL_BASE + 6)
-#define GDT_ENTRY_APMBIOS_BASE         (GDT_ENTRY_KERNEL_BASE + 11)
+#define GDT_ENTRY_PNPBIOS_BASE         (GDT_ENTRY_KERNEL_BASE+6)
+#define GDT_ENTRY_APMBIOS_BASE         (GDT_ENTRY_KERNEL_BASE+11)
 
-#define GDT_ENTRY_ESPFIX_SS            (GDT_ENTRY_KERNEL_BASE + 14)
-#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
+#define GDT_ENTRY_ESPFIX_SS            (GDT_ENTRY_KERNEL_BASE+14)
+#define __ESPFIX_SS                    (GDT_ENTRY_ESPFIX_SS*8)
 
-#define GDT_ENTRY_PERCPU                       (GDT_ENTRY_KERNEL_BASE + 15)
+#define GDT_ENTRY_PERCPU               (GDT_ENTRY_KERNEL_BASE+15)
 #ifdef CONFIG_SMP
 #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8)
 #else
 #define __KERNEL_PERCPU 0
 #endif
 
-#define GDT_ENTRY_STACK_CANARY         (GDT_ENTRY_KERNEL_BASE + 16)
+#define GDT_ENTRY_STACK_CANARY         (GDT_ENTRY_KERNEL_BASE+16)
 #ifdef CONFIG_CC_STACKPROTECTOR
-#define __KERNEL_STACK_CANARY          (GDT_ENTRY_STACK_CANARY * 8)
+#define __KERNEL_STACK_CANARY          (GDT_ENTRY_STACK_CANARY*8)
 #else
 #define __KERNEL_STACK_CANARY          0
 #endif
 
 #endif
 
-#define __KERNEL_CS    (GDT_ENTRY_KERNEL_CS * 8)
-#define __KERNEL_DS    (GDT_ENTRY_KERNEL_DS * 8)
-#define __USER_DS     (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3)
-#define __USER_CS     (GDT_ENTRY_DEFAULT_USER_CS* 8 + 3)
+#define __KERNEL_CS    (GDT_ENTRY_KERNEL_CS*8)
+#define __KERNEL_DS    (GDT_ENTRY_KERNEL_DS*8)
+#define __USER_DS      (GDT_ENTRY_DEFAULT_USER_DS*8+3)
+#define __USER_CS      (GDT_ENTRY_DEFAULT_USER_CS*8+3)
 #ifndef CONFIG_PARAVIRT
 #define get_kernel_rpl()  0
 #endif
index dfdbf64..1a4088d 100644 (file)
@@ -99,9 +99,7 @@ void foo(void)
 
        DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
        DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
-       DEFINE(PTRS_PER_PTE, PTRS_PER_PTE);
-       DEFINE(PTRS_PER_PMD, PTRS_PER_PMD);
-       DEFINE(PTRS_PER_PGD, PTRS_PER_PGD);
+       DEFINE(THREAD_SIZE_asm, THREAD_SIZE);
 
        OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
 
index 695f177..d16c2c5 100644 (file)
@@ -284,9 +284,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
        /* Don't do the funky fallback heuristics the AMD version employs
           for now. */
        node = apicid_to_node[apicid];
-       if (node == NUMA_NO_NODE)
-               node = first_node(node_online_map);
-       else if (!node_online(node)) {
+       if (node == NUMA_NO_NODE || !node_online(node)) {
                /* reuse the value from init_cpu_to_node() */
                node = cpu_to_node(cpu);
        }
index 9fb188d..59e175e 100644 (file)
@@ -382,20 +382,20 @@ sysenter_past_esp:
         * enough kernel state to call TRACE_IRQS_OFF can be called - but
         * we immediately enable interrupts at that point anyway.
         */
-       pushl_cfi $(__USER_DS)
+       pushl_cfi $__USER_DS
        /*CFI_REL_OFFSET ss, 0*/
        pushl_cfi %ebp
        CFI_REL_OFFSET esp, 0
        pushfl_cfi
        orl $X86_EFLAGS_IF, (%esp)
-       pushl_cfi $(__USER_CS)
+       pushl_cfi $__USER_CS
        /*CFI_REL_OFFSET cs, 0*/
        /*
         * Push current_thread_info()->sysenter_return to the stack.
         * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
         * pushed above; +8 corresponds to copy_thread's esp0 setting.
         */
-       pushl_cfi (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
+       pushl_cfi (TI_sysenter_return-THREAD_SIZE_asm+8+4*4)(%esp)
        CFI_REL_OFFSET eip, 0
 
        pushl_cfi %eax
index a7ae7fd..fe2690d 100644 (file)
@@ -963,22 +963,10 @@ apicinterrupt X86_PLATFORM_IPI_VECTOR \
        x86_platform_ipi smp_x86_platform_ipi
 
 #ifdef CONFIG_SMP
-apicinterrupt INVALIDATE_TLB_VECTOR_START+0 \
-       invalidate_interrupt0 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+1 \
-       invalidate_interrupt1 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+2 \
-       invalidate_interrupt2 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+3 \
-       invalidate_interrupt3 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+4 \
-       invalidate_interrupt4 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+5 \
-       invalidate_interrupt5 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+6 \
-       invalidate_interrupt6 smp_invalidate_interrupt
-apicinterrupt INVALIDATE_TLB_VECTOR_START+7 \
-       invalidate_interrupt7 smp_invalidate_interrupt
+.irpc idx, "01234567"
+apicinterrupt (INVALIDATE_TLB_VECTOR_START)+\idx \
+       invalidate_interrupt\idx smp_invalidate_interrupt
+.endr
 #endif
 
 apicinterrupt THRESHOLD_APIC_VECTOR \
index 939b9e9..8bbe8c5 100644 (file)
@@ -344,6 +344,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
                         vt8237_force_enable_hpet);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
                         vt8237_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700,
+                        vt8237_force_enable_hpet);
 
 static void ati_force_hpet_resume(void)
 {
index 50ac949..20ea20a 100644 (file)
@@ -1001,10 +1001,10 @@ static int uv_ptc_seq_show(struct seq_file *file, void *data)
 static ssize_t tunables_read(struct file *file, char __user *userbuf,
                                                size_t count, loff_t *ppos)
 {
-       char buf[300];
+       char *buf;
        int ret;
 
-       ret = snprintf(buf, 300, "%s %s %s\n%d %d %d %d %d %d %d %d %d\n",
+       buf = kasprintf(GFP_KERNEL, "%s %s %s\n%d %d %d %d %d %d %d %d %d\n",
                "max_bau_concurrent plugged_delay plugsb4reset",
                "timeoutsb4reset ipi_reset_limit complete_threshold",
                "congested_response_us congested_reps congested_period",
@@ -1012,7 +1012,12 @@ static ssize_t tunables_read(struct file *file, char __user *userbuf,
                timeoutsb4reset, ipi_reset_limit, complete_threshold,
                congested_response_us, congested_reps, congested_period);
 
-       return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
+       if (!buf)
+               return -ENOMEM;
+
+       ret = simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf));
+       kfree(buf);
+       return ret;
 }
 
 /*
index d439685..cb838ca 100644 (file)
@@ -575,6 +575,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
        if (regs->flags & X86_VM_MASK) {
                handle_vm86_trap((struct kernel_vm86_regs *) regs,
                                error_code, 1);
+               preempt_conditional_cli(regs);
                return;
        }
 
index 5ffb562..61fb985 100644 (file)
@@ -551,8 +551,14 @@ cannot_handle:
 int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno)
 {
        if (VMPI.is_vm86pus) {
-               if ((trapno == 3) || (trapno == 1))
-                       return_to_32bit(regs, VM86_TRAP + (trapno << 8));
+               if ((trapno == 3) || (trapno == 1)) {
+                       KVM86->regs32->ax = VM86_TRAP + (trapno << 8);
+                       /* setting this flag forces the code in entry_32.S to
+                          call save_v86_state() and change the stack pointer
+                          to KVM86->regs32 */
+                       set_thread_flag(TIF_IRET);
+                       return 0;
+               }
                do_int(regs, trapno, (unsigned char __user *) (regs->pt.ss << 4), SP(regs));
                return 0;
        }
index 4143285..01b2816 100644 (file)
@@ -416,7 +416,6 @@ static inline void __raise_softirq_irqoff(unsigned int nr)
 
 extern void raise_softirq_irqoff(unsigned int nr);
 extern void raise_softirq(unsigned int nr);
-extern void wakeup_softirqd(void);
 
 /* This is the worklist that queues up per-cpu softirq work.
  *
index fc97888..f02a9df 100644 (file)
@@ -67,7 +67,7 @@ char *softirq_to_name[NR_SOFTIRQS] = {
  * to the pending events, so lets the scheduler to balance
  * the softirq load for us.
  */
-void wakeup_softirqd(void)
+static void wakeup_softirqd(void)
 {
        /* Interrupts are disabled: no need to stop preemption */
        struct task_struct *tsk = __get_cpu_var(ksoftirqd);