Patches contributed by Eötvös Lorand University


commit c3d80000e3a812fe5a200d6bde755fbd7fa65481
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 15:15:17 2008 +0100

    x86: export vector_used_by_percpu_irq
    
    Impact: build fix
    
    lguest can be built as a module and makes use of this new symbol:
    
    ERROR: "vector_used_by_percpu_irq" [drivers/lguest/lg.ko] undefined!
    
    export it.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 3f1d9d18df67..bce53e1352a0 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -9,6 +9,7 @@
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <asm/smp.h>
+#include <asm/irq.h>
 
 atomic_t irq_err_count;
 
@@ -190,3 +191,5 @@ u64 arch_irq_stat(void)
 #endif
 	return sum;
 }
+
+EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);

commit bed4f13065b520e564adffbfcd1c1a764a9c887e
Merge: 3e5621edb339 bf8bd66d0580
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:30:31 2008 +0100

    Merge branch 'x86/irq' into x86/core

diff --cc arch/x86/kernel/time_64.c
index 1b7711b31037,1749cacde8b9..891e7a7c4334
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@@ -49,9 -49,9 +49,9 @@@ unsigned long profile_pc(struct pt_reg
  }
  EXPORT_SYMBOL(profile_pc);
  
 -irqreturn_t timer_interrupt(int irq, void *dev_id)
 +static irqreturn_t timer_interrupt(int irq, void *dev_id)
  {
- 	add_pda(irq0_irqs, 1);
+ 	inc_irq_stat(irq0_irqs);
  
  	global_clock_event->event_handler(global_clock_event);
  

commit 3e5621edb3392b28efb260ac99b2d26fb8b44e73
Merge: be9a1d3c2e55 181de82ee3ff
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:30:27 2008 +0100

    Merge branch 'x86/iommu' into x86/core

commit be9a1d3c2e559b267983bcf8b003997b83befb49
Merge: fa623d1b0222 7e3cbc3f774f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:30:20 2008 +0100

    Merge branch 'x86/tsc' into x86/core

commit 7e3cbc3f774f31ecd88a51edae3d9377f60a4c00
Merge: 345077cd98ff f4166c54bfe0
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:29:31 2008 +0100

    Merge branch 'x86/ptrace' into x86/tsc
    
    Conflicts:
            arch/x86/kernel/cpu/intel.c

diff --cc arch/x86/kernel/cpu/intel.c
index b21c37c060a2,816f27f289b1..ccfd2047630c
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@@ -328,8 -312,7 +329,6 @@@ static void __cpuinit init_intel(struc
  	if (cpu_has_bts)
  		ptrace_bts_init_intel(c);
  
- #endif
- 
 -	detect_extended_topology(c);
  	if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) {
  		/*
  		 * let's use the legacy cpuid vector 0x1 and 0x4 for topology

commit fa623d1b0222adbe8f822e53c08003b9679a410c
Merge: 3d44cc3e01ee 1ccedb7cdba6 34945ede3107 d43779740621 c415b3dce30d beeb4195cbc8 f269b07e862c 4e42ebd57b2e e1286f2c686f 878719e831d9 fd28a5b58ddd adf77bac052b 8f2466f45f75 93093d099e5d bb5574608a83 f34a10bd9f8c b6fd6f26733e 30604bb410b5 5b9a0e14eb4b 67bac792cd0c 7a9787e1eba9 f4166c54bfe0 69b88afa8d11 8daa19051e1c 3e1e9002aa8b 8403295e0fa4 4db646b1af8f 205516c12dbb c8182f0016fb ecbf29cdb399
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:27:23 2008 +0100

    Merge branches 'x86/apic', 'x86/cleanups', 'x86/cpufeature', 'x86/crashdump', 'x86/debug', 'x86/defconfig', 'x86/detect-hyper', 'x86/doc', 'x86/dumpstack', 'x86/early-printk', 'x86/fpu', 'x86/idle', 'x86/io', 'x86/memory-corruption-check', 'x86/microcode', 'x86/mm', 'x86/mtrr', 'x86/nmi-watchdog', 'x86/pat2', 'x86/pci-ioapic-boot-irq-quirks', 'x86/ptrace', 'x86/quirks', 'x86/reboot', 'x86/setup-memory', 'x86/signal', 'x86/sparse-fixes', 'x86/time', 'x86/uv' and 'x86/xen' into x86/core

diff --cc Documentation/kernel-parameters.txt
index e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed,c86c07459712,e0f346d201ed,e0f346d201ed,dc6b06f67fca,e0f346d201ed,53ba7c7d82b3,e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed,343e0f0f84b6,6246220ac914,e0f346d201ed,63bac584f9cb,c86c07459712,e0f346d201ed,c86c07459712,e0f346d201ed,343e0f0f84b6,e0f346d201ed,e0f346d201ed,e0f346d201ed,e0f346d201ed..d5418d528910
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -198,50 -198,50 -198,50 -198,50 -198,67 -198,50 -198,50 -198,67 -198,50 -198,40 -198,50 -198,50 -198,50 -198,50 -198,50 -198,50 -198,50 -198,67 -198,67 -198,50 -198,67 -198,67 -198,50 -198,67 -198,50 -198,67 -198,50 -198,50 -198,50 -198,50 +198,50 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ and is between 256 and 4096 characters
                              			that require a timer override, but don't have
                              			HPET
                              
    -  - -       -- -- - -    	acpi.debug_layer=	[HW,ACPI]
         -       -- -    -    			Format: <int>
         -       -- -    -    			Each bit of the <int> indicates an ACPI debug layer,
         -       -- -    -    			1: enable, 0: disable. It is useful for boot time
         -       -- -    -    			debugging. After system has booted up, it can be set
         -       -- -    -    			via /sys/module/acpi/parameters/debug_layer.
         -       -- -    -    			CONFIG_ACPI_DEBUG must be enabled for this to produce any output.
         -       -- -    -    			Available bits (add the numbers together) to enable debug output
         -       -- -    -    			for specific parts of the ACPI subsystem:
         -       -- -    -    			0x01 utilities 0x02 hardware 0x04 events 0x08 tables
         -       -- -    -    			0x10 namespace 0x20 parser 0x40 dispatcher
         -       -- -    -    			0x80 executer 0x100 resources 0x200 acpica debugger
         -       -- -    -    			0x400 os services 0x800 acpica disassembler.
         -       -- -    -    			The number can be in decimal or prefixed with 0x in hex.
         -       -- -    -    			Warning: Many of these options can produce a lot of
         -       -- -    -    			output and make your system unusable. Be very careful.
         -       -- -    -    
         -       -- -    -    	acpi.debug_level=	[HW,ACPI]
    +  + +       ++ ++ + +    	acpi_backlight=	[HW,ACPI]
    +  + +       ++ ++ + +    			acpi_backlight=vendor
    +  + +       ++ ++ + +    			acpi_backlight=video
    +  + +       ++ ++ + +    			If set to vendor, prefer vendor specific driver
    +  + +       ++ ++ + +    			(e.g. thinkpad_acpi, sony_acpi, etc.) instead
    +  + +       ++ ++ + +    			of the ACPI video.ko driver.
    +  + +       ++ ++ + +    
    +  + +       ++ ++ + +    	acpi_display_output=	[HW,ACPI]
    +  + +       ++ ++ + +    			acpi_display_output=vendor
    +  + +       ++ ++ + +    			acpi_display_output=video
    +  + +       ++ ++ + +    			See above.
    +  + +       ++ ++ + +    
    +  + +       ++ ++ + +    	acpi.debug_layer=	[HW,ACPI,ACPI_DEBUG]
    +  + +       ++ ++ + +    	acpi.debug_level=	[HW,ACPI,ACPI_DEBUG]
                              			Format: <int>
    -  -             - -      			Each bit of the <int> indicates an ACPI debug layer,
         -                    			Each bit of the <int> indicates an ACPI debug level,
    -  - -           - -      			1: enable, 0: disable. It is useful for boot time
    -  - -           - -      			debugging. After system has booted up, it can be set
    -  -             - -      			via /sys/module/acpi/parameters/debug_layer.
         -                    			via /sys/module/acpi/parameters/debug_level.
    -  - -           - -      			CONFIG_ACPI_DEBUG must be enabled for this to produce any output.
    -  -             - -      			Available bits (add the numbers together) to enable debug output
    -  -             - -      			for specific parts of the ACPI subsystem:
    -  -             - -      			0x01 utilities 0x02 hardware 0x04 events 0x08 tables
    -  -             - -      			0x10 namespace 0x20 parser 0x40 dispatcher
    -  -             - -      			0x80 executer 0x100 resources 0x200 acpica debugger
    -  -             - -      			0x400 os services 0x800 acpica disassembler.
         -                    			Available bits (add the numbers together) to enable different
         -                    			debug output levels of the ACPI subsystem:
         -                    			0x01 error 0x02 warn 0x04 init 0x08 debug object
         -                    			0x10 info 0x20 init names 0x40 parse 0x80 load
         -                    			0x100 dispatch 0x200 execute 0x400 names 0x800 operation region
         -                    			0x1000 bfield 0x2000 tables 0x4000 values 0x8000 objects
         -                    			0x10000 resources 0x20000 user requests 0x40000 package.
    -  - -           - -      			The number can be in decimal or prefixed with 0x in hex.
    -  - -           - -      			Warning: Many of these options can produce a lot of
    -  - -           - -      			output and make your system unusable. Be very careful.
    -  -             - -      
    -  -             - -      	acpi.debug_level=	[HW,ACPI]
    -  -             - -      			Format: <int>
    -  -         -- -- - -    			Each bit of the <int> indicates an ACPI debug level,
    -  -         -- -- - -    			which corresponds to the level in an ACPI_DEBUG_PRINT
    -  -         -- -- - -    			statement.  After system has booted up, this mask
    -  -         -- -- - -    			can be set via /sys/module/acpi/parameters/debug_level.
    -  -         -- -- - -    
    -  -         -- -- - -    			CONFIG_ACPI_DEBUG must be enabled for this to produce
    -  -         -- -- - -    			any output.  The number can be in decimal or prefixed
    -  -         -- -- - -    			with 0x in hex.  Some of these options produce so much
    -  -         -- -- - -    			output that the system is unusable.
    -  -         -- -- - -    
    -  -         -- -- - -    			The following global components are defined by the
    -  -         -- -- - -    			ACPI CA:
    -  -         -- -- - -    			       0x01 error
    -  -         -- -- - -    			       0x02 warn
    -  -         -- -- - -    			       0x04 init
    -  -         -- -- - -    			       0x08 debug object
    -  -         -- -- - -    			       0x10 info
    -  -         -- -- - -    			       0x20 init names
    -  -         -- -- - -    			       0x40 parse
    -  -         -- -- - -    			       0x80 load
    -  -         -- -- - -    			      0x100 dispatch
    -  -         -- -- - -    			      0x200 execute
    -  -         -- -- - -    			      0x400 names
    -  -         -- -- - -    			      0x800 operation region
    -  -         -- -- - -    			     0x1000 bfield
    -  -         -- -- - -    			     0x2000 tables
    -  -         -- -- - -    			     0x4000 values
    -  -         -- -- - -    			     0x8000 objects
    -  -         -- -- - -    			    0x10000 resources
    -  -         -- -- - -    			    0x20000 user requests
    -  -         -- -- - -    			    0x40000 package
    -  -         -- -- - -     			The number can be in decimal or prefixed with 0x in hex.
    -  -         -- -- - -     			Warning: Many of these options can produce a lot of
    -  -         -- -- - -     			output and make your system unusable. Be very careful.
    +  + +       ++ ++ + +    			CONFIG_ACPI_DEBUG must be enabled to produce any ACPI
    +  + +       ++ ++ + +    			debug output.  Bits in debug_layer correspond to a
    +  + +       ++ ++ + +    			_COMPONENT in an ACPI source file, e.g.,
    +  + +       ++ ++ + +    			    #define _COMPONENT ACPI_PCI_COMPONENT
    +  + +       ++ ++ + +    			Bits in debug_level correspond to a level in
    +  + +       ++ ++ + +    			ACPI_DEBUG_PRINT statements, e.g.,
    +  + +       ++ ++ + +    			    ACPI_DEBUG_PRINT((ACPI_DB_INFO, ...
    +  + +       ++ ++ + +    			See Documentation/acpi/debug.txt for more information
    +  + +       ++ ++ + +    			about debug layers and levels.
    +  + +       ++ ++ + +    
    +  + +       ++ ++ + +    			Enable AML "Debug" output, i.e., stores to the Debug
    +  + +       ++ ++ + +    			object while interpreting AML:
    +  + +       ++ ++ + +    			    acpi.debug_layer=0xffffffff acpi.debug_level=0x2
    +  + +       ++ ++ + +    			Enable PCI/PCI interrupt routing info messages:
    +  + +       ++ ++ + +    			    acpi.debug_layer=0x400000 acpi.debug_level=0x4
    +  + +       ++ ++ + +    			Enable all messages related to ACPI hardware:
    +  + +       ++ ++ + +    			    acpi.debug_layer=0x2 acpi.debug_level=0xffffffff
    +  + +       ++ ++ + +    
    +  + +       ++ ++ + +    			Some values produce so much output that the system is
    +  + +       ++ ++ + +    			unusable.  The "log_buf_len" parameter may be useful
    +  + +       ++ ++ + +    			if you need to capture more output.
         +                    
         +                     	acpi.power_nocheck=	[HW,ACPI]
         +                     			Format: 1/0 enable/disable the check of power state.
         +                     			On some bogus BIOS the _PSC object/_STA object of
         +                     			power resource can't return the correct device power
         +                     			state. In such case it is unneccessary to check its
         +                     			power state again in power transition.
         +                     			1 : disable the power state check
                              
                              	acpi_pm_good	[X86-32,X86-64]
                              			Override the pmtimer bug detection: force the kernel
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -1710,13 -1710,13 -1710,13 -1710,13 -1722,13 -1710,13 -1710,13 -1722,13 -1710,13 -1695,13 -1710,13 -1710,13 -1710,13 -1710,13 -1710,13 -1710,13 -1710,13 -1722,13 -1735,13 -1710,13 -1733,13 -1722,13 -1710,13 -1722,13 -1710,13 -1722,13 -1710,13 -1710,13 -1710,13 -1710,13 +1734,13 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              			See arch/parisc/kernel/pdc_chassis.c
                              
                              	pf.		[PARIDE]
    -  - -       -- -- - -    			See Documentation/paride.txt.
    +  + +       ++ ++ + +    			See Documentation/blockdev/paride.txt.
                              
                              	pg.		[PARIDE]
    -  - -       -- -- - -    			See Documentation/paride.txt.
    +  + +       ++ ++ + +    			See Documentation/blockdev/paride.txt.
                              
                              	pirq=		[SMP,APIC] Manual mp-table setup
         -       -- -    -    			See Documentation/i386/IO-APIC.txt.
         +       ++ +    +    			See Documentation/x86/i386/IO-APIC.txt.
                              
                              	plip=		[PPT,NET] Parallel port network link
                              			Format: { parport<nr> | timid | 0 }
diff --cc arch/x86/Kconfig
index ac22bb7719f7,ac22bb7719f7,d4d4cb7629ea,ac22bb7719f7,93224b569187,ab98cca84e1b,ac22bb7719f7,6f20718d3156,e795b5ba25b2,5b9b12321ad1,ac22bb7719f7,ac22bb7719f7,ac22bb7719f7,a7d50f5d118c,ac22bb7719f7,ac22bb7719f7,cb6a58b77126,350bee1d54dc,d11d7b513191,ac22bb7719f7,f4ed47db79ee,4cf0ab13d187,705e72e954b4,ebcad15ccf35,ac22bb7719f7,350bee1d54dc,ac22bb7719f7,ac22bb7719f7,ac22bb7719f7,ac22bb7719f7..1cbec0269d39
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -956,11 -956,11 -948,11 -956,11 -953,11 -960,11 -956,11 -953,11 -956,11 -946,11 -956,11 -956,11 -956,11 -958,11 -956,11 -956,11 -956,20 -949,11 -949,11 -956,11 -973,11 -953,11 -952,11 -953,11 -956,11 -949,11 -956,11 -956,11 -956,11 -956,11 +974,20 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ config X86_PA
                              config ARCH_PHYS_ADDR_T_64BIT
                                     def_bool X86_64 || X86_PAE
                              
++++++++++++++++ +++++++++++++config DIRECT_GBPAGES
++++++++++++++++ +++++++++++++	bool "Enable 1GB pages for kernel pagetables" if EMBEDDED
++++++++++++++++ +++++++++++++	default y
++++++++++++++++ +++++++++++++	depends on X86_64
++++++++++++++++ +++++++++++++	help
++++++++++++++++ +++++++++++++	  Allow the kernel linear mapping to use 1GB pages on CPUs that
++++++++++++++++ +++++++++++++	  support it. This can improve the kernel's performance a tiny bit by
++++++++++++++++ +++++++++++++	  reducing TLB pressure. If in doubt, say "Y".
++++++++++++++++ +++++++++++++
                              # Common NUMA Features
                              config NUMA
-------- ---------------------	bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
++++++++ +++++++++++++++++++++	bool "Numa Memory Allocation and Scheduler Support"
                              	depends on SMP
    -                         	depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && BROKEN)
    +                         	depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL)
                              	default n if X86_PC
                              	default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
                              	help
diff --cc arch/x86/kernel/Makefile
index b62a7667828e,b62a7667828e,b62a7667828e,b62a7667828e,e489ff9cb3e2,943fe6026c64,e489ff9cb3e2,e489ff9cb3e2,b62a7667828e,db3216a9d2b9,b62a7667828e,b62a7667828e,b62a7667828e,e489ff9cb3e2,b2077d3fe977,b62a7667828e,b62a7667828e,d7e5a58ee22f,e489ff9cb3e2,b62a7667828e,d7e5a58ee22f,e489ff9cb3e2,b62a7667828e,e489ff9cb3e2,b62a7667828e,ef28c210ebf8,e489ff9cb3e2,b62a7667828e,b62a7667828e,b62a7667828e..1f208aaee780
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -11,7 -11,7 -11,7 -11,7 -11,7 -11,8 -11,7 -11,7 -11,7 -11,6 -11,7 -11,7 -11,7 -11,7 -11,7 -11,7 -11,7 -11,6 -11,7 -11,7 -11,6 -11,7 -11,7 -11,7 -11,7 -11,6 -11,7 -11,7 -11,7 -11,7 +11,8 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ifdef CONFIG_FUNCTION_TRACE
                              CFLAGS_REMOVE_tsc.o = -pg
                              CFLAGS_REMOVE_rtc.o = -pg
                              CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
         +       +  +    +    CFLAGS_REMOVE_ftrace.o = -pg
+++++ ++++++++++++++++++++++++CFLAGS_REMOVE_early_printk.o = -pg
                              endif
                              
                              #
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -23,9 -23,9 -23,9 -23,9 -23,9 -24,9 -23,9 -23,9 -23,9 -22,9 -23,9 -23,9 -23,9 -23,9 -23,9 -23,9 -23,9 -22,9 -23,9 -23,9 -22,9 -23,9 -23,9 -23,9 -23,9 -22,9 -23,9 -23,9 -23,9 -23,9 +24,9 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ CFLAGS_vsyscall_64.o	:= $(PROFILING) -g
                              CFLAGS_hpet.o		:= $(nostackp)
                              CFLAGS_tsc.o		:= $(nostackp)
                              
------------------------- ----obj-y			:= process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
+++++++++++++++++++++++++ ++++obj-y			:= process_$(BITS).o signal.o entry_$(BITS).o
                              obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
--------- --------------------obj-y			+= time_$(BITS).o ioport.o ldt.o
+++++++++ ++++++++++++++++++++obj-y			+= time_$(BITS).o ioport.o ldt.o dumpstack.o
                              obj-y			+= setup.o i8259.o irqinit_$(BITS).o setup_percpu.o
                              obj-$(CONFIG_X86_VISWS)	+= visws_quirks.o
                              obj-$(CONFIG_X86_32)	+= probe_roms_32.o
diff --cc arch/x86/kernel/ds.c
index a2d1176c38ee,a2d1176c38ee,a2d1176c38ee,a2d1176c38ee,2b69994fd3a8,d1a121443bde,d1a121443bde,2b69994fd3a8,a2d1176c38ee,2b69994fd3a8,a2d1176c38ee,a2d1176c38ee,a2d1176c38ee,d1a121443bde,d1a121443bde,a2d1176c38ee,a2d1176c38ee,2b69994fd3a8,2b69994fd3a8,a2d1176c38ee,2b69994fd3a8,c570252905a1,a2d1176c38ee,2b69994fd3a8,a2d1176c38ee,2b69994fd3a8,d1a121443bde,a2d1176c38ee,a2d1176c38ee,a2d1176c38ee..d6938d9351cf
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -231,12 -231,12 -231,12 -231,12 -234,12 -234,16 -234,16 -234,12 -231,12 -234,12 -231,12 -231,12 -231,12 -234,16 -234,16 -231,12 -231,12 -234,12 -234,12 -231,12 -234,12 -234,12 -231,12 -234,12 -231,12 -234,12 -234,16 -231,12 -231,12 -231,12 +231,12 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ static inline struct ds_context *ds_all
                              	struct ds_context **p_context =
                              		(task ? &task->thread.ds_ctx : &this_system_context);
                              	struct ds_context *context = *p_context;
    ++++ +   ++  ++ ++ + ++   	unsigned long irq;
                              
                              	if (!context) {
     --      --           -   		spin_unlock(&ds_lock);
     --      --           -   
                              		context = kzalloc(sizeof(*context), GFP_KERNEL);
    ---- -   --  -- -- - --   
     --      --           -   		if (!context) {
     --      --           -   			spin_lock(&ds_lock);
     ++      ++           +   		if (!context)
                              			return NULL;
     --      --           -   		}
                              
                              		context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
                              		if (!context->ds) {
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -244,27 -244,27 -244,27 -244,27 -247,18 -251,30 -251,30 -247,18 -244,27 -247,18 -244,27 -244,27 -244,27 -251,30 -251,30 -244,27 -244,27 -247,18 -247,18 -244,27 -247,18 -247,18 -244,27 -247,18 -244,27 -247,18 -251,30 -244,27 -244,27 -244,27 +244,27 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                              			return NULL;
                              		}
                              
    -  - -       -- -- - -    		*p_context = context;
     --      --           -   		spin_lock(&ds_lock);
     --      --           -   		/*
     --      --           -   		 * Check for race - another CPU could have allocated
     --      --           -   		 * it meanwhile:
     --      --           -   		 */
    ++++ +   ++  ++ ++ + ++   		spin_lock_irqsave(&ds_lock, irq);
     ++      ++           +   
    -  - -       -- -- - -    		context->this = p_context;
    -  - -       -- -- - -    		context->task = task;
    +  + +       ++ ++ + +    		if (*p_context) {
    +  + +       ++ ++ + +    			kfree(context->ds);
    +  + +       ++ ++ + +    			kfree(context);
     --      --           -   			return *p_context;
     --      --           -   		}
                     +        
    -  - -       -- -  - -    		if (task)
    -  - -       -- -  - -    			set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
     --      --           -   		*p_context = context;
    ++++ +   ++  ++ ++ + ++   			context = *p_context;
    ++++ +   ++  ++ ++ + ++   		} else {
    ++++ +   ++  ++ ++ + ++   			*p_context = context;
                              
    -  - -       -- -  - -    		if (!task || (task == current))
    -  - -       -- -  - -    			wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
     --      --           -   		context->this = p_context;
     --      --           -   		context->task = task;
                     -        		if (task)
                     -        			set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
    ++++ +   ++  ++ ++ + ++   			context->this = p_context;
    ++++ +   ++  ++ ++ + ++   			context->task = task;
                              
    -  - -       -- -  - -    		get_tracer(task);
     --      --           -   		if (task)
     --      --           -   			set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
                     -        		if (!task || (task == current))
                     -        			wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
    ++++ +   ++  ++ ++ + ++   			if (task)
    ++++ +   ++  ++ ++ + ++   				set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
    +  + +       ++ +  + +    
     --      --           -   		if (!task || (task == current))
     --      --           -   			wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
     --      --           -   
     --      --      -    -   		get_tracer(task);
    ++++ +   ++  ++ ++ + ++   			if (!task || (task == current))
    ++++ +   ++  ++ ++ + ++   				wrmsrl(MSR_IA32_DS_AREA,
    ++++ +   ++  ++ ++ + ++   				       (unsigned long)context->ds);
    ++++ +   ++  ++ ++ + ++   		}
    ++++ +   ++  ++ ++ + ++   		spin_unlock_irqrestore(&ds_lock, irq);
                              	}
                              
                              	context->count++;
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -391,27 -391,27 -391,27 -391,27 -382,25 -398,26 -398,26 -382,25 -391,27 -382,25 -391,27 -391,27 -391,27 -398,26 -398,26 -391,27 -391,27 -382,25 -382,25 -391,27 -382,25 -382,25 -391,27 -382,25 -391,27 -382,25 -398,26 -391,27 -391,27 -391,27 +391,27 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ static int ds_request(struct task_struc
                              		return -EOPNOTSUPP;
                              
                              
    ---- -   --  -- -- - --   	spin_lock(&ds_lock);
    -  - -       -- -- - -    
    -  - -       -- -- - -    	if (!check_tracer(task))
    -  - -       -- -- - -    		return -EPERM;
    ---- -   --  -- -- - --   
    ---- -   --  -- -- - --   	error = -ENOMEM;
                              	context = ds_alloc_context(task);
                              	if (!context)
     --      --           -   		goto out_unlock;
    ++++ +   ++  ++ ++ + ++   		return -ENOMEM;
    ++++ +   ++  ++ ++ + ++   
    ++++ +   ++  ++ ++ + ++   	spin_lock_irqsave(&ds_lock, irq);
    +  + +       ++ ++ + +    
    +  + +       ++ ++ + +    	error = -EPERM;
    +  + +       ++ ++ + +    	if (!check_tracer(task))
                              		goto out_unlock;
                              
    ++++ +   ++  ++ ++ + ++   	get_tracer(task);
    ++++ +   ++  ++ ++ + ++   
                              	error = -EALREADY;
                              	if (context->owner[qual] == current)
    ---- -   --  -- -- - --   		goto out_unlock;
    ++++ +   ++  ++ ++ + ++   		goto out_put_tracer;
                              	error = -EPERM;
                              	if (context->owner[qual] != NULL)
    ---- -   --  -- -- - --   		goto out_unlock;
    ++++ +   ++  ++ ++ + ++   		goto out_put_tracer;
                              	context->owner[qual] = current;
                              
    ---- -   --  -- -- - --   	spin_unlock(&ds_lock);
    ++++ +   ++  ++ ++ + ++   	spin_unlock_irqrestore(&ds_lock, irq);
                              
                              
                              	error = -ENOMEM;
diff --cc arch/x86/kernel/entry_64.S
index b86f332c96a6,b86f332c96a6,54927784bab9,b86f332c96a6,b86f332c96a6,4a16bf31c783,b86f332c96a6,b86f332c96a6,b86f332c96a6,09e7145484c5,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6,09e7145484c5,b86f332c96a6,b86f332c96a6,09e7145484c5,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6,09e7145484c5,b86f332c96a6,b86f332c96a6,b86f332c96a6,b86f332c96a6..42571baaca32
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -255,8 -255,8 -255,8 -255,8 -255,8 -255,9 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 -255,8 +255,9 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ENTRY(ret_from_fork
                              	call schedule_tail
                              	GET_THREAD_INFO(%rcx)
                              	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
+++++ ++++++++++++++++++++++++	CFI_REMEMBER_STATE
                              	jnz rff_trace
-- ---------------------------rff_action:	
++ +++++++++++++++++++++++++++rff_action:
                              	RESTORE_REST
                              	testl $3,CS-ARGOFFSET(%rsp)	# from kernel_thread?
                              	je   int_ret_from_sys_call
diff --cc arch/x86/kernel/reboot.c
index cc5a2545dd41,cc5a2545dd41,cc5a2545dd41,cc5a2545dd41,c3cd512484e5,cc5a2545dd41,cc5a2545dd41,f4c93f1cfc19,cc5a2545dd41,f4c93f1cfc19,cc5a2545dd41,cc5a2545dd41,cc5a2545dd41,cc5a2545dd41,724adfc63cb9,cc5a2545dd41,cc5a2545dd41,f4c93f1cfc19,f4c93f1cfc19,cc5a2545dd41,f4c93f1cfc19,724adfc63cb9,cc5a2545dd41,bb387ab0eea8,cc5a2545dd41,f4c93f1cfc19,cc5a2545dd41,cc5a2545dd41,cc5a2545dd41,cc5a2545dd41..61f718df6eec
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -404,12 -404,12 -404,12 -404,12 -398,12 -404,12 -404,12 -399,12 -404,12 -399,12 -404,12 -404,12 -404,12 -404,12 -395,12 -404,12 -404,12 -399,12 -399,12 -404,12 -399,12 -395,12 -404,12 -400,27 -404,12 -399,12 -404,12 -404,12 -404,12 -404,12 +412,27 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ static void native_machine_emergency_re
                              			reboot_type = BOOT_KBD;
                              			break;
                              
----------------------- ------
                              		case BOOT_EFI:
                              			if (efi_enabled)
----------------------- ------				efi.reset_system(reboot_mode ? EFI_RESET_WARM : EFI_RESET_COLD,
+++++++++++++++++++++++ ++++++				efi.reset_system(reboot_mode ?
+++++++++++++++++++++++ ++++++						 EFI_RESET_WARM :
+++++++++++++++++++++++ ++++++						 EFI_RESET_COLD,
                              						 EFI_SUCCESS, 0, NULL);
+++++++++++++++++++++++ ++++++			reboot_type = BOOT_KBD;
+++++++++++++++++++++++ ++++++			break;
       + +       ++ +    +    
+++++++++++++++++++++++ ++++++		case BOOT_CF9:
+++++++++++++++++++++++ ++++++			port_cf9_safe = true;
+++++++++++++++++++++++ ++++++			/* fall through */
+++++++ + +++++++  + ++ + ++++
+++++++++++++++++++++++ ++++++		case BOOT_CF9_COND:
+++++++++++++++++++++++ ++++++			if (port_cf9_safe) {
+++++++++++++++++++++++ ++++++				u8 cf9 = inb(0xcf9) & ~6;
+++++++++++++++++++++++ ++++++				outb(cf9|2, 0xcf9); /* Request hard reset */
+++++++++++++++++++++++ ++++++				udelay(50);
+++++++++++++++++++++++ ++++++				outb(cf9|6, 0xcf9); /* Actually do the reset */
+++++++++++++++++++++++ ++++++				udelay(50);
+++++++++++++++++++++++ ++++++			}
                              			reboot_type = BOOT_KBD;
                              			break;
                              		}
diff --cc arch/x86/kernel/setup.c
index bdec76e55594,bdec76e55594,81f5d22747ae,9d5674f7b6cc,0fa6790c1dd3,9d5674f7b6cc,9d5674f7b6cc,f44dadfb32cf,9d5674f7b6cc,0fa6790c1dd3,9d5674f7b6cc,bdec76e55594,9d5674f7b6cc,9d5674f7b6cc,13a5f592ac28,9d5674f7b6cc,9d5674f7b6cc,0fa6790c1dd3,0fa6790c1dd3,bdec76e55594,0fa6790c1dd3,0fa6790c1dd3,f5096a6bf4ed,0fa6790c1dd3,9d5674f7b6cc,0fa6790c1dd3,9d5674f7b6cc,9d5674f7b6cc,9d5674f7b6cc,bdec76e55594..a31223828597
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -583,161 -583,161 -584,161 -583,161 -583,161 -583,161 -583,161 -584,161 -583,161 -583,161 -583,161 -583,161 -583,161 -583,161 -583,11 -583,161 -583,161 -583,161 -583,161 -583,161 -583,161 -583,161 -583,174 -583,161 -583,161 -583,161 -583,161 -583,161 -583,161 -583,161 +585,24 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ static int __init setup_elfcorehdr(cha
                              early_param("elfcorehdr", setup_elfcorehdr);
                              #endif
                              
---------------------- -------static struct x86_quirks default_x86_quirks __initdata;
-------------- ------- -------
-------------- ------- -------struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
-------------- ------- -------
-------------- ------- -------/*
-------------- ------- ------- * Some BIOSes seem to corrupt the low 64k of memory during events
-------------- ------- ------- * like suspend/resume and unplugging an HDMI cable.  Reserve all
-------------- ------- ------- * remaining free memory in that area and fill it with a distinct
-------------- ------- ------- * pattern.
-------------- ------- ------- */
-------------- ------- -------#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
-------------- ------- -------#define MAX_SCAN_AREAS	8
-------------- ------- -------
-------------- ------- -------static int __read_mostly memory_corruption_check = -1;
-------------- ------- -------
-------------- ------- -------static unsigned __read_mostly corruption_check_size = 64*1024;
-------------- ------- -------static unsigned __read_mostly corruption_check_period = 60; /* seconds */
-------------- ------- -------
-------------- ------- -------static struct e820entry scan_areas[MAX_SCAN_AREAS];
-------------- ------- -------static int num_scan_areas;
-------------- ------- -------
-------------- ------- -------
-------------- ------- -------static int set_corruption_check(char *arg)
  ----- --- -- ---- -- ------ {
  ----- --- -- ---- -- ------ 	char *end;
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	memory_corruption_check = simple_strtol(arg, &end, 10);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	return (*end == 0) ? 0 : -EINVAL;
  ----- --- -- ---- -- ------ }
  ----- --- -- ---- -- ------ early_param("memory_corruption_check", set_corruption_check);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ static int set_corruption_check_period(char *arg)
  ----- --- -- ---- -- ------ {
  ----- --- -- ---- -- ------ 	char *end;
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	corruption_check_period = simple_strtoul(arg, &end, 10);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	return (*end == 0) ? 0 : -EINVAL;
  ----- --- -- ---- -- ------ }
  ----- --- -- ---- -- ------ early_param("memory_corruption_check_period", set_corruption_check_period);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ static int set_corruption_check_size(char *arg)
  ----- --- -- ---- -- ------ {
  ----- --- -- ---- -- ------ 	char *end;
  ----- --- -- ---- -- ------ 	unsigned size;
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	size = memparse(arg, &end);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	if (*end == '\0')
  ----- --- -- ---- -- ------ 		corruption_check_size = size;
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	return (size == corruption_check_size) ? 0 : -EINVAL;
  ----- --- -- ---- -- ------ }
  ----- --- -- ---- -- ------ early_param("memory_corruption_check_size", set_corruption_check_size);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ static void __init setup_bios_corruption_check(void)
++++++++++++++++++++++ +++++++static int __init default_update_genapic(void)
              +               {
--     -   -       -         -	char *end;
--     -   -       -         -
--     -   -       -         -	memory_corruption_check = simple_strtol(arg, &end, 10);
--     -   -       -         -
--     -   -       -         -	return (*end == 0) ? 0 : -EINVAL;
--     -   -       -         -}
--     -   -       -         -early_param("memory_corruption_check", set_corruption_check);
--     -   -       -         -
--     -   -       -         -static int set_corruption_check_period(char *arg)
--     -   -       -         -{
--     -   -       -         -	char *end;
--     -   -       -         -
--     -   -       -         -	corruption_check_period = simple_strtoul(arg, &end, 10);
--     -   -       -         -
--     -   -       -         -	return (*end == 0) ? 0 : -EINVAL;
--     -   -       -         -}
--     -   -       -         -early_param("memory_corruption_check_period", set_corruption_check_period);
--     -   -       -         -
--     -   -       -         -static int set_corruption_check_size(char *arg)
--     -   -       -         -{
--     -   -       -         -	char *end;
--     -   -       -         -	unsigned size;
--     -   -       -         -
--     -   -       -         -	size = memparse(arg, &end);
--     -   -       -         -
--     -   -       -         -	if (*end == '\0')
--     -   -       -         -		corruption_check_size = size;
--     -   -       -         -
--     -   -       -         -	return (size == corruption_check_size) ? 0 : -EINVAL;
--     -   -       -         -}
--     -   -       -         -early_param("memory_corruption_check_size", set_corruption_check_size);
--     -   -       -         -
--     -   -       -         -
--     -   -       -         -static void __init setup_bios_corruption_check(void)
--     -   -       -         -{
-------------- ------- -------	u64 addr = PAGE_SIZE;	/* assume first page is reserved anyway */
-------------- ------- -------
-------------- ------- -------	if (memory_corruption_check == -1) {
-------------- ------- -------		memory_corruption_check =
-------------- ------- -------#ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
-------------- ------- -------			1
-------------- ------- -------#else
-------------- ------- -------			0
++++++++++++++++++++++ +++++++#ifdef CONFIG_X86_SMP
++++++++++++++++++++++ +++++++# if defined(CONFIG_X86_GENERICARCH) || defined(CONFIG_X86_64)
++++++++++++++++++++++ +++++++	genapic->wakeup_cpu = wakeup_secondary_cpu_via_init;
++++++++++++++++++++++ +++++++# endif
              +               #endif
-------------- ------- -------			;
-------------- ------- -------	}
------- ------ ------- -------
------- ------ ------- -------	if (corruption_check_size == 0)
------- ------ ------- -------		memory_corruption_check = 0;
------- ------ ------- -------
------- ------ ------- -------	if (!memory_corruption_check)
------- ------ ------- -------		return;
------- ------ ------- -------
------- ------ ------- -------	corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 	while(addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) {
  ----- --- -- ---- -- ------ 		u64 size;
  ----- --- -- ---- -- ------ 		addr = find_e820_area_size(addr, &size, PAGE_SIZE);
  ----- --- -- ---- -- ------ 
  ----- --- -- ---- -- ------ 		if (addr == 0)
  ----- --- -- ---- -- ------ 			break;
              +               
       -                      	if (corruption_check_size == 0)
       -                      		memory_corruption_check = 0;
       -                      
       -                      	if (!memory_corruption_check)
       -                      		return;
       -                      
       -                      	corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
       -                      
--     -   -       -         -	while(addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) {
--     -   -       -         -		u64 size;
--     -   -       -         -		addr = find_e820_area_size(addr, &size, PAGE_SIZE);
--     -   -       -         -
--     -   -       -         -		if (addr == 0)
--     -   -       -         -			break;
--     -   -       -         -
-------------- ------- -------		if ((addr + size) > corruption_check_size)
-------------- ------- -------			size = corruption_check_size - addr;
-------------- ------- -------
-------------- ------- -------		if (size == 0)
-------------- ------- -------			break;
-------------- ------- -------
-------------- ------- -------		e820_update_range(addr, size, E820_RAM, E820_RESERVED);
-------------- ------- -------		scan_areas[num_scan_areas].addr = addr;
-------------- ------- -------		scan_areas[num_scan_areas].size = size;
-------------- ------- -------		num_scan_areas++;
-------------- ------- -------
-------------- ------- -------		/* Assume we've already mapped this early memory */
-------------- ------- -------		memset(__va(addr), 0, size);
-------------- ------- -------
-------------- ------- -------		addr += size;
-------------- ------- -------	}
-------------- ------- -------
-------------- ------- -------	printk(KERN_INFO "Scanning %d areas for low memory corruption\n",
-------------- ------- -------	       num_scan_areas);
-------------- ------- -------	update_e820();
-------------- ------- -------}
-------------- ------- -------
-------------- ------- -------static struct timer_list periodic_check_timer;
-------------- ------- -------
-------------- ------- -------void check_for_bios_corruption(void)
-------------- ------- -------{
-------------- ------- -------	int i;
-------------- ------- -------	int corruption = 0;
-------------- ------- -------
-------------- ------- -------	if (!memory_corruption_check)
-------------- ------- -------		return;
-------------- ------- -------
-------------- ------- -------	for(i = 0; i < num_scan_areas; i++) {
-------------- ------- -------		unsigned long *addr = __va(scan_areas[i].addr);
-------------- ------- -------		unsigned long size = scan_areas[i].size;
-------------- ------- -------
-------------- ------- -------		for(; size; addr++, size -= sizeof(unsigned long)) {
-------------- ------- -------			if (!*addr)
-------------- ------- -------				continue;
-------------- ------- -------			printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n",
-------------- ------- -------			       addr, __pa(addr), *addr);
-------------- ------- -------			corruption = 1;
-------------- ------- -------			*addr = 0;
-------------- ------- -------		}
-------------- ------- -------	}
-------------- ------- -------
-------------- ------- -------	WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
-------------- ------- -------}
-------------- ------- -------
-------------- ------- -------static void periodic_check_for_corruption(unsigned long data)
-------------- ------- -------{
-------------- ------- -------	check_for_bios_corruption();
-------------- ------- -------	mod_timer(&periodic_check_timer, round_jiffies(jiffies + corruption_check_period*HZ));
++++++++++++++++++++++ +++++++	return 0;
              +               }
              +               
-------------- ------- -------void start_periodic_check_for_corruption(void)
-------------- ------- -------{
-------------- ------- -------	if (!memory_corruption_check || corruption_check_period == 0)
-------------- ------- -------		return;
-------------- ------- -------
-------------- ------- -------	printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
-------------- ------- -------	       corruption_check_period);
++++++++++++++++++++++ +++++++static struct x86_quirks default_x86_quirks __initdata = {
++++++++++++++++++++++ +++++++	.update_genapic         = default_update_genapic,
++++++++++++++++++++++ +++++++};
                              
-------------- ------- -------	init_timer(&periodic_check_timer);
-------------- ------- -------	periodic_check_timer.function = &periodic_check_for_corruption;
-------------- ------- -------	periodic_check_for_corruption(0);
-------------- ------- -------}
-------------- ------- -------#endif
++++++++++++++ +++++++ +++++++struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
                              
                      -       /*
                      -        * Some BIOSes seem to corrupt the low 64k of memory during events
                      -        * like suspend/resume and unplugging an HDMI cable.  Reserve all
                      -        * remaining free memory in that area and fill it with a distinct
                      -        * pattern.
                      -        */
                      -       #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
                      -       #define MAX_SCAN_AREAS	8
                      -       
                      -       static int __read_mostly memory_corruption_check = -1;
                      -       
                      -       static unsigned __read_mostly corruption_check_size = 64*1024;
                      -       static unsigned __read_mostly corruption_check_period = 60; /* seconds */
                      -       
                      -       static struct e820entry scan_areas[MAX_SCAN_AREAS];
                      -       static int num_scan_areas;
                      -       
                      -       
                      -       static int set_corruption_check(char *arg)
                      -       {
                      -       	char *end;
                      -       
                      -       	memory_corruption_check = simple_strtol(arg, &end, 10);
                      -       
                      -       	return (*end == 0) ? 0 : -EINVAL;
                      -       }
                      -       early_param("memory_corruption_check", set_corruption_check);
                      -       
                      -       static int set_corruption_check_period(char *arg)
                      -       {
                      -       	char *end;
                      -       
                      -       	corruption_check_period = simple_strtoul(arg, &end, 10);
                      -       
                      -       	return (*end == 0) ? 0 : -EINVAL;
                      -       }
                      -       early_param("memory_corruption_check_period", set_corruption_check_period);
                      -       
                      -       static int set_corruption_check_size(char *arg)
                      -       {
                      -       	char *end;
                      -       	unsigned size;
                      -       
                      -       	size = memparse(arg, &end);
                      -       
                      -       	if (*end == '\0')
                      -       		corruption_check_size = size;
                      -       
                      -       	return (size == corruption_check_size) ? 0 : -EINVAL;
                      -       }
                      -       early_param("memory_corruption_check_size", set_corruption_check_size);
                      -       
                      -       
                      -       static void __init setup_bios_corruption_check(void)
                      -       {
                      -       	u64 addr = PAGE_SIZE;	/* assume first page is reserved anyway */
                      -       
                      -       	if (memory_corruption_check == -1) {
                      -       		memory_corruption_check =
                      -       #ifdef CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK
                      -       			1
                      -       #else
                      -       			0
                      -       #endif
                      -       			;
                      -       	}
                      -       
                      -       	if (corruption_check_size == 0)
                      -       		memory_corruption_check = 0;
                      -       
                      -       	if (!memory_corruption_check)
                      -       		return;
                      -       
                      -       	corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
                      -       
                      -       	while(addr < corruption_check_size && num_scan_areas < MAX_SCAN_AREAS) {
                      -       		u64 size;
                      -       		addr = find_e820_area_size(addr, &size, PAGE_SIZE);
                      -       
                      -       		if (addr == 0)
                      -       			break;
                      -       
                      -       		if ((addr + size) > corruption_check_size)
                      -       			size = corruption_check_size - addr;
                      -       
                      -       		if (size == 0)
                      -       			break;
                      -       
                      -       		e820_update_range(addr, size, E820_RAM, E820_RESERVED);
                      -       		scan_areas[num_scan_areas].addr = addr;
                      -       		scan_areas[num_scan_areas].size = size;
                      -       		num_scan_areas++;
                      -       
                      -       		/* Assume we've already mapped this early memory */
                      -       		memset(__va(addr), 0, size);
                      -       
                      -       		addr += size;
                      -       	}
                      -       
                      -       	printk(KERN_INFO "Scanning %d areas for low memory corruption\n",
                      -       	       num_scan_areas);
                      -       	update_e820();
                      -       }
                      -       
                      -       static struct timer_list periodic_check_timer;
                      -       
                      -       void check_for_bios_corruption(void)
                      -       {
                      -       	int i;
                      -       	int corruption = 0;
                      -       
                      -       	if (!memory_corruption_check)
                      -       		return;
                      -       
                      -       	for(i = 0; i < num_scan_areas; i++) {
                      -       		unsigned long *addr = __va(scan_areas[i].addr);
                      -       		unsigned long size = scan_areas[i].size;
                      -       
                      -       		for(; size; addr++, size -= sizeof(unsigned long)) {
                      -       			if (!*addr)
                      -       				continue;
                      -       			printk(KERN_ERR "Corrupted low memory at %p (%lx phys) = %08lx\n",
                      -       			       addr, __pa(addr), *addr);
                      -       			corruption = 1;
                      -       			*addr = 0;
                      -       		}
                      -       	}
                      -       
                      -       	WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
                      -       }
                      -       
                      -       static void periodic_check_for_corruption(unsigned long data)
                      -       {
                      -       	check_for_bios_corruption();
                      -       	mod_timer(&periodic_check_timer, round_jiffies(jiffies + corruption_check_period*HZ));
                      -       }
                      -       
                      -       void start_periodic_check_for_corruption(void)
                      -       {
                      -       	if (!memory_corruption_check || corruption_check_period == 0)
                      -       		return;
                      -       
                      -       	printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
                      -       	       corruption_check_period);
                      -       
                      -       	init_timer(&periodic_check_timer);
                      -       	periodic_check_timer.function = &periodic_check_for_corruption;
                      -       	periodic_check_for_corruption(0);
                      -       }
                      -       #endif
                      -       
++++++++++++++ +++++++++++++++#ifdef CONFIG_X86_RESERVE_LOW_64K
                              static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
                              {
                              	printk(KERN_NOTICE

commit bf8bd66d0580f296f257d371ee41a0a137b541c7
Merge: 8ae936690972 1ccedb7cdba6
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:24:15 2008 +0100

    Merge branch 'x86/apic' into x86/irq
    
    Conflicts:
            arch/x86/kernel/apic.c

diff --cc arch/x86/kernel/apic.c
index 1771dd746811,fc26ff390f14..47cbaa237b7b
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@@ -1691,11 -1681,14 +1677,11 @@@ void smp_spurious_interrupt(struct pt_r
  	if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
  		ack_APIC_irq();
  
 -#ifdef CONFIG_X86_64
 -	add_pda(irq_spurious_count, 1);
 -#else
 +	inc_irq_stat(irq_spurious_count);
 +
  	/* see sw-dev-man vol 3, chapter 7.4.13.5 */
- 	printk(KERN_INFO "spurious APIC interrupt on CPU#%d, "
- 	       "should never happen.\n", smp_processor_id());
+ 	pr_info("spurious APIC interrupt on CPU#%d, "
+ 		"should never happen.\n", smp_processor_id());
 -	__get_cpu_var(irq_stat).irq_spurious_count++;
 -#endif
  	irq_exit();
  }
  

commit 1ccedb7cdba6886939dd8b4c8f965a826f696e56
Merge: a98f8fd24fb2 929096fe9ff1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 16:23:23 2008 +0100

    Merge commit 'v2.6.28-rc9' into x86/apic

commit 2f18d1e8d07ae67dd0afce875287756d4bd31a46
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Dec 22 11:10:42 2008 +0100

    x86, perfcounters: add support for fixed-function pmcs
    
    Impact: extend performance counter support on x86 Intel CPUs
    
    Modern Intel CPUs have 3 "fixed-function" performance counters, which
    count these hardware events:
    
        Instr_Retired.Any
        CPU_CLK_Unhalted.Core
        CPU_CLK_Unhalted.Ref
    
    Add support for them to the performance counters subsystem.
    
    Their use is transparent to user-space: the counter scheduler is
    extended to automatically recognize the cases where a fixed-function
    PMC can be utilized instead of a generic PMC. In such cases the
    generic PMC is kept available for more counters.
    
    The above fixed-function events map to these generic counter hw events:
    
            PERF_COUNT_INSTRUCTIONS
            PERF_COUNT_CPU_CYCLES
            PERF_COUNT_BUS_CYCLES
    
    (The 'bus' cycles are in reality often CPU-ish cycles, just with a fixed
     frequency.)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/include/asm/perf_counter.h b/arch/x86/include/asm/perf_counter.h
index 13745deb16c8..2e08ed736647 100644
--- a/arch/x86/include/asm/perf_counter.h
+++ b/arch/x86/include/asm/perf_counter.h
@@ -23,6 +23,11 @@
 #define ARCH_PERFMON_EVENTSEL_OS			  (1 << 17)
 #define ARCH_PERFMON_EVENTSEL_USR			  (1 << 16)
 
+/*
+ * Includes eventsel and unit mask as well:
+ */
+#define ARCH_PERFMON_EVENT_MASK				    0xffff
+
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL		      0x3c
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK		(0x00 << 8)
 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 		 0
@@ -69,12 +74,15 @@ union cpuid10_edx {
 
 /* Instr_Retired.Any: */
 #define MSR_ARCH_PERFMON_FIXED_CTR0			0x309
+#define X86_PMC_IDX_FIXED_INSTRUCTIONS			(X86_PMC_IDX_FIXED + 0)
 
 /* CPU_CLK_Unhalted.Core: */
 #define MSR_ARCH_PERFMON_FIXED_CTR1			0x30a
+#define X86_PMC_IDX_FIXED_CPU_CYCLES			(X86_PMC_IDX_FIXED + 1)
 
 /* CPU_CLK_Unhalted.Ref: */
 #define MSR_ARCH_PERFMON_FIXED_CTR2			0x30b
+#define X86_PMC_IDX_FIXED_BUS_CYCLES			(X86_PMC_IDX_FIXED + 2)
 
 #ifdef CONFIG_PERF_COUNTERS
 extern void init_hw_perf_counters(void);
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 86b2fdd344a6..da46eca12543 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -26,6 +26,7 @@ static bool perf_counters_initialized __read_mostly;
  */
 static int nr_counters_generic __read_mostly;
 static u64 perf_counter_mask __read_mostly;
+static u64 counter_value_mask __read_mostly;
 
 static int nr_counters_fixed __read_mostly;
 
@@ -120,9 +121,6 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
 			hwc->nmi = 1;
 	}
 
-	hwc->config_base	= MSR_ARCH_PERFMON_EVENTSEL0;
-	hwc->counter_base	= MSR_ARCH_PERFMON_PERFCTR0;
-
 	hwc->irq_period		= hw_event->irq_period;
 	/*
 	 * Intel PMCs cannot be accessed sanely above 32 bit width,
@@ -183,16 +181,34 @@ void hw_perf_restore(u64 ctrl)
 }
 EXPORT_SYMBOL_GPL(hw_perf_restore);
 
+static inline void
+__pmc_fixed_disable(struct perf_counter *counter,
+		    struct hw_perf_counter *hwc, unsigned int __idx)
+{
+	int idx = __idx - X86_PMC_IDX_FIXED;
+	u64 ctrl_val, mask;
+	int err;
+
+	mask = 0xfULL << (idx * 4);
+
+	rdmsrl(hwc->config_base, ctrl_val);
+	ctrl_val &= ~mask;
+	err = checking_wrmsrl(hwc->config_base, ctrl_val);
+}
+
 static inline void
 __pmc_generic_disable(struct perf_counter *counter,
 			   struct hw_perf_counter *hwc, unsigned int idx)
 {
 	int err;
 
+	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL))
+		return __pmc_fixed_disable(counter, hwc, idx);
+
 	err = wrmsr_safe(hwc->config_base + idx, hwc->config, 0);
 }
 
-static DEFINE_PER_CPU(u64, prev_left[X86_PMC_MAX_GENERIC]);
+static DEFINE_PER_CPU(u64, prev_left[X86_PMC_IDX_MAX]);
 
 /*
  * Set the next IRQ period, based on the hwc->period_left value.
@@ -202,8 +218,9 @@ static void
 __hw_perf_counter_set_period(struct perf_counter *counter,
 			     struct hw_perf_counter *hwc, int idx)
 {
-	s32 left = atomic64_read(&hwc->period_left);
+	s64 left = atomic64_read(&hwc->period_left);
 	s32 period = hwc->irq_period;
+	int err;
 
 	/*
 	 * If we are way outside a reasoable range then just skip forward:
@@ -224,21 +241,64 @@ __hw_perf_counter_set_period(struct perf_counter *counter,
 	 * The hw counter starts counting from this counter offset,
 	 * mark it to be able to extra future deltas:
 	 */
-	atomic64_set(&hwc->prev_count, (u64)(s64)-left);
+	atomic64_set(&hwc->prev_count, (u64)-left);
 
-	wrmsr(hwc->counter_base + idx, -left, 0);
+	err = checking_wrmsrl(hwc->counter_base + idx,
+			     (u64)(-left) & counter_value_mask);
+}
+
+static inline void
+__pmc_fixed_enable(struct perf_counter *counter,
+		   struct hw_perf_counter *hwc, unsigned int __idx)
+{
+	int idx = __idx - X86_PMC_IDX_FIXED;
+	u64 ctrl_val, bits, mask;
+	int err;
+
+	/*
+	 * Enable IRQ generation (0x8) and ring-3 counting (0x2),
+	 * and enable ring-0 counting if allowed:
+	 */
+	bits = 0x8ULL | 0x2ULL;
+	if (hwc->config & ARCH_PERFMON_EVENTSEL_OS)
+		bits |= 0x1;
+	bits <<= (idx * 4);
+	mask = 0xfULL << (idx * 4);
+
+	rdmsrl(hwc->config_base, ctrl_val);
+	ctrl_val &= ~mask;
+	ctrl_val |= bits;
+	err = checking_wrmsrl(hwc->config_base, ctrl_val);
 }
 
 static void
 __pmc_generic_enable(struct perf_counter *counter,
 			  struct hw_perf_counter *hwc, int idx)
 {
+	if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL))
+		return __pmc_fixed_enable(counter, hwc, idx);
+
 	wrmsr(hwc->config_base + idx,
 	      hwc->config | ARCH_PERFMON_EVENTSEL0_ENABLE, 0);
 }
 
