i386: avoid gcc extension
Subsystems (4)
PATCH 5/29 i386: arch/i386/kernel/alternative.c should #include <asm/bugs.h>
In reply to Andi KleenFrom: Adrian Bunk <[email protected]>
Every file should include the headers containing the prototypes for its global functions.
---
arch/i386/kernel/alternative.c | 1 + 1 file changed, 1 insertion(+)
arch/i386/kernel/alternative.c +1 -0
@@ -4,6 +4,7 @@#include <linux/list.h> #include <asm/alternative.h> #include <asm/sections.h> +#include <asm/bugs.h> static int no_replacement =0 ;static int smp_alt_once =0 ;
PATCH 8/29 x86_64: avoid warning message livelock
In reply to Andi KleenFrom: Roland Dreier <[email protected]>
I've seen my box paralyzed by an endless spew of
rtc: lost some interrupts at 1024Hz.
messages on the serial console. What seems to be happening is that something real causes an interrupt to be lost and triggers the message. But then printing the message to the serial console (from the hpet interrupt handler) takes more than 1/1024th of a second, and then some more interrupts are lost, so the message triggers again....
Fix this by adding a printk_ratelimit() before printing the warning.
---
arch/x86_64/kernel/time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86_64/kernel/time.c +3 -2
@@ -1226,8 +1226,9 @@ static void hpet_rtc_timer_reinit(void)if (PIE_on) PIE_count += lost_ints; -printk (KERN_WARNING "rtc: lost some interrupts at %ldHz.\n" , - hpet_rtc_int_freq); +if (printk_ratelimit ()) +printk (KERN_WARNING "rtc: lost some interrupts at %ldHz.\n" , + hpet_rtc_int_freq); } }
PATCH 27/29 i386: Rename cpu_gdt_descr and remove extern declaration from smpboot.c
In reply to Andi KleenFrom: Rusty Russell <[email protected]>
When I implemented the DECLARE_PER_CPU(var) macros, I was careful that people couldn't use "var" in a non-percpu context, by prepending percpu__. I never considered that this would allow them to overload the same name for a per-cpu and a non-percpu variable.
It is only one of many horrors in the i386 boot code, but let's rename the non-perpcu cpu_gdt_descr to early_gdt_descr (not boot_gdt_descr, that's something else...)
===================================================================
--- arch/i386/kernel/head.S | 6 +++--- arch/i386/kernel/smpboot.c | 1 - include/asm-i386/desc.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-)
arch/i386/kernel/head.S +3 -3
@@ -319,7 +319,7 @@ is386: movl $2,%ecx # set MP call check_x87 call setup_pda - lgdt cpu_gdt_descr + lgdt early_gdt_descr lidt idt_descr ljmp $(__KERNEL_CS),$1f 1: movl $(__KERNEL_DS),%eax # reload all the segment registers
@@ -375,7 +375,7 @@ ENTRY(setup_pda) movl start_pda, %eax /* slot the PDA address into the GDT */ - mov cpu_gdt_descr+2, %ecx + mov early_gdt_descr+2, %ecx mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */ shr $16, %eax mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */
@@ -597,7 +597,7 @@ idt_descr: # boot GDT descriptor (later on used by CPU#0): .word 0 # 32 bit align gdt_desc.address -ENTRY(cpu_gdt_descr) +ENTRY(early_gdt_descr) .word GDT_ENTRIES*8-1 .long cpu_gdt_table
arch/i386/kernel/smpboot.c +0 -1
@@ -622,7 +622,6 @@ extern struct {unsigned short ss; } stack_start;extern struct i386_pda *start_pda; -extern struct Xgt_desc_struct cpu_gdt_descr;#ifdef CONFIG_NUMA
include/asm-i386/desc.h +1 -1
@@ -22,7 +22,7 @@ struct Xgt_desc_struct {extern struct Xgt_desc_struct idt_descr; DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); - +extern struct Xgt_desc_struct early_gdt_descr;static inline struct desc_struct *get_cpu_gdt_table (unsigned int cpu) {
PATCH 24/29 x86_64: -mm merge plans for 2.6.21
In reply to Andi KleenFrom: Ralf Baechle <[email protected]>
Quoted 3 lines · Heiko Carstens
Which remembers me that I think that MIPS is using the non-compat version of
sys_epoll_pwaitfor compat syscalls. But maybe MIPS doesn't need a compat syscall for some reason. Dunno.
Which reminds me that x86_64 i386 compat doesn't wire up sys_epoll_pwait ;-)
Ralf
--- arch/x86_64/ia32/ia32entry.S | 1 + 1 file changed, 1 insertion(+)
arch/x86_64/ia32/ia32entry.S +1 -0
@@ -730,4 +730,5 @@ ia32_sys_call_table: .quad compat_sys_vmsplice .quad compat_sys_move_pages .quad sys_getcpu + .quad sys_epoll_pwait ia32_syscall_end:
PATCH 18/29 i386: Add L3 cache support to AMD CPUID4 emulation
In reply to Andi KleenWith that an L3 cache is correctly reported in the cache information in /sys
--- arch/i386/kernel/cpu/intel_cacheinfo.c | 65 +++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 15 deletions(-)
arch/i386/kernel/cpu/intel_cacheinfo.c +50 -15
@@ -135,7 +135,7 @@ unsigned short num_cache_leaves;/* AMD doesn't have CPUID4. Emulate it here to report the same information to the user. This makes some assumptions about the machine: -No L3, L2 not shared, no SMT etc. that is currently true on AMD CPUs. +L2 not shared, no SMT etc. that is currently true on AMD CPUs. In theory the TLBs could be reported as fake type (they are in "dummy"). Maybe later */
@@ -159,11 +159,23 @@ union l2_cache {unsigned val; }; +union l3_cache { +struct { +unsigned line_size :8 ; +unsigned lines_per_tag :4 ; +unsigned assoc :4 ; +unsigned res :2 ; +unsigned size_encoded :14 ; + }; +unsigned val; +}; +static const unsigned short assocs[] = { [1 ] =1 , [2 ] =2 , [4 ] =4 , [6 ] =8 , [8 ] =16 , [0xf ] =0xffff // ?? - }; +}; +static const unsigned char levels[] = {1 ,1 ,2 };static const unsigned char types[] = {1 ,2 ,3 };
@@ -175,37 +187,60 @@ static void __cpuinit amd_cpuid4(int leaunsigned line_size, lines_per_tag, assoc, size_in_kb;union l1_cache l1i, l1d;union l2_cache l2; +union l3_cache l3; +union l1_cache *l1 = &l1d; eax->full =0 ; ebx->full =0 ; ecx->full =0 ;cpuid (0x80000005 , &dummy, &dummy, &l1d.val, &l1i.val); -cpuid (0x80000006 , &dummy, &dummy, &l2.val, &dummy); - -if (leaf >2 || !l1d.val || !l1i.val || !l2.val) -return ; +cpuid (0x80000006 , &dummy, &dummy, &l2.val, &l3.val); - eax->split.is_self_initializing =1 ; - eax->split.type = types[leaf]; - eax->split.level = levels[leaf]; - eax->split.num_threads_sharing =0 ; - eax->split.num_cores_on_die = current_cpu_data.x86_max_cores -1 ; - -if (leaf <=1 ) { -union l1_cache *l1 = leaf ==0 ? &l1d : &l1i; +switch (leaf) { +case 1 : + l1 = &l1i; +case 0 : +if (!l1->val) +return ; assoc = l1->assoc; line_size = l1->line_size; lines_per_tag = l1->lines_per_tag; size_in_kb = l1->size_in_kb; - }else { +break ; +case 2 : +if (!l2.val) +return ; assoc = l2.assoc; line_size = l2.line_size; lines_per_tag = l2.lines_per_tag;/* cpu_data has errata corrections for K7 applied */ size_in_kb = current_cpu_data.x86_cache_size; +break ; +case 3 : +if (!l3.val) +return ; + assoc = l3.assoc; + line_size = l3.line_size; + lines_per_tag = l3.lines_per_tag; +switch (l3.size_encoded) { +case 4 : size_in_kb =2 *1024 ;break ; +case 8 : size_in_kb =4 *1024 ;break ; +case 12 : size_in_kb =6 *1024 ;break ; +default : size_in_kb =0 ;break ; + } +break ; +default : +return ; } + eax->split.is_self_initializing =1 ; + eax->split.type = types[leaf]; + eax->split.level = levels[leaf]; + eax->split.num_threads_sharing =0 ; + eax->split.num_cores_on_die = current_cpu_data.x86_max_cores -1 ; + +if (assoc ==0xf ) eax->split.is_fully_associative =1 ; ebx->split.coherency_line_size = line_size -1 ;
PATCH 20/29 i386: Fix warning in microcode.c
In reply to Andi KleenFix bogus gcc warning
linux/arch/i386/kernel/microcode.c:387: warning: ‘new_mc’ may be used uninitialized in this function
--- arch/i386/kernel/microcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/kernel/microcode.c +1 -1
@@ -384,7 +384,7 @@ static int do_microcode_update (void) {long cursor =0 ;int error =0 ; -void *new_mc; +void *new_mc =NULL ;int cpu;cpumask_t old;
PATCH 21/29 i386: Fix warning in cpu initialization
In reply to Andi KleenFix bogus warning
linux/arch/i386/kernel/cpu/transmeta.c:12: warning: ‘cpu_freq’ may be used uninitialized in this function
--- arch/i386/kernel/cpu/transmeta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/kernel/cpu/transmeta.c +1 -1
@@ -9,7 +9,7 @@ static void __cpuinit init_transmeta(str {unsigned int cap_mask, uk, max, dummy;unsigned int cms_rev1, cms_rev2; -unsigned int cpu_rev, cpu_freq, cpu_flags, new_cpu_rev; +unsigned int cpu_rev, cpu_freq =0 , cpu_flags, new_cpu_rev;char cpu_info[65 ];get_model_name (c);/* Same as AMD/Cyrix */
PATCH 7/29 x86_64: update IO-APIC dest field to 8-bit for xAPIC
In reply to Andi KleenFrom: Benjamin Romer <[email protected]>
On the Unisys ES7000/ONE system, we encountered a problem where performing a kexec reboot or dump on any cell other than cell 0 causes the system timer to stop working, resulting in a hang during timer calibration in the new kernel.
We traced the problem to one line of code in disable_IO_APIC(), which needs to restore the timer's IO-APIC configuration before rebooting. The code is currently using the 4-bit physical destination field, rather than using the 8-bit logical destination field, and it cuts off the upper 4 bits of the timer's APIC ID. If we change this to use the logical destination field, the timer works and we can kexec on the upper cells. This was tested on two different cells (0 and 2) in an ES7000/ONE system.
For reference, the relevant Intel xAPIC spec is kept at ftp://download.intel.com/design/chipsets/e8501/datashts/30962001.pdf, specifically on page 334.
---
arch/x86_64/kernel/io_apic.c | 24 +++++++++++------------- include/asm-x86_64/io_apic.h | 14 ++------------ 2 files changed, 13 insertions(+), 25 deletions(-)
arch/x86_64/kernel/io_apic.c +11 -13
@@ -831,7 +831,7 @@ static void __init setup_IO_APIC_irq(int entry.delivery_mode =INT_DELIVERY_MODE ; entry.dest_mode =INT_DEST_MODE ; entry.mask =0 ;/* enable IRQ */ - entry.dest.logical.logical_dest =cpu_mask_to_apicid (TARGET_CPUS ); + entry.dest =cpu_mask_to_apicid (TARGET_CPUS ); entry.trigger =irq_trigger (idx); entry.polarity =irq_polarity (idx);
@@ -839,7 +839,7 @@ static void __init setup_IO_APIC_irq(intif (irq_trigger (idx)) { entry.trigger =1 ; entry.mask =1 ; - entry.dest.logical.logical_dest =cpu_mask_to_apicid (TARGET_CPUS ); + entry.dest =cpu_mask_to_apicid (TARGET_CPUS ); }if (!apic && !IO_APIC_IRQ (irq))
@@ -851,7 +851,7 @@ static void __init setup_IO_APIC_irq(intif (vector <0 )return ; - entry.dest.logical.logical_dest =cpu_mask_to_apicid (mask); + entry.dest =cpu_mask_to_apicid (mask); entry.vector = vector;ioapic_register_intr (irq, vector,IOAPIC_AUTO );
@@ -920,7 +920,7 @@ static void __init setup_ExtINT_IRQ0_pin*/ entry.dest_mode =INT_DEST_MODE ; entry.mask =0 ;/* unmask IRQ now */ - entry.dest.logical.logical_dest =cpu_mask_to_apicid (TARGET_CPUS ); + entry.dest =cpu_mask_to_apicid (TARGET_CPUS ); entry.delivery_mode =INT_DELIVERY_MODE ; entry.polarity =0 ; entry.trigger =0 ;
@@ -1020,18 +1020,17 @@ void __apicdebuginit print_IO_APIC(void)printk (KERN_DEBUG ".... IRQ redirection table:\n" ); -printk (KERN_DEBUG " NR Log Phy Mask Trig IRR Pol" -" Stat Dest Deli Vect: \n" ); +printk (KERN_DEBUG " NR Dst Mask Trig IRR Pol" +" Stat Dmod Deli Vect: \n" );for (i =0 ; i <= reg_01.bits.entries; i++) {struct IO_APIC_route_entry entry; entry =ioapic_read_entry (apic, i); -printk (KERN_DEBUG " %02x %03X %02X " , +printk (KERN_DEBUG " %02x %03X " , i, - entry.dest.logical.logical_dest, - entry.dest.physical.physical_dest + entry.dest ); printk("%1d %1d %1d %1d %1d %1d %1d %02X\n",
@@ -1293,8 +1292,7 @@ void disable_IO_APIC(void) entry.dest_mode =0 ;/* Physical */ entry.delivery_mode = dest_ExtINT;/* ExtInt */ entry.vector =0 ; - entry.dest.physical.physical_dest = -GET_APIC_ID (apic_read (APIC_ID )); + entry.dest =GET_APIC_ID (apic_read (APIC_ID ));/* * Add it to the IO-APIC irq-routing table:
@@ -1556,7 +1554,7 @@ static inline void unlock_ExtINT_logic(v entry1.dest_mode =0 ;/* physical delivery */ entry1.mask =0 ;/* unmask IRQ now */ - entry1.dest.physical.physical_dest =hard_smp_processor_id (); + entry1.dest =hard_smp_processor_id (); entry1.delivery_mode = dest_ExtINT; entry1.polarity = entry0.polarity; entry1.trigger =0 ;
@@ -2131,7 +2129,7 @@ int io_apic_set_pci_routing (int ioapic, entry.delivery_mode =INT_DELIVERY_MODE ; entry.dest_mode =INT_DEST_MODE ; - entry.dest.logical.logical_dest =cpu_mask_to_apicid (mask); + entry.dest =cpu_mask_to_apicid (mask); entry.trigger = triggering; entry.polarity = polarity; entry.mask =1 ;/* Disabled (masked) */
include/asm-x86_64/io_apic.h +2 -12
@@ -85,18 +85,8 @@ struct IO_APIC_route_entry { mask :1 ,/* 0: enabled, 1: disabled */ __reserved_2 : 15; -union {struct {__u32 - __reserved_1 :24 , - physical_dest :4 , - __reserved_2 :4 ; - } physical; - -struct {__u32 - __reserved_1 :24 , - logical_dest :8 ; - } logical; - } dest; - + __u32 __reserved_3 : 24, + dest : 8; } __attribute__ ((packed));/*
PATCH 23/29 x86: Don't require the vDSO for handling a.out signals
In reply to Andi Kleenand in other strange binfmts. vDSO is not necessarily mapped there.
--- arch/i386/kernel/signal.c | 6 +++++- arch/x86_64/ia32/ia32_signal.c | 7 ++++++- fs/binfmt_elf.c | 3 ++- include/linux/binfmts.h | 1 + 4 files changed, 14 insertions(+), 3 deletions(-)
arch/i386/kernel/signal.c +5 -1
@@ -21,6 +21,7 @@#include <linux/suspend.h> #include <linux/ptrace.h> #include <linux/elf.h> +#include <linux/binfmts.h> #include <asm/processor.h> #include <asm/ucontext.h> #include <asm/uaccess.h>
@@ -349,7 +350,10 @@ static int setup_frame(int sig, struct k goto give_sigsegv; } - restorer = (void *)VDSO_SYM (&__kernel_sigreturn); +if (current->binfmt->hasvdso) + restorer = (void *)VDSO_SYM (&__kernel_sigreturn); +else + restorer = (void *)&frame->retcode;if (ka->sa.sa_flags &SA_RESTORER ) restorer = ka->sa.sa_restorer;
arch/x86_64/ia32/ia32_signal.c +6 -1
@@ -21,6 +21,7 @@#include <linux/stddef.h> #include <linux/personality.h> #include <linux/compat.h> +#include <linux/binfmts.h> #include <asm/ucontext.h> #include <asm/uaccess.h> #include <asm/i387.h>
@@ -449,7 +450,11 @@ int ia32_setup_frame(int sig, struct k_s/* Return stub is in 32bit vsyscall page */ { -void __user *restorer =VSYSCALL32_SIGRETURN ; +void __user *restorer; +if (current->binfmt->hasvdso) + restorer =VSYSCALL32_SIGRETURN ; +else + restorer = (void *)&frame->retcode;if (ka->sa.sa_flags &SA_RESTORER ) restorer = ka->sa.sa_restorer; err |=__put_user (ptr_to_compat (restorer), &frame->pretcode);
fs/binfmt_elf.c +2 -1
@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = .load_binary = load_elf_binary, .load_shlib = load_elf_library, .core_dump = elf_core_dump, - .min_coredump = ELF_EXEC_PAGESIZE + .min_coredump = ELF_EXEC_PAGESIZE, + .hasvdso = 1 };#define BAD_ADDR (x) ((unsigned long)(x) >= TASK_SIZE)
include/linux/binfmts.h +1 -0
@@ -59,6 +59,7 @@ struct linux_binfmt {int (*load_shlib)(struct file *);int (*core_dump)(long signr,struct pt_regs * regs,struct file * file);unsigned long min_coredump;/* minimal dump size */ +int hasvdso; };extern int register_binfmt (struct linux_binfmt *);
PATCH 25/29 i386: paravirt unhandled fallthrough
In reply to Andi KleenFrom: Rusty Russell <[email protected]>
The current code simply calls "start_kernel" directly if we're under a hypervisor and no paravirt_ops backend wants us, because paravirt.c registers that as a backend.
This was always a vain hope; start_kernel won't get far without setup. It's also impossible for paravirt_ops backends which don't sit in the arch/i386/kernel directory: they can't link before paravirt.o anyway.
Keep it simple: if we pass all the registered paravirt probes, BUG().
--- arch/i386/kernel/Makefile | 2 -- arch/i386/kernel/head.S | 7 ++++++- arch/i386/kernel/paravirt.c | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/i386/kernel/Makefile +0 -2
@@ -41,8 +41,6 @@ obj-$(CONFIG_HPET_TIMER) += hpet.o obj-$(CONFIG_K8_NB) += k8.o obj-$(CONFIG_VMI) += vmi.o vmitime.o - -# Make sure this is linked after any other paravirt_ops structs: see head.S obj-$(CONFIG_PARAVIRT) += paravirt.o EXTRA_AFLAGS := -traditional
arch/i386/kernel/head.S +6 -1
@@ -513,10 +513,11 @@ startup_paravirt: pushl %ecx pushl %eax - /* paravirt.o is last in link, and that probe fn never returns */ pushl $__start_paravirtprobe 1: movl 0(%esp), %eax + cmpl $__stop_paravirtprobe, %eax + je unhandled_paravirt pushl (%eax) movl 8(%esp), %eax call *(%esp)
@@ -528,6 +529,10 @@ startup_paravirt: addl $4, (%esp) jmp 1b + +unhandled_paravirt: + /* Nothing wanted us: we're screwed. */ + ud2 #endif /*
arch/i386/kernel/paravirt.c +0 -3
@@ -482,9 +482,6 @@ static int __init print_banner(void) }core_initcall (print_banner); -/* We simply declare start_kernel to be the paravirt probe of last resort. */ -paravirt_probe (start_kernel); -struct paravirt_ops paravirt_ops = { .name ="bare hardware" , .paravirt_enabled =0 ,
PATCH 26/29 i386: Move mce_disabled to asm/mce.h
In reply to Andi KleenFrom: Rusty Russell <[email protected]>
Allows external actors to disable mce.
===================================================================
--- arch/i386/kernel/cpu/mcheck/mce.h | 2 +- include/asm-i386/mce.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
arch/i386/kernel/cpu/mcheck/mce.h +1 -1
@@ -1,4 +1,5 @@#include <linux/init.h> +#include <asm/mce.h> void amd_mcheck_init (struct cpuinfo_x86 *c);void intel_p4_mcheck_init (struct cpuinfo_x86 *c);
@@ -9,6 +10,5 @@ void winchip_mcheck_init(struct cpuinfo_/* Call the installed machine check handler for this CPU setup. */ extern fastcall void (*machine_check_vector)(struct pt_regs *, long error_code); -extern int mce_disabled;extern int nr_mce_banks;
include/asm-i386/mce.h +2 -0
@@ -3,3 +3,5 @@ extern void mcheck_init(struct cpuinfo_x#else #define mcheck_init (c) do {} while(0)#endif + +extern int mce_disabled;
PATCH 28/29 i386: Remove extern declaration from mm/discontig.c, put in header.
In reply to Andi KleenFrom: Rusty Russell <[email protected]>
Extern declarations belong in headers. Times, they are a'changin.
===================================================================
--- arch/i386/mm/discontig.c | 1 - include/asm-i386/setup.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
arch/i386/mm/discontig.c +0 -1
@@ -101,7 +101,6 @@ extern void find_max_pfn(void);extern void add_one_highpage_init (struct page *,int ,int );extern struct e820map e820; -extern unsigned long init_pg_tables_end;extern unsigned long highend_pfn, highstart_pfn;extern unsigned long max_low_pfn;extern unsigned long totalram_pages;
include/asm-i386/setup.h +2 -0
@@ -77,6 +77,8 @@ int __init sanitize_e820_map(struct e820void __init add_memory_region (unsigned long long start,unsigned long long size,int type); +extern unsigned long init_pg_tables_end; +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */
PATCH 29/29 x86: Unify pcspeaker platform device code between i386/x86-64
In reply to Andi KleenTrivial cleanup.
Only change is that it is always compiled in now on x86-64 like on i386.
--- arch/i386/kernel/Makefile | 1 + arch/i386/kernel/pcspeaker.c | 20 ++++++++++++++++++++ arch/i386/kernel/setup.c | 26 -------------------------- arch/x86_64/kernel/Makefile | 2 ++ arch/x86_64/kernel/setup.c | 20 -------------------- 5 files changed, 23 insertions(+), 46 deletions(-)
arch/i386/kernel/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_K8_NB) += k8.o obj-$(CONFIG_VMI) += vmi.o vmitime.o obj-$(CONFIG_PARAVIRT) += paravirt.o +obj-y += pcspeaker.o EXTRA_AFLAGS := -traditional
arch/i386/kernel/pcspeaker.c new file +20 -0
@@ -0,0 +1,20 @@ +#include <linux/platform_device.h> +#include <linux/errno.h> +#include <linux/init.h> + +static __init int add_pcspkr (void ) +{ +struct platform_device *pd; +int ret; + + pd =platform_device_alloc ("pcspkr" ,-1 ); +if (!pd) +return -ENOMEM ; + + ret =platform_device_add (pd); +if (ret) +platform_device_put (pd); + +return ret; +} +device_initcall (add_pcspkr);
arch/i386/kernel/setup.c +0 -26
@@ -33,7 +33,6 @@#include <linux/initrd.h> #include <linux/bootmem.h> #include <linux/seq_file.h> -#include <linux/platform_device.h> #include <linux/console.h> #include <linux/mca.h> #include <linux/root_dev.h>
@@ -660,28 +659,3 @@ void __init setup_arch(char **cmdline_p)#endif tsc_init (); } - -static __init int add_pcspkr (void ) -{ -struct platform_device *pd; -int ret; - - pd =platform_device_alloc ("pcspkr" ,-1 ); -if (!pd) -return -ENOMEM ; - - ret =platform_device_add (pd); -if (ret) -platform_device_put (pd); - -return ret; -} -device_initcall (add_pcspkr); - -/* -* Local Variables: -* mode:c -* c-file-style:"k&r" -* c-basic-offset:8 -* End: -*/
arch/x86_64/kernel/Makefile +2 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_PCI) += early-quirks.o obj-y += topology.o obj-y += intel_cacheinfo.o +obj-y += pcspeaker.o CFLAGS_vsyscall.o := $(PROFILING) -g0
@@ -55,3 +56,4 @@ quirks-y += ../../i386/kernel/quirks.o i8237-y += ../../i386/kernel/i8237.o msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o alternative-y += ../../i386/kernel/alternative.o +pcspeaker-y += ../../i386/kernel/pcspeaker.o
arch/x86_64/kernel/setup.c +0 -20
@@ -1104,23 +1104,3 @@ struct seq_operations cpuinfo_op = { .stop = c_stop, .show = show_cpuinfo, }; - -#if defined(CONFIG_INPUT_PCSPKR ) || defined(CONFIG_INPUT_PCSPKR_MODULE ) -#include <linux/platform_device.h> -static __init int add_pcspkr (void ) -{ -struct platform_device *pd; -int ret; - - pd =platform_device_alloc ("pcspkr" ,-1 ); -if (!pd) -return -ENOMEM ; - - ret =platform_device_add (pd); -if (ret) -platform_device_put (pd); - -return ret; -} -device_initcall (add_pcspkr); -#endif
PATCH 17/29 x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
In reply to Andi KleenJust various new acronyms. The new popcnt bit is in the middle of Intel space. This looks a little weird, but I've been assured it's ok.
Also I fixed RDTSCP for i386 which was at the wrong place.
For i386 and x86-64.
--- arch/i386/kernel/cpu/proc.c | 14 +++++++++----- arch/x86_64/kernel/setup.c | 14 ++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-)
arch/x86_64/kernel/setup.c +10 -4
@@ -942,7 +942,8 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"syscall" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"nx" ,NULL ,"mmxext" ,NULL , -NULL ,"fxsr_opt" ,NULL ,"rdtscp" ,NULL ,"lm" ,"3dnowext" ,"3dnow" , +NULL ,"fxsr_opt" ,"pdpe1gb" ,"rdtscp" ,NULL ,"lm" , +"3dnowext" ,"3dnow" ,/* Transmeta-defined */ "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -960,7 +961,7 @@ static int show_cpuinfo(struct seq_file/* Intel-defined (#2) */ "pni" ,NULL ,NULL ,"monitor" ,"ds_cpl" ,"vmx" ,"smx" ,"est" ,"tm2" ,"ssse3" ,"cid" ,NULL ,NULL ,"cx16" ,"xtpr" ,NULL , -NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,"popcnt" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , /* VIA/Cyrix/Centaur-defined */
@@ -970,8 +971,10 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,/* AMD-defined (#2) */ -"lahf_lm" ,"cmp_legacy" ,"svm" ,NULL ,"cr8_legacy" ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , +"lahf_lm" ,"cmp_legacy" ,"svm" ,"extapic" ,"cr8_legacy" , +"altmovcr8" ,"abm" ,"sse4a" , +"misalignsse" ,"3dnowprefetch" , +"osvw" ,"ibs" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };
@@ -982,6 +985,9 @@ static int show_cpuinfo(struct seq_file"ttp" ,/* thermal trip */ "tm" ,"stc" , +"100mhzsteps" , +"hwpstate" , +NULL ,/* tsc invariant mapped to constant_tsc */ NULL, /* nothing */ /* constant_tsc - moved to flags */ };
arch/i386/kernel/cpu/proc.c +9 -5
@@ -29,7 +29,7 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"syscall" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"mp" ,"nx" ,NULL ,"mmxext" ,NULL , -NULL ,"fxsr_opt" ,"rdtscp" ,NULL ,NULL ,"lm" ,"3dnowext" ,"3dnow" , +NULL ,"fxsr_opt" ,"pdpe1gb" ,"rdtscp" ,NULL ,"lm" ,"3dnowext" ,"3dnow" ,/* Transmeta-defined */ "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -47,7 +47,7 @@ static int show_cpuinfo(struct seq_file/* Intel-defined (#2) */ "pni" ,NULL ,NULL ,"monitor" ,"ds_cpl" ,"vmx" ,"smx" ,"est" ,"tm2" ,"ssse3" ,"cid" ,NULL ,NULL ,"cx16" ,"xtpr" ,NULL , -NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,"popcnt" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , /* VIA/Cyrix/Centaur-defined */
@@ -57,8 +57,9 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,/* AMD-defined (#2) */ -"lahf_lm" ,"cmp_legacy" ,"svm" ,NULL ,"cr8legacy" ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , +"lahf_lm" ,"cmp_legacy" ,"svm" ,"extapic" ,"cr8legacy" ,"abm" , +"sse4a" ,"misalignsse" , +"3dnowprefetch" ,"osvw" ,"ibs" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };
@@ -69,8 +70,11 @@ static int show_cpuinfo(struct seq_file"ttp" ,/* thermal trip */ "tm" ,"stc" , +"100mhzsteps" , +"hwpstate" ,NULL , - /* nothing */ /* constant_tsc - moved to flags */ + NULL, /* constant_tsc - moved to flags */ + /* nothing */ };struct cpuinfo_x86 *c = v;int i, n = c - cpu_data;
PATCH 19/29 x86: Enable NMI watchdog for AMD Family 0x10 CPUs
In reply to Andi KleenFor i386/x86-64.
Straight forward -- just reuse the Family 0xf code.
--- arch/i386/kernel/nmi.c | 6 ++++-- arch/x86_64/kernel/nmi.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
arch/i386/kernel/nmi.c +4 -2
@@ -185,7 +185,8 @@ static __cpuinit inline int nmi_known_cp {switch (boot_cpu_data.x86_vendor) {case X86_VENDOR_AMD : -return ((boot_cpu_data.x86 ==15 ) || (boot_cpu_data.x86 ==6 )); +return ((boot_cpu_data.x86 ==15 ) || (boot_cpu_data.x86 ==6 ) + || (boot_cpu_data.x86 ==16 ));case X86_VENDOR_INTEL :if (cpu_has (&boot_cpu_data,X86_FEATURE_ARCH_PERFMON ))return 1 ;
@@ -817,7 +818,8 @@ void setup_apic_nmi_watchdog (void *unusif (nmi_watchdog ==NMI_LOCAL_APIC ) {switch (boot_cpu_data.x86_vendor) {case X86_VENDOR_AMD : -if (boot_cpu_data.x86 !=6 && boot_cpu_data.x86 !=15 ) +if (boot_cpu_data.x86 !=6 && boot_cpu_data.x86 !=15 && + boot_cpu_data.x86 !=16 )return ;if (!setup_k7_watchdog ())return ;
arch/x86_64/kernel/nmi.c +1 -1
@@ -172,7 +172,7 @@ static __cpuinit inline int nmi_known_cp {switch (boot_cpu_data.x86_vendor) {case X86_VENDOR_AMD : -return boot_cpu_data.x86 ==15 ; +return boot_cpu_data.x86 ==15 || boot_cpu_data.x86 ==16 ;case X86_VENDOR_INTEL :if (cpu_has (&boot_cpu_data,X86_FEATURE_ARCH_PERFMON ))return 1 ;
PATCH 11/29 i386: add option to show more code in oops reports
In reply to Andi KleenFrom: Chuck Ebbert <[email protected]>
Sometimes developers need to see more object code in an oops report, e.g. when kernel may be corrupted at runtime.
Add the "code_bytes" option for this.
---
Documentation/kernel-parameters.txt | 5 +++++ arch/i386/kernel/traps.c | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
Documentation/kernel-parameters.txt +5 -0
@@ -364,6 +364,11 @@ and is between 256 and 4096 characters. clocksource is not available, it defaults to PIT. Format: { pit | tsc | cyclone | pmtmr } + code_bytes [IA32] How many bytes of object code to print in an + oops report. + Range: 0 - 8192 + Default: 64 + disable_8254_timer enable_8254_timer [IA32/X86_64] Disable/Enable interrupt 0 timer routing
arch/i386/kernel/traps.c +16 -4
@@ -94,6 +94,7 @@ asmlinkage void spurious_interrupt_bug(v asmlinkage void machine_check(void);int kstack_depth_to_print =24 ; +static unsigned int code_bytes =64 ;ATOMIC_NOTIFIER_HEAD (i386die_chain);int register_die_notifier (struct notifier_block *nb)
@@ -325,7 +326,8 @@ void show_registers(struct pt_regs *regs*/ if (in_kernel) {u8 *eip; -int code_bytes =64 ; +unsigned int code_prologue = code_bytes *43 /64 ; +unsigned int code_len = code_bytes;unsigned char c;printk ("\n" KERN_EMERG "Stack: " );
@@ -333,14 +335,14 @@ void show_registers(struct pt_regs *regsprintk (KERN_EMERG "Code: " ); - eip = (u8 *)regs->eip -43 ; + eip = (u8 *)regs->eip - code_prologue;if (eip < (u8 *)PAGE_OFFSET ||probe_kernel_address (eip, c)) {/* try starting at EIP */ eip = (u8 *)regs->eip; - code_bytes =32 ; + code_len = code_len - code_prologue +1 ; } -for (i =0 ; i < code_bytes; i++, eip++) { +for (i =0 ; i < code_len; i++, eip++) {if (eip < (u8 *)PAGE_OFFSET ||probe_kernel_address (eip, c)) {printk (" Bad EIP value." );
@@ -1190,3 +1192,13 @@ static int __init kstack_setup(char *s)return 1 ; }__setup ("kstack=" , kstack_setup); + +static int __init code_bytes_setup (char *s) +{ + code_bytes =simple_strtoul (s,NULL ,0 ); +if (code_bytes >8192 ) + code_bytes =8192 ; + +return 1 ; +} +__setup ("code_bytes=" , code_bytes_setup);
PATCH 3/29 i386: entry.S END/ENDPROC annotations
In reply to Andi KleenFrom: "Jan Beulich" <[email protected]>
Annotate i386/kernel/entry.S with END/ENDPROC to assist disassemblers and other analysis tools.
---
arch/i386/kernel/entry.S | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)
arch/i386/kernel/entry.S +37 -4
@@ -227,6 +227,7 @@ ENTRY(ret_from_fork) CFI_ADJUST_CFA_OFFSET -4 jmp syscall_exit CFI_ENDPROC +END(ret_from_fork) /* * Return to user mode is not as complex as all this looks,
@@ -258,6 +259,7 @@ ENTRY(resume_userspace) # int/exception return? jne work_pending jmp restore_all +END(ret_from_exception) #ifdef CONFIG_PREEMPT ENTRY(resume_kernel)
@@ -272,6 +274,7 @@ need_resched: jz restore_all call preempt_schedule_irq jmp need_resched +END(resume_kernel) #endif CFI_ENDPROC
@@ -359,6 +362,7 @@ sysenter_past_esp: .align 4 .long 1b,2b .popsection +ENDPROC(sysenter_entry) # system call handler stub ENTRY(system_call)
@@ -459,6 +463,7 @@ ldt_ss: CFI_ADJUST_CFA_OFFSET -8 jmp restore_nocheck CFI_ENDPROC +ENDPROC(system_call) # perform work that needs to be done immediately before resumption ALIGN
@@ -504,6 +509,7 @@ work_notifysig_v86: xorl %edx, %edx call do_notify_resume jmp resume_userspace_sig +END(work_pending) # perform syscall exit tracing ALIGN
@@ -519,6 +525,7 @@ syscall_trace_entry: cmpl $(nr_syscalls), %eax jnae syscall_call jmp syscall_exit +END(syscall_trace_entry) # perform syscall exit tracing ALIGN
@@ -532,6 +539,7 @@ syscall_exit_work: movl $1, %edx call do_syscall_trace jmp resume_userspace +END(syscall_exit_work) CFI_ENDPROC RING0_INT_FRAME # can't unwind into user space anyway
@@ -542,10 +550,12 @@ syscall_fault: GET_THREAD_INFO(%ebp) movl $-EFAULT,PT_EAX(%esp) jmp resume_userspace +END(syscall_fault) syscall_badsys: movl $-ENOSYS,PT_EAX(%esp) jmp resume_userspace +END(syscall_badsys) CFI_ENDPROC #define FIXUP_ESPFIX_STACK \
@@ -581,9 +591,9 @@ syscall_badsys: ENTRY(interrupt) .text -vector=0 ENTRY(irq_entries_start) RING0_INT_FRAME +vector=0 .rept NR_IRQS ALIGN .if vector
@@ -592,11 +602,16 @@ ENTRY(irq_entries_start) 1: pushl $~(vector) CFI_ADJUST_CFA_OFFSET 4 jmp common_interrupt -.data + .previous .long 1b -.text + .text vector=vector+1 .endr +END(irq_entries_start) + +.previous +END(interrupt) +.previous /* * the CPU automatically disables interrupts when executing an IRQ vector,
@@ -609,6 +624,7 @@ common_interrupt: movl %esp,%eax call do_IRQ jmp ret_from_intr +ENDPROC(common_interrupt) CFI_ENDPROC #define BUILD_INTERRUPT(name, nr) \
@@ -621,7 +637,8 @@ ENTRY(name) \ movl %esp,%eax; \ call smp_/**/name; \ jmp ret_from_intr; \ - CFI_ENDPROC + CFI_ENDPROC; \ +ENDPROC(name) /* The include is where all of the SMP etc. interrupts come from */ #include "entry_arch.h"
@@ -697,6 +714,7 @@ ENTRY(coprocessor_error) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(coprocessor_error) ENTRY(simd_coprocessor_error) RING0_INT_FRAME
@@ -706,6 +724,7 @@ ENTRY(simd_coprocessor_error) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(simd_coprocessor_error) ENTRY(device_not_available) RING0_INT_FRAME
@@ -726,6 +745,7 @@ device_not_available_emulate: CFI_ADJUST_CFA_OFFSET -4 jmp ret_from_exception CFI_ENDPROC +END(device_not_available) /* * Debug traps and NMI can happen at the one SYSENTER instruction
@@ -869,10 +889,12 @@ ENTRY(native_iret) .align 4 .long 1b,iret_exc .previous +END(native_iret) ENTRY(native_irq_enable_sysexit) sti sysexit +END(native_irq_enable_sysexit) #endif KPROBE_ENTRY(int3)
@@ -895,6 +917,7 @@ ENTRY(overflow) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(overflow) ENTRY(bounds) RING0_INT_FRAME
@@ -904,6 +927,7 @@ ENTRY(bounds) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(bounds) ENTRY(invalid_op) RING0_INT_FRAME
@@ -913,6 +937,7 @@ ENTRY(invalid_op) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(invalid_op) ENTRY(coprocessor_segment_overrun) RING0_INT_FRAME
@@ -922,6 +947,7 @@ ENTRY(coprocessor_segment_overrun) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(coprocessor_segment_overrun) ENTRY(invalid_TSS) RING0_EC_FRAME
@@ -929,6 +955,7 @@ ENTRY(invalid_TSS) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(invalid_TSS) ENTRY(segment_not_present) RING0_EC_FRAME
@@ -936,6 +963,7 @@ ENTRY(segment_not_present) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(segment_not_present) ENTRY(stack_segment) RING0_EC_FRAME
@@ -943,6 +971,7 @@ ENTRY(stack_segment) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(stack_segment) KPROBE_ENTRY(general_protection) RING0_EC_FRAME
@@ -958,6 +987,7 @@ ENTRY(alignment_check) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(alignment_check) ENTRY(divide_error) RING0_INT_FRAME
@@ -967,6 +997,7 @@ ENTRY(divide_error) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(divide_error) #ifdef CONFIG_X86_MCE ENTRY(machine_check)
@@ -977,6 +1008,7 @@ ENTRY(machine_check) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(machine_check) #endif ENTRY(spurious_interrupt_bug)
@@ -987,6 +1019,7 @@ ENTRY(spurious_interrupt_bug) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC +END(spurious_interrupt_bug) ENTRY(kernel_thread_helper) pushl $0 # fake return address for unwinder
PATCH 9/29 x86_64: Minor patch for compilation warning in x86_64 signal code
In reply to Andi KleenFrom: Evgeniy Polyakov <[email protected]>
If DEBUG_SIG is enbaled in source code, ia32_signal.c compiles with warning due to wrong format string. Attached patch fixes that. It is quite minor update, since by default DEBUG_SIG is not enabled and can not be turned on without code modification.
---
arch/x86_64/ia32/ia32_signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86_64/ia32/ia32_signal.c +2 -2
@@ -495,7 +495,7 @@ int ia32_setup_frame(int sig, struct k_sptrace_notify (SIGTRAP );#if DEBUG_SIG -printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , +printk ("SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n" , current->comm, current->pid, frame, regs->rip, frame->pretcode);#endif
@@ -601,7 +601,7 @@ int ia32_setup_rt_frame(int sig, structptrace_notify (SIGTRAP );#if DEBUG_SIG -printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , +printk ("SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n" , current->comm, current->pid, frame, regs->rip, frame->pretcode);#endif
PATCH 6/29 i386: Remove unused kernel config option X86_XADD
In reply to Andi KleenFrom: "Robert P. J. Day" <[email protected]>
Remove the unused kernel config option X86_XADD, which is unused in any source or header file.
---
arch/i386/Kconfig.cpu | 5 ----- 1 file changed, 5 deletions(-)
arch/i386/Kconfig.cpu +0 -5
@@ -226,11 +226,6 @@ config X86_CMPXCHG depends on !M386 default y -config X86_XADD - bool - depends on !M386 - default y - config X86_L1_CACHE_SHIFT int default "7" if MPENTIUM4 || X86_GENERIC
PATCH 2/29 i386: support Classic MediaGXm
In reply to Andi KleenFrom: takada <[email protected]>
I hope to support "classic" MediaGXm in kernel.
The DIR1 register of MediaGXm( or Geode) shows the following values for identify CPU. For example, My MediaGXm shows 0x42.
We can read National Semiconductor's datasheet without any NDAs.
http://www.national.com/pf/GX/GXLV.html
from datasheets:
DIR10x30 - 0x33 GXm rev. 1.0 - 2.30x34 - 0x4f GXm rev. 2.4 - 3.x
0x5x GXm rev. 5.0 - 5.4
0x6x GXLV
0x7x (unknow)
0x8x Gx1
In nsc driver of X, accept 0x30 through 0x82. What will 0x7x mean?
---
arch/i386/kernel/cpu/cyrix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/i386/kernel/cpu/cyrix.c +8 -3
@@ -285,10 +285,15 @@ static void __cpuinit init_cyrix(struct/* GXm supports extended cpuid levels 'ala' AMD */ if (c->cpuid_level ==2 ) {/* Enable cxMMX extensions (GX1 Datasheet 54) */ -setCx86 (CX86_CCR7 ,getCx86 (CX86_CCR7 )|1 ); +setCx86 (CX86_CCR7 ,getCx86 (CX86_CCR7 ) |1 ); -/* GXlv/GXm/GX1 */ -if ((dir1 >=0x50 && dir1 <=0x54 ) || dir1 >=0x63 ) +/* +* GXm : 0x30 ... 0x5f GXm datasheet 51 +* GXlv: 0x6x GXlv datasheet 54 +* ? : 0x7x +* GX1 : 0x8x GX1 datasheet 56 +*/ +if ((0x30 <= dir1 && dir1 <=0x6f ) || (0x80 <=dir1 && dir1 <=0x8f ))geode_configure ();get_model_name (c);/* get CPU marketing name */ return ;
PATCH 10/29 i386: don't include bugs.h
In reply to Andi KleenFrom: Andrew Morton <[email protected]>
That stupid non-inlined-static function in bugs.h causes:
include/asm/bugs.h:186: warning: 'check_bugs' defined but not used
But fortunately the include isn't needed.
---
arch/i386/kernel/alternative.c | 1 - 1 file changed, 1 deletion(-)
arch/i386/kernel/alternative.c +0 -1
@@ -4,7 +4,6 @@#include <linux/list.h> #include <asm/alternative.h> #include <asm/sections.h> -#include <asm/bugs.h> static int no_replacement =0 ;static int smp_alt_once =0 ;
PATCH 15/29 x86_64: Fix wrong gcc check in bitops.h
In reply to Andi Kleengcc 5.0 will likely not have the constraint problem
--- include/asm-x86_64/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-x86_64/bitops.h +1 -1
@@ -7,7 +7,7 @@#include <asm/alternative.h> -#if __GNUC__ <4 || __GNUC_MINOR__ <1 +#if __GNUC__ <4 || (__GNUC__ ==4 && __GNUC_MINOR__ <1 )/* Technically wrong, but this avoids compilation errors on some gcc versions. */ #define ADDR "=m" (*(volatile long *) addr)
PATCH 4/29 x86_64: clean up sparsemem memory_present call
In reply to Andi KleenFrom: "Bob Picco" <[email protected]>
Eliminate arch specific memory_present call x86_64 NUMA by utilizing sparse_memory_present_with_active_regions.
---
arch/x86_64/mm/numa.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
arch/x86_64/mm/numa.c +2 -15
@@ -460,20 +460,6 @@ unsigned long __init numa_free_all_bootmreturn pages; } -#ifdef CONFIG_SPARSEMEM -static void __init arch_sparse_init (void ) -{ -int i; - -for_each_online_node (i) -memory_present (i,node_start_pfn (i),node_end_pfn (i)); - -sparse_init (); -} -#else -#define arch_sparse_init () do {} while (0) -#endif -void __init paging_init (void ) {int i;
@@ -483,7 +469,8 @@ void __init paging_init(void) max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; max_zone_pfns[ZONE_NORMAL ] = end_pfn; -arch_sparse_init (); +sparse_memory_present_with_active_regions (MAX_NUMNODES ); +sparse_init ();for_each_online_node (i) {setup_node_zones (i);
PATCH 1/29 i386: avoid gcc extension
From: Randy Dunlap <[email protected]>
setcc() in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.
---
arch/i386/math-emu/status_w.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/i386/math-emu/status_w.h +5 -3
@@ -48,9 +48,11 @@#define status_word () \ ((partial_status & ~SW_Top & 0xffff) | ((top << SW_Top_Shift) & SW_Top)) -#define setcc (cc) ({ \ - partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \ - partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); }) +static inline void setcc (int cc) +{ + partial_status &= ~(SW_C0 |SW_C1 |SW_C2 |SW_C3 ); + partial_status |= (cc) & (SW_C0 |SW_C1 |SW_C2 |SW_C3 ); +}#ifdef PECULIAR_486 /* Default, this conveys no information, but an 80486 does it. */
PATCH 16/29 i386: Remove fastcall in paravirt.[ch]
Not needed because fastcall is always default now
--- arch/i386/kernel/paravirt.c | 102 ++++++++++++++++----------------- include/asm-i386/paravirt.h | 136 ++++++++++++++++++++++---------------------- 2 files changed, 119 insertions(+), 119 deletions(-)
arch/i386/kernel/paravirt.c +51 -51
@@ -92,7 +92,7 @@ static unsigned native_patch(u8 type, u1return insn_len; } -static fastcall unsigned long native_get_debugreg (int regno) +static unsigned long native_get_debugreg (int regno) {unsigned long val =0 ;/* Damn you, gcc! */
@@ -115,7 +115,7 @@ static fastcall unsigned long native_getreturn val; } -static fastcall void native_set_debugreg(int regno, unsigned long value) +static void native_set_debugreg (int regno,unsigned long value) {switch (regno) {case 0 :
@@ -146,55 +146,55 @@ void init_IRQ(void) paravirt_ops.init_IRQ (); } -static fastcall void native_clts(void) +static void native_clts (void ) { asmvolatile ("clts" ); } -static fastcall unsigned long native_read_cr0 (void ) +static unsigned long native_read_cr0 (void ) {unsigned long val; asmvolatile ("movl %%cr0,%0\n\t" :"=r" (val));return val; } -static fastcall void native_write_cr0(unsigned long val) +static void native_write_cr0 (unsigned long val) { asmvolatile ("movl %0,%%cr0" : :"r" (val)); } -static fastcall unsigned long native_read_cr2 (void ) +static unsigned long native_read_cr2 (void ) {unsigned long val; asmvolatile ("movl %%cr2,%0\n\t" :"=r" (val));return val; } -static fastcall void native_write_cr2(unsigned long val) +static void native_write_cr2 (unsigned long val) { asmvolatile ("movl %0,%%cr2" : :"r" (val)); } -static fastcall unsigned long native_read_cr3 (void ) +static unsigned long native_read_cr3 (void ) {unsigned long val; asmvolatile ("movl %%cr3,%0\n\t" :"=r" (val));return val; } -static fastcall void native_write_cr3(unsigned long val) +static void native_write_cr3 (unsigned long val) { asmvolatile ("movl %0,%%cr3" : :"r" (val)); } -static fastcall unsigned long native_read_cr4 (void ) +static unsigned long native_read_cr4 (void ) {unsigned long val; asmvolatile ("movl %%cr4,%0\n\t" :"=r" (val));return val; } -static fastcall unsigned long native_read_cr4_safe (void ) +static unsigned long native_read_cr4_safe (void ) {unsigned long val;/* This could fault if %cr4 does not exist */
@@ -207,51 +207,51 @@ static fastcall unsigned long native_reareturn val; } -static fastcall void native_write_cr4(unsigned long val) +static void native_write_cr4 (unsigned long val) { asmvolatile ("movl %0,%%cr4" : :"r" (val)); } -static fastcall unsigned long native_save_fl (void ) +static unsigned long native_save_fl (void ) {unsigned long f; asmvolatile ("pushfl ; popl %0" :"=g" (f):/* no input */ );return f; } -static fastcall void native_restore_fl(unsigned long f) +static void native_restore_fl (unsigned long f) { asmvolatile ("pushl %0 ; popfl" :/* no output */ :"g" (f) :"memory" ,"cc" ); } -static fastcall void native_irq_disable(void) +static void native_irq_disable (void ) { asmvolatile ("cli" : : :"memory" ); } -static fastcall void native_irq_enable(void) +static void native_irq_enable (void ) { asmvolatile ("sti" : : :"memory" ); } -static fastcall void native_safe_halt(void) +static void native_safe_halt (void ) { asmvolatile ("sti; hlt" : : :"memory" ); } -static fastcall void native_halt(void) +static void native_halt (void ) { asmvolatile ("hlt" : : :"memory" ); } -static fastcall void native_wbinvd(void) +static void native_wbinvd (void ) { asmvolatile ("wbinvd" : : :"memory" ); } -static fastcall unsigned long long native_read_msr (unsigned int msr,int *err) +static unsigned long long native_read_msr (unsigned int msr,int *err) {unsigned long long val;
@@ -270,7 +270,7 @@ static fastcall unsigned long long nativreturn val; } -static fastcall int native_write_msr(unsigned int msr, unsigned long long val) +static int native_write_msr (unsigned int msr,unsigned long long val) {int err; asm volatile("2: wrmsr ; xorl %0,%0\n"
@@ -288,53 +288,53 @@ static fastcall int native_write_msr(unsreturn err; } -static fastcall unsigned long long native_read_tsc (void ) +static unsigned long long native_read_tsc (void ) {unsigned long long val; asmvolatile ("rdtsc" :"=A" (val));return val; } -static fastcall unsigned long long native_read_pmc (void ) +static unsigned long long native_read_pmc (void ) {unsigned long long val; asmvolatile ("rdpmc" :"=A" (val));return val; } -static fastcall void native_load_tr_desc(void) +static void native_load_tr_desc (void ) { asmvolatile ("ltr %w0" ::"q" (GDT_ENTRY_TSS *8 )); } -static fastcall void native_load_gdt(const struct Xgt_desc_struct *dtr) +static void native_load_gdt (const struct Xgt_desc_struct *dtr) { asmvolatile ("lgdt %0" ::"m" (*dtr)); } -static fastcall void native_load_idt(const struct Xgt_desc_struct *dtr) +static void native_load_idt (const struct Xgt_desc_struct *dtr) { asmvolatile ("lidt %0" ::"m" (*dtr)); } -static fastcall void native_store_gdt(struct Xgt_desc_struct *dtr) +static void native_store_gdt (struct Xgt_desc_struct *dtr) { asm ("sgdt %0" :"=m" (*dtr)); } -static fastcall void native_store_idt(struct Xgt_desc_struct *dtr) +static void native_store_idt (struct Xgt_desc_struct *dtr) { asm ("sidt %0" :"=m" (*dtr)); } -static fastcall unsigned long native_store_tr (void ) +static unsigned long native_store_tr (void ) {unsigned long tr; asm ("str %0" :"=r" (tr));return tr; } -static fastcall void native_load_tls(struct thread_struct *t, unsigned int cpu) +static void native_load_tls (struct thread_struct *t,unsigned int cpu) {#define C (i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]C (0 );C (1 );C (2 );
@@ -348,22 +348,22 @@ static inline void native_write_dt_entry lp[1 ] = entry_high; } -static fastcall void native_write_ldt_entry(void *dt, int entrynum, u32 low, u32 high) +static void native_write_ldt_entry (void *dt,int entrynum,u32 low,u32 high) {native_write_dt_entry (dt, entrynum, low, high); } -static fastcall void native_write_gdt_entry(void *dt, int entrynum, u32 low, u32 high) +static void native_write_gdt_entry (void *dt,int entrynum,u32 low,u32 high) {native_write_dt_entry (dt, entrynum, low, high); } -static fastcall void native_write_idt_entry(void *dt, int entrynum, u32 low, u32 high) +static void native_write_idt_entry (void *dt,int entrynum,u32 low,u32 high) {native_write_dt_entry (dt, entrynum, low, high); } -static fastcall void native_load_esp0(struct tss_struct *tss, +static void native_load_esp0 (struct tss_struct *tss,struct thread_struct *thread) { tss->esp0 = thread->esp0;
@@ -375,12 +375,12 @@ static fastcall void native_load_esp0(st } } -static fastcall void native_io_delay(void) +static void native_io_delay (void ) { asmvolatile ("outb %al,$0x80" ); } -static fastcall void native_flush_tlb(void) +static void native_flush_tlb (void ) {__native_flush_tlb (); }
@@ -389,49 +389,49 @@ static fastcall void native_flush_tlb(vo* Global pages have to be flushed a bit differently. Not a real * performance problem because this does not happen often. */ -static fastcall void native_flush_tlb_global(void) +static void native_flush_tlb_global (void ) {__native_flush_tlb_global (); } -static fastcall void native_flush_tlb_single(u32 addr) +static void native_flush_tlb_single (u32 addr) {__native_flush_tlb_single (addr); }#ifndef CONFIG_X86_PAE -static fastcall void native_set_pte(pte_t *ptep, pte_t pteval) +static void native_set_pte (pte_t *ptep,pte_t pteval) { *ptep = pteval; } -static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) +static void native_set_pte_at (struct mm_struct *mm,u32 addr,pte_t *ptep,pte_t pteval) { *ptep = pteval; } -static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) +static void native_set_pmd (pmd_t *pmdp,pmd_t pmdval) { *pmdp = pmdval; }#else /* CONFIG_X86_PAE */ -static fastcall void native_set_pte(pte_t *ptep, pte_t pte) +static void native_set_pte (pte_t *ptep,pte_t pte) { ptep->pte_high = pte.pte_high;smp_wmb (); ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) +static void native_set_pte_at (struct mm_struct *mm,u32 addr,pte_t *ptep,pte_t pte) { ptep->pte_high = pte.pte_high;smp_wmb (); ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) +static void native_set_pte_present (struct mm_struct *mm,unsigned long addr,pte_t *ptep,pte_t pte) { ptep->pte_low =0 ;smp_wmb ();
@@ -440,29 +440,29 @@ static fastcall void native_set_pte_pres ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_atomic(pte_t *ptep, pte_t pteval) +static void native_set_pte_atomic (pte_t *ptep,pte_t pteval) {set_64bit ((unsigned long long *)ptep,pte_val (pteval)); } -static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) +static void native_set_pmd (pmd_t *pmdp,pmd_t pmdval) {set_64bit ((unsigned long long *)pmdp,pmd_val (pmdval)); } -static fastcall void native_set_pud(pud_t *pudp, pud_t pudval) +static void native_set_pud (pud_t *pudp,pud_t pudval) { *pudp = pudval; } -static fastcall void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +static void native_pte_clear (struct mm_struct *mm,unsigned long addr,pte_t *ptep) { ptep->pte_low =0 ;smp_wmb (); ptep->pte_high =0 ; } -static fastcall void native_pmd_clear(pmd_t *pmd) +static void native_pmd_clear (pmd_t *pmd) {u32 *tmp = (u32 *)pmd; *tmp =0 ;
@@ -472,8 +472,8 @@ static fastcall void native_pmd_clear(pm#endif /* CONFIG_X86_PAE */ /* These are in entry.S */ -extern fastcall void native_iret(void); -extern fastcall void native_irq_enable_sysexit(void); +extern void native_iret (void ); +extern void native_irq_enable_sysexit (void );static int __init print_banner (void ) {
include/asm-i386/paravirt.h +68 -68
170 lines not on this page · raw message
PATCH 13/29 i386: geode configuration fixes
In reply to Andi KleenFrom: TAKADA Yoshihito <[email protected]>
Original code doesn't write back to CCR4 register. This patch reflects a value of a register.
---
arch/i386/kernel/cpu/cyrix.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
arch/i386/kernel/cpu/cyrix.c +10 -11
@@ -161,19 +161,19 @@ static void __cpuinit set_cx86_inc(void)static void __cpuinit geode_configure (void ) {unsigned long flags; -u8 ccr3, ccr4; +u8 ccr3;local_irq_save (flags);/* Suspend on halt power saving and enable #SUSP pin */ setCx86 (CX86_CCR2 ,getCx86 (CX86_CCR2 ) |0x88 ); ccr3 =getCx86 (CX86_CCR3 ); -setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* Enable */ +setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* enable MAPEN */ - ccr4 =getCx86 (CX86_CCR4 ); - ccr4 |=0x38 ;/* FPU fast, DTE cache, Mem bypass */ - -setCx86 (CX86_CCR3 , ccr3); + +/* FPU fast, DTE cache, Mem bypass */ +setCx86 (CX86_CCR4 ,getCx86 (CX86_CCR4 ) |0x38 ); +setCx86 (CX86_CCR3 , ccr3);/* disable MAPEN */ set_cx86_memwb ();set_cx86_reorder ();
@@ -420,15 +420,14 @@ static void __cpuinit cyrix_identify(strif (dir0 ==5 || dir0 ==3 ) { -unsigned char ccr3, ccr4; +unsigned char ccr3;unsigned long flags;printk (KERN_INFO "Enabling CPUID on Cyrix processor.\n" );local_irq_save (flags); ccr3 =getCx86 (CX86_CCR3 ); -setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* enable MAPEN */ - ccr4 =getCx86 (CX86_CCR4 ); -setCx86 (CX86_CCR4 , ccr4 |0x80 );/* enable cpuid */ -setCx86 (CX86_CCR3 , ccr3);/* disable MAPEN */ +setCx86 (CX86_CCR3 , (ccr3 &0x0f ) |0x10 );/* enable MAPEN */ +setCx86 (CX86_CCR4 ,getCx86 (CX86_CCR4 ) |0x80 );/* enable cpuid */ +setCx86 (CX86_CCR3 , ccr3);/* disable MAPEN */ local_irq_restore (flags); } }
PATCH 12/29 x86_64: 32-bit ptrace mangles sixth system call argument
In reply to Andi KleenFrom: Jeff Dike <[email protected]>
The 32-bit sysenter entry point mangles the sixth system call argument for both 32-bit and 64-bit ptrace. In both cases, strace shows the frame pointer (ebp) as the sixth argument.
Here's a snippet of a 64-bit strace of a 32-bit test program which calls mmap through sysenter:
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xfff00fcc) = 0xfffffffff7f7a000fstat64(0x1, 0xfff008d8) = 0mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xfff0089c) = 0xfffffffff7f79000 write(1, "mmap returns 0xf7f7a000\n", 24mmap returns 0xf7f7a000
) = 24
Here's a 32-bit strace of the same program:
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xffc224ec) = 0xf7fcb000
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0xffc21dbc) = 0xf7fca000write(1, "mmap returns 0xf7fcb000\n", 24mmap returns 0xf7fcb000 ) = 24
The first mmap is the one made by the test - its final argument (the offset) is 0, but strace shows 0xfff00fcc, which is the value of ebp. The second is a guilty bystander which is also showing the bug.
The patch below copies %r9 (where the sixth argument has been stashed) into the RBP slot of pt_regs before syscall_trace_enter is called. This fixes ptrace.
To allow a successful return to userspace, the original value of rbp must be restored. This is done by storing the current value of rbp into the RBP slot of pt_regs before the RESTORE_REST.
With this patch, the straces now look like this:
64-bit:
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7f5a000fstat64(0x1, 0xff926ee8) = 0mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7f59000 write(1, "mmap returns 0xf7f5a000\n", 24mmap returns 0xf7f5a000
) = 24
32-bit:
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7fa9000
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7fa8000write(1, "mmap returns 0xf7fa9000\n", 24mmap returns 0xf7fa9000 ) = 24
---
arch/x86_64/ia32/ia32entry.S | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/x86_64/ia32/ia32entry.S +12 -0
@@ -148,11 +148,23 @@ sysenter_do_call: sysenter_tracesys: CFI_RESTORE_STATE SAVE_REST + /* + * We need the 6th system call argument to be in regs->rbp at + * this point so that ptrace will see it. It's in r9 now, so copy + * it to the rbp slot now. + */ + movq %r9, RBP(%rsp) CLEAR_RREGS movq $-ENOSYS,RAX(%rsp) /* really needed? */ movq %rsp,%rdi /* &pt_regs -> arg1 */ call syscall_trace_enter LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ + /* + * Now, we need the correct value of rbp to be restored. It + * was never munged, so we can save it to the rbp slot and + * just have it restored. + */ + movq %rbp, RBP(%rsp) RESTORE_REST movl %ebp, %ebp /* no need to do an access_ok check here because rbp has been
Re: [PATCH x86 for review III] [10/29] i386: don't include bugs.h
In reply to Andi KleenQuoted 23 lines · Andi Kleen
From: Andrew Morton <[email protected]>
That stupid non-inlined-static function in
bugs.hcauses:
include/asm/bugs.h:186: warning: 'check_bugs' defined but not usedBut fortunately the include isn't needed.
Cc Andi Kleen <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Andi Kleen <[email protected]>---
arch/i386/kernel/alternative.c | 1 - 1 file changed, 1 deletion(-)Index:
linux/arch/i386/kernel/alternative.c
===================================================================
arch/i386/kernel/alternative.c line 9
Quoted 7 lines
arch/i386/kernel/alternative.c +0
-1@@ -4,7 +4,6 @@#include <linux/list.h> #include <asm/alternative.h> #include <asm/sections.h> -#include <asm/bugs.h> static int no_replacement =0 ;static int smp_alt_once =0 ;
Didn't your patchset also include a near-identical patch from Adrian Bunk (with - and + exchanged)?
Jörn
Signature · 3 lines
Courage is not the absence of fear, but rather the judgement that something else is more important than fear. -- Ambrose Redmoon
Re: [PATCH x86 for review III] [10/29] i386: don't include bugs.h
Quoted 11 lines
Quoted 11 lines
Index:
linux/arch/i386/kernel/alternative.c
===================================================================arch/i386/kernel/alternative.c +0
-1@@ -4,7 +4,6 @@#include <linux/list.h> #include <asm/alternative.h> #include <asm/sections.h> -#include <asm/bugs.h>
Quoted 5 lines
arch/i386/kernel/alternative.c line 9
Quoted 2 lines
arch/i386/kernel/alternative.c +0
-0static int no_replacement =0 ;static int smp_alt_once =0 ;Didn't your patchset also include a near-identical patch from Adrian Bunk (with - and + exchanged)?
Good catch. I will remove both patches.
-Andi
Hi,
Quoted 4 lines · Andi Kleen
setcc()in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.
This description ...
arch/i386/math-emu/status_w.h line 55
Quoted 8 lines
arch/i386/math-emu/status_w.h +5
-3-#define setcc (cc) ({ \ - partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \ - partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); }) +static inline void setcc (int cc) +{ + partial_status &= ~(SW_C0 |SW_C1 |SW_C2 |SW_C3 ); + partial_status |= (cc) & (SW_C0 |SW_C1 |SW_C2 |SW_C3 ); +}
... seems to contradict the implementation. No "do-while" here.
I hope this helps,
Jochen
Signature · 1 line
http://seehuhn.de/
Re: [PATCH x86 for review III] [7/29] x86_64: update IO-APIC dest field to 8-bit for xAPIC
In reply to Andi KleenQuoted 19 lines · Andi Kleen
From: Benjamin Romer <[email protected]>
On the Unisys ES7000/ONE system, we encountered a problem where performing a kexec reboot or dump on any cell other than cell 0 causes the system timer to stop working, resulting in a hang during timer calibration in the new kernel.
We traced the problem to one line of code in
disable_IO_APIC(), which needs to restore the timer's IO-APIC configuration before rebooting. The code is currently using the 4-bit physical destination field, rather than using the 8-bit logical destination field, and it cuts off the upper 4 bits of the timer's APIC ID. If we change this to use the logical destination field, the timer works and we can kexec on the upper cells. This was tested on two different cells (0 and 2) in an ES7000/ONE system.For reference, the relevant Intel xAPIC spec is kept at ftp://download.intel.com/design/chipsets/e8501/datashts/30962001.pdf, specifically on page 334.
Quoted 6 lines
Signed-off-by Benjamin M Romer <[email protected]>Signed-off-by Andi Kleen <[email protected]>Cc Andi Kleen <[email protected]>Cc "Eric W. Biederman" <[email protected]>Cc Vivek Goyal <[email protected]>Signed-off-by Andrew Morton <[email protected]>
Quoted 8 lines · On Mon, 12 Feb 2007 19:43:36 +0000 Jochen Voß wrote:
Hi,
Quoted 4 lines · Andi Kleen
setcc()in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.
Quoted 5 lines
This description ...
... seems to contradict the implementation. No "do-while" here.
I hope this helps,
Yes, thanks. First version was do-while, latter was inline.
Here's an updated patch/description.
---
From: Randy Dunlap <[email protected]>
setcc() in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it an inline void so that we don't use an extension when it's not needed.
--- arch/i386/math-emu/status_w.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/i386/math-emu/status_w.h +5 -3
@@ -48,9 +48,11 @@#define status_word () \ ((partial_status & ~SW_Top & 0xffff) | ((top << SW_Top_Shift) & SW_Top)) -#define setcc (cc) ({ \ - partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \ - partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); }) +static inline void setcc (int cc) +{ + partial_status &= ~(SW_C0 |SW_C1 |SW_C2 |SW_C3 ); + partial_status |= (cc) & (SW_C0 |SW_C1 |SW_C2 |SW_C3 ); +}#ifdef PECULIAR_486 /* Default, this conveys no information, but an 80486 does it. */
Re: [PATCH x86 for review III] [12/29] x86_64: 32-bit ptrace mangles sixth system call argument
In reply to Andi KleenQuoted 25 lines · Andi Kleen
From: Jeff Dike <[email protected]>
The patch below copies %r9 (where the sixth argument has been stashed) into the RBP slot ofpt_regsbeforesyscall_trace_enteris called. This fixes ptrace.To allow a successful return to userspace, the original value of rbp must be restored. This is done by storing the current value of rbp into the RBP slot of
pt_regsbefore theRESTORE_REST.arch/x86_64/ia32/ia32entry.S +6
-0@@ -148,11 +148,23 @@ sysenter_do_call: sysenter_tracesys: CFI_RESTORE_STATE SAVE_REST + /* + * We need the 6th system call argument to be in regs->rbp at + * this point so that ptrace will see it. It's in r9 now, so copy + * it to the rbp slot now. + */ + movq %r9, RBP(%rsp) CLEAR_RREGS movq $-ENOSYS,RAX(%rsp) /* really needed? */ movq %rsp,%rdi /* &pt_regs -> arg1 */ call syscall_trace_enter
arch/x86_64/ia32/ia32entry.S sysenter_do_call: · line 170
Quoted 10 lines
arch/x86_64/ia32/ia32entry.S +6
-0LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ + /* + * Now, we need the correct value of rbp to be restored. It + * was never munged, so we can save it to the rbp slot and + * just have it restored. + */ + movq %rbp, RBP(%rsp) RESTORE_REST movl %ebp, %ebp /* no need to do an access_ok check here because rbp has been
Didn't we have problems with this exact approach before? This one was dropped because it caused 32-bit programs to crash:
http://www2.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.13/2.6.13-mm2/broken-out/x86-64-ptrace-ia32-bp-fix.patch
See:
http://lkml.org/lkml/2005/09/16/261
for the one I proposed instead.
And in any case doesn't cstar_tracesys() need the same fix?
Re: [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
In reply to Andi KleenQuoted 99 lines · Andi Kleen
Just various new acronyms. The new popcnt bit is in the middle of Intel space. This looks a little weird, but I've been assured it's ok.
Also I fixed RDTSCP for i386 which was at the wrong place.
For i386 and x86-64.
Signed-off-by Andi Kleen <[email protected]>--- arch/i386/kernel/cpu/proc.c | 14 +++++++++----- arch/x86_64/kernel/setup.c | 14 ++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-)Index:
linux/arch/x86_64/kernel/setup.c
===================================================================arch/x86_64/kernel/setup.c +10
-4@@ -942,7 +942,8 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"syscall" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"nx" ,NULL ,"mmxext" ,NULL , -NULL ,"fxsr_opt" ,NULL ,"rdtscp" ,NULL ,"lm" ,"3dnowext" ,"3dnow" , +NULL ,"fxsr_opt" ,"pdpe1gb" ,"rdtscp" ,NULL ,"lm" , +"3dnowext" ,"3dnow" ,/* Transmeta-defined */ "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,@@ -960,7 +961,7 @@ static int show_cpuinfo(struct seq_file/* Intel-defined (#2) */ "pni" ,NULL ,NULL ,"monitor" ,"ds_cpl" ,"vmx" ,"smx" ,"est" ,"tm2" ,"ssse3" ,"cid" ,NULL ,NULL ,"cx16" ,"xtpr" ,NULL , -NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,"popcnt" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , /* VIA/Cyrix/Centaur-defined */@@ -970,8 +971,10 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,/* AMD-defined (#2) */ -"lahf_lm" ,"cmp_legacy" ,"svm" ,NULL ,"cr8_legacy" ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , +"lahf_lm" ,"cmp_legacy" ,"svm" ,"extapic" ,"cr8_legacy" , +"altmovcr8" ,"abm" ,"sse4a" , +"misalignsse" ,"3dnowprefetch" , +"osvw" ,"ibs" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };@@ -982,6 +985,9 @@ static int show_cpuinfo(struct seq_file"ttp" ,/* thermal trip */ "tm" ,"stc" , +"100mhzsteps" , +"hwpstate" , +NULL ,/* tsc invariant mapped to constant_tsc */ NULL, /* nothing */ /* constant_tsc - moved to flags */ };Index:
linux/arch/i386/kernel/cpu/proc.c
===================================================================arch/i386/kernel/cpu/proc.c +5
-4@@ -29,7 +29,7 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"syscall" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"mp" ,"nx" ,NULL ,"mmxext" ,NULL , -NULL ,"fxsr_opt" ,"rdtscp" ,NULL ,NULL ,"lm" ,"3dnowext" ,"3dnow" , +NULL ,"fxsr_opt" ,"pdpe1gb" ,"rdtscp" ,NULL ,"lm" ,"3dnowext" ,"3dnow" ,/* Transmeta-defined */ "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,@@ -47,7 +47,7 @@ static int show_cpuinfo(struct seq_file/* Intel-defined (#2) */ "pni" ,NULL ,NULL ,"monitor" ,"ds_cpl" ,"vmx" ,"smx" ,"est" ,"tm2" ,"ssse3" ,"cid" ,NULL ,NULL ,"cx16" ,"xtpr" ,NULL , -NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,"dca" ,NULL ,NULL ,NULL ,NULL ,"popcnt" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , /* VIA/Cyrix/Centaur-defined */@@ -57,8 +57,9 @@ static int show_cpuinfo(struct seq_fileNULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,/* AMD-defined (#2) */ -"lahf_lm" ,"cmp_legacy" ,"svm" ,NULL ,"cr8legacy" ,NULL ,NULL ,NULL , -NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , +"lahf_lm" ,"cmp_legacy" ,"svm" ,"extapic" ,"cr8legacy" ,"abm" , +"sse4a" ,"misalignsse" , +"3dnowprefetch" ,"osvw" ,"ibs" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };@@ -69,8 +70,11 @@ static int show_cpuinfo(struct seq_file"ttp" ,/* thermal trip */ "tm" , "stc",
arch/i386/kernel/cpu/proc.c static int show_cpuinfo(struct seq_file
Quoted 10 lines
arch/i386/kernel/cpu/proc.c +4
-2+"100mhzsteps" , +"hwpstate" ,NULL , -/* nothing */ /* constant_tsc - moved to flags */ + NULL, /* constant_tsc - moved to flags */ + /* nothing */ };struct cpuinfo_x86 *c = v;int i, n = c - cpu_data; -
Since we seem to have become the place where all these are collected, shouldn't we document what they mean? I've got some this machine that I'd like to know more about:
dts ss ds_cpl est tm2 ssse3 xtpr
Re: [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
Quoted 4 lines
Since we seem to have become the place where all these are collected, shouldn't we document what they mean?
This is not a data sheet and the CPU vendors have fine tech writers working on this already.
Also I don't really want to encourage people to hack this without at least taking a basic look at the documentation first.
Quoted 4 lines
I've got some this machine that
I'd like to know more about:dts ss
ds_cplest tm2 ssse3 xtpr
All documented in Intel documentation. But it's all relatively boring stuff
dts = debug trace store
ss = self snoopds_cpl = cpl qualified debug store
est = enhanced speedstep
tm2 = thermal monitor 2
ssse3 = more sse3 instructions
xtpr = tpr register chipset update control msr
-Andi
Re: [PATCH x86 for review III] [12/29] x86_64: 32-bit ptrace mangles sixth system call argument
In reply to Chuck EbbertQuoted 9 lines
Didn't we have problems with this exact approach before? This one was dropped because it caused 32-bit programs to crash:
http://www2.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.13/2.6.13-mm2/broken-out/x86-64-ptrace-ia32-bp-fix.patchSee:
http://lkml.org/lkml/2005/09/16/261for the one I proposed instead.
Yes you're right. I dropped it for now.
-Andi
Re: [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
In reply to Andi KleenQuoted 16 lines · Andi Kleen
Quoted 2 lines
Since we seem to have become the place where all these are collected, shouldn't we document what they mean?
This is not a data sheet and the CPU vendors have fine tech writers working on this already.
Also I don't really want to encourage people to hack this without at least taking a basic look at the documentation first.
Quoted 4 lines
I've got some this machine that
I'd like to know more about:dts ss
ds_cplest tm2 ssse3 xtprAll documented in Intel documentation. But it's all relatively boring stuff
Quoted 8 lines
dts = debug trace store
ss = self snoopds_cpl= cpl qualified debug store
est = enhanced speedstep
tm2 = thermal monitor 2
ssse3 = more sse3 instructions
xtpr = tpr register chipset update control msr
That's exactly what I was asking for. Our abbreviations are too cryptic to let someone go look up the meanings without a lot of trouble.
A one-liner for each in the comments would be just enough.
Re: [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
Quoted 1 line
A one-liner for each in the comments would be just enough.
No. RTFM.
-Andi
Re: [PATCH x86 for review III] [17/29] x86: Add new CPUID bits for AMD Family 10 CPUs in /proc/cpuinfo
Quoted 3 lines · Andi Kleen
Quoted 1 line
A one-liner for each in the comments would be just enough.
No. RTFM.
Sure, I'll get right on that:
./AMD:
total 16216
-rw-rw-r-- 1 cebbert cebbert 2485489 Nov 22 13:49 24592.pdf -rw-rw-r-- 1 cebbert cebbert 3537793 Nov 22 13:49 24593.pdf -rw-rw-r-- 1 cebbert cebbert 2212151 Nov 22 13:49 24594.pdf -rw-rw-r-- 1 cebbert cebbert 3474511 Nov 22 13:49 25112.pdf -rw-rw-r-- 1 cebbert cebbert 1992762 Nov 22 13:49 26568.pdf -rw-rw-r-- 1 cebbert cebbert 1558189 Nov 22 13:49 26569.pdf -rw-rw-r-- 1 cebbert cebbert 616422 Nov 22 13:49 34434.pdf -rw-rw-r-- 1 cebbert cebbert 646779 Nov 22 13:49 40555.pdf
./Intel:
total 17284
-rw-rw-r-- 1 cebbert cebbert 3199114 Nov 8 16:58 248966.pdf -rw-rw-r-- 1 cebbert cebbert 585350 Oct 30 18:44 25204618.pdf -rw-rw-r-- 1 cebbert cebbert 3311769 Nov 16 14:49 253665.pdf -rw-rw-r-- 1 cebbert cebbert 2515357 Nov 16 14:49 253666.pdf -rw-rw-r-- 1 cebbert cebbert 2093479 Nov 16 14:49 253667.pdf -rw-rw-r-- 1 cebbert cebbert 3274186 Nov 16 14:49 253668.pdf -rw-rw-r-- 1 cebbert cebbert 2645170 Nov 16 14:50 253669.pdf
:-)
Quoted 5 lines · Andi Kleen
setcc()in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.
The patch looks good but it doesn't match the description any more, since you now use a function...
Quoted 9 lines · On Tue, 13 Feb 2007 16:11:14 +0100 Arnd Bergmann wrote:
Quoted 5 lines · Andi Kleen
setcc()in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.The patch looks good but it doesn't match the description any more, since you now use a function...
Hi Arnd,
Someone else had that same comment, so I sent a corrected patch (description change only) to that mail.
Thanks,
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 9 lines · Randy Dunlap
Quoted 7 lines · On Tue, 13 Feb 2007 16:11:14 +0100 Arnd Bergmann wrote:
Quoted 5 lines · Andi Kleen
setcc()in math-emu is written as a gcc extension statement expression macro that returns a value. However, it's not used that way and it's not needed like that, so just make it a do-while non-extension macro so that we don't use an extension when it's not needed.
Quoted 6 lines
Quoted 2 lines
The patch looks good but it doesn't match the description any more, since you now use a function...
Hi Arnd,
Someone else had that same comment, so I sent a corrected patch (description change only) to that mail.
I had already fixed it up
-Andi
Re: [PATCH x86 for review III] [12/29] x86_64: 32-bit ptrace mangles sixth system call argument
In reply to Chuck EbbertQuoted 4 lines · Chuck Ebbert
See:
http://lkml.org/lkml/2005/09/16/261for the one I proposed instead.
That works for me - can we get this into mainline?
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com