Patches contributed by Eötvös Lorand University
commit f12e6a451aad671a724e61abce2b8b323f209355
Merge: 046fd53773cd dc44e6594316
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Sep 6 14:53:20 2008 +0200
Merge branch 'x86/cleanups' into x86/signal
Conflicts:
arch/x86/kernel/signal_64.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --cc arch/x86/kernel/sigframe.h
index 6dd7e2b70a4b,8b4956e800ac..cc673aa55ce4
--- a/arch/x86/kernel/sigframe.h
+++ b/arch/x86/kernel/sigframe.h
@@@ -32,6 -23,10 +32,11 @@@ struct rt_sigframe
char __user *pretcode;
struct ucontext uc;
struct siginfo info;
+ /* fp state follows here */
};
+
+ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+ sigset_t *set, struct pt_regs *regs);
+ int ia32_setup_frame(int sig, struct k_sigaction *ka,
+ sigset_t *set, struct pt_regs *regs);
#endif
diff --cc arch/x86/kernel/signal_64.c
index 2f28252d2d26,162da796a323..823a55bf8c39
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@@ -98,9 -154,20 +94,9 @@@ restore_sigcontext(struct pt_regs *regs
}
{
- struct _fpstate __user * buf;
+ struct _fpstate __user *buf;
err |= __get_user(buf, &sc->fpstate);
-
- if (buf) {
- if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
- goto badframe;
- err |= restore_i387(buf);
- } else {
- struct task_struct *me = current;
- if (used_math()) {
- clear_fpu(me);
- clear_used_math();
- }
- }
+ err |= restore_i387_xstate(buf);
}
err |= __get_user(*pax, &sc->ax);
@@@ -199,10 -270,10 +196,10 @@@ get_stack(struct k_sigaction *ka, struc
}
static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
- sigset_t *set, struct pt_regs * regs)
+ sigset_t *set, struct pt_regs *regs)
{
struct rt_sigframe __user *frame;
- struct _fpstate __user *fp = NULL;
+ void __user *fp = NULL;
int err = 0;
struct task_struct *me = current;
@@@ -211,8 -282,11 +208,8 @@@
frame = (void __user *)round_down(
(unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
- if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
- goto give_sigsegv;
-
- if (save_i387(fp) < 0)
+ if (save_i387_xstate(fp) < 0)
- err |= -1;
+ err |= -1;
} else
frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8;
@@@ -224,12 -298,9 +221,12 @@@
if (err)
goto give_sigsegv;
}
-
+
/* Create the ucontext. */
- err |= __put_user(0, &frame->uc.uc_flags);
+ if (cpu_has_xsave)
+ err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
+ else
+ err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(0, &frame->uc.uc_link);
err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(regs->sp),
@@@ -280,9 -351,38 +277,9 @@@ give_sigsegv
return -EFAULT;
}
-/*
- * Return -1L or the syscall number that @regs is executing.
- */
-static long current_syscall(struct pt_regs *regs)
-{
- /*
- * We always sign-extend a -1 value being set here,
- * so this is always either -1L or a syscall number.
- */
- return regs->orig_ax;
-}
-
-/*
- * Return a value that is -EFOO if the system call in @regs->orig_ax
- * returned an error. This only works for @regs from @current.
- */
-static long current_syscall_ret(struct pt_regs *regs)
-{
-#ifdef CONFIG_IA32_EMULATION
- if (test_thread_flag(TIF_IA32))
- /*
- * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
- * and will match correctly in comparisons.
- */
- return (int) regs->ax;
-#endif
- return regs->ax;
-}
-
/*
* OK, we're invoking a handler
- */
+ */
static int
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
@@@ -350,16 -450,15 +347,16 @@@
* handler too.
*/
regs->flags &= ~X86_EFLAGS_TF;
- if (test_thread_flag(TIF_SINGLESTEP))
- ptrace_notify(SIGTRAP);
spin_lock_irq(¤t->sighand->siglock);
- sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
+ sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask);
if (!(ka->sa.sa_flags & SA_NODEFER))
- sigaddset(¤t->blocked,sig);
+ sigaddset(¤t->blocked, sig);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
+
+ tracehook_signal_handler(sig, info, ka, regs,
+ test_thread_flag(TIF_SINGLESTEP));
}
return ret;
diff --cc arch/x86/kernel/sys_x86_64.c
index c9288c883e20,56eb8f916e9f..6bc211accf08
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@@ -13,16 -13,16 +13,17 @@@
#include <linux/utsname.h>
#include <linux/personality.h>
#include <linux/random.h>
+ #include <linux/uaccess.h>
- #include <asm/uaccess.h>
#include <asm/ia32.h>
+#include <asm/syscalls.h>
- asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
- unsigned long fd, unsigned long off)
+ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
+ unsigned long prot, unsigned long flags,
+ unsigned long fd, unsigned long off)
{
long error;
- struct file * file;
+ struct file *file;
error = -EINVAL;
if (off & ~PAGE_MASK)
commit 046fd53773cd87125f799b00422e487bf1428d38
Merge: 70bb08962ea9 4ab4ba32aa16 fe47784ba5cb 8d7ccaa54549
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Sep 6 14:53:01 2008 +0200
Merge branches 'x86/tracehook', 'x86/xsave' and 'x86/prototypes' into x86/signal
Conflicts:
arch/x86/kernel/signal_64.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --cc arch/x86/Kconfig
index ed92864d1325,ebfd7ff82ade,0a80d6a5e9f1,ac2fb0641a04..6b8fc9003ecc
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@@@@ -586,11 -587,11 -585,17 -585,17 +587,11 @@@@@ config MAXSM
Configure maximum number of CPUS and NUMA Nodes for this architecture.
If unsure, say N.
--if MAXSMP
- config NR_CPUS
- int
- default "4096"
- endif
-
- if !MAXSMP
config NR_CPUS
- int
- default "4096"
-endif
-
-if !MAXSMP
-config NR_CPUS
-- int "Maximum number of CPUs (2-4096)"
-- range 2 4096
++ int "Maximum number of CPUs (2-512)" if !MAXSMP
++ range 2 512
depends on SMP
++ default "4096" if MAXSMP
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
default "8"
help
diff --cc arch/x86/kernel/signal_64.c
index ca316b5b742c,1e1933892b4f,6c581698ab56,02b02583f5b5..2f28252d2d26
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@@@@ -26,6 -27,7 -26,6 -26,7 +27,8 @@@@@
#include <asm/proto.h>
#include <asm/ia32_unistd.h>
#include <asm/mce.h>
+ ++#include <asm/syscall.h>
+++ #include <asm/syscalls.h>
#include "sigframe.h"
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@@@@ -53,69 -55,69 -53,6 -54,60 +56,6 @@@@@ sys_sigaltstack(const stack_t __user *u
return do_sigaltstack(uss, uoss, regs->sp);
}
-- -/*
-- - * Signal frame handlers.
-- - */
-- -
-- -static inline int save_i387(struct _fpstate __user *buf)
-- -{
-- - struct task_struct *tsk = current;
-- - int err = 0;
-- -
-- - BUILD_BUG_ON(sizeof(struct user_i387_struct) !=
-- - sizeof(tsk->thread.xstate->fxsave));
-- -
-- - if ((unsigned long)buf % 16)
-- - printk("save_i387: bad fpstate %p\n", buf);
-- -
-- - if (!used_math())
-- - return 0;
-- - clear_used_math(); /* trigger finit */
-- - if (task_thread_info(tsk)->status & TS_USEDFPU) {
-- - err = save_i387_checking((struct i387_fxsave_struct __user *)
-- - buf);
-- - if (err)
-- - return err;
-- - task_thread_info(tsk)->status &= ~TS_USEDFPU;
-- - stts();
-- - } else {
-- - if (__copy_to_user(buf, &tsk->thread.xstate->fxsave,
-- - sizeof(struct i387_fxsave_struct)))
-- - return -1;
-- - }
-- - return 1;
-- -}
-- -
-- -/*
-- - * This restores directly out of user space. Exceptions are handled.
-- - */
-- -static inline int restore_i387(struct _fpstate __user *buf)
-- -{
-- - struct task_struct *tsk = current;
-- - int err;
-- -
-- - if (!used_math()) {
-- - err = init_fpu(tsk);
-- - if (err)
-- - return err;
-- - }
-- -
-- - if (!(task_thread_info(current)->status & TS_USEDFPU)) {
-- - clts();
-- - task_thread_info(current)->status |= TS_USEDFPU;
-- }
-- err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
-- if (unlikely(err)) {
-- /*
-- * Encountered an error while doing the restore from the
-- * user buffer, clear the fpu state.
-- */
-- clear_fpu(tsk);
-- clear_used_math();
-- - }
-- return err;
- return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
-- -}
-- -
/*
* Do a signal return; undo the signal stack.
*/
diff --cc include/asm-x86/apic.h
index 133c998161ca,133c998161ca,bc2e364bdb10,519ad65708e7..1311c82b165b
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@@@@ -54,8 -54,8 -54,8 -54,13 +54,13 @@@@@ extern int disable_apic
#endif
extern int is_vsmp_box(void);
+++ extern void xapic_wait_icr_idle(void);
+++ extern u32 safe_xapic_wait_icr_idle(void);
+++ extern u64 xapic_icr_read(void);
+++ extern void xapic_icr_write(u32, u32);
+++ extern int setup_profiling_timer(unsigned int);
-- -static inline void native_apic_write(unsigned long reg, u32 v)
++ +static inline void native_apic_mem_write(u32 reg, u32 v)
{
volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
diff --cc include/asm-x86/traps.h
index a4b65a71bd66,a4b65a71bd66,2a891a704719,b60fab546da7..2ccebc6fb0b0
--- a/include/asm-x86/traps.h
+++ b/include/asm-x86/traps.h
@@@@@ -62,5 -62,5 -62,5 -64,7 +64,7 @@@@@ asmlinkage void do_coprocessor_error(st
asmlinkage void do_simd_coprocessor_error(struct pt_regs *);
asmlinkage void do_spurious_interrupt_bug(struct pt_regs *);
+++ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code);
+++
#endif /* CONFIG_X86_32 */
-- -#endif /* _ASM_X86_TRAPS_H */
++ +#endif /* ASM_X86__TRAPS_H */
commit 616ad8c44281c0c6711a72b560e01ec335ff27e0
Merge: 99809963c99e b380b0d4f7df
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 18:56:57 2008 +0200
Merge branch 'linus' into x86/defconfig
commit 28c3cfd5fb998bd3683bebeebbba38baa2101cad
Merge: 04197c83b3e0 b380b0d4f7df
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 17:53:05 2008 +0200
Merge branch 'linus' into x86/tracehook
commit 0a328ea43da9c3eefce7cb6c947e43e1a0fef810
Merge: d3d0ba7b8fb8 5bbd4c372400
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 17:03:17 2008 +0200
Merge branch 'x86/alternatives' into x86/core
commit deed05b7c017e49473e8c386efba196410fd18b3
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 10:23:26 2008 +0200
x86, init_64.c: cleanup
Clean up comments.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9c750d6307b0..1f6806b62eb8 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -93,12 +93,13 @@ EXPORT_SYMBOL_GPL(__supported_pte_mask);
static int do_not_nx __cpuinitdata;
-/* noexec=on|off
-Control non executable mappings for 64bit processes.
-
-on Enable(default)
-off Disable
-*/
+/*
+ * noexec=on|off
+ * Control non-executable mappings for 64-bit processes.
+ *
+ * on Enable (default)
+ * off Disable
+ */
static int __init nonx_setup(char *str)
{
if (!str)
@@ -125,13 +126,14 @@ void __cpuinit check_efer(void)
int force_personality32;
-/* noexec32=on|off
-Control non executable heap for 32bit processes.
-To control the stack too use noexec=off
-
-on PROT_READ does not imply PROT_EXEC for 32bit processes (default)
-off PROT_READ implies PROT_EXEC
-*/
+/*
+ * noexec32=on|off
+ * Control non executable heap for 32bit processes.
+ * To control the stack too use noexec=off
+ *
+ * on PROT_READ does not imply PROT_EXEC for 32-bit processes (default)
+ * off PROT_READ implies PROT_EXEC
+ */
static int __init nonx32_setup(char *str)
{
if (!strcmp(str, "on"))
commit 143b604a2d07ff69cc2bc02ecd9395b28e0b5292
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 09:37:15 2008 +0200
x86: cpu/common*.c, merge whitespaces
Merge leftover whitespaces, to make arch/x86/kernel/cpu/common_64.c
exactly identical to arch/x86/kernel/cpu/common.c.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c
index 6a42371a609f..eef868c97b89 100644
--- a/arch/x86/kernel/cpu/common_64.c
+++ b/arch/x86/kernel/cpu/common_64.c
@@ -26,6 +26,7 @@
#include <mach_apic.h>
#include <asm/genapic.h>
#endif
+
#include <asm/pda.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
@@ -280,7 +281,6 @@ int __cpuinit get_model_name(struct cpuinfo_x86 *c)
return 1;
}
-
void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
{
unsigned int n, dummy, ebx, ecx, edx, l2size;
@@ -307,7 +307,6 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
#ifdef CONFIG_X86_64
c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
#else
-
/* do processor-specific cache resizing */
if (this_cpu->c_size_cache)
l2size = this_cpu->c_size_cache(c, l2size);
@@ -334,6 +333,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
if (!cpu_has(c, X86_FEATURE_HT))
return;
+
if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
goto out;
@@ -443,7 +443,6 @@ void __cpuinit cpu_detect(struct cpuinfo_x86 *c)
}
}
-
static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
{
u32 tfms, xlvl;
@@ -452,7 +451,6 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
/* Intel-defined flags: level 0x00000001 */
if (c->cpuid_level >= 0x00000001) {
u32 capability, excap;
-
cpuid(0x00000001, &tfms, &ebx, &excap, &capability);
c->x86_capability[0] = capability;
c->x86_capability[4] = excap;
@@ -488,7 +486,6 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
}
#endif
}
-
/*
* Do minimum CPU detection early.
* Fields really needed: vendor, cpuid_level, family, model, mask,
@@ -500,7 +497,6 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
*/
static void __init early_identify_cpu(struct cpuinfo_x86 *c)
{
-
#ifdef CONFIG_X86_64
c->x86_clflush_size = 64;
#else
@@ -722,12 +718,12 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
/* Init Machine Check Exception if available. */
mcheck_init(c);
#endif
+
select_idle_routine(c);
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
numa_add_cpu(smp_processor_id());
#endif
-
}
void __init identify_boot_cpu(void)
commit 0c8c708a7e6b52556ee9079041f504191ec5f0e9
Merge: b380b0d4f7df d3d0ba7b8fb8
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 09:27:23 2008 +0200
Merge branch 'x86/core' into x86/unify-cpu-detect
commit d3d0ba7b8fb8f57c33207adcb41f40c176148c03
Merge: 9042763808c5 63cc8c751564
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 09:24:30 2008 +0200
Merge commit '63cc8c75156462d4b42cbdd76c293b7eee7ddbfe':
"percpu: introduce DEFINE_PER_CPU_PAGE_ALIGNED() macro"
into x86/core
Conflicts:
arch/x86/kernel/cpu/common.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --cc arch/x86/kernel/cpu/common.c
index 008c73796bbb,b2f54fafb8bc..7d5a07f0fd24
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@@ -22,9 -21,7 +22,9 @@@
#include "cpu.h"
+static struct cpu_dev *this_cpu __cpuinitdata;
+
- DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = {
+ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
[GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } },
[GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } },
[GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } },
diff --cc include/asm-generic/vmlinux.lds.h
index cb752ba72466,69e5c1182fde..7440a0dceddb
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@@ -383,8 -346,9 +383,9 @@@
#define PERCPU(align) \
. = ALIGN(align); \
- __per_cpu_start = .; \
+ VMLINUX_SYMBOL(__per_cpu_start) = .; \
.data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
+ *(.data.percpu.page_aligned) \
*(.data.percpu) \
*(.data.percpu.shared_aligned) \
} \
commit 9042763808c5285a1a61b45b0fe98a710a4c903c
Merge: 446d27338d3b aa3341a16888
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Sep 5 09:21:21 2008 +0200
Merge branch 'x86/x2apic' into x86/core
Conflicts:
arch/x86/kernel/cpu/common_64.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --cc arch/x86/kernel/cpu/common_64.c
index ae007b3521cb,a2888c7b56ac..bcb48ce05d23
--- a/arch/x86/kernel/cpu/common_64.c
+++ b/arch/x86/kernel/cpu/common_64.c
@@@ -150,8 -139,6 +150,11 @@@ void __cpuinit detect_ht(struct cpuinfo
if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
goto out;
++ if (cpu_has(c, X86_FEATURE_XTOPOLOGY))
++ return;
++
+ cpuid(1, &eax, &ebx, &ecx, &edx);
+
smp_num_siblings = (ebx & 0xff0000) >> 16;
if (smp_num_siblings == 1) {