Re: [Git pull] x86 bugfixes

2007-10-27 Thread Thomas Gleixner
Linus,

please pull x86 bugfixes from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

Some more voyager fixes and other compile warning fixups than in the
yesterday pull request.

Thanks,
tglx

Eric W. Biederman (1):
  x86: Fix boot protocol KEEP_SEGMENTS check.

James Bottomley (1):
  x86: voyager: fix bogus conversion to per_cpu for boot_cpu_info

Jeff Garzik (2):
  x86: fix !SMP compiler warning in arch/x86/kernel/acpi/processor.c
  x86: fix compiler warnings in arch/x86/kernel/early-quirks.c

Ken'ichi Ohmichi (1):
  x86: Dump filtering supports x86_64 sparsemem

Thomas Gleixner (2):
  Revert "i386: export i386 smp_call_function_mask() to modules"
  x86: export smp_ops to allow modular build of KVM

 arch/x86/boot/compressed/head_32.S  |   12 
 arch/x86/boot/compressed/head_64.S  |7 +++
 arch/x86/kernel/acpi/processor.c|3 +--
 arch/x86/kernel/asm-offsets_64.c|   10 ++
 arch/x86/kernel/early-quirks.c  |4 +++-
 arch/x86/kernel/machine_kexec_64.c  |2 ++
 arch/x86/kernel/smp_32.c|8 +---
 arch/x86/mach-voyager/voyager_smp.c |4 ++--
 include/asm-x86/smp_32.h|9 ++---
 9 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/arch/x86/boot/compressed/head_32.S 
b/arch/x86/boot/compressed/head_32.S
index a0ae2e7..036e635 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -33,24 +33,20 @@
.globl startup_32
 
 startup_32:
-   /* check to see if KEEP_SEGMENTS flag is meaningful */
-   cmpw $0x207, BP_version(%esi)
-   jb 1f
-
+   cld
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
 * us to not reload segments */
testb $(1<<6), BP_loadflags(%esi)
-   jnz 2f
+   jnz 1f
 
-1: cli
+   cli
movl $(__BOOT_DS),%eax
movl %eax,%ds
movl %eax,%es
movl %eax,%fs
movl %eax,%gs
movl %eax,%ss
-
-2: cld
+1:
 
 /* Calculate the delta between where we were compiled to run
  * at and where we were actually loaded at.  This can only be done
diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index 4946764..1ccb38a 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 .section ".text.head"
.code32
@@ -36,11 +37,17 @@
 
 startup_32:
cld
+   /* test KEEP_SEGMENTS flag to see if the bootloader is asking
+* us to not reload segments */
+   testb $(1<<6), BP_loadflags(%esi)
+   jnz 1f
+
cli
movl$(__KERNEL_DS), %eax
movl%eax, %ds
movl%eax, %es
movl%eax, %ss
+1:
 
 /* Calculate the delta between where we were compiled to run
  * at and where we were actually loaded at.  This can only be done
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 2ed0a4c..f63e5ff 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -62,8 +62,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct 
cpuinfo_x86 *c)
 /* Initialize _PDC data based on the CPU vendor */
 void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
-   unsigned int cpu = pr->id;
-   struct cpuinfo_x86 *c = _data(cpu);
+   struct cpuinfo_x86 *c = _data(pr->id);
 
pr->pdc = NULL;
if (c->x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 7e50bda..d1b6ed9 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -15,12 +15,16 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DEFINE(sym, val) \
 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
 
 #define BLANK() asm volatile("\n->" : : )
 
+#define OFFSET(sym, str, mem) \
+   DEFINE(sym, offsetof(struct str, mem))
+
 #define __NO_STUBS 1
 #undef __SYSCALL
 #undef _ASM_X86_64_UNISTD_H_
@@ -109,5 +113,11 @@ int main(void)
DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
BLANK();
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
+
+   BLANK();
+   OFFSET(BP_scratch, boot_params, scratch);
+   OFFSET(BP_loadflags, boot_params, hdr.loadflags);
+   OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
+   OFFSET(BP_version, boot_params, hdr.version);
return 0;
 }
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index dc34acb..639e632 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -35,12 +35,14 @@ static void __init via_bugs(void)
 }
 
 #ifdef CONFIG_ACPI
