Skip to content
  1. Oct 31, 2018
    • Mike Rapoport's avatar
      memblock: add align parameter to memblock_alloc_node() · 3913c8f9
      Mike Rapoport authored
      
      
      With the align parameter memblock_alloc_node() can be used as drop in
      replacement for alloc_bootmem_pages_node() and __alloc_bootmem_node(),
      which is done in the following patches.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-15-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3913c8f9
    • Mike Rapoport's avatar
      memblock: replace __alloc_bootmem_nopanic with memblock_alloc_from_nopanic · a5159e84
      Mike Rapoport authored
      
      
      When __alloc_bootmem_nopanic() is used with explicit lower limit for the
      allocation it attempts to allocate memory at or above that limit and falls
      back to allocation with no limit set.
      
      The memblock_alloc_from_nopanic() does exactly the same thing and can be
      used as a replacement for __alloc_bootmem_nopanic() is such cases.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-14-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a5159e84
    • Mike Rapoport's avatar
      memblock: replace alloc_bootmem_low with memblock_alloc_low (2) · 510d22f4
      Mike Rapoport authored
      
      
      The alloc_bootmem_low(size) allocates low memory with default alignment
      and can be replaced by memblock_alloc_low(size, 0)
      
      Link: http://lkml.kernel.org/r/1536927045-23536-13-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      510d22f4
    • Mike Rapoport's avatar
      memblock: replace alloc_bootmem_pages_nopanic with memblock_alloc_nopanic · 238997e5
      Mike Rapoport authored
      
      
      The alloc_bootmem_pages_nopanic(size) is a shortcut for
      __alloc_bootmem_nopanic(size, PAGE_SIZE, BOOTMEM_LOW_LIMIT) which allocates
      PAGE_SIZE aligned memory. Since BOOTMEM_LOW_LIMIT is hardwired to 0 there
      is no restrictions on where the allocated memory should reside.
      
      The memblock_alloc_nopanic(size, PAGE_SIZE) also allocates PAGE_SIZE
      aligned memory without any restrictions and thus can be used as a
      replacement for alloc_bootmem_pages_nopanic()
      
      Link: http://lkml.kernel.org/r/1536927045-23536-12-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      238997e5
    • Mike Rapoport's avatar
      memblock: replace __alloc_bootmem_node_nopanic with memblock_alloc_try_nid_nopanic · bf2886ef
      Mike Rapoport authored
      
      
      The __alloc_bootmem_node_nopanic() attempts to allocate memory for a
      specified node. If the allocation fails it then retries to allocate memory
      from any node. Upon success, the allocated memory is set to 0.
      
      The memblock_alloc_try_nid_nopanic() does exactly the same thing and can be
      used instead.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-11-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bf2886ef
    • Mike Rapoport's avatar
      memblock: replace alloc_bootmem_low with memblock_alloc_low · 07915170
      Mike Rapoport authored
      
      
      The functions are equivalent, just the later does not require nobootmem
      translation layer.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-10-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      07915170
    • Mike Rapoport's avatar
      memblock: replace alloc_bootmem_align with memblock_alloc · e0802b8d
      Mike Rapoport authored
      
      
      The functions are equivalent, just the later does not require nobootmem
      translation layer.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-9-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e0802b8d
    • Mike Rapoport's avatar
      memblock: remove _virt from APIs returning virtual address · eb31d559
      Mike Rapoport authored
      
      
      The conversion is done using
      
      sed -i 's@memblock_virt_alloc@memblock_alloc@g' \
      	$(git grep -l memblock_virt_alloc)
      
      Link: http://lkml.kernel.org/r/1536927045-23536-8-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eb31d559
    • Mike Rapoport's avatar
      memblock: rename memblock_alloc{_nid,_try_nid} to memblock_phys_alloc* · 9a8dd708
      Mike Rapoport authored
      
      
      Make it explicit that the caller gets a physical address rather than a
      virtual one.
      
      This will also allow using meblock_alloc prefix for memblock allocations
      returning virtual address, which is done in the following patches.
      
      The conversion is done using the following semantic patch:
      
      @@
      expression e1, e2, e3;
      @@
      (
      - memblock_alloc(e1, e2)
      + memblock_phys_alloc(e1, e2)
      |
      - memblock_alloc_nid(e1, e2, e3)
      + memblock_phys_alloc_nid(e1, e2, e3)
      |
      - memblock_alloc_try_nid(e1, e2, e3)
      + memblock_phys_alloc_try_nid(e1, e2, e3)
      )
      
      Link: http://lkml.kernel.org/r/1536927045-23536-7-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9a8dd708
    • Mike Rapoport's avatar
      mm: nobootmem: remove dead code · b146ada2
      Mike Rapoport authored
      
      
      Several bootmem functions and macros are not used. Remove them.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-6-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b146ada2
    • Mike Rapoport's avatar
      mm: remove bootmem allocator implementation. · 355c45af
      Mike Rapoport authored
      
      
      All architectures have been converted to use MEMBLOCK + NO_BOOTMEM. The
      bootmem allocator implementation can be removed.
      
      Link: http://lkml.kernel.org/r/1536927045-23536-5-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      355c45af
    • Mike Rapoport's avatar
      mm: remove CONFIG_HAVE_MEMBLOCK · aca52c39
      Mike Rapoport authored
      
      
      All architecures use memblock for early memory management. There is no need
      for the CONFIG_HAVE_MEMBLOCK configuration option.
      
      [rppt@linux.vnet.ibm.com: of/fdt: fixup #ifdefs]
        Link: http://lkml.kernel.org/r/20180919103457.GA20545@rapoport-lnx
      [rppt@linux.vnet.ibm.com: csky: fixups after bootmem removal]
        Link: http://lkml.kernel.org/r/20180926112744.GC4628@rapoport-lnx
      [rppt@linux.vnet.ibm.com: remove stale #else and the code it protects]
        Link: http://lkml.kernel.org/r/1538067825-24835-1-git-send-email-rppt@linux.vnet.ibm.com
      Link: http://lkml.kernel.org/r/1536927045-23536-4-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Tested-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      aca52c39
    • Mike Rapoport's avatar
      mm: remove CONFIG_NO_BOOTMEM · b4a991ec
      Mike Rapoport authored
      
      
      All achitectures select NO_BOOTMEM which essentially becomes 'Y' for any
      kernel configuration and therefore it can be removed.
      
      [alexander.h.duyck@linux.intel.com: remove now defunct NO_BOOTMEM from depends list for deferred init]
        Link: http://lkml.kernel.org/r/20180925201814.3576.15105.stgit@localhost.localdomain
      Link: http://lkml.kernel.org/r/1536927045-23536-3-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b4a991ec
    • Alexander Pateenok's avatar
      percpu: remove PER_CPU_DEF_ATTRIBUTES macro · 69a60bc7
      Alexander Pateenok authored
      The macro is not used:
      
        $ grep -r PER_CPU_DEF_ATTRIBUTES
        include/linux/percpu-defs.h:	__PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak		\
        include/linux/percpu-defs.h:	__PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES		\
        include/asm-generic/percpu.h:#ifndef PER_CPU_DEF_ATTRIBUTES
        include/asm-generic/percpu.h:#define PER_CPU_DEF_ATTRIBUTES
      
      It was added with b01e8dc3 ("alpha: fix percpu build breakage") and
      removed in 2009 with b01e8dc3..6088464c
      
      .
      
      Link: http://lkml.kernel.org/r/20180821164904.qqhcduimjznods66@K55DR.localdomain
      Signed-off-by: default avatarAlexander Pateenok <pateenoc@gmail.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      69a60bc7
    • Arnd Bergmann's avatar
      kbuild: fix kernel/bounds.c 'W=1' warning · 6a32c246
      Arnd Bergmann authored
      
      
      Building any configuration with 'make W=1' produces a warning:
      
      kernel/bounds.c:16:6: warning: no previous prototype for 'foo' [-Wmissing-prototypes]
      
      When also passing -Werror, this prevents us from building any other files.
      Nobody ever calls the function, but we can't make it 'static' either
      since we want the compiler output.
      
      Calling it 'main' instead however avoids the warning, because gcc
      does not insist on having a declaration for main.
      
      Link: http://lkml.kernel.org/r/20181005083313.2088252-1-arnd@arndb.de
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reported-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Cc: David Laight <David.Laight@ACULAB.COM>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      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>
      6a32c246
    • Gao Xiang's avatar
      lib/lz4: update LZ4 decompressor module · 2209fda3
      Gao Xiang authored
      
      
      Update the LZ4 compression module based on LZ4 v1.8.3 in order for the
      erofs file system to use the newest LZ4_decompress_safe_partial() which
      can now decode exactly the nb of bytes requested [1] to take place of the
      open hacked code in the erofs file system itself.
      
      Currently, apart from the erofs file system, no other users use
      LZ4_decompress_safe_partial, so no worry about the interface.
      
      In addition, LZ4 v1.8.x boosts up decompression speed compared to the
      current code which is based on LZ4 v1.7.3, mainly due to shortcut
      optimization for the specific common LZ4-sequences [2].
      
      lzbench testdata (tested in kirin710, 8 cores, 4 big cores
      at 2189Mhz, 2GB DDR RAM at 1622Mhz, with enwik8 testdata [3]):
      
      Compressor name         Compress. Decompress. Compr. size  Ratio Filename
      memcpy                   5004 MB/s  4924 MB/s   100000000 100.00 enwik8
      lz4hc 1.7.3 -9             12 MB/s   653 MB/s    42203253  42.20 enwik8
      lz4hc 1.8.0 -9             12 MB/s   908 MB/s    42203096  42.20 enwik8
      lz4hc 1.8.3 -9             11 MB/s   965 MB/s    42203094  42.20 enwik8
      
      [1] https://github.com/lz4/lz4/issues/566
          https://github.com/lz4/lz4/commit/08d347b5b217b011ff7487130b79480d8cfdaeb8
      
      [2] v1.8.1 perf: slightly faster compression and decompression speed
          https://github.com/lz4/lz4/commit/a31b7058cb97e4393da55e78a77a1c6f0c9ae038
          v1.8.2 perf: slightly faster HC compression and decompression speed
          https://github.com/lz4/lz4/commit/45f8603aae389d34c689d3ff7427b314071ccd2c
          https://github.com/lz4/lz4/commit/1a191b3f8d26b50a7c1d41590b529ec308d768cd
      
      [3] http://mattmahoney.net/dc/textdata.html
          http://mattmahoney.net/dc/enwik8.zip
      
      Link: http://lkml.kernel.org/r/1537181207-21932-1-git-send-email-gaoxiang25@huawei.com
      Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
      Tested-by: default avatarGuo Xuenan <guoxuenan@huawei.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Yann Collet <yann.collet.73@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Fang Wei <fangwei1@huawei.com>
      Cc: Chao Yu <yuchao0@huawei.com>
      Cc: Miao Xie <miaoxie@huawei.com>
      Cc: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>
      Cc: Kyungsik Lee <kyungsik.lee@lge.com>
      Cc: <weidu.du@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2209fda3
    • Waiman Long's avatar
      ipc: IPCMNI limit check for semmni · 8c81ddd2
      Waiman Long authored
      
      
      For SysV semaphores, the semmni value is the last part of the 4-element
      sem number array.  To make semmni behave in a similar way to msgmni and
      shmmni, we can't directly use the _minmax handler.  Instead, a special sem
      specific handler is added to check the last argument to make sure that it
      is limited to the [0, IPCMNI] range.  An error will be returned if this is
      not the case.
      
      Link: http://lkml.kernel.org/r/1536352137-12003-3-git-send-email-longman@redhat.com
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Luis R. Rodriguez <mcgrof@kernel.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8c81ddd2
    • Waiman Long's avatar
      ipc: IPCMNI limit check for msgmni and shmmni · 6730e658
      Waiman Long authored
      
      
      Patch series "ipc: IPCMNI limit check for *mni & increase that limit", v9.
      
      The sysctl parameters msgmni, shmmni and semmni have an inherent limit of
      IPC_MNI (32k).  However, users may not be aware of that because they can
      write a value much higher than that without getting any error or
      notification.  Reading the parameters back will show the newly written
      values which are not real.
      
      The real IPCMNI limit is now enforced to make sure that users won't put in
      an unrealistic value.  The first 2 patches enforce the limits.
      
      There are also users out there requesting increase in the IPCMNI value.
      The last 2 patches attempt to do that by using a boot kernel parameter
      "ipcmni_extend" to increase the IPCMNI limit from 32k to 8M if the users
      really want the extended value.
      
      This patch (of 4):
      
      A user can write arbitrary integer values to msgmni and shmmni sysctl
      parameters without getting error, but the actual limit is really IPCMNI
      (32k).  This can mislead users as they think they can get a value that is
      not real.
      
      The right limits are now set for msgmni and shmmni so that the users will
      become aware if they set a value outside of the acceptable range.
      
      Link: http://lkml.kernel.org/r/1536352137-12003-2-git-send-email-longman@redhat.com
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Acked-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6730e658
    • Borislav Petkov's avatar
      kernel/panic.c: filter out a potential trailing newline · b49dec1c
      Borislav Petkov authored
      
      
      If a call to panic() terminates the string with a \n , the result puts the
      closing brace ']---' on a newline because panic() itself adds \n too.
      
      Now, if one goes and removes the newline chars from all panic()
      invocations - and the stats right now look like this:
      
      ~300 calls with a \n
      ~500 calls without a \n
      
      one is destined to a neverending game of whack-a-mole because the usual
      thing to do is add a newline at the end of a string a function is supposed
      to print.
      
      Therefore, simply zap any \n at the end of the panic string to avoid
      touching so many places in the kernel.
      
      Link: http://lkml.kernel.org/r/20181009205019.2786-1-bp@alien8.de
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b49dec1c
    • Borislav Petkov's avatar
      kernel/panic.c: do not append newline to the stack protector panic string · 95c4fb78
      Borislav Petkov authored
      
      
      ... because panic() itself already does this. Otherwise you have
      line-broken trailer:
      
        [    1.836965] ---[ end Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: pgd_alloc+0x29e/0x2a0
        [    1.836965]  ]---
      
      Link: http://lkml.kernel.org/r/20181008202901.7894-1-bp@alien8.de
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      95c4fb78
    • Gustavo A. R. Silva's avatar
      include/linux/signal.h: mark expected switch fall-throughs · 3819ddec
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
      we are expecting to fall through.
      
      Link: http://lkml.kernel.org/r/20181013114847.GA3160@embeddedor.com
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3819ddec
    • Weikang Shi's avatar
      kernel/signal.c: fix a comment error · 2e58f57d
      Weikang Shi authored
      
      
      Because get_signal_to_deliver() was renamed to get_signal() the
      comment should be fixed.
      
      Link: http://lkml.kernel.org/r/1539179128-45709-1-git-send-email-swkhack@gmail.com
      Signed-off-by: default avatarWeikang Shi <swkhack@gmail.com>
      Reported-by: default avatarChristian Brauner <christian@brauner.io>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2e58f57d
    • Frank Sorenson's avatar
      fat: truncate inode timestamp updates in setattr · 22ea4eba
      Frank Sorenson authored
      
      
      setattr_copy can't truncate timestamps correctly for
      msdos/vfat, so truncate and copy them ourselves.
      
      Link: http://lkml.kernel.org/r/a2b4701b1125573fafaeaae6802050ca86d6f8cc.1538363961.git.sorenson@redhat.com
      Signed-off-by: default avatarFrank Sorenson <sorenson@redhat.com>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      22ea4eba
    • Frank Sorenson's avatar
      fat: change timestamp updates to use fat_truncate_time · cd83f6b1
      Frank Sorenson authored
      
      
      Convert the inode timestamp updates to use fat_truncate_time.
      
      Link: http://lkml.kernel.org/r/2663d3083c4dd62f00b64612c8eaf5542bb05a4c.1538363961.git.sorenson@redhat.com
      Signed-off-by: default avatarFrank Sorenson <sorenson@redhat.com>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd83f6b1
    • Frank Sorenson's avatar
      fat: add functions to update and truncate timestamps appropriately · 6bb885ec
      Frank Sorenson authored
      
      
      Add the fat-specific inode_operation ->update_time() and
      fat_truncate_time() function to truncate the inode timestamps from 1
      nanosecond to the appropriate granularity.
      
      Link: http://lkml.kernel.org/r/38af1ba3c3cf0d7381ce7b63077ef8af75901532.1538363961.git.sorenson@redhat.com
      Signed-off-by: default avatarFrank Sorenson <sorenson@redhat.com>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6bb885ec
    • Frank Sorenson's avatar
      fat: create a function to calculate the timezone offest · d9f4d942
      Frank Sorenson authored
      
      
      Patch series "fat: timestamp updates", v5.
      
      fat/msdos timestamps are stored on-disk with several different
      granularities, some of them lower resolution than timespec64_trunc() can
      provide.  In addition, they are only truncated as they are written to
      disk, so the timestamps in-memory for new or modified files/directories
      may be different from the same timestamps after a remount, as the
      now-truncated times are re-read from the on-disk format.
      
      These patches allow finer granularity for the timestamps where possible
      and add fat-specific ->update_time inode operation and fat_truncate_time
      functions to truncate each timestamp correctly, giving consistent times
      across remounts.
      
      This patch (of 4):
      
      Move the calculation of the number of seconds in the timezone offset to a
      common function.
      
      Link: http://lkml.kernel.org/r/3671ff8cff5eeedbb85ebda5e4de0728920db4f6.1538363961.git.sorenson@redhat.com
      Signed-off-by: default avatarFrank Sorenson <sorenson@redhat.com>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d9f4d942
    • Mihir Mehta's avatar
      fat: expand a slightly out-of-date comment · eceb8902
      Mihir Mehta authored
      
      
      The file namei.c seems to have been renamed to namei_msdos.c, so I decided
      to update the comment with the correct name, and expand it a bit to tell
      the reader what to look for.
      
      Link: http://lkml.kernel.org/r/20180928194947.23932-1-mihir@cs.utexas.edu
      Signed-off-by: default avatarMihir Mehta <mihir@cs.utexas.edu>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eceb8902
    • Masahiro Yamada's avatar
      reiserfs: remove workaround code for GCC 3.x · 21bfc830
      Masahiro Yamada authored
      cafa0010
      
       ("Raise the minimum required gcc version to 4.6") bumped the
      minimum GCC version to 4.6 for all architectures.
      
      The workaround code in fs/reiserfs/Makefile is obsolete now.
      
      Link: http://lkml.kernel.org/r/1535337230-13222-1-git-send-email-yamada.masahiro@socionext.com
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      21bfc830
    • Jann Horn's avatar
      reiserfs: propagate errors from fill_with_dentries() properly · b10298d5
      Jann Horn authored
      
      
      fill_with_dentries() failed to propagate errors up to
      reiserfs_for_each_xattr() properly.  Plumb them through.
      
      Note that reiserfs_for_each_xattr() is only used by
      reiserfs_delete_xattrs() and reiserfs_chown_xattrs().  The result of
      reiserfs_delete_xattrs() is discarded anyway, the only difference there is
      whether a warning is printed to dmesg.  The result of
      reiserfs_chown_xattrs() does matter because it can block chowning of the
      file to which the xattrs belong; but either way, the resulting state can
      have misaligned ownership, so my patch doesn't improve things greatly.
      
      Credit for making me look at this code goes to Al Viro, who pointed out
      that the ->actor calling convention is suboptimal and should be changed.
      
      Link: http://lkml.kernel.org/r/20180802163335.83312-1-jannh@google.com
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Jeff Mahoney <jeffm@suse.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b10298d5
    • Colin Ian King's avatar
      fs/hfs/extent.c: fix array out of bounds read of array extent · 6c9a3f84
      Colin Ian King authored
      
      
      Currently extent and index i are both being incremented causing an array
      out of bounds read on extent[i].  Fix this by removing the extraneous
      increment of extent.
      
      Ernesto said:
      
      : This is only triggered when deleting a file with a resource fork.  I
      : may be wrong because the documentation isn't clear, but I don't think
      : you can create those under linux.  So I guess nobody was testing them.
      :
      : > A disk space leak, perhaps?
      :
      : That's what it looks like in general.  hfs_free_extents() won't do
      : anything if the block count doesn't add up, and the error will be
      : ignored.  Now, if the block count randomly does add up, we could see
      : some corruption.
      
      Detected by CoverityScan, CID#711541 ("Out of bounds read")
      
      Link: http://lkml.kernel.org/r/20180831140538.31566-1-colin.king@canonical.com
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Reviewed-by: default avatarErnesto A. Fernndez <ernesto.mnd.fernandez@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6c9a3f84
    • Ernesto A. Fernández's avatar
      hfs: update timestamp on truncate() · 8cd3cb50
      Ernesto A. Fernández authored
      
      
      The vfs takes care of updating mtime on ftruncate(), but on truncate() it
      must be done by the module.
      
      Link: http://lkml.kernel.org/r/e1611eda2985b672ed2d8677350b4ad8c2d07e8a.1539316825.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Reviewed-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8cd3cb50
    • Ernesto A. Fernández's avatar
      hfsplus: update timestamps on truncate() · dc8844aa
      Ernesto A. Fernández authored
      
      
      The vfs takes care of updating ctime and mtime on ftruncate(), but on
      truncate() it must be done by the module.
      
      This patch can be tested with xfstests generic/313.
      
      Link: http://lkml.kernel.org/r/9beb0913eea37288599e8e1b7cec8768fb52d1b8.1539316825.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Reviewed-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc8844aa
    • Ernesto A. Fernández's avatar
      hfs: fix return value of hfs_get_block() · 1267a07b
      Ernesto A. Fernández authored
      
      
      Direct writes to empty inodes fail with EIO.  The generic direct-io code
      is in part to blame (a patch has been submitted as "direct-io: allow
      direct writes to empty inodes"), but hfs is worse affected than the other
      filesystems because the fallback to buffered I/O doesn't happen.
      
      The problem is the return value of hfs_get_block() when called with
      !create.  Change it to be more consistent with the other modules.
      
      Link: http://lkml.kernel.org/r/4538ab8c35ea37338490525f0f24cbc37227528c.1539195310.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Reviewed-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1267a07b
    • Ernesto A. Fernández's avatar
      hfsplus: fix return value of hfsplus_get_block() · 839c3a6a
      Ernesto A. Fernández authored
      
      
      Direct writes to empty inodes fail with EIO.  The generic direct-io code
      is in part to blame (a patch has been submitted as "direct-io: allow
      direct writes to empty inodes"), but hfsplus is worse affected than the
      other filesystems because the fallback to buffered I/O doesn't happen.
      
      The problem is the return value of hfsplus_get_block() when called with
      !create.  Change it to be more consistent with the other modules.
      
      Link: http://lkml.kernel.org/r/2cd1301404ec7cf1e39c8f11a01a4302f1460ad6.1539195310.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Reviewed-by: default avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      839c3a6a
    • Ernesto A. Fernández's avatar
      hfs: prevent btree data loss on ENOSPC · 54640c75
      Ernesto A. Fernández authored
      
      
      Inserting a new record in a btree may require splitting several of its
      nodes.  If we hit ENOSPC halfway through, the new nodes will be left
      orphaned and their records will be lost.  This could mean lost inodes or
      extents.
      
      Henceforth, check the available disk space before making any changes.
      This still leaves the potential problem of corruption on ENOMEM.
      
      There is no need to reserve space before deleting a catalog record, as we
      do for hfsplus.  This difference is because hfs index nodes have fixed
      length keys.
      
      Link: http://lkml.kernel.org/r/ab5fc8a7d5ffccfd5f27b1cf2cb4ceb6c110da74.1536269131.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      54640c75
    • Ernesto A. Fernández's avatar
      hfsplus: prevent btree data loss on ENOSPC · d92915c3
      Ernesto A. Fernández authored
      
      
      Inserting or deleting a record in a btree may require splitting several of
      its nodes.  If we hit ENOSPC halfway through, the new nodes will be left
      orphaned and their records will be lost.  This could mean lost inodes,
      extents or xattrs.
      
      Henceforth, check the available disk space before making any changes.
      This still leaves the potential problem of corruption on ENOMEM.
      
      The patch can be tested with xfstests generic/027.
      
      Link: http://lkml.kernel.org/r/4596eef22fbda137b4ffa0272d92f0da15364421.1536269129.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d92915c3
    • Ernesto A. Fernández's avatar
      hfs: fix BUG on bnode parent update · ef75bcc5
      Ernesto A. Fernández authored
      
      
      hfs_brec_update_parent() may hit BUG_ON() if the first record of both a
      leaf node and its parent are changed, and if this forces the parent to
      be split.  It is not possible for this to happen on a valid hfs
      filesystem because the index nodes have fixed length keys.
      
      For reasons I ignore, the hfs module does have support for a number of
      hfsplus features.  A corrupt btree header may report variable length
      keys and trigger this BUG, so it's better to fix it.
      
      Link: http://lkml.kernel.org/r/cf9b02d57f806217a2b1bf5db8c3e39730d8f603.1535682463.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Viacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ef75bcc5
    • Ernesto A. Fernández's avatar
      hfs: prevent btree data loss on root split · d057c036
      Ernesto A. Fernández authored
      
      
      This bug is triggered whenever hfs_brec_update_parent() needs to split
      the root node.  The height of the btree is not increased, which leaves
      the new node orphaned and its records lost.  It is not possible for this
      to happen on a valid hfs filesystem because the index nodes have fixed
      length keys.
      
      For reasons I ignore, the hfs module does have support for a number of
      hfsplus features.  A corrupt btree header may report variable length
      keys and trigger this bug, so it's better to fix it.
      
      Link: http://lkml.kernel.org/r/9750b1415685c4adca10766895f6d5ef12babdb0.1535682463.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d057c036
    • Ernesto A. Fernández's avatar
      hfsplus: fix BUG on bnode parent update · 19a9d0f1
      Ernesto A. Fernández authored
      
      
      Creating, renaming or deleting a file may hit BUG_ON() if the first
      record of both a leaf node and its parent are changed, and if this
      forces the parent to be split.  This bug is triggered by xfstests
      generic/027, somewhat rarely; here is a more reliable reproducer:
      
        truncate -s 50M fs.iso
        mkfs.hfsplus fs.iso
        mount fs.iso /mnt
        i=1000
        while [ $i -le 2400 ]; do
          touch /mnt/$i &>/dev/null
          ((++i))
        done
        i=2400
        while [ $i -ge 1000 ]; do
          mv /mnt/$i /mnt/$(perl -e "print $i x61") &>/dev/null
          ((--i))
        done
      
      The issue is that a newly created bnode is being put twice.  Reset
      new_node to NULL in hfs_brec_update_parent() before reaching goto again.
      
      Link: http://lkml.kernel.org/r/5ee1db09b60373a15890f6a7c835d00e76bf601d.1535682461.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      19a9d0f1
    • Ernesto A. Fernández's avatar
      hfsplus: prevent btree data loss on root split · 0a3021d4
      Ernesto A. Fernández authored
      
      
      Creating, renaming or deleting a file may cause catalog corruption and
      data loss.  This bug is randomly triggered by xfstests generic/027, but
      here is a faster reproducer:
      
        truncate -s 50M fs.iso
        mkfs.hfsplus fs.iso
        mount fs.iso /mnt
        i=100
        while [ $i -le 150 ]; do
          touch /mnt/$i &>/dev/null
          ((++i))
        done
        i=100
        while [ $i -le 150 ]; do
          mv /mnt/$i /mnt/$(perl -e "print $i x82") &>/dev/null
          ((++i))
        done
        umount /mnt
        fsck.hfsplus -n fs.iso
      
      The bug is triggered whenever hfs_brec_update_parent() needs to split the
      root node.  The height of the btree is not increased, which leaves the new
      node orphaned and its records lost.
      
      Link: http://lkml.kernel.org/r/26d882184fc43043a810114258f45277752186c7.1535682461.git.ernesto.mnd.fernandez@gmail.com
      Signed-off-by: default avatarErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0a3021d4