-static int fixed_mode_idx(struct hw_perf_counter *hwc)
+static int
+fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
 {
+	unsigned int event;
+
+	if (unlikely(hwc->nmi))
+		return -1;
+
+	event = hwc->config & ARCH_PERFMON_EVENT_MASK;
+
+	if (unlikely(event == intel_perfmon_event_map[PERF_COUNT_INSTRUCTIONS]))
+		return X86_PMC_IDX_FIXED_INSTRUCTIONS;
+	if (unlikely(event == intel_perfmon_event_map[PERF_COUNT_CPU_CYCLES]))
+		return X86_PMC_IDX_FIXED_CPU_CYCLES;
+	if (unlikely(event == intel_perfmon_event_map[PERF_COUNT_BUS_CYCLES]))
+		return X86_PMC_IDX_FIXED_BUS_CYCLES;
+
 	return -1;
 }
 
@@ -249,16 +309,39 @@ static int pmc_generic_enable(struct perf_counter *counter)
 {
 	struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
 	struct hw_perf_counter *hwc = &counter->hw;
-	int idx = hwc->idx;
+	int idx;
 
-	/* Try to get the previous counter again */
-	if (test_and_set_bit(idx, cpuc->used)) {
-		idx = find_first_zero_bit(cpuc->used, nr_counters_generic);
-		if (idx == nr_counters_generic)
-			return -EAGAIN;
+	idx = fixed_mode_idx(counter, hwc);
+	if (idx >= 0) {
+		/*
+		 * Try to get the fixed counter, if that is already taken
+		 * then try to get a generic counter:
+		 */
+		if (test_and_set_bit(idx, cpuc->used))
+			goto try_generic;
 
-		set_bit(idx, cpuc->used);
+		hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
+		/*
+		 * We set it so that counter_base + idx in wrmsr/rdmsr maps to
+		 * MSR_ARCH_PERFMON_FIXED_CTR0 ... CTR2:
+		 */
+		hwc->counter_base =
+			MSR_ARCH_PERFMON_FIXED_CTR0 - X86_PMC_IDX_FIXED;
 		hwc->idx = idx;
+	} else {
+		idx = hwc->idx;
+		/* Try to get the previous generic counter again */
+		if (test_and_set_bit(idx, cpuc->used)) {
+try_generic:
+			idx = find_first_zero_bit(cpuc->used, nr_counters_generic);
+			if (idx == nr_counters_generic)
+				return -EAGAIN;
+
+			set_bit(idx, cpuc->used);
+			hwc->idx = idx;
+		}
+		hwc->config_base  = MSR_ARCH_PERFMON_EVENTSEL0;
+		hwc->counter_base = MSR_ARCH_PERFMON_PERFCTR0;
 	}
 
 	perf_counters_lapic_init(hwc->nmi);
@@ -266,6 +349,10 @@ static int pmc_generic_enable(struct perf_counter *counter)
 	__pmc_generic_disable(counter, hwc, idx);
 
 	cpuc->counters[idx] = counter;
+	/*
+	 * Make it visible before enabling the hw:
+	 */
+	smp_wmb();
 
 	__hw_perf_counter_set_period(counter, hwc, idx);
 	__pmc_generic_enable(counter, hwc, idx);
@@ -275,7 +362,7 @@ static int pmc_generic_enable(struct perf_counter *counter)
 
 void perf_counter_print_debug(void)
 {
-	u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left;
+	u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
 	struct cpu_hw_counters *cpuc;
 	int cpu, idx;
 
@@ -290,11 +377,13 @@ void perf_counter_print_debug(void)
 	rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
 	rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
 	rdmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, overflow);
+	rdmsrl(MSR_ARCH_PERFMON_FIXED_CTR_CTRL, fixed);
 
 	printk(KERN_INFO "\n");
 	printk(KERN_INFO "CPU#%d: ctrl:       %016llx\n", cpu, ctrl);
 	printk(KERN_INFO "CPU#%d: status:     %016llx\n", cpu, status);
 	printk(KERN_INFO "CPU#%d: overflow:   %016llx\n", cpu, overflow);
+	printk(KERN_INFO "CPU#%d: fixed:      %016llx\n", cpu, fixed);
 	printk(KERN_INFO "CPU#%d: used:       %016llx\n", cpu, *(u64 *)cpuc->used);
 
 	for (idx = 0; idx < nr_counters_generic; idx++) {
@@ -303,13 +392,19 @@ void perf_counter_print_debug(void)
 
 		prev_left = per_cpu(prev_left[idx], cpu);
 
-		printk(KERN_INFO "CPU#%d: PMC%d ctrl:  %016llx\n",
+		printk(KERN_INFO "CPU#%d:   gen-PMC%d ctrl:  %016llx\n",
 			cpu, idx, pmc_ctrl);
-		printk(KERN_INFO "CPU#%d: PMC%d count: %016llx\n",
+		printk(KERN_INFO "CPU#%d:   gen-PMC%d count: %016llx\n",
 			cpu, idx, pmc_count);
-		printk(KERN_INFO "CPU#%d: PMC%d left:  %016llx\n",
+		printk(KERN_INFO "CPU#%d:   gen-PMC%d left:  %016llx\n",
 			cpu, idx, prev_left);
 	}
+	for (idx = 0; idx < nr_counters_fixed; idx++) {
+		rdmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, pmc_count);
+
+		printk(KERN_INFO "CPU#%d: fixed-PMC%d count: %016llx\n",
+			cpu, idx, pmc_count);
+	}
 	local_irq_enable();
 }
 
@@ -323,6 +418,11 @@ static void pmc_generic_disable(struct perf_counter *counter)
 
 	clear_bit(idx, cpuc->used);
 	cpuc->counters[idx] = NULL;
+	/*
+	 * Make sure the cleared pointer becomes visible before we
+	 * (potentially) free the counter:
+	 */
+	smp_wmb();
 
 	/*
 	 * Drain the remaining delta count out of a counter
@@ -353,14 +453,11 @@ static void perf_save_and_restart(struct perf_counter *counter)
 {
 	struct hw_perf_counter *hwc = &counter->hw;
 	int idx = hwc->idx;
-	u64 pmc_ctrl;
-
-	rdmsrl(MSR_ARCH_PERFMON_EVENTSEL0 + idx, pmc_ctrl);
 
 	x86_perf_counter_update(counter, hwc, idx);
 	__hw_perf_counter_set_period(counter, hwc, idx);
 
-	if (pmc_ctrl & ARCH_PERFMON_EVENTSEL0_ENABLE)
+	if (counter->state == PERF_COUNTER_STATE_ACTIVE)
 		__pmc_generic_enable(counter, hwc, idx);
 }
 
@@ -373,6 +470,7 @@ perf_handle_group(struct perf_counter *sibling, u64 *status, u64 *overflown)
 	 * Store sibling timestamps (if any):
 	 */
 	list_for_each_entry(counter, &group_leader->sibling_list, list_entry) {
+
 		x86_perf_counter_update(counter, &counter->hw, counter->hw.idx);
 		perf_store_irq_data(sibling, counter->hw_event.type);
 		perf_store_irq_data(sibling, atomic64_read(&counter->count));
@@ -403,7 +501,7 @@ static void __smp_perf_counter_interrupt(struct pt_regs *regs, int nmi)
 
 again:
 	ack = status;
-	for_each_bit(bit, (unsigned long *) &status, nr_counters_generic) {
+	for_each_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
 		struct perf_counter *counter = cpuc->counters[bit];
 
 		clear_bit(bit, (unsigned long *) &status);
@@ -561,6 +659,9 @@ void __init init_hw_perf_counters(void)
 	perf_max_counters = nr_counters_generic;
 
 	printk(KERN_INFO "... bit width:       %d\n", eax.split.bit_width);
+	counter_value_mask = (1ULL << eax.split.bit_width) - 1;
+	printk(KERN_INFO "... value mask:      %016Lx\n", counter_value_mask);
+
 	printk(KERN_INFO "... mask length:     %d\n", eax.split.mask_length);
 
 	nr_counters_fixed = edx.split.num_counters_fixed;

commit f650a672359819454c3d8d4135ecd1558cde0b24
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Dec 23 12:17:29 2008 +0100

    perfcounters: add PERF_COUNT_BUS_CYCLES
    
    Generalize "bus cycles" hw events - and map them to CPU_CLK_Unhalted.Ref
    on x86. (which is a good enough approximation)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index f3359c2b3910..86b2fdd344a6 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -41,12 +41,13 @@ static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters);
 
 static const int intel_perfmon_event_map[] =
 {
-  [PERF_COUNT_CYCLES]			= 0x003c,
+  [PERF_COUNT_CPU_CYCLES]		= 0x003c,
   [PERF_COUNT_INSTRUCTIONS]		= 0x00c0,
   [PERF_COUNT_CACHE_REFERENCES]		= 0x4f2e,
   [PERF_COUNT_CACHE_MISSES]		= 0x412e,
   [PERF_COUNT_BRANCH_INSTRUCTIONS]	= 0x00c4,
   [PERF_COUNT_BRANCH_MISSES]		= 0x00c5,
+  [PERF_COUNT_BUS_CYCLES]		= 0x013c,
 };
 
 static const int max_intel_perfmon_events = ARRAY_SIZE(intel_perfmon_event_map);
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 1ea08e9f31ce..ec77d1643d37 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -36,14 +36,15 @@ enum hw_event_types {
 	/*
 	 * Common hardware events, generalized by the kernel:
 	 */
-	PERF_COUNT_CYCLES		=  0,
+	PERF_COUNT_CPU_CYCLES		=  0,
 	PERF_COUNT_INSTRUCTIONS		=  1,
 	PERF_COUNT_CACHE_REFERENCES	=  2,
 	PERF_COUNT_CACHE_MISSES		=  3,
 	PERF_COUNT_BRANCH_INSTRUCTIONS	=  4,
 	PERF_COUNT_BRANCH_MISSES	=  5,
+	PERF_COUNT_BUS_CYCLES		=  6,
 
-	PERF_HW_EVENTS_MAX		=  6,
+	PERF_HW_EVENTS_MAX		=  7,
 
 	/*
 	 * Special "software" counters provided by the kernel, even if