+#ifdef CONFIG_X86_IO_APIC
 
 static int __init nvidia_hpet_check(struct acpi_table_header *header)
 {
return 0;
 }
-#endif
+#endif /* CONFIG_X86_IO_APIC */
+#endif 

Re: [Git pull] x86 bugfixes

2007-10-27 Thread Thomas Gleixner
Linus,

please pull x86 bugfixes from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

Some more voyager fixes and other compile warning fixups than in the
yesterday pull request.

Thanks,
tglx

Eric W. Biederman (1):
  x86: Fix boot protocol KEEP_SEGMENTS check.

James Bottomley (1):
  x86: voyager: fix bogus conversion to per_cpu for boot_cpu_info

Jeff Garzik (2):
  x86: fix !SMP compiler warning in arch/x86/kernel/acpi/processor.c
  x86: fix compiler warnings in arch/x86/kernel/early-quirks.c

Ken'ichi Ohmichi (1):
  x86: Dump filtering supports x86_64 sparsemem

Thomas Gleixner (2):
  Revert i386: export i386 smp_call_function_mask() to modules
  x86: export smp_ops to allow modular build of KVM

 arch/x86/boot/compressed/head_32.S  |   12 
 arch/x86/boot/compressed/head_64.S  |7 +++
 arch/x86/kernel/acpi/processor.c|3 +--
 arch/x86/kernel/asm-offsets_64.c|   10 ++
 arch/x86/kernel/early-quirks.c  |4 +++-
 arch/x86/kernel/machine_kexec_64.c  |2 ++
 arch/x86/kernel/smp_32.c|8 +---
 arch/x86/mach-voyager/voyager_smp.c |4 ++--
 include/asm-x86/smp_32.h|9 ++---
 9 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/arch/x86/boot/compressed/head_32.S 
b/arch/x86/boot/compressed/head_32.S
index a0ae2e7..036e635 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -33,24 +33,20 @@
.globl startup_32
 
 startup_32:
-   /* check to see if KEEP_SEGMENTS flag is meaningful */
-   cmpw $0x207, BP_version(%esi)
-   jb 1f
-
+   cld
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
 * us to not reload segments */
testb $(16), BP_loadflags(%esi)
-   jnz 2f
+   jnz 1f
 
