1. 08 Dec, 2016 5 commits
    • Oleg Nesterov's avatar
      kthread: Don't abuse kthread_create_on_cpu() in __kthread_create_worker() · 8fb9dcbd
      Oleg Nesterov authored
      kthread_create_on_cpu() sets KTHREAD_IS_PER_CPU and kthread->cpu, this
      only makes sense if this kthread can be parked/unparked by cpuhp code.
      kthread workers never call kthread_parkme() so this has no effect.
      
      Change __kthread_create_worker() to simply call kthread_bind(task, cpu).
      The very fact that kthread_create_on_cpu() doesn't accept a generic fmt
      shows that it should not be used outside of smpboot.c.
      
      Now, the only reason we can not unexport this helper and move it into
      smpboot.c is that it sets kthread->cpu and struct kthread is not exported.
      And the only reason we can not kill kthread->cpu is that kthread_unpark()
      is used by drivers/gpu/drm/amd/scheduler/gpu_scheduler.c and thus we can
      not turn _unpark into kthread_unpark(struct smp_hotplug_thread *, cpu).
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Tested-by: default avatarPetr Mladek <pmladek@suse.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Chunming Zhou <David1.Zhou@amd.com>
      Cc: Roman Pen <roman.penyaev@profitbricks.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20161129175110.GA5342@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      8fb9dcbd
    • Oleg Nesterov's avatar
      kthread: Don't use to_live_kthread() in kthread_[un]park() · cf380a4a
      Oleg Nesterov authored
      Now that to_kthread() is always validm change kthread_park() and
      kthread_unpark() to use it and kill to_live_kthread().
      
      The conversion of kthread_unpark() is trivial. If KTHREAD_IS_PARKED is set
      then the task has called complete(&self->parked) and there the function
      cannot race against a concurrent kthread_stop() and exit.
      
      kthread_park() is more tricky, because its semantics are not well
      defined. It returns -ENOSYS if the thread exited but this can never happen
      and as Roman pointed out kthread_park() can obviously block forever if it
      would race with the exiting kthread.
      
      The usage of kthread_park() in cpuhp code (cpu.c, smpboot.c, stop_machine.c)
      is fine. It can never see an exiting/exited kthread, smpboot_destroy_threads()
      clears *ht->store, smpboot_park_thread() checks it is not NULL under the same
      smpboot_threads_lock. cpuhp_threads and cpu_stop_threads never exit, so other
      callers are fine too.
      
      But it has two more users:
      
      - watchdog_park_threads():
      
        The code is actually correct, get_online_cpus() ensures that
        kthread_park() can't race with itself (note that kthread_park() can't
        handle this race correctly), but it should not use kthread_park()
        directly.
      
      - drivers/gpu/drm/amd/scheduler/gpu_scheduler.c should not use
        kthread_park() either.
      
        kthread_park() must not be called after amd_sched_fini() which does
        kthread_stop(), otherwise even to_live_kthread() is not safe because
        task_struct can be already freed and sched->thread can point to nowhere.
      
      The usage of kthread_park/unpark should either be restricted to core code
      which is properly protected against the exit race or made more robust so it
      is safe to use it in drivers.
      
      To catch eventual exit issues, add a WARN_ON(PF_EXITING) for now.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Chunming Zhou <David1.Zhou@amd.com>
      Cc: Roman Pen <roman.penyaev@profitbricks.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20161129175107.GA5339@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      cf380a4a
    • Oleg Nesterov's avatar
      kthread: Don't use to_live_kthread() in kthread_stop() · efb29fbf
      Oleg Nesterov authored
      kthread_stop() had to use to_live_kthread() simply because it was not
      possible to access kthread->exited after the exiting task clears
      task_struct->vfork_done. Now that to_kthread() is always valid,
      wake_up_process() + wait_for_completion() can be done
      ununconditionally. It's not an issue anymore if the task has already issued
      complete_vfork_done() or died.
      
      The exiting task can get the spurious wakeup after mm_release() but this is
      possible without this change too and is fine; do_task_dead() ensures that
      this can't make any harm.
      
      As a further enhancement this could be converted to task_work_add() later,
      so ->vfork_done can be avoided completely.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Chunming Zhou <David1.Zhou@amd.com>
      Cc: Roman Pen <roman.penyaev@profitbricks.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20161129175103.GA5336@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      efb29fbf
    • Oleg Nesterov's avatar
      Revert "kthread: Pin the stack via try_get_task_stack()/put_task_stack() in... · eff96625
      Oleg Nesterov authored
      Revert "kthread: Pin the stack via try_get_task_stack()/put_task_stack() in to_live_kthread() function"
      
      This reverts commit 23196f2e.
      
      Now that struct kthread is kmalloc'ed and not longer on the task stack
      there is no need anymore to pin the stack.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Chunming Zhou <David1.Zhou@amd.com>
      Cc: Roman Pen <roman.penyaev@profitbricks.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20161129175100.GA5333@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      eff96625
    • Oleg Nesterov's avatar
      kthread: Make struct kthread kmalloc'ed · 1da5c46f
      Oleg Nesterov authored
      commit 23196f2e "kthread: Pin the stack via try_get_task_stack() /
      put_task_stack() in to_live_kthread() function" is a workaround for the
      fragile design of struct kthread being allocated on the task stack.
      
      struct kthread in its current form should be removed, but this needs
      cleanups outside of kthread.c.
      
      As a first step move struct kthread away from the task stack by making it
      kmalloc'ed. This allows to access kthread.exited without the magic of
      trying to pin task stack and the try logic in to_live_kthread().
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Chunming Zhou <David1.Zhou@amd.com>
      Cc: Roman Pen <roman.penyaev@profitbricks.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20161129175057.GA5330@redhat.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      1da5c46f
  2. 06 Dec, 2016 1 commit
  3. 30 Nov, 2016 2 commits
    • Ingo Molnar's avatar
      sched/x86: Make CONFIG_SCHED_MC_PRIO=y easier to enable · 0a21fc12
      Ingo Molnar authored
      Right now CONFIG_SCHED_MC_PRIO has X86_INTEL_PSTATE as a dependency,
      which is not enabled by default and which hides the CONFIG_SCHED_MC_PRIO
      hardware-enabling feature.
      
      Select X86_INTEL_PSTATE instead, plus its dependency (CPU_FREQ), if the
      user enables CONFIG_SCHED_MC_PRIO=y.
      
      (Also align the CONFIG_SCHED_MC_PRIO Kconfig help text in standard style.)
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: bp@suse.de
      Cc: jolsa@redhat.com
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: rjw@rjwysocki.net
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0a21fc12
    • Tim Chen's avatar
      sched/x86: Change CONFIG_SCHED_ITMT to CONFIG_SCHED_MC_PRIO · de966cf4
      Tim Chen authored
      Rename CONFIG_SCHED_ITMT for Intel Turbo Boost Max Technology 3.0
      to CONFIG_SCHED_MC_PRIO.  This makes the configuration extensible
      in future to other architectures that wish to similarly establish
      CPU core priorities support in the scheduler.
      
      The description in Kconfig is updated to reflect this change with
      added details for better clarity.  The configuration is explicitly
      default-y, to enable the feature on CPUs that have this feature.
      
      It has no effect on non-TBM3 CPUs.
      Signed-off-by: default avatarTim Chen <tim.c.chen@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@suse.de
      Cc: jolsa@redhat.com
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: rjw@rjwysocki.net
      Link: http://lkml.kernel.org/r/2b2ee29d93e3f162922d72d0165a1405864fbb23.1480444902.git.tim.c.chen@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      de966cf4
  4. 28 Nov, 2016 1 commit
    • Ingo Molnar's avatar
      x86/sched: Use #include <linux/mutex.h> instead of #include <asm/mutex.h> · a293b395
      Ingo Molnar authored
      asm/mutex.h is gone from the locking tree, which makes sched/core break the build.
      
      Use linux/mutex.h instead, which is the canonical method.
      
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: peterz@infradead.org
      Cc: jolsa@redhat.com
      Cc: rjw@rjwysocki.net
      Cc: bp@suse.de
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a293b395
  5. 24 Nov, 2016 8 commits
  6. 23 Nov, 2016 3 commits
  7. 22 Nov, 2016 7 commits
  8. 21 Nov, 2016 13 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 3b404a51
      Linus Torvalds authored
      Pull apparmor bugfix from James Morris:
       "This has a fix for a policy replacement bug that is fairly serious for
        apache mod_apparmor users, as it results in the wrong policy being
        applied on an network facing service"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        apparmor: fix change_hat not finding hat after policy replacement
      3b404a51
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · 8d1a2408
      Linus Torvalds authored
      Pull sparc fixes from David Miller:
      
       1) With modern networking cards we can run out of 32-bit DMA space, so
          support 64-bit DMA addressing when possible on sparc64. From Dave
          Tushar.
      
       2) Some signal frame validation checks are inverted on sparc32, fix
          from Andreas Larsson.
      
       3) Lockdep tables can get too large in some circumstances on sparc64,
          add a way to adjust the size a bit. From Babu Moger.
      
       4) Fix NUMA node probing on some sun4v systems, from Thomas Tai.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc: drop duplicate header scatterlist.h
        lockdep: Limit static allocations if PROVE_LOCKING_SMALL is defined
        config: Adding the new config parameter CONFIG_PROVE_LOCKING_SMALL for sparc
        sunbmac: Fix compiler warning
        sunqe: Fix compiler warnings
        sparc64: Enable 64-bit DMA
        sparc64: Enable sun4v dma ops to use IOMMU v2 APIs
        sparc64: Bind PCIe devices to use IOMMU v2 service
        sparc64: Initialize iommu_map_table and iommu_pool
        sparc64: Add ATU (new IOMMU) support
        sparc64: Add FORCE_MAX_ZONEORDER and default to 13
        sparc64: fix compile warning section mismatch in find_node()
        sparc32: Fix inverted invalid_frame_pointer checks on sigreturns
        sparc64: Fix find_node warning if numa node cannot be found
      8d1a2408
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 27e7ab99
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Clear congestion control state when changing algorithms on an
          existing socket, from Florian Westphal.
      
       2) Fix register bit values in altr_tse_pcs portion of stmmac driver,
          from Jia Jie Ho.
      
       3) Fix PTP handling in stammc driver for GMAC4, from Giuseppe
          CAVALLARO.
      
       4) Fix udplite multicast delivery handling, it ignores the udp_table
          parameter passed into the lookups, from Pablo Neira Ayuso.
      
       5) Synchronize the space estimated by rtnl_vfinfo_size and the space
          actually used by rtnl_fill_vfinfo. From Sabrina Dubroca.
      
       6) Fix memory leak in fib_info when splitting nodes, from Alexander
          Duyck.
      
       7) If a driver does a napi_hash_del() explicitily and not via
          netif_napi_del(), it must perform RCU synchronization as needed. Fix
          this in virtio-net and bnxt drivers, from Eric Dumazet.
      
       8) Likewise, it is not necessary to invoke napi_hash_del() is we are
          also doing neif_napi_del() in the same code path. Remove such calls
          from be2net and cxgb4 drivers, also from Eric Dumazet.
      
       9) Don't allocate an ID in peernet2id_alloc() if the netns is dead,
          from WANG Cong.
      
      10) Fix OF node and device struct leaks in of_mdio, from Johan Hovold.
      
      11) We cannot cache routes in ip6_tunnel when using inherited traffic
          classes, from Paolo Abeni.
      
      12) Fix several crashes and leaks in cpsw driver, from Johan Hovold.
      
      13) Splice operations cannot use freezable blocking calls in AF_UNIX,
          from WANG Cong.
      
      14) Link dump filtering by master device and kind support added an error
          in loop index updates during the dump if we actually do filter, fix
          from Zhang Shengju.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (59 commits)
        tcp: zero ca_priv area when switching cc algorithms
        net: l2tp: Treat NET_XMIT_CN as success in l2tp_eth_dev_xmit
        ethernet: stmmac: make DWMAC_STM32 depend on it's associated SoC
        tipc: eliminate obsolete socket locking policy description
        rtnl: fix the loop index update error in rtnl_dump_ifinfo()
        l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()
        net: macb: add check for dma mapping error in start_xmit()
        rtnetlink: fix FDB size computation
        netns: fix get_net_ns_by_fd(int pid) typo
        af_unix: conditionally use freezable blocking calls in read
        net: ethernet: ti: cpsw: fix fixed-link phy probe deferral
        net: ethernet: ti: cpsw: add missing sanity check
        net: ethernet: ti: cpsw: fix secondary-emac probe error path
        net: ethernet: ti: cpsw: fix of_node and phydev leaks
        net: ethernet: ti: cpsw: fix deferred probe
        net: ethernet: ti: cpsw: fix mdio device reference leak
        net: ethernet: ti: cpsw: fix bad register access in probe error path
        net: sky2: Fix shutdown crash
        cfg80211: limit scan results cache size
        net sched filters: pass netlink message flags in event notification
        ...
      27e7ab99
    • Florian Westphal's avatar
      tcp: zero ca_priv area when switching cc algorithms · 7082c5c3
      Florian Westphal authored
      We need to zero out the private data area when application switches
      connection to different algorithm (TCP_CONGESTION setsockopt).
      
      When congestion ops get assigned at connect time everything is already
      zeroed because sk_alloc uses GFP_ZERO flag.  But in the setsockopt case
      this contains whatever previous cc placed there.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7082c5c3
    • Gao Feng's avatar
      net: l2tp: Treat NET_XMIT_CN as success in l2tp_eth_dev_xmit · 7c6ae610
      Gao Feng authored
      The tc could return NET_XMIT_CN as one congestion notification, but
      it does not mean the packe is lost. Other modules like ipvlan,
      macvlan, and others treat NET_XMIT_CN as success too.
      So l2tp_eth_dev_xmit should add the NET_XMIT_CN check.
      Signed-off-by: default avatarGao Feng <gfree.wind@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c6ae610
    • Peter Robinson's avatar
      ethernet: stmmac: make DWMAC_STM32 depend on it's associated SoC · 6bc5445c
      Peter Robinson authored
      There's not much point, except compile test, enabling the stmmac
      platform drivers unless the STM32 SoC is enabled. It's not
      useful without it.
      Signed-off-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6bc5445c
    • Jacob Pan's avatar
      thermal/powerclamp: add back module device table · ec638db8
      Jacob Pan authored
      Commit 3105f234 replaced module
      cpu id table with a cpu feature check, which is logically correct.
      But we need the module device table to allow module auto loading.
      
      Cc: stable@vger.kernel.org # 4.8
      Fixes:3105f234 thermal/powerclamp: correct cpu support check
      Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
      Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
      ec638db8
    • Andy Shevchenko's avatar
      x86/platform/intel-mid: Rename platform_wdt to platform_mrfld_wdt · e5dce286
      Andy Shevchenko authored
      Rename the watchdog platform library file to explicitly show that is used only
      on Intel Merrifield platforms.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20161118172723.179761-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e5dce286
    • H.J. Lu's avatar
      x86/build: Build compressed x86 kernels as PIE when !CONFIG_RELOCATABLE as well · a980ce35
      H.J. Lu authored
      Since the bootloader may load the compressed x86 kernel at any address,
      it should always be built as PIE, not just when CONFIG_RELOCATABLE=y.
      
      Otherwise, linker in binutils 2.27 will optimize GOT load into the
      absolute address when building the compressed x86 kernel as a non-PIE
      executable.
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      [ Small wording changes. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a980ce35
    • Andy Shevchenko's avatar
      x86/platform/intel-mid: Register watchdog device after SCU · 8c5c86fb
      Andy Shevchenko authored
      Watchdog device in Intel Tangier relies on SCU to be present. It uses the SCU
      IPC channel to send commands and receive responses. If watchdog driver is
      initialized quite before SCU and a command has been sent the result is always
      an error like the following:
      
      	intel_mid_wdt: Error stopping watchdog: 0xffffffed
      
      Register watchdog device whne SCU is ready to avoid described issue.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20161118165224.175514-1-andriy.shevchenko@linux.intel.com
      [ Small cleanups. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8c5c86fb
    • Yu-cheng Yu's avatar
      x86/fpu: Fix invalid FPU ptrace state after execve() · b22cbe40
      Yu-cheng Yu authored
      Robert O'Callahan reported that after an execve PTRACE_GETREGSET
      NT_X86_XSTATE continues to return the pre-exec register values
      until the exec'ed task modifies FPU state.
      
      The test code is at:
      
        https://bugzilla.redhat.com/attachment.cgi?id=1164286.
      
      What is happening is fpu__clear() does not properly clear fpstate.
      Fix it by doing just that.
      Reported-by: default avatarRobert O'Callahan <robert@ocallahan.org>
      Signed-off-by: default avatarYu-cheng Yu <yu-cheng.yu@intel.com>
      Cc: <stable@vger.kernel.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Hansen <dave.hansen@linux.intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi V. Shankar <ravi.v.shankar@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1479402695-6553-1-git-send-email-yu-cheng.yu@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b22cbe40
    • Andy Lutomirski's avatar
      x86/boot: Fail the boot if !M486 and CPUID is missing · ed68d7e9
      Andy Lutomirski authored
      Linux will have all kinds of sporadic problems on systems that don't
      have the CPUID instruction unless CONFIG_M486=y.  In particular,
      sync_core() will explode.
      
      I believe that these kernels had a better chance of working before
      commit 05fb3c19 ("x86/boot: Initialize FPU and X86_FEATURE_ALWAYS
      even if we don't have CPUID").  That commit inadvertently fixed a
      serious bug: we used to fail to detect the FPU if CPUID wasn't
      present.  Because we also used to forget to set X86_FEATURE_ALWAYS, we
      end up with no cpu feature bits set at all.  This meant that
      alternative patching didn't do anything and, if paravirt was disabled,
      we could plausibly finish the entire boot process without calling
      sync_core().
      
      Rather than trying to work around these issues, just have the kernel
      fail loudly if it's running on a CPUID-less 486, doesn't have CPUID,
      and doesn't have CONFIG_M486 set.
      Reported-by: default avatarMatthew Whitehead <tedheadster@gmail.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/70eac6639f23df8be5fe03fa1984aedd5d40077a.1479598603.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ed68d7e9
    • Andy Lutomirski's avatar
      x86/traps: Ignore high word of regs->cs in early_fixup_exception() · fc0e81b2
      Andy Lutomirski authored
      On the 80486 DX, it seems that some exceptions may leave garbage in
      the high bits of CS.  This causes sporadic failures in which
      early_fixup_exception() refuses to fix up an exception.
      
      As far as I can tell, this has been buggy for a long time, but the
      problem seems to have been exacerbated by commits:
      
        1e02ce4c ("x86: Store a per-cpu shadow copy of CR4")
        e1bfc11c ("x86/init: Fix cr4_init_shadow() on CR4-less machines")
      
      This appears to have broken for as long as we've had early
      exception handling.
      
      [ Note to stable maintainers: This patch is needed all the way back to 3.4,
        but it will only apply to 4.6 and up, as it depends on commit:
      
          0e861fbb ("x86/head: Move early exception panic code into early_fixup_exception()")
      
        If you want to backport to kernels before 4.6, please don't backport the
        prerequisites (there was a big chain of them that rewrote a lot of the
        early exception machinery); instead, ask me and I can send you a one-liner
        that will apply. ]
      Reported-by: default avatarMatthew Whitehead <tedheadster@gmail.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Fixes: 4c5023a3 ("x86-32: Handle exception table entries during early boot")
      Link: http://lkml.kernel.org/r/cb32c69920e58a1a58e7b5cad975038a69c0ce7d.1479609510.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fc0e81b2