Commit c2ed69cd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-cleanups-for-linus' of...

Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix a section mismatch in arch/x86/kernel/setup.c
  x86: Fixup last users of irq_chip->typename
  x86: Remove BKL from apm_32
  x86: Remove BKL from microcode
  x86: use kernel_stack_pointer() in kprobes.c
  x86: use kernel_stack_pointer() in kgdb.c
  x86: use kernel_stack_pointer() in dumpstack.c
  x86: use kernel_stack_pointer() in process_32.c
parents ef26b169 9eaa192d
...@@ -204,7 +204,6 @@ ...@@ -204,7 +204,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/smp_lock.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/timer.h> #include <linux/timer.h>
...@@ -403,6 +402,7 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); ...@@ -403,6 +402,7 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
static struct apm_user *user_list; static struct apm_user *user_list;
static DEFINE_SPINLOCK(user_list_lock); static DEFINE_SPINLOCK(user_list_lock);
static DEFINE_MUTEX(apm_mutex);
/* /*
* Set up a segment that references the real mode segment 0x40 * Set up a segment that references the real mode segment 0x40
...@@ -1531,7 +1531,7 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg) ...@@ -1531,7 +1531,7 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg)
return -EPERM; return -EPERM;
switch (cmd) { switch (cmd) {
case APM_IOC_STANDBY: case APM_IOC_STANDBY:
lock_kernel(); mutex_lock(&apm_mutex);
if (as->standbys_read > 0) { if (as->standbys_read > 0) {
as->standbys_read--; as->standbys_read--;
as->standbys_pending--; as->standbys_pending--;
...@@ -1540,10 +1540,10 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg) ...@@ -1540,10 +1540,10 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg)
queue_event(APM_USER_STANDBY, as); queue_event(APM_USER_STANDBY, as);
if (standbys_pending <= 0) if (standbys_pending <= 0)
standby(); standby();
unlock_kernel(); mutex_unlock(&apm_mutex);
break; break;
case APM_IOC_SUSPEND: case APM_IOC_SUSPEND:
lock_kernel(); mutex_lock(&apm_mutex);
if (as->suspends_read > 0) { if (as->suspends_read > 0) {
as->suspends_read--; as->suspends_read--;
as->suspends_pending--; as->suspends_pending--;
...@@ -1552,13 +1552,14 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg) ...@@ -1552,13 +1552,14 @@ static long do_ioctl(struct file *filp, u_int cmd, u_long arg)
queue_event(APM_USER_SUSPEND, as); queue_event(APM_USER_SUSPEND, as);
if (suspends_pending <= 0) { if (suspends_pending <= 0) {
ret = suspend(1); ret = suspend(1);
mutex_unlock(&apm_mutex);
} else { } else {
as->suspend_wait = 1; as->suspend_wait = 1;
mutex_unlock(&apm_mutex);
wait_event_interruptible(apm_suspend_waitqueue, wait_event_interruptible(apm_suspend_waitqueue,
as->suspend_wait == 0); as->suspend_wait == 0);
ret = as->suspend_result; ret = as->suspend_result;
} }
unlock_kernel();
return ret; return ret;
default: default:
return -ENOTTY; return -ENOTTY;
...@@ -1608,12 +1609,10 @@ static int do_open(struct inode *inode, struct file *filp) ...@@ -1608,12 +1609,10 @@ static int do_open(struct inode *inode, struct file *filp)
{ {
struct apm_user *as; struct apm_user *as;
lock_kernel();
as = kmalloc(sizeof(*as), GFP_KERNEL); as = kmalloc(sizeof(*as), GFP_KERNEL);
if (as == NULL) { if (as == NULL) {
printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
sizeof(*as)); sizeof(*as));
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
as->magic = APM_BIOS_MAGIC; as->magic = APM_BIOS_MAGIC;
...@@ -1635,7 +1634,6 @@ static int do_open(struct inode *inode, struct file *filp) ...@@ -1635,7 +1634,6 @@ static int do_open(struct inode *inode, struct file *filp)
user_list = as; user_list = as;
spin_unlock(&user_list_lock); spin_unlock(&user_list_lock);
filp->private_data = as; filp->private_data = as;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -268,11 +268,12 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) ...@@ -268,11 +268,12 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
show_registers(regs); show_registers(regs);
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
sp = (unsigned long) (&regs->sp); if (user_mode_vm(regs)) {
savesegment(ss, ss);
if (user_mode(regs)) {
sp = regs->sp; sp = regs->sp;
ss = regs->ss & 0xffff; ss = regs->ss & 0xffff;
} else {
sp = kernel_stack_pointer(regs);
savesegment(ss, ss);
} }
printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip); printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
print_symbol("%s", regs->ip); print_symbol("%s", regs->ip);
......
...@@ -89,7 +89,6 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) ...@@ -89,7 +89,6 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
gdb_regs[GDB_SS] = __KERNEL_DS; gdb_regs[GDB_SS] = __KERNEL_DS;
gdb_regs[GDB_FS] = 0xFFFF; gdb_regs[GDB_FS] = 0xFFFF;
gdb_regs[GDB_GS] = 0xFFFF; gdb_regs[GDB_GS] = 0xFFFF;
gdb_regs[GDB_SP] = (int)&regs->sp;
#else #else
gdb_regs[GDB_R8] = regs->r8; gdb_regs[GDB_R8] = regs->r8;
gdb_regs[GDB_R9] = regs->r9; gdb_regs[GDB_R9] = regs->r9;
...@@ -102,8 +101,8 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) ...@@ -102,8 +101,8 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
gdb_regs32[GDB_PS] = regs->flags; gdb_regs32[GDB_PS] = regs->flags;
gdb_regs32[GDB_CS] = regs->cs; gdb_regs32[GDB_CS] = regs->cs;
gdb_regs32[GDB_SS] = regs->ss; gdb_regs32[GDB_SS] = regs->ss;
gdb_regs[GDB_SP] = regs->sp;
#endif #endif
gdb_regs[GDB_SP] = kernel_stack_pointer(regs);
} }
/** /**
......
...@@ -63,19 +63,7 @@ void jprobe_return_end(void); ...@@ -63,19 +63,7 @@ void jprobe_return_end(void);
DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
#ifdef CONFIG_X86_64 #define stack_addr(regs) ((unsigned long *)kernel_stack_pointer(regs))
#define stack_addr(regs) ((unsigned long *)regs->sp)
#else
/*
* "&regs->sp" looks wrong, but it's correct for x86_32. x86_32 CPUs
* don't save the ss and esp registers if the CPU is already in kernel
* mode when it traps. So for kprobes, regs->sp and regs->ss are not
* the [nonexistent] saved stack pointer and ss register, but rather
* the top 8 bytes of the pre-int3 stack. So &regs->sp happens to
* point to the top of the pre-int3 stack.
*/
#define stack_addr(regs) ((unsigned long *)&regs->sp)
#endif
#define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf)\ #define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf)\
(((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \
......
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/smp_lock.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -201,7 +200,6 @@ static int do_microcode_update(const void __user *buf, size_t size) ...@@ -201,7 +200,6 @@ static int do_microcode_update(const void __user *buf, size_t size)
static int microcode_open(struct inode *unused1, struct file *unused2) static int microcode_open(struct inode *unused1, struct file *unused2)
{ {
cycle_kernel_lock();
return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
} }
......
...@@ -135,7 +135,7 @@ void __show_regs(struct pt_regs *regs, int all) ...@@ -135,7 +135,7 @@ void __show_regs(struct pt_regs *regs, int all)
ss = regs->ss & 0xffff; ss = regs->ss & 0xffff;
gs = get_user_gs(regs); gs = get_user_gs(regs);
} else { } else {
sp = (unsigned long) (&regs->sp); sp = kernel_stack_pointer(regs);
savesegment(ss, ss); savesegment(ss, ss);
savesegment(gs, gs); savesegment(gs, gs);
} }
......
...@@ -248,7 +248,7 @@ EXPORT_SYMBOL(edd); ...@@ -248,7 +248,7 @@ EXPORT_SYMBOL(edd);
* from boot_params into a safe place. * from boot_params into a safe place.
* *
*/ */
static inline void copy_edd(void) static inline void __init copy_edd(void)
{ {
memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
sizeof(edd.mbr_signature)); sizeof(edd.mbr_signature));
...@@ -257,7 +257,7 @@ static inline void copy_edd(void) ...@@ -257,7 +257,7 @@ static inline void copy_edd(void)
edd.edd_info_nr = boot_params.eddbuf_entries; edd.edd_info_nr = boot_params.eddbuf_entries;
} }
#else #else
static inline void copy_edd(void) static inline void __init copy_edd(void)
{ {
} }
#endif #endif
......
...@@ -486,7 +486,7 @@ static void end_cobalt_irq(unsigned int irq) ...@@ -486,7 +486,7 @@ static void end_cobalt_irq(unsigned int irq)
} }
static struct irq_chip cobalt_irq_type = { static struct irq_chip cobalt_irq_type = {
.typename = "Cobalt-APIC", .name = "Cobalt-APIC",
.startup = startup_cobalt_irq, .startup = startup_cobalt_irq,
.shutdown = disable_cobalt_irq, .shutdown = disable_cobalt_irq,
.enable = enable_cobalt_irq, .enable = enable_cobalt_irq,
...@@ -523,7 +523,7 @@ static void end_piix4_master_irq(unsigned int irq) ...@@ -523,7 +523,7 @@ static void end_piix4_master_irq(unsigned int irq)
} }
static struct irq_chip piix4_master_irq_type = { static struct irq_chip piix4_master_irq_type = {
.typename = "PIIX4-master", .name = "PIIX4-master",
.startup = startup_piix4_master_irq, .startup = startup_piix4_master_irq,
.ack = ack_cobalt_irq, .ack = ack_cobalt_irq,
.end = end_piix4_master_irq, .end = end_piix4_master_irq,
...@@ -531,7 +531,7 @@ static struct irq_chip piix4_master_irq_type = { ...@@ -531,7 +531,7 @@ static struct irq_chip piix4_master_irq_type = {
static struct irq_chip piix4_virtual_irq_type = { static struct irq_chip piix4_virtual_irq_type = {
.typename = "PIIX4-virtual", .name = "PIIX4-virtual",
.shutdown = disable_8259A_irq, .shutdown = disable_8259A_irq,
.enable = enable_8259A_irq, .enable = enable_8259A_irq,
.disable = disable_8259A_irq, .disable = disable_8259A_irq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment