1. 06 Apr, 2018 2 commits
    • Huang Ying's avatar
      mm: fix races between swapoff and flush dcache · cb9f753a
      Huang Ying authored
      Thanks to commit 4b3ef9da ("mm/swap: split swap cache into 64MB
      trunks"), after swapoff the address_space associated with the swap
      device will be freed.  So page_mapping() users which may touch the
      address_space need some kind of mechanism to prevent the address_space
      from being freed during accessing.
      
      The dcache flushing functions (flush_dcache_page(), etc) in architecture
      specific code may access the address_space of swap device for anonymous
      pages in swap cache via page_mapping() function.  But in some cases
      there are no mechanisms to prevent the swap device from being swapoff,
      for example,
      
        CPU1					CPU2
        __get_user_pages()			swapoff()
          flush_dcache_page()
            mapping = page_mapping()
              ...				  exit_swap_address_space()
              ...				    kvfree(spaces)
              mapping_mapped(mapping)
      
      The address space may be accessed after being freed.
      
      But from cachetlb.txt and Russell King, flush_dcache_page() only care
      about file cache pages, for anonymous pages, flush_anon_page() should be
      used.  The implementation of flush_dcache_page() in all architectures
      follows this too.  They will check whether page_mapping() is NULL and
      whether mapping_mapped() is true to determine whether to flush the
      dcache immediately.  And they will use interval tree (mapping->i_mmap)
      to find all user space mappings.  While mapping_mapped() and
      mapping->i_mmap isn't used by anonymous pages in swap cache at all.
      
      So, to fix the race between swapoff and flush dcache, __page_mapping()
      is add to return the address_space for file cache pages and NULL
      otherwise.  All page_mapping() invoking in flush dcache functions are
      replaced with page_mapping_file().
      
      [akpm@linux-foundation.org: simplify page_mapping_file(), per Mike]
      Link: http://lkml.kernel.org/r/20180305083634.15174-1-ying.huang@intel.comSigned-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Chen Liqin <liqin.linux@gmail.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb9f753a
    • Huacai Chen's avatar
      zboot: fix stack protector in compressed boot phase · 7bbaf27d
      Huacai Chen authored
      Calling __stack_chk_guard_setup() in decompress_kernel() is too late
      that stack checking always fails for decompress_kernel() itself.  So
      remove __stack_chk_guard_setup() and initialize __stack_chk_guard before
      we call decompress_kernel().
      
      Original code comes from ARM but also used for MIPS and SH, so fix them
      together.  If without this fix, compressed booting of these archs will
      fail because stack checking is enabled by default (>=4.16).
      
      Link: http://lkml.kernel.org/r/1522226933-29317-1-git-send-email-chenhc@lemote.com
      Fixes: 8779657d ("stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG")
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Acked-by: default avatarJames Hogan <jhogan@kernel.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarRich Felker <dalias@libc.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7bbaf27d
  2. 02 Apr, 2018 8 commits
  3. 26 Mar, 2018 1 commit
  4. 22 Mar, 2018 1 commit
    • NeilBrown's avatar
      MIPS: ralink: Fix booting on MT7621 · a63d706e
      NeilBrown authored
      Since commit 3af5a67c ("MIPS: Fix early CM probing") the MT7621 has
      not been able to boot.
      
      This commit caused mips_cm_probe() to be called before
      mt7621.c::proc_soc_init().
      
      prom_soc_init() has a comment explaining that mips_cm_probe() "wipes out
      the bootloader config" and means that configuration registers are no
      longer available. It has some code to re-enable this config.
      
      Before this re-enable code is run, the sysc register cannot be read, so
      when SYSC_REG_CHIP_NAME0 is read, a garbage value is returned and
      panic() is called.
      
      If we move the config-repair code to the top of prom_soc_init(), the
      registers can be read and boot can proceed.
      
      Very occasionally, the first register read after the reconfiguration
      returns garbage, so add a call to __sync().
      
      Fixes: 3af5a67c ("MIPS: Fix early CM probing")
      Signed-off-by: default avatarNeilBrown <neil@brown.name>
      Reviewed-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
      Cc: John Crispin <john@phrozen.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.5+
      Patchwork: https://patchwork.linux-mips.org/patch/18859/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      a63d706e
  5. 21 Mar, 2018 4 commits
  6. 20 Mar, 2018 2 commits
  7. 16 Mar, 2018 2 commits
  8. 12 Mar, 2018 1 commit
    • Peter Zijlstra's avatar
      perf/core: Remove perf_event::group_entry · 8343aae6
      Peter Zijlstra authored
      Now that all the grouping is done with RB trees, we no longer need
      group_entry and can replace the whole thing with sibling_list.
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Dmitri Prokhorov <Dmitry.Prohorov@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Valery Cherepennikov <valery.cherepennikov@intel.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8343aae6
  9. 05 Mar, 2018 3 commits
  10. 23 Feb, 2018 3 commits
  11. 20 Feb, 2018 1 commit
    • James Hogan's avatar
      MIPS: Drop spurious __unused in struct compat_flock · 6ae1756f
      James Hogan authored
      MIPS' struct compat_flock doesn't match the 32-bit struct flock, as it
      has an extra short __unused before pad[4], which combined with alignment
      increases the size to 40 bytes compared with struct flock's 36 bytes.
      
      Since commit 8c6657cb ("Switch flock copyin/copyout primitives to
      copy_{from,to}_user()"), put_compat_flock() writes the full compat_flock
      struct to userland, which results in corruption of the userland word
      after the struct flock when running 32-bit userlands on 64-bit kernels.
      
      This was observed to cause a bus error exception when starting Firefox
      on Debian 8 (Jessie).
      Reported-by: default avatarPeter Mamonov <pmamonov@gmail.com>
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Tested-by: default avatarPeter Mamonov <pmamonov@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.13+
      Patchwork: https://patchwork.linux-mips.org/patch/18646/
      6ae1756f
  12. 14 Feb, 2018 1 commit
    • Linus Walleij's avatar
      spi: spi-gpio: Rewrite to use GPIO descriptors · 9b00bc7b
      Linus Walleij authored
      This converts the bit-banged GPIO SPI driver to looking up and
      using GPIO descriptors to get a handle on GPIO lines for SCK,
      MOSI, MISO and all CS lines.
      
      All existing board files are converted in one go to keep it all
      consistent. With these conversions I rarely find any interrim
      steps that makes any sense.
      
      Device tree probing and GPIO handling should work like before
      also after this patch.
      
      For board files, we stop using controller data to pass the GPIO
      line for chip select, instead we pass this as a GPIO descriptor
      lookup like everything else.
      
      In some s3c24xx machines the names of the SPI devices were set to
      "spi-gpio" rather than "spi_gpio" which can never have worked, I
      fixed it working (I guess) as part of this patch set. Sometimes
      I wonder how this code got upstream in the first place, it
      obviously is not tested.
      
      mach-s3c64xx/mach-smartq.c has the same problem and additionally
      defines the *same* GPIO line for MOSI and MISO which is not going
      to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
      it was a typo and use lines 1,2,3. A comment gives awat that line 0
      is chip select though no actual SPI device is provided for the LCD
      supposed to be on this bit-banged SPI bus. I left it intact instead
      of just deleting the bus though.
      
      Kill off board file code that try to initialize the SPI lines
      to the same values that they will later be set by the spi_gpio
      driver anyways. Given the huge number of weird things in these
      board files I do not think this code is very tested or put in
      with much afterthought anyways.
      
      In order to assert that we do not get performance regressions on
      this crucial bing-banged driver, a ran a script like this dumping the
      Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
      an otherwise idle system in two iterations before and after the
      patches:
      
       #!/bin/sh
       for run in `seq 10000`
       do
           cat /debug/regmap/spi0.0/registers > /dev/null
       done
      
      Before the patch:
      
      time test.sh
      real    3m 41.03s
      user    0m 29.41s
      sys     3m 7.22s
      
      time test.sh
      real    3m 44.24s
      user    0m 32.31s
      sys     3m 7.60s
      
      After the patch:
      
      time test.sh
      real    3m 41.32s
      user    0m 28.92s
      sys     3m 8.08s
      
      time test.sh
      real    3m 39.92s
      user    0m 30.20s
      sys     3m 5.56s
      
      So any performance differences seems to be in the error margin.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Acked-by: default avatarOlof Johansson <olof@lixom.net>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      9b00bc7b
  13. 13 Feb, 2018 2 commits
  14. 11 Feb, 2018 2 commits
    • Al Viro's avatar
      unify {de,}mangle_poll(), get rid of kernel-side POLL... · 7a163b21
      Al Viro authored
      except, again, POLLFREE and POLL_BUSY_LOOP.
      
      With this, we finally get to the promised end result:
      
       - POLL{IN,OUT,...} are plain integers and *not* in __poll_t, so any
         stray instances of ->poll() still using those will be caught by
         sparse.
      
       - eventpoll.c and select.c warning-free wrt __poll_t
      
       - no more kernel-side definitions of POLL... - userland ones are
         visible through the entire kernel (and used pretty much only for
         mangle/demangle)
      
       - same behavior as after the first series (i.e. sparc et.al. epoll(2)
         working correctly).
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7a163b21
    • Linus Torvalds's avatar
      vfs: do bulk POLL* -> EPOLL* replacement · a9a08845
      Linus Torvalds authored
      This is the mindless scripted replacement of kernel use of POLL*
      variables as described by Al, done by this script:
      
          for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
              L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
              for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
          done
      
      with de-mangling cleanups yet to come.
      
      NOTE! On almost all architectures, the EPOLL* constants have the same
      values as the POLL* constants do.  But they keyword here is "almost".
      For various bad reasons they aren't the same, and epoll() doesn't
      actually work quite correctly in some cases due to this on Sparc et al.
      
      The next patch from Al will sort out the final differences, and we
      should be all done.
      Scripted-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a9a08845
  15. 08 Feb, 2018 1 commit
  16. 06 Feb, 2018 4 commits
  17. 05 Feb, 2018 2 commits