1. 11 Aug, 2017 3 commits
    • Arnd Bergmann's avatar
      scsi: lpfc: fix linking against modular NVMe support · 49f4ca2f
      Arnd Bergmann authored
      commit cd069bb9 upstream.
      
      When LPFC is built-in but NVMe is a loadable module, we fail to link the
      kernel:
      
      drivers/scsi/built-in.o: In function `lpfc_nvme_create_localport':
      (.text+0x156a82): undefined reference to `nvme_fc_register_localport'
      drivers/scsi/built-in.o: In function `lpfc_nvme_destroy_localport':
      (.text+0x156eaa): undefined reference to `nvme_fc_unregister_remoteport'
      
      We can avoid this either by forcing lpfc to be a module, or by disabling
      NVMe support in this case. This implements the former.
      
      Fixes: 7d708033 ("scsi: lpfc: Finalize Kconfig options for nvme")
      Link: https://patchwork.kernel.org/patch/9636569/Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49f4ca2f
    • John David Anglin's avatar
      parisc: Handle vma's whose context is not current in flush_cache_range · e7ed1b9d
      John David Anglin authored
      commit 13d57093 upstream.
      
      In testing James' patch to drivers/parisc/pdc_stable.c, I hit the BUG
      statement in flush_cache_range() during a system shutdown:
      
      kernel BUG at arch/parisc/kernel/cache.c:595!
      CPU: 2 PID: 6532 Comm: kworker/2:0 Not tainted 4.13.0-rc2+ #1
      Workqueue: events free_ioctx
      
       IAOQ[0]: flush_cache_range+0x144/0x148
       IAOQ[1]: flush_cache_page+0x0/0x1a8
       RP(r2): flush_cache_range+0xec/0x148
      Backtrace:
       [<00000000402910ac>] unmap_page_range+0x84/0x880
       [<00000000402918f4>] unmap_single_vma+0x4c/0x60
       [<0000000040291a18>] zap_page_range_single+0x110/0x160
       [<0000000040291c34>] unmap_mapping_range+0x174/0x1a8
       [<000000004026ccd8>] truncate_pagecache+0x50/0xa8
       [<000000004026cd84>] truncate_setsize+0x54/0x70
       [<000000004033d534>] put_aio_ring_file+0x44/0xb0
       [<000000004033d5d8>] aio_free_ring+0x38/0x140
       [<000000004033d714>] free_ioctx+0x34/0xa8
       [<00000000401b0028>] process_one_work+0x1b8/0x4d0
       [<00000000401b04f4>] worker_thread+0x1b4/0x648
       [<00000000401b9128>] kthread+0x1b0/0x208
       [<0000000040150020>] end_fault_vector+0x20/0x28
       [<0000000040639518>] nf_ip_reroute+0x50/0xa8
       [<0000000040638ed0>] nf_ip_route+0x10/0x78
       [<0000000040638c90>] xfrm4_mode_tunnel_input+0x180/0x1f8
      
      CPU: 2 PID: 6532 Comm: kworker/2:0 Not tainted 4.13.0-rc2+ #1
      Workqueue: events free_ioctx
      Backtrace:
       [<0000000040163bf0>] show_stack+0x20/0x38
       [<0000000040688480>] dump_stack+0xa8/0x120
       [<0000000040163dc4>] die_if_kernel+0x19c/0x2b0
       [<0000000040164d0c>] handle_interruption+0xa24/0xa48
      
      This patch modifies flush_cache_range() to handle non current contexts.
      In as much as this occurs infrequently, the simplest approach is to
      flush the entire cache when this happens.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7ed1b9d
    • Helge Deller's avatar
      parisc: Increase thread and stack size to 32kb · fea9ea4f
      Helge Deller authored
      commit 8f8201df upstream.
      
      Since kernel 4.11 the thread and irq stacks on parisc randomly overflow
      the default size of 16k. The reason why stack usage suddenly grew is yet
      unknown.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fea9ea4f
  2. 06 Aug, 2017 32 commits
  3. 27 Jul, 2017 5 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.12.4 · 13df91db
      Greg Kroah-Hartman authored
      13df91db
    • Wanpeng Li's avatar
      sched/cputime: Don't use smp_processor_id() in preemptible context · baa11d76
      Wanpeng Li authored
      commit 0e4097c3 upstream.
      
      Recent kernels trigger this warning:
      
       BUG: using smp_processor_id() in preemptible [00000000] code: 99-trinity/181
       caller is debug_smp_processor_id+0x17/0x19
       CPU: 0 PID: 181 Comm: 99-trinity Not tainted 4.12.0-01059-g2a42eb95 #1
       Call Trace:
        dump_stack+0x82/0xb8
        check_preemption_disabled()
        debug_smp_processor_id()
        vtime_delta()
        task_cputime()
        thread_group_cputime()
        thread_group_cputime_adjusted()
        wait_consider_task()
        do_wait()
        SYSC_wait4()
        do_syscall_64()
        entry_SYSCALL64_slow_path()
      
      As Frederic pointed out:
      
      | Although those sched_clock_cpu() things seem to only matter when the
      | sched_clock() is unstable. And that stability is a condition for nohz_full
      | to work anyway. So probably sched_clock() alone would be enough.
      
      This patch fixes it by replacing sched_clock_cpu() with sched_clock() to
      avoid calling smp_processor_id() in a preemptible context.
      Reported-by: default avatarXiaolong Ye <xiaolong.ye@intel.com>
      Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luiz Capitulino <lcapitulino@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1499586028-7402-1-git-send-email-wanpeng.li@hotmail.com
      [ Prettified the changelog. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      baa11d76
    • Greg Hackmann's avatar
      alarmtimer: don't rate limit one-shot timers · ccb1fe49
      Greg Hackmann authored
      Commit ff86bf0c ("alarmtimer: Rate limit periodic intervals") sets a
      minimum bound on the alarm timer interval.  This minimum bound shouldn't
      be applied if the interval is 0.  Otherwise, one-shot timers will be
      converted into periodic ones.
      
      This patch is specific to 4.11.y and 4.12.y.  Older -stable trees have a
      slightly different patch, and 4.13-rc2 isn't impacted due to a later
      refactoring.
      
      Fixes: ff86bf0c ("alarmtimer: Rate limit periodic intervals")
      Reported-by: default avatarBen Fennema <fennema@google.com>
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ccb1fe49
    • Thomas Gleixner's avatar
      smp/hotplug: Replace BUG_ON and react useful · 2de3bd03
      Thomas Gleixner authored
      commit dea1d0f5 upstream.
      
      The move of the unpark functions to the control thread moved the BUG_ON()
      there as well. While it made some sense in the idle thread of the upcoming
      CPU, it's bogus to crash the control thread on the already online CPU,
      especially as the function has a return value and the callsite is prepared
      to handle an error return.
      
      Replace it with a WARN_ON_ONCE() and return a proper error code.
      
      Fixes: 9cd4f1a4 ("smp/hotplug: Move unparking of percpu threads to the control CPU")
      Rightfully-ranted-at-by: default avatarLinux Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2de3bd03
    • Thomas Gleixner's avatar
      smp/hotplug: Move unparking of percpu threads to the control CPU · 8e5772cd
      Thomas Gleixner authored
      commit 9cd4f1a4 upstream.
      
      Vikram reported the following backtrace:
      
         BUG: scheduling while atomic: swapper/7/0/0x00000002
         CPU: 7 PID: 0 Comm: swapper/7 Not tainted 4.9.32-perf+ #680
         schedule
         schedule_hrtimeout_range_clock
         schedule_hrtimeout
         wait_task_inactive
         __kthread_bind_mask
         __kthread_bind
         __kthread_unpark
         kthread_unpark
         cpuhp_online_idle
         cpu_startup_entry
         secondary_start_kernel
      
      He analyzed correctly that a parked cpu hotplug thread of an offlined CPU
      was still on the runqueue when the CPU came back online and tried to unpark
      it. This causes the thread which invoked kthread_unpark() to call
      wait_task_inactive() and subsequently schedule() with preemption disabled.
      His proposed workaround was to "make sure" that a parked thread has
      scheduled out when the CPU goes offline, so the situation cannot happen.
      
      But that's still wrong because the root cause is not the fact that the
      percpu thread is still on the runqueue and neither that preemption is
      disabled, which could be simply solved by enabling preemption before
      calling kthread_unpark().
      
      The real issue is that the calling thread is the idle task of the upcoming
      CPU, which is not supposed to call anything which might sleep.  The moron,
      who wrote that code, missed completely that kthread_unpark() might end up
      in schedule().
      
      The solution is simpler than expected. The thread which controls the
      hotplug operation is waiting for the CPU to call complete() on the hotplug
      state completion. So the idle task of the upcoming CPU can set its state to
      CPUHP_AP_ONLINE_IDLE and invoke complete(). This in turn wakes the control
      task on a different CPU, which then can safely do the unpark and kick the
      now unparked hotplug thread of the upcoming CPU to complete the bringup to
      the final target state.
      
      Control CPU                     AP
      
      bringup_cpu();
        __cpu_up()  ------------>
      				bringup_ap();
        bringup_wait_for_ap()
          wait_for_completion();
                                      cpuhp_online_idle();
                      <------------    complete();
          unpark(AP->stopper);
          unpark(AP->hotplugthread);
                                      while(1)
                                        do_idle();
          kick(AP->hotplugthread);
          wait_for_completion();	hotplug_thread()
      				  run_online_callbacks();
      				  complete();
      
      Fixes: 8df3e07e ("cpu/hotplug: Let upcoming cpu bring itself fully up")
      Reported-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Sewior <bigeasy@linutronix.de>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1707042218020.2131@nanosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e5772cd