-1: cli
+   cli
movl $(__BOOT_DS),%eax
movl %eax,%ds
movl %eax,%es
movl %eax,%fs
movl %eax,%gs
movl %eax,%ss
-
-2: cld
+1:
 
 /* Calculate the delta between where we were compiled to run
  * at and where we were actually loaded at.  This can only be done
diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index 4946764..1ccb38a 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -29,6 +29,7 @@
 #include asm/pgtable.h
 #include asm/page.h
 #include asm/msr.h
+#include asm/asm-offsets.h
 
 .section .text.head
.code32
@@ -36,11 +37,17 @@
 
 startup_32:
cld
+   /* test KEEP_SEGMENTS flag to see if the bootloader is asking
+* us to not reload segments */
+   testb $(16), BP_loadflags(%esi)
+   jnz 1f
+
cli
movl$(__KERNEL_DS), %eax
movl%eax, %ds
movl%eax, %es
movl%eax, %ss
+1:
 
 /* Calculate the delta between where we were compiled to run
  * at and where we were actually loaded at.  This can only be done
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 2ed0a4c..f63e5ff 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -62,8 +62,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct 
cpuinfo_x86 *c)
 /* Initialize _PDC data based on the CPU vendor */
 void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
 {
-   unsigned int cpu = pr-id;
-   struct cpuinfo_x86 *c = cpu_data(cpu);
+   struct cpuinfo_x86 *c = cpu_data(pr-id);
 
pr-pdc = NULL;
if (c-x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 7e50bda..d1b6ed9 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -15,12 +15,16 @@
 #include asm/segment.h
 #include asm/thread_info.h
 #include asm/ia32.h
+#include asm/bootparam.h
 
 #define DEFINE(sym, val) \
 asm volatile(\n- #sym  %0  #val : : i (val))
 
 #define BLANK() asm volatile(\n- : : )
 
+#define OFFSET(sym, str, mem) \
+   DEFINE(sym, offsetof(struct str, mem))
+
 #define __NO_STUBS 1
 #undef __SYSCALL
 #undef _ASM_X86_64_UNISTD_H_
@@ -109,5 +113,11 @@ int main(void)
DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
BLANK();
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
+
+   BLANK();
+   OFFSET(BP_scratch, boot_params, scratch);
+   OFFSET(BP_loadflags, boot_params, hdr.loadflags);
+   OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
+   OFFSET(BP_version, boot_params, hdr.version);
return 0;
 }
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index dc34acb..639e632 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -35,12 +35,14 @@ static void __init via_bugs(void)
 }
 
 #ifdef CONFIG_ACPI
+#ifdef CONFIG_X86_IO_APIC
 
 static int __init nvidia_hpet_check(struct 

[Git pull] x86 bugfixes

2007-10-26 Thread Thomas Gleixner
Linus,

please pull x86 bugfixes from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

Thanks

tglx


Thomas Gleixner (2):
  Revert "i386: export i386 smp_call_function_mask() to modules"
  x86: export smp_ops to allow modular build of KVM

 arch/x86/kernel/smp_32.c |8 +---
 include/asm-x86/smp_32.h |9 ++---
 2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index f321153..fcaa026 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -708,10 +708,4 @@ struct smp_ops smp_ops = {
.smp_send_reschedule = native_smp_send_reschedule,
.smp_call_function_mask = native_smp_call_function_mask,
 };
-
-int smp_call_function_mask(cpumask_t mask, void (*func) (void *info),
-  void *info, int wait)
-{
-   return smp_ops.smp_call_function_mask(mask, func, info, wait);
-}
-EXPORT_SYMBOL(smp_call_function_mask);
+EXPORT_SYMBOL_GPL(smp_ops);
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index 7056d86..e10b7af 100644
--- a/include/asm-x86/smp_32.h
+++ b/include/asm-x86/smp_32.h
@@ -94,9 +94,12 @@ static inline void smp_send_reschedule(int cpu)
 {
smp_ops.smp_send_reschedule(cpu);
 }
-extern int smp_call_function_mask(cpumask_t mask,
- void (*func) (void *info), void *info,
- int wait);
+static inline int smp_call_function_mask(cpumask_t mask,
+void (*func) (void *info), void *info,
+int wait)
+{
+   return smp_ops.smp_call_function_mask(mask, func, info, wait);
+}
 
 void native_smp_prepare_boot_cpu(void);
 void native_smp_prepare_cpus(unsigned int max_cpus);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Git pull] x86 bugfixes

2007-10-26 Thread Thomas Gleixner
Linus,

please pull x86 bugfixes from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git

Thanks

tglx


Thomas Gleixner (2):
  Revert i386: export i386 smp_call_function_mask() to modules
  x86: export smp_ops to allow modular build of KVM

 arch/x86/kernel/smp_32.c |8 +---
 include/asm-x86/smp_32.h |9 ++---
 2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index f321153..fcaa026 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -708,10 +708,4 @@ struct smp_ops smp_ops = {
.smp_send_reschedule = native_smp_send_reschedule,
.smp_call_function_mask = native_smp_call_function_mask,
 };
-
-int smp_call_function_mask(cpumask_t mask, void (*func) (void *info),
-  void *info, int wait)
-{
-   return smp_ops.smp_call_function_mask(mask, func, info, wait);
-}
-EXPORT_SYMBOL(smp_call_function_mask);
+EXPORT_SYMBOL_GPL(smp_ops);
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index 7056d86..e10b7af 100644
--- a/include/asm-x86/smp_32.h
+++ b/include/asm-x86/smp_32.h
@@ -94,9 +94,12 @@ static inline void smp_send_reschedule(int cpu)
 {
smp_ops.smp_send_reschedule(cpu);
 }
-extern int smp_call_function_mask(cpumask_t mask,
- void (*func) (void *info), void *info,
- int wait);
+static inline int smp_call_function_mask(cpumask_t mask,
+void (*func) (void *info), void *info,
+int wait)
+{
+   return smp_ops.smp_call_function_mask(mask, func, info, wait);
+}
 
 void native_smp_prepare_boot_cpu(void);
 void native_smp_prepare_cpus(unsigned int max_cpus);
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: {GIT pull] x86 bugfixes

2007-10-14 Thread Thomas Gleixner
On Sun, 14 Oct 2007, Jeff Garzik wrote:
> Unless the size is overlarge (currently 400k, on lkml), any chance I could
> talk you into appending the associated patch onto the end of future emails?

Sure. See below.
 
> If it helps, I use the attached script when I send stuff upstream.

Cute. 

Thanks,

tglx
---

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index bd72d94..11b03d3 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define MAX_PATCH_LEN (255-1)
 
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 395928d..09b8209 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -964,8 +964,34 @@ void __init setup_boot_APIC_clock (void)
setup_APIC_timer();
 }
 
+/*
+ * AMD C1E enabled CPUs have a real nasty problem: Some BIOSes set the
+ * C1E flag only in the secondary CPU, so when we detect the wreckage
+ * we already have enabled the boot CPU local apic timer. Check, if
+ * disable_apic_timer is set and the DUMMY flag is cleared. If yes,
+ * set the DUMMY flag again and force the broadcast mode in the
+ * clockevents layer.
+ */
+void __cpuinit check_boot_apic_timer_broadcast(void)
+{
+   struct clock_event_device *levt = _cpu(lapic_events, boot_cpu_id);
+
+   if (!disable_apic_timer ||
+   (lapic_clockevent.features & CLOCK_EVT_FEAT_DUMMY))
+   return;
+
+   printk(KERN_INFO "AMD C1E detected late. Force timer broadcast.\n");
+   lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
+   levt->features |= CLOCK_EVT_FEAT_DUMMY;
+
+   local_irq_enable();
+   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, _cpu_id);
+   local_irq_disable();
+}
+
 void __cpuinit setup_secondary_APIC_clock(void)
 {
+   check_boot_apic_timer_broadcast();
setup_APIC_timer();
 }
 
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 57ccf7c..720a7d1 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -335,11 +335,6 @@ void __cpuinit start_secondary(void)
 */
check_tsc_sync_target();
 
