From c9c9f1469fb70c4cda51e9e7137f207eb793e1a2 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Thu, 25 Sep 2003 07:36:41 -0700 Subject: [PATCH] [PATCH] Another x86-64 merge - make it boot again This fixes a few x86-64 issues that have crept in and broke bootup. - Disable -funit-at-a-time. It breaks symbol exports with gcc 3.3.1-hammer. - Fix sched_clock to not access HPET. The new scheduler uses it more extensively and it is not mapped early enough. I opted to just disable the HPET access, because even a slightly non monotonous TSC should be accurate enough for scheduling purposes. - Fixes for separate objdirs by Arnd Bergmann - Fix two warnings that have crept in --- arch/x86_64/Makefile | 4 ++-- arch/x86_64/boot/Makefile | 2 +- arch/x86_64/kernel/Makefile | 27 +++++++++++---------------- arch/x86_64/kernel/time.c | 13 ++++++++++++- arch/x86_64/mm/fault.c | 1 + arch/x86_64/mm/pageattr.c | 2 +- arch/x86_64/oprofile/Makefile | 23 ++++------------------- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 2a3082e0a6296..22af9352b3e47 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile @@ -52,14 +52,14 @@ CFLAGS += -Wno-sign-compare ifneq ($(CONFIG_X86_REMOTE_DEBUG),y) CFLAGS += -fno-asynchronous-unwind-tables endif -CFLAGS += $(call check_gcc,-funit-at-a-time,) +#CFLAGS += $(call check_gcc,-funit-at-a-time,) head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o libs-y += arch/x86_64/lib/ core-y += arch/x86_64/kernel/ arch/x86_64/mm/ core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/ -drivers-$(CONFIG_PCI) += arch/x86_64/pci/ +drivers-$(CONFIG_PCI) += arch/i386/pci/ drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/ boot := arch/x86_64/boot diff --git a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile index 46e4960381ca0..1c2d3cbcae430 100644 --- a/arch/x86_64/boot/Makefile +++ b/arch/x86_64/boot/Makefile @@ -98,4 +98,4 @@ zlilo: $(BOOTIMAGE) if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi install: $(BOOTIMAGE) - sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" + sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index 7d8aac19544c3..78c3a9ade80e3 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile @@ -9,24 +9,19 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ x8664_ksyms.o i387.o syscall.o vsyscall.o \ setup64.o bluesmoke.o bootflag.o e820.o reboot.o warmreboot.o -obj-$(CONFIG_MTRR) += mtrr/ -obj-$(CONFIG_ACPI) += acpi/ -obj-$(CONFIG_X86_MSR) += msr.o -obj-$(CONFIG_X86_CPUID) += cpuid.o -obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o +obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ +obj-$(CONFIG_ACPI) += acpi/ +obj-$(CONFIG_X86_MSR) += msr.o +obj-$(CONFIG_X86_CPUID) += cpuid.o +obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o suspend_asm.o -obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o -obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o +obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o -obj-$(CONFIG_MODULES) += module.o - -$(obj)/bootflag.c: - @ln -sf ../../i386/kernel/bootflag.c $(obj)/bootflag.c -$(obj)/cpuid.c: - @ln -sf ../../i386/kernel/cpuid.c $(obj)/cpuid.c - -clean-files += bootflag.c cpuid.c +obj-$(CONFIG_MODULES) += module.o +bootflag-y += ../../i386/kernel/bootflag.o +cpuid-$(CONFIG_X86_CPUID) += ../../i386/kernel/cpuid.o diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 3159406611794..ff1a73926c8eb 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c @@ -374,10 +374,21 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) and could overflow, it may be better (but slower)to use an 64bit division. */ unsigned long long sched_clock(void) { - unsigned long a; + unsigned long a = 0; +#if 0 + /* Don't do a HPET read here. Using TSC always is much faster + and HPET may not be mapped yet when the scheduler first runs. + Disadvantage is a small drift between CPUs in some configurations, + but that should be tolerable. */ if (__vxtime.mode == VXTIME_HPET) return (hpet_readl(HPET_COUNTER) * vxtime.quot) >> 32; +#endif + + /* Could do CPU core sync here. Opteron can execute rdtsc speculatively, + which means it is not completely exact and may not be monotonous between + CPUs. But the errors should be too small to matter for scheduling + purposes. */ rdtscll(a); return (a * vxtime.tsc_quot) >> 32; diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index b8dbff87daccc..da216232e53f8 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c @@ -31,6 +31,7 @@ #include #include #include +#include void bust_spinlocks(int yes) { diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c index cec7a5bfc19ac..c91b22c7a7e7d 100644 --- a/arch/x86_64/mm/pageattr.c +++ b/arch/x86_64/mm/pageattr.c @@ -57,7 +57,7 @@ static void flush_kernel_map(void *address) /* is this worth it? */ int i; for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) - asm volatile("clflush %0" :: "m" (address + i)); + asm volatile("clflush (%0)" :: "r" (address + i)); } else asm volatile("wbinvd":::"memory"); __flush_tlb_one(address); diff --git a/arch/x86_64/oprofile/Makefile b/arch/x86_64/oprofile/Makefile index ae861349bb8a5..22da1334957c5 100644 --- a/arch/x86_64/oprofile/Makefile +++ b/arch/x86_64/oprofile/Makefile @@ -11,24 +11,9 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ event_buffer.o oprofile_files.o \ oprofilefs.o oprofile_stats.o \ timer_int.o ) - -oprofile-objs := $(DRIVER_OBJS) init.o -oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o -oprofile-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o -INCL := $(obj)/op_counter.h $(obj)/op_x86_model.h +OPROFILE-y := init.o +OPROFILE-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_athlon.o +OPROFILE-$(CONFIG_X86_IO_APIC) += nmi_timer_int.o -$(obj)/nmi_int.c: ${INCL} - @ln -sf ../../i386/oprofile/nmi_int.c $(obj)/nmi_int.c -$(obj)/op_model_athlon.c: ${INCL} - @ln -sf ../../i386/oprofile/op_model_athlon.c $(obj)/op_model_athlon.c -$(obj)/init.c: ${INCL} - @ln -sf ../../i386/oprofile/init.c $(obj)/init.c -$(obj)/nmi_timer_int.c: ${INCL} - @ln -sf ../../i386/oprofile/nmi_timer_int.c $(obj)/nmi_timer_int.c -$(obj)/op_counter.h: - @ln -sf ../../i386/oprofile/op_counter.h $(obj)/op_counter.h -$(obj)/op_x86_model.h: - @ln -sf ../../i386/oprofile/op_x86_model.h $(obj)/op_x86_model.h -clean-files += op_x86_model.h op_counter.h init.c \ - op_model_athlon.c nmi_int.c nmi_timer_int.c +oprofile-y = $(DRIVER_OBJS) $(addprefix ../../i386/oprofile/, $(OPROFILE-y)) -- 2.53.0