Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Sep 2015 18:01:34 +0000 (11:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Sep 2015 18:01:34 +0000 (11:01 -0700)
Pull x86 fixes from Ingo Molnar:
 - misc fixes all around the map
 - block non-root vm86(old) if mmap_min_addr != 0
 - two small debuggability improvements
 - removal of obsolete paravirt op

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/platform: Fix Geode LX timekeeping in the generic x86 build
  x86/apic: Serialize LVTT and TSC_DEADLINE writes
  x86/ioapic: Force affinity setting in setup_ioapic_dest()
  x86/paravirt: Remove the unused pv_time_ops::get_tsc_khz method
  x86/ldt: Fix small LDT allocation for Xen
  x86/vm86: Fix the misleading CONFIG_VM86 Kconfig help text
  x86/cpu: Print family/model/stepping in hex
  x86/vm86: Block non-root vm86(old) if mmap_min_addr != 0
  x86/alternatives: Make optimize_nops() interrupt safe and synced
  x86/mm/srat: Print non-volatile flag in SRAT
  x86/cpufeatures: Enable cpuid for Intel SHA extensions

1  2 
arch/x86/Kconfig
arch/x86/kernel/tsc.c

diff --combined arch/x86/Kconfig
index 7aef2d52daa0d8ea8b55a683a11eb2c2e204eaef,d28815325ef027ce1013d3eec241ba9a8a2ff98a..328c8352480c5dcfd34d72a70d01d6a57e5bb515
@@@ -27,8 -27,7 +27,8 @@@ config X8
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_FAST_MULTIPLIER
        select ARCH_HAS_GCOV_PROFILE_ALL
 -      select ARCH_HAS_PMEM_API
 +      select ARCH_HAS_PMEM_API                if X86_64
 +      select ARCH_HAS_MMIO_FLUSH
        select ARCH_HAS_SG_CHAIN
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_MIGHT_HAVE_ACPI_PDC         if ACPI
@@@ -42,7 -41,6 +42,7 @@@
        select ARCH_USE_CMPXCHG_LOCKREF         if X86_64
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
 +      select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if SMP
        select ARCH_WANTS_DYNAMIC_TASK_STRUCT
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_IPC_PARSE_VERSION      if X86_32
@@@ -1006,7 -1004,7 +1006,7 @@@ config X86_THERMAL_VECTO
        depends on X86_MCE_INTEL
  
  config X86_LEGACY_VM86
-       bool "Legacy VM86 support (obsolete)"
+       bool "Legacy VM86 support"
        default n
        depends on X86_32
        ---help---
          available to accelerate real mode DOS programs.  However, any
          recent version of DOSEMU, X, or vbetool should be fully
          functional even without kernel VM86 support, as they will all
-         fall back to (pretty well performing) software emulation.
+         fall back to software emulation. Nevertheless, if you are using
+         a 16-bit DOS program where 16-bit performance matters, vm86
+         mode might be faster than emulation and you might want to
+         enable this option.
  
-         Anything that works on a 64-bit kernel is unlikely to need
-         this option, as 64-bit kernels don't, and can't, support V8086
-         mode.  This option is also unrelated to 16-bit protected mode
-         and is not needed to run most 16-bit programs under Wine.
+         Note that any app that works on a 64-bit kernel is unlikely to
+         need this option, as 64-bit kernels don't, and can't, support
+         V8086 mode. This option is also unrelated to 16-bit protected
+         mode and is not needed to run most 16-bit programs under Wine.
  
-         Enabling this option adds considerable attack surface to the
-         kernel and slows down system calls and exception handling.
+         Enabling this option increases the complexity of the kernel
+         and slows down exception handling a tiny bit.
  
-         Unless you use very old userspace or need the last drop of
-         performance in your real mode DOS games and can't use KVM,
-         say N here.
+         If unsure, say N here.
  
  config VM86
         bool
@@@ -1451,14 -1450,10 +1452,14 @@@ config ILLEGAL_POINTER_VALU
  
  source "mm/Kconfig"
  
 +config X86_PMEM_LEGACY_DEVICE
 +      bool
 +
  config X86_PMEM_LEGACY
 -      bool "Support non-standard NVDIMMs and ADR protected memory"
 +      tristate "Support non-standard NVDIMMs and ADR protected memory"
        depends on PHYS_ADDR_T_64BIT
        depends on BLK_DEV
 +      select X86_PMEM_LEGACY_DEVICE
        select LIBNVDIMM
        help
          Treat memory marked using the non-standard e820 type of 12 as used
@@@ -1754,7 -1749,6 +1755,7 @@@ source kernel/Kconfig.h
  
  config KEXEC
        bool "kexec system call"
 +      select KEXEC_CORE
        ---help---
          kexec is a system call that implements the ability to shutdown your
          current kernel, and to start another kernel.  It is like a reboot
  
  config KEXEC_FILE
        bool "kexec file based system call"
 +      select KEXEC_CORE
        select BUILD_BIN2C
 -      depends on KEXEC
        depends on X86_64
        depends on CRYPTO=y
        depends on CRYPTO_SHA256=y
diff --combined arch/x86/kernel/tsc.c
index c8d52cb4cb6e8b9ee9d81cfc9c0fa3603284ce0e,51e62d6afd9a36bd0410061b63c5477cedfbfec7..c3f7602cd0386b2fb0a1a7437263f9c71f27d03c
@@@ -21,6 -21,7 +21,7 @@@
  #include <asm/hypervisor.h>
  #include <asm/nmi.h>
  #include <asm/x86_init.h>
+ #include <asm/geode.h>
  
  unsigned int __read_mostly cpu_khz;   /* TSC clocks / usec, not used here */
  EXPORT_SYMBOL(cpu_khz);
@@@ -38,7 -39,7 +39,7 @@@ static int __read_mostly tsc_unstable
     erroneous rdtsc usage on !cpu_has_tsc processors */
  static int __read_mostly tsc_disabled = -1;
  
 -static struct static_key __use_tsc = STATIC_KEY_INIT;
 +static DEFINE_STATIC_KEY_FALSE(__use_tsc);
  
  int tsc_clocksource_reliable;
  
@@@ -274,12 -275,7 +275,12 @@@ done
   */
  u64 native_sched_clock(void)
  {
 -      u64 tsc_now;
 +      if (static_branch_likely(&__use_tsc)) {
 +              u64 tsc_now = rdtsc();
 +
 +              /* return the value in ns */
 +              return cycles_2_ns(tsc_now);
 +      }
  
        /*
         * Fall back to jiffies if there's no TSC available:
         *   very important for it to be as fast as the platform
         *   can achieve it. )
         */
 -      if (!static_key_false(&__use_tsc)) {
 -              /* No locking but a rare wrong value is not a big deal: */
 -              return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
 -      }
 -
 -      /* read the Time Stamp Counter: */
 -      tsc_now = rdtsc();
  
 -      /* return the value in ns */
 -      return cycles_2_ns(tsc_now);
 +      /* No locking but a rare wrong value is not a big deal: */
 +      return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
  }
  
  /*
@@@ -1013,15 -1016,17 +1014,17 @@@ EXPORT_SYMBOL_GPL(mark_tsc_unstable)
  
  static void __init check_system_tsc_reliable(void)
  {
- #ifdef CONFIG_MGEODE_LX
-       /* RTSC counts during suspend */
+ #if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || defined(CONFIG_X86_GENERIC)
+       if (is_geode_lx()) {
+               /* RTSC counts during suspend */
  #define RTSC_SUSP 0x100
-       unsigned long res_low, res_high;
+               unsigned long res_low, res_high;
  
-       rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
-       /* Geode_LX - the OLPC CPU has a very reliable TSC */
-       if (res_low & RTSC_SUSP)
-               tsc_clocksource_reliable = 1;
+               rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
+               /* Geode_LX - the OLPC CPU has a very reliable TSC */
+               if (res_low & RTSC_SUSP)
+                       tsc_clocksource_reliable = 1;
+       }
  #endif
        if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
                tsc_clocksource_reliable = 1;
@@@ -1210,7 -1215,7 +1213,7 @@@ void __init tsc_init(void
        /* now allow native_sched_clock() to use rdtsc */
  
        tsc_disabled = 0;
 -      static_key_slow_inc(&__use_tsc);
 +      static_branch_enable(&__use_tsc);
  
        if (!no_sched_irq_time)
                enable_sched_clock_irqtime();