-   Dprintk("cpu %d: setting up apic clock\n", smp_processor_id()); 
-   setup_secondary_APIC_clock();
-
-   Dprintk("cpu %d: enabling apic timer\n", smp_processor_id());
-
if (nmi_watchdog == NMI_IO_APIC) {
disable_8259A_irq(0);
enable_NMI_through_LVT0(NULL);
@@ -374,6 +369,8 @@ void __cpuinit start_secondary(void)
 
unlock_ipi_call_lock();
 
+   setup_secondary_APIC_clock();
+
cpu_idle();
 }
 
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index d2ddea9..c33b0dc 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -31,6 +31,7 @@ enum clock_event_nofitiers {
CLOCK_EVT_NOTIFY_ADD,
CLOCK_EVT_NOTIFY_BROADCAST_ON,
CLOCK_EVT_NOTIFY_BROADCAST_OFF,
+   CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
CLOCK_EVT_NOTIFY_SUSPEND,
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 298bc7c..fc3fc79 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -217,26 +217,43 @@ static void tick_do_broadcast_on_off(void *why)
bc = tick_broadcast_device.evtdev;
 
/*
-* Is the device in broadcast mode forever or is it not
-* affected by the powerstate ?
+* Is the device not affected by the powerstate ?
 */
-   if (!dev || !tick_device_is_functional(dev) ||
-   !(dev->features & CLOCK_EVT_FEAT_C3STOP))
+   if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
goto out;
 
-   if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_ON) {
+   /*
+* Defect device ?
+*/
+   if (!tick_device_is_functional(dev)) {
+   /*
+* AMD C1E wreckage fixup:
+*
+* Device was registered functional in the first
+* place. Now the secondary CPU detected the C1E
+* misfeature and notifies us to fix it up
+*/
+   if (*reason != CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
+   goto out;
+   }
+
+   switch (*reason) {
+   case CLOCK_EVT_NOTIFY_BROADCAST_ON:
+   case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
if (!cpu_isset(cpu, tick_broadcast_mask)) {
cpu_set(cpu, tick_broadcast_mask);
if (td->mode == TICKDEV_MODE_PERIODIC)
clockevents_set_mode(dev,
 CLOCK_EVT_MODE_SHUTDOWN);
}
-   } else {
+   break;
+   case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
if (cpu_isset(cpu, tick_broadcast_mask)) {
   

Re: {GIT pull] x86 bugfixes

2007-10-14 Thread Jeff Garzik

Thomas Gleixner wrote:

Linus,

please pull from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86.git

Thanks,

tglx
--
Dave Jones (1):
  x86: fix missing include for vsyscall

Thomas Gleixner (3):
  clockevents: introduce force broadcast notifier
  x86: move local APIC timer init to the end of start_secondary()
  x86: force timer broadcast on late AMD C1E detection

 arch/x86/kernel/alternative.c |1 +
 arch/x86/kernel/apic_64.c |   26 ++
 arch/x86/kernel/smpboot_64.c  |7 ++-
 include/linux/clockchips.h|1 +
 kernel/time/tick-broadcast.c  |   29 +++--
 kernel/time/tick-common.c |1 +
 6 files changed, 54 insertions(+), 11 deletions(-)


Unless the size is overlarge (currently 400k, on lkml), any chance I 
could talk you into appending the associated patch onto the end of 
future emails?


If it helps, I use the attached script when I send stuff upstream.

Jeff





mkmsg.sh
Description: application/shellscript


{GIT pull] x86 bugfixes

2007-10-14 Thread Thomas Gleixner
Linus,

please pull from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86.git

Thanks,

tglx
--
Dave Jones (1):
  x86: fix missing include for vsyscall

Thomas Gleixner (3):
  clockevents: introduce force broadcast notifier
  x86: move local APIC timer init to the end of start_secondary()
  x86: force timer broadcast on late AMD C1E detection

 arch/x86/kernel/alternative.c |1 +
 arch/x86/kernel/apic_64.c |   26 ++
 arch/x86/kernel/smpboot_64.c  |7 ++-
 include/linux/clockchips.h|1 +
 kernel/time/tick-broadcast.c  |   29 +++--
 kernel/time/tick-common.c |1 +
 6 files changed, 54 insertions(+), 11 deletions(-)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


{GIT pull] x86 bugfixes

2007-10-14 Thread Thomas Gleixner
Linus,

please pull from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86.git

Thanks,

tglx
--
Dave Jones (1):
  x86: fix missing include for vsyscall

Thomas Gleixner (3):
  clockevents: introduce force broadcast notifier
  x86: move local APIC timer init to the end of start_secondary()
  x86: force timer broadcast on late AMD C1E detection

 arch/x86/kernel/alternative.c |1 +
 arch/x86/kernel/apic_64.c |   26 ++
 arch/x86/kernel/smpboot_64.c  |7 ++-
 include/linux/clockchips.h|1 +
 kernel/time/tick-broadcast.c  |   29 +++--
 kernel/time/tick-common.c |1 +
 6 files changed, 54 insertions(+), 11 deletions(-)


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: {GIT pull] x86 bugfixes

2007-10-14 Thread Jeff Garzik

Thomas Gleixner wrote:

Linus,

please pull from

  ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86.git

Thanks,

tglx
--
Dave Jones (1):
  x86: fix missing include for vsyscall

Thomas Gleixner (3):
  clockevents: introduce force broadcast notifier
  x86: move local APIC timer init to the end of start_secondary()
  x86: force timer broadcast on late AMD C1E detection

 arch/x86/kernel/alternative.c |1 +
 arch/x86/kernel/apic_64.c |   26 ++
 arch/x86/kernel/smpboot_64.c  |7 ++-
 include/linux/clockchips.h|1 +
 kernel/time/tick-broadcast.c  |   29 +++--
 kernel/time/tick-common.c |1 +
 6 files changed, 54 insertions(+), 11 deletions(-)


Unless the size is overlarge (currently 400k, on lkml), any chance I 
could talk you into appending the associated patch onto the end of 
future emails?


If it helps, I use the attached script when I send stuff upstream.

Jeff





mkmsg.sh
Description: application/shellscript


Re: {GIT pull] x86 bugfixes

2007-10-14 Thread Thomas Gleixner
On Sun, 14 Oct 2007, Jeff Garzik wrote:
 Unless the size is overlarge (currently 400k, on lkml), any chance I could
 talk you into appending the associated patch onto the end of future emails?

Sure. See below.
 
 If it helps, I use the attached script when I send stuff upstream.

Cute. 

Thanks,

tglx
---

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index bd72d94..11b03d3 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -10,6 +10,7 @@
 #include asm/pgtable.h
 #include asm/mce.h
 #include asm/nmi.h
+#include asm/vsyscall.h
 
 #define MAX_PATCH_LEN (255-1)
 
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 395928d..09b8209 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -964,8 +964,34 @@ void __init setup_boot_APIC_clock (void)
setup_APIC_timer();
 }
 
+/*
+ * AMD C1E enabled CPUs have a real nasty problem: Some BIOSes set the
+ * C1E flag only in the secondary CPU, so when we detect the wreckage
+ * we already have enabled the boot CPU local apic timer. Check, if
+ * disable_apic_timer is set and the DUMMY flag is cleared. If yes,
+ * set the DUMMY flag again and force the broadcast mode in the
+ * clockevents layer.
+ */
+void __cpuinit check_boot_apic_timer_broadcast(void)
+{
+   struct clock_event_device *levt = per_cpu(lapic_events, boot_cpu_id);
+
+   if (!disable_apic_timer ||
+   (lapic_clockevent.features  CLOCK_EVT_FEAT_DUMMY))
+   return;
+
+   printk(KERN_INFO AMD C1E detected late. Force timer broadcast.\n);
+   lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
+   levt-features |= CLOCK_EVT_FEAT_DUMMY;
+
+   local_irq_enable();
+   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, boot_cpu_id);
+   local_irq_disable();
+}
+
 void __cpuinit setup_secondary_APIC_clock(void)
 {
+   check_boot_apic_timer_broadcast();
setup_APIC_timer();
 }
 
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 57ccf7c..720a7d1 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -335,11 +335,6 @@ void __cpuinit start_secondary(void)
 */
check_tsc_sync_target();
 
-   Dprintk(cpu %d: setting up apic clock\n, smp_processor_id()); 
-   setup_secondary_APIC_clock();
-
-   Dprintk(cpu %d: enabling apic timer\n, smp_processor_id());
-
if (nmi_watchdog == NMI_IO_APIC) {
disable_8259A_irq(0);
enable_NMI_through_LVT0(NULL);
@@ -374,6 +369,8 @@ void __cpuinit start_secondary(void)
 
unlock_ipi_call_lock();
 
+   setup_secondary_APIC_clock();
+
cpu_idle();
 }
 
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index d2ddea9..c33b0dc 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -31,6 +31,7 @@ enum clock_event_nofitiers {
CLOCK_EVT_NOTIFY_ADD,
CLOCK_EVT_NOTIFY_BROADCAST_ON,
CLOCK_EVT_NOTIFY_BROADCAST_OFF,
+   CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
CLOCK_EVT_NOTIFY_SUSPEND,
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 298bc7c..fc3fc79 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -217,26 +217,43 @@ static void tick_do_broadcast_on_off(void *why)
bc = tick_broadcast_device.evtdev;
 
/*
-* Is the device in broadcast mode forever or is it not
-* affected by the powerstate ?
+* Is the device not affected by the powerstate ?
 */
-   if (!dev || !tick_device_is_functional(dev) ||
-   !(dev-features  CLOCK_EVT_FEAT_C3STOP))
+   if (!dev || !(dev-features  CLOCK_EVT_FEAT_C3STOP))
goto out;
 
-   if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_ON) {
+   /*
+* Defect device ?
+*/
+   if (!tick_device_is_functional(dev)) {
+   /*
+* AMD C1E wreckage fixup:
+*
+* Device was registered functional in the first
+* place. Now the secondary CPU detected the C1E
+* misfeature and notifies us to fix it up
+*/
+   if (*reason != CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
+   goto out;
+   }
+
+   switch (*reason) {
+   case CLOCK_EVT_NOTIFY_BROADCAST_ON:
+   case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
if (!cpu_isset(cpu, tick_broadcast_mask)) {
cpu_set(cpu, tick_broadcast_mask);
if (td-mode == TICKDEV_MODE_PERIODIC)
clockevents_set_mode(dev,
 CLOCK_EVT_MODE_SHUTDOWN);
}
-   } else {
+   break;
+   case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
if