Skip to content
  1. Jul 03, 2017
  2. Jul 02, 2017
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e18aca02
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Fixlets for x86:
      
         - Prevent kexec crash when KASLR is enabled, which was caused by an
           address calculation bug
      
         - Restore the freeing of PUDs on memory hot remove
      
         - Correct a negated pointer check in the intel uncore performance
           monitoring driver
      
         - Plug a memory leak in an error exit path in the RDT code"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/intel_rdt: Fix memory leak on mount failure
        x86/boot/KASLR: Fix kexec crash due to 'virt_addr' calculation bug
        x86/boot/KASLR: Add checking for the offset of kernel virtual address randomization
        perf/x86/intel/uncore: Fix wrong box pointer check
        x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD
      e18aca02
  3. Jul 01, 2017
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a527bf61
      Linus Torvalds authored
      Pull perf fix from Thomas Gleixner:
       "The last fix for perf for this cycles:
      
         - Prevent a segfault when kernel.kptr_restrict=2 is set by avoiding a
           null pointer dereference"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf machine: Fix segfault for kernel.kptr_restrict=2
      a527bf61
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 46589d7a
      Linus Torvalds authored
      Pull pinctrl fix from Linus Walleij:
       "Brian noticed that this regression has not got a proper fix for the
        entire merge window and consequently we need to revert the offending
        commit.
      
        It's part of the RT-mainstream work, the dance goes like this, two
        steps forward, one step back.
      
        Summary:
      
         - A last fix for v4.12, an IRQ problem reported early in the merge
           window appears not to have been properly fixed, so the offending
           commit will be reverted and we will find the proper fix for v4.13.
           Hopefully"
      
      * tag 'pinctrl-v4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        Revert "pinctrl: rockchip: avoid hardirq-unsafe functions in irq_chip"
      46589d7a
    • Linus Torvalds's avatar
      Merge tag 'gpio-v4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · fc93274a
      Linus Torvalds authored
      Pull last minute fixes for GPIO from Linus Walleij:
      
       - Fix another ACPI problem with broken BIOSes.
      
       - Filter out the right GPIO events, making a very user-visible bug go
         away.
      
      * tag 'gpio-v4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: acpi: Skip _AEI entries without a handler rather then aborting the scan
        gpiolib: fix filtering out unwanted events
      fc93274a
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · c0a0c7a4
      Linus Torvalds authored
      Pull last-minute tracing fixes from Steven Rostedt:
       "Two fixes:
      
        One is for a crash when using the :mod: trace probe command into
        stack_trace_filter. This bug was introduced during the last merge
        window.
      
        The other was there forever. It's a small bug that makes it impossible
        to name a module function for kprobes when the module starts with a
        digit"
      
      * tag 'trace-v4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing/kprobes: Allow to create probe with a module name starting with a digit
        ftrace: Fix regression with module command in stack_trace_filter
      c0a0c7a4
    • Zack Weinberg's avatar
      uapi/linux/a.out.h: don't use deprecated system-specific predefines. · fbd57629
      Zack Weinberg authored
      
      
      uapi/linux/a.out.h uses a number of predefined macros that are
      deprecated because they're in the application namespace
      (e.g. '#ifdef linux' instead of '#ifdef __linux__').
      This patch either corrects or just removes them if they are not
      applicable to Linux.
      
      The primary reason this is worth bothering to fix, considering how
      obsolete a.out binary support is, is that the GCC build process
      considers this such a severe error that it will copy the header into a
      private directory and change the macro names, which causes future
      updates to the header to be masked.  This header probably doesn't get
      updated very often anymore, but it is the _only_ uapi header that gets
      this treatment, so IMHO it is worth patching just to drive that number
      all the way to zero.
      
      Signed-off-by: default avatarZack Weinberg <zackw@panix.com>
      [hch: removed dead conditionals]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fbd57629
    • Jakub Kicinski's avatar
      hashtable: remove repeated phrase from a comment · dbd18777
      Jakub Kicinski authored
      
      
      "in a rcu enabled hashtable" is repeated twice in a comment.
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dbd18777
    • Vikas Shivappa's avatar
      x86/intel_rdt: Fix memory leak on mount failure · 79298acc
      Vikas Shivappa authored
      If mount fails, the kn_info directory is not freed causing memory leak.
      
      Add the missing error handling path.
      
      Fixes: 4e978d06
      
       ("x86/intel_rdt: Add "info" files to resctrl file system")
      Signed-off-by: default avatarVikas Shivappa <vikas.shivappa@linux.intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: ravi.v.shankar@intel.com
      Cc: tony.luck@intel.com
      Cc: fenghua.yu@intel.com
      Cc: peterz@infradead.org
      Cc: vikas.shivappa@intel.com
      Cc: andi.kleen@intel.com
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1498503368-20173-3-git-send-email-vikas.shivappa@linux.intel.com
      79298acc
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.12-8' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · b4df2e35
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Hopefully the last two powerpc fixes for 4.12.
      
        The CXL one is larger than I'd usually send at rc7, but it fixes new
        code this cycle, so better to have it working for the release. It was
        actually sent a few weeks back but got blocked in testing behind
        another fix that was causing issues.
      
        We are still tracking one crash in v4.12-rc7, but only one person has
        reproduced it and the commit identified by bisect doesn't touch any of
        the relevant code, so I think it's 50/50 whether that commit is
        actually the problem or it's some code layout / toolchain issue.
      
        Two fixes for code we merged this cycle:
      
         - cxl: Fixes for Coherent Accelerator Interface Architecture 2.0
      
         - Avoid miscompilation w/GCC 4.6.3 on 32-bit - don't inline
           copy_to/from_user()
      
        Thanks to Al Viro, Larry Finger, Christophe Lombard"
      
      * tag 'powerpc-4.12-8' of git://git.kernel.org/pub/...
      b4df2e35
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v4.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 27ab862a
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
       "Two fixes:
      
         - A fix for AMD IOMMU interrupt remapping code when IRQs are
           forwarded directly to KVM guests
      
         - Fixed check in the recently merged code to allow tboot with
           Intel VT-d disabled"
      
      * tag 'iommu-fixes-v4.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Fix interrupt remapping when disable guest_mode
        iommu/vt-d: Correctly disable Intel IOMMU force on
      27ab862a
    • Linus Torvalds's avatar
      Merge tag 'sound-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 4adc6b93
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Two last-minute HD-audio fixes"
      
      * tag 'sound-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda - Fix endless loop of codec configure
        ALSA: hda - set input_path bitmap to zero after moving it to new place
      4adc6b93
    • Linus Torvalds's avatar
      Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs · 86c3e00a
      Linus Torvalds authored
      Pull overlayfs fixes from Miklos Szeredi:
       "Fix two bugs in copy-up code. One introduced in 4.11 and one in
        4.12-rc"
      
      * 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
        ovl: don't set origin on broken lower hardlink
        ovl: copy-up: don't unlock between lookup and link
      86c3e00a
  4. Jun 30, 2017
    • Vunny Sodhi's avatar
      ASoC: Intel: Skylake: Add support to read firmware registers · bdd0384a
      Vunny Sodhi authored
      
      
      This patch adds debugfs support to read fw registers, mailbox
      offsets and sram address.
      
      Signed-off-by: default avatarMousumi Jana <mousumix.jana@intel.com>
      Signed-off-by: default avatarRamesh Babu <ramesh.babu@intel.com>
      Signed-off-by: default avatarJayachandran B <jayachandran.b@intel.com>
      Signed-off-by: default avatarPardha Saradhi K <pardha.saradhi.kesapragada@intel.com>
      Signed-off-by: default avatarVunny Sodhi <vunnyx.sodhi@intel.com>
      Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
      Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      bdd0384a
    • Guneshwor Singh's avatar
      ASoC: Intel: Skylake: Add sram address to sst_addr structure · 09e914d6
      Guneshwor Singh authored
      
      
      SRAM address and memory window size differ for different platforms.
      So add members to sst_addr structure and initialize them in the
      respective dsp_init().
      
      Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
      Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      09e914d6
    • Vinod Koul's avatar
      ASoC: Intel: Skylake: Debugfs facility to dump module config · d14700a0
      Vinod Koul authored
      
      
      Driver modules have lot of information represented in struct
      skl_module_cfg. Knowing this is useful for debug, so enable
      debugfs for this structure.
      
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarVunny Sodhi <vunnyx.sodhi@intel.com>
      Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      d14700a0
    • Vinod Koul's avatar
      ASoC: Intel: Skylake: Add debugfs support · 5cdf6c09
      Vinod Koul authored
      
      
      For debug, the kernel debugfs mechanism is available. We can add various
      debug options for driver like module configuration read, firmware register
      read etc.
      
      This patch adds debugfs as a child to asoc plaform component and caller is
      added for skylake driver to do init and cleanup of debugfs.
      
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarVunny Sodhi <vunnyx.sodhi@intel.com>
      Signed-off-by: default avatarGuneshwor Singh <guneshwor.o.singh@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      5cdf6c09
    • Wu Fengguang's avatar
      ASoC: fix semicolon.cocci warnings · 46b5a4d2
      Wu Fengguang authored
      sound/soc/soc-core.c:1961:2-3: Unneeded semicolon
      
       Remove unneeded semicolon.
      
      Generated by: scripts/coccinelle/misc/semicolon.cocci
      
      Fixes: 98faf436
      
       ("ASoC: Drop invalid DMI fields when setting card long name from DMI info")
      CC: Mengdong Lin <mengdong.lin@linux.intel.com>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      46b5a4d2
    • Colin Ian King's avatar
      ASoC: rsnd: make arrays path and cmd_case static const · 82885913
      Colin Ian King authored
      
      
      Don't populate the arrays path and cmd_case on the stack but make
      them static const.  Makes the object code smaller:
      
      Before:
         text    data     bss     dec     hex filename
         2673     624       0    3297     ce1 sound/soc/sh/rcar/cmd.o
      
      After:
         text    data     bss     dec     hex filename
         2398     768       0    3166     c5e sound/soc/sh/rcar/cmd.o
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      82885913
    • Arvind Yadav's avatar
      ASoC: rsnd: constify dev_pm_ops structures. · 49ebf13b
      Arvind Yadav authored
      
      
      dev_pm_ops are not supposed to change at runtime. All functions
      working with dev_pm_ops provided by <linux/device.h> work with const
      dev_pm_ops. So mark the non-const structs as const.
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         8172	    920	      0	   9092	   2384	sound/soc/sh/rcar/core.o
      
      File size After adding 'const':
         text	   data	    bss	    dec	    hex	filename
         8364	    728	      0	   9092	   2384	sound/soc/sh/rcar/core.o
      
      Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      49ebf13b
    • Liam Girdwood's avatar
      ASoC: dapm: Add new widget type for constructing DAPM graphs on DSPs. · 8a70b454
      Liam Girdwood authored
      
      
      Add some DAPM widget types to better support the construction of DAPM
      graphs within DSPs.
      
      Signed-off-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      8a70b454
    • Colin Ian King's avatar
      ASoC: ak4642: make arrays fs_list and ps_list static const · 836e4fed
      Colin Ian King authored
      
      
      Don't populate the arrays fs_list and ps_list on the stack but make
      them static const.  Makes the object code smaller:
      
      Before:
         text    data     bss     dec     hex filename
        12084    4888      64   17036    428c sound/soc/codecs/ak4642.o
      
      After:
         text    data     bss     dec     hex filename
        11883    5032      64   16979    4253 sound/soc/codecs/ak4642.o
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      836e4fed
    • Baoquan He's avatar
      x86/boot/KASLR: Fix kexec crash due to 'virt_addr' calculation bug · 8eabf42a
      Baoquan He authored
      
      
      Kernel text KASLR is separated into physical address and virtual
      address randomization. And for virtual address randomization, we
      only randomiza to get an offset between 16M and KERNEL_IMAGE_SIZE.
      So the initial value of 'virt_addr' should be LOAD_PHYSICAL_ADDR,
      but not the original kernel loading address 'output'.
      
      The bug will cause kernel boot failure if kernel is loaded at a different
      position than the address, 16M, which is decided at compiled time.
      Kexec/kdump is such practical case.
      
      To fix it, just assign LOAD_PHYSICAL_ADDR to virt_addr as initial
      value.
      
      Tested-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 8391c73c
      
       ("x86/KASLR: Randomize virtual address separately")
      Link: http://lkml.kernel.org/r/1498567146-11990-3-git-send-email-bhe@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8eabf42a
    • Baoquan He's avatar
      x86/boot/KASLR: Add checking for the offset of kernel virtual address randomization · b892cb87
      Baoquan He authored
      
      
      For kernel text KASLR, the virtual address is confined to area of 1G,
      [0xffffffff80000000, 0xffffffffc0000000). For the implemenataion of
      virtual address randomization, we only randomize to get an offset
      between 16M and 1G, then add this offset to the starting address,
      0xffffffff80000000. Here 16M is the offset which is decided at linking
      stage. So the amount of the local variable 'virt_addr' which respresents
      the offset plus the kernel output size can not exceed KERNEL_IMAGE_SIZE.
      
      Add a debug check for the offset. If out of bounds, print error
      message and hang there.
      
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBaoquan He <bhe@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/1498567146-11990-2-git-send-email-bhe@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b892cb87
    • Sabrina Dubroca's avatar
      tracing/kprobes: Allow to create probe with a module name starting with a digit · 9e52b325
      Sabrina Dubroca authored
      Always try to parse an address, since kstrtoul() will safely fail when
      given a symbol as input. If that fails (which will be the case for a
      symbol), try to parse a symbol instead.
      
      This allows creating a probe such as:
      
          p:probe/vlan_gro_receive 8021q:vlan_gro_receive+0
      
      Which is necessary for this command to work:
      
          perf probe -m 8021q -a vlan_gro_receive
      
      Link: http://lkml.kernel.org/r/fd72d666f45b114e2c5b9cf7e27b91de1ec966f1.1498122881.git.sd@queasysnail.net
      
      Cc: stable@vger.kernel.org
      Fixes: 413d37d1
      
       ("tracing: Add kprobe-based event tracer")
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      9e52b325
    • James Hogan's avatar
      MIPS: Avoid accidental raw backtrace · 85423636
      James Hogan authored
      Since commit 81a76d71 ("MIPS: Avoid using unwind_stack() with
      usermode") show_backtrace() invokes the raw backtracer when
      cp0_status & ST0_KSU indicates user mode to fix issues on EVA kernels
      where user and kernel address spaces overlap.
      
      However this is used by show_stack() which creates its own pt_regs on
      the stack and leaves cp0_status uninitialised in most of the code paths.
      This results in the non deterministic use of the raw back tracer
      depending on the previous stack content.
      
      show_stack() deals exclusively with kernel mode stacks anyway, so
      explicitly initialise regs.cp0_status to KSU_KERNEL (i.e. 0) to ensure
      we get a useful backtrace.
      
      Fixes: 81a76d71
      
       ("MIPS: Avoid using unwind_stack() with usermode")
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/16656/
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      85423636
    • Paul Burton's avatar
      MIPS: Perform post-DMA cache flushes on systems with MAARs · cad482c1
      Paul Burton authored
      
      
      Recent CPUs from Imagination Technologies such as the I6400 or P6600 are
      able to speculatively fetch data from memory into caches. This means
      that if used in a system with non-coherent DMA they require that caches
      be invalidated after a device performs DMA, and before the CPU reads the
      DMA'd data, in order to ensure that stale values weren't speculatively
      prefetched.
      
      Such CPUs also introduced Memory Accessibility Attribute Registers
      (MAARs) in order to control the regions in which they are allowed to
      speculate. Thus we can use the presence of MAARs as a good indication
      that the CPU requires the above cache maintenance. Use the presence of
      MAARs to determine the result of cpu_needs_post_dma_flush() in the
      default case, in order to handle these recent CPUs correctly.
      
      Note that the return type of cpu_needs_post_dma_flush() is changed to
      bool, such that it's clearer what's happening when cpu_has_maar is cast
      to bool for the return value. If this patch were backported to a
      pre-v4.7 kernel then MIPS_CPU_MAAR was 1ull<<34, so when cast to an int
      we would incorrectly return 0. It so happens that MIPS_CPU_MAAR is
      currently 1ull<<30, so when truncated to an int gives a non-zero value
      anyway, but even so the implicit conversion from long long int to bool
      makes it clearer to understand what will happen than the implicit
      conversion from long long int to int would. The bool return type also
      fits this usage better semantically, so seems like an all-round win.
      
      Thanks to Ed for spotting the issue for pre-v4.7 kernels & suggesting
      the return type change.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: default avatarBryan O'Donoghue <pure.logic@nexus-software.ie>
      Tested-by: default avatarBryan O'Donoghue <pure.logic@nexus-software.ie>
      Cc: Ed Blake <ed.blake@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16363/
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      cad482c1
    • Paul Burton's avatar
      MIPS: Fix IRQ tracing & lockdep when rescheduling · d8550860
      Paul Burton authored
      
      
      When the scheduler sets TIF_NEED_RESCHED & we call into the scheduler
      from arch/mips/kernel/entry.S we disable interrupts. This is true
      regardless of whether we reach work_resched from syscall_exit_work,
      resume_userspace or by looping after calling schedule(). Although we
      disable interrupts in these paths we don't call trace_hardirqs_off()
      before calling into C code which may acquire locks, and we therefore
      leave lockdep with an inconsistent view of whether interrupts are
      disabled or not when CONFIG_PROVE_LOCKING & CONFIG_DEBUG_LOCKDEP are
      both enabled.
      
      Without tracing this interrupt state lockdep will print warnings such
      as the following once a task returns from a syscall via
      syscall_exit_partial with TIF_NEED_RESCHED set:
      
      [   49.927678] ------------[ cut here ]------------
      [   49.934445] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:3687 check_flags.part.41+0x1dc/0x1e8
      [   49.946031] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
      [   49.946355] CPU: 0 PID: 1 Comm: init Not tainted 4.10.0-00439-gc9fd5d362289-dirty #197
      [   49.963505] Stack : 0000000000000000 ffffffff81bb5d6a 0000000000000006 ffffffff801ce9c4
      [   49.974431]         0000000000000000 0000000000000000 0000000000000000 000000000000004a
      [   49.985300]         ffffffff80b7e487 ffffffff80a24498 a8000000ff160000 ffffffff80ede8b8
      [   49.996194]         0000000000000001 0000000000000000 0000000000000000 0000000077c8030c
      [   50.007063]         000000007fd8a510 ffffffff801cd45c 0000000000000000 a8000000ff127c88
      [   50.017945]         0000000000000000 ffffffff801cf928 0000000000000001 ffffffff80a24498
      [   50.028827]         0000000000000000 0000000000000001 0000000000000000 0000000000000000
      [   50.039688]         0000000000000000 a8000000ff127bd0 0000000000000000 ffffffff805509bc
      [   50.050575]         00000000140084e0 0000000000000000 0000000000000000 0000000000040a00
      [   50.061448]         0000000000000000 ffffffff8010e1b0 0000000000000000 ffffffff805509bc
      [   50.072327]         ...
      [   50.076087] Call Trace:
      [   50.079869] [<ffffffff8010e1b0>] show_stack+0x80/0xa8
      [   50.086577] [<ffffffff805509bc>] dump_stack+0x10c/0x190
      [   50.093498] [<ffffffff8015dde0>] __warn+0xf0/0x108
      [   50.099889] [<ffffffff8015de34>] warn_slowpath_fmt+0x3c/0x48
      [   50.107241] [<ffffffff801c15b4>] check_flags.part.41+0x1dc/0x1e8
      [   50.114961] [<ffffffff801c239c>] lock_is_held_type+0x8c/0xb0
      [   50.122291] [<ffffffff809461b8>] __schedule+0x8c0/0x10f8
      [   50.129221] [<ffffffff80946a60>] schedule+0x30/0x98
      [   50.135659] [<ffffffff80106278>] work_resched+0x8/0x34
      [   50.142397] ---[ end trace 0cb4f6ef5b99fe21 ]---
      [   50.148405] possible reason: unannotated irqs-off.
      [   50.154600] irq event stamp: 400463
      [   50.159566] hardirqs last  enabled at (400463): [<ffffffff8094edc8>] _raw_spin_unlock_irqrestore+0x40/0xa8
      [   50.171981] hardirqs last disabled at (400462): [<ffffffff8094eb98>] _raw_spin_lock_irqsave+0x30/0xb0
      [   50.183897] softirqs last  enabled at (400450): [<ffffffff8016580c>] __do_softirq+0x4ac/0x6a8
      [   50.195015] softirqs last disabled at (400425): [<ffffffff80165e78>] irq_exit+0x110/0x128
      
      Fix this by using the TRACE_IRQS_OFF macro to call trace_hardirqs_off()
      when CONFIG_TRACE_IRQFLAGS is enabled. This is done before invoking
      schedule() following the work_resched label because:
      
       1) Interrupts are disabled regardless of the path we take to reach
          work_resched() & schedule().
      
       2) Performing the tracing here avoids the need to do it in paths which
          disable interrupts but don't call out to C code before hitting a
          path which uses the RESTORE_SOME macro that will call
          trace_hardirqs_on() or trace_hardirqs_off() as appropriate.
      
      We call trace_hardirqs_on() using the TRACE_IRQS_ON macro before calling
      syscall_trace_leave() for similar reasons, ensuring that lockdep has a
      consistent view of state after we re-enable interrupts.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Cc: linux-mips@linux-mips.org
      Cc: stable <stable@vger.kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/15385/
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      d8550860
    • Paul Burton's avatar
      MIPS: pm-cps: Drop manual cache-line alignment of ready_count · 161c51cc
      Paul Burton authored
      
      
      We allocate memory for a ready_count variable per-CPU, which is accessed
      via a cached non-coherent TLB mapping to perform synchronisation between
      threads within the core using LL/SC instructions. In order to ensure
      that the variable is contained within its own data cache line we
      allocate 2 lines worth of memory & align the resulting pointer to a line
      boundary. This is however unnecessary, since kmalloc is guaranteed to
      return memory which is at least cache-line aligned (see
      ARCH_DMA_MINALIGN). Stop the redundant manual alignment.
      
      Besides cleaning up the code & avoiding needless work, this has the side
      effect of avoiding an arithmetic error found by Bryan on 64 bit systems
      due to the 32 bit size of the former dlinesz. This led the ready_count
      variable to have its upper 32b cleared erroneously for MIPS64 kernels,
      causing problems when ready_count was later used on MIPS64 via cpuidle.
      
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Fixes: 3179d37e
      
       ("MIPS: pm-cps: add PM state entry code for CPS systems")
      Reported-by: default avatarBryan O'Donoghue <bryan.odonoghue@imgtec.com>
      Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@imgtec.com>
      Tested-by: default avatarBryan O'Donoghue <bryan.odonoghue@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable <stable@vger.kernel.org> # v3.16+
      Patchwork: https://patchwork.linux-mips.org/patch/15383/
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      161c51cc