1. 12 Mar, 2019 21 commits
    • Mike Rapoport's avatar
      sparc: add checks for the return value of memblock_alloc*() · b1e1c869
      Mike Rapoport authored
      Add panic() calls if memblock_alloc*() returns NULL.
      
      Most of the changes are simply addition of
      
              if(!ptr)
                      panic();
      
      statements after the calls to memblock_alloc*() variants.
      
      Exceptions are pcpu_populate_pte() and kernel_map_range() that were
      slightly refactored to accommodate the change.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-16-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      b1e1c869
    • Mike Rapoport's avatar
      ia64: add checks for the return value of memblock_alloc*() · d80db5c1
      Mike Rapoport authored
      Add panic() calls if memblock_alloc*() returns NULL.
      
      Most of the changes are simply addition of
      
      	if(!ptr)
      		panic();
      
      statements after the calls to memblock_alloc*() variants.
      
      Exceptions are create_mem_map_page_table() and ia64_log_init() that were
      slightly refactored to accommodate the change.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-15-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      d80db5c1
    • Mike Rapoport's avatar
      arch: don't memset(0) memory returned by memblock_alloc() · 0240dfd5
      Mike Rapoport authored
      memblock_alloc() already clears the allocated memory, no point in doing
      it twice.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-14-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>	[m68k]
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      0240dfd5
    • Mike Rapoport's avatar
      arch: use memblock_alloc() instead of memblock_alloc_from(size, align, 0) · 9415673e
      Mike Rapoport authored
      The last parameter of memblock_alloc_from() is the lower limit for the
      memory allocation.  When it is 0, the call is equivalent to
      memblock_alloc().
      
      Link: http://lkml.kernel.org/r/1548057848-15136-13-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS part
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      9415673e
    • Mike Rapoport's avatar
      memblock: make memblock_find_in_range_node() and choose_memblock_flags() static · c366ea89
      Mike Rapoport authored
      These functions are not used outside memblock.  Make them static.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-12-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      c366ea89
    • Mike Rapoport's avatar
      memblock: refactor internal allocation functions · 92d12f95
      Mike Rapoport authored
      Currently, memblock has several internal functions with overlapping
      functionality.  They all call memblock_find_in_range_node() to find free
      memory and then reserve the allocated range and mark it with kmemleak.
      However, there is difference in the allocation constraints and in
      fallback strategies.
      
      The allocations returning physical address first attempt to find free
      memory on the specified node within mirrored memory regions, then retry
      on the same node without the requirement for memory mirroring and
      finally fall back to all available memory.
      
      The allocations returning virtual address start with clamping the
      allowed range to memblock.current_limit, attempt to allocate from the
      specified node from regions with mirroring and with user defined minimal
      address.  If such allocation fails, next attempt is done with node
      restriction lifted.  Next, the allocation is retried with minimal
      address reset to zero and at last without the requirement for mirrored
      regions.
      
      Let's consolidate various fallbacks handling and make them more
      consistent for physical and virtual variants.  Most of the fallback
      handling is moved to memblock_alloc_range_nid() and it now handles node
      and mirror fallbacks.
      
      The memblock_alloc_internal() uses memblock_alloc_range_nid() to get a
      physical address of the allocated range and converts it to virtual
      address.
      
      The fallback for allocation below the specified minimal address remains
      in memblock_alloc_internal() because memblock_alloc_range_nid() is used
      by CMA with exact requirement for lower bounds.
      
      The memblock_phys_alloc_nid() function is completely dropped as it is not
      used anywhere outside memblock and its only usage can be replaced by a
      call to memblock_alloc_range_nid().
      
      [rppt@linux.ibm.com: fix parameter order in memblock_phys_alloc_try_nid()]
        Link: http://lkml.kernel.org/r/20190203113915.GC8620@rapoport-lnx
      Link: http://lkml.kernel.org/r/1548057848-15136-11-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Tested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      92d12f95
    • Mike Rapoport's avatar
      memblock: drop memblock_alloc_base() · 0ba9e6ed
      Mike Rapoport authored
      The memblock_alloc_base() function tries to allocate a memory up to the
      limit specified by its max_addr parameter and panics if the allocation
      fails.  Replace its usage with memblock_phys_alloc_range() and make the
      callers check the return value and panic in case of error.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-10-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au>		[powerpc]
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      0ba9e6ed
    • Mike Rapoport's avatar
      memblock: drop __memblock_alloc_base() · 42b46aef
      Mike Rapoport authored
      The __memblock_alloc_base() function tries to allocate a memory up to
      the limit specified by its max_addr parameter.  Depending on the value
      of this parameter, the __memblock_alloc_base() can is replaced with the
      appropriate memblock_phys_alloc*() variant.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-9-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      42b46aef
    • Mike Rapoport's avatar
      memblock: memblock_phys_alloc(): don't panic · ecc3e771
      Mike Rapoport authored
      Make the memblock_phys_alloc() function an inline wrapper for
      memblock_phys_alloc_range() and update the memblock_phys_alloc() callers
      to check the returned value and panic in case of error.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-8-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      ecc3e771
    • Mike Rapoport's avatar
      memblock: memblock_phys_alloc_try_nid(): don't panic · 33755574
      Mike Rapoport authored
      The memblock_phys_alloc_try_nid() function tries to allocate memory from
      the requested node and then falls back to allocation from any node in
      the system.  The memblock_alloc_base() fallback used by this function
      panics if the allocation fails.
      
      Replace the memblock_alloc_base() fallback with the direct call to
      memblock_alloc_range_nid() and update the memblock_phys_alloc_try_nid()
      callers to check the returned value and panic in case of error.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-7-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au>		[powerpc]
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      33755574
    • Mike Rapoport's avatar
      memblock: emphasize that memblock_alloc_range() returns a physical address · 8a770c2a
      Mike Rapoport authored
      Rename memblock_alloc_range() to memblock_phys_alloc_range() to
      emphasize that it returns a physical address.
      
      While on it, remove the 'enum memblock_flags' parameter from this
      function as its only user anyway sets it to MEMBLOCK_NONE, which is the
      default for the most of memblock allocations.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-6-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      8a770c2a
    • Mike Rapoport's avatar
      memblock: drop memblock_alloc_base_nid() · 53d818d2
      Mike Rapoport authored
      memblock_alloc_base_nid() is a oneliner wrapper for
      memblock_alloc_range_nid() without any side effect.
      
      Replace it's usage by the direct calls to memblock_alloc_range_nid().
      
      Link: http://lkml.kernel.org/r/1548057848-15136-5-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      53d818d2
    • Mike Rapoport's avatar
      memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc · f240ec09
      Mike Rapoport authored
      The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
      and memblock_phys_alloc(size, align) are equivalent as both try to
      allocate 'size' bytes with 'align' alignment anywhere in the memory and
      panic if hte allocation fails.
      
      The conversion is done using the following semantic patch:
      
        @@
        expression size, align;
        @@
        - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
        + memblock_phys_alloc(size, align)
      
      Link: http://lkml.kernel.org/r/1548057848-15136-4-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      f240ec09
    • Christophe Leroy's avatar
      powerpc: use memblock functions returning virtual address · 1269f7b8
      Christophe Leroy authored
      Since only the virtual address of allocated blocks is used, lets use
      functions returning directly virtual address.
      
      Those functions have the advantage of also zeroing the block.
      
      [rppt@linux.ibm.com: powerpc: remove duplicated alloc_stack() function]
        Link: http://lkml.kernel.org/r/20190226064032.GA5873@rapoport-lnx
      [rppt@linux.ibm.com: updated error message in alloc_stack() to be more verbose]
      [rppt@linux.ibm.com: convereted several additional call sites ]
      Link: http://lkml.kernel.org/r/1548057848-15136-3-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      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>
      1269f7b8
    • Mike Rapoport's avatar
      openrisc: prefer memblock APIs returning virtual address · fb054d0d
      Mike Rapoport authored
      Patch series "Refine memblock API", v2.
      
      Current memblock API is quite extensive and, which is more annoying,
      duplicated.  Except the low-level functions that allow searching for a
      free memory region and marking it as reserved, memblock provides three
      (well, two and a half) sets of functions to allocate memory.
      
      There are several overlapping functions that return a physical address
      and there are functions that return virtual address.  Those that return
      the virtual address may also clear the allocated memory.  And, on top of
      all that, some allocators panic and some return NULL in case of error.
      
      This set tries to reduce the mess, and trim down the amount of memblock
      allocation methods.
      
      Patches 1-10 consolidate the functions that return physical address of
      the allocated memory
      
      Patches 11-13 are some trivial cleanups
      
      Patches 14-19 add checks for the return value of memblock_alloc*() and
      panics in case of errors.  The patches 14-18 include some minor
      refactoring to have better readability of the resulting code and patch
      19 is a mechanical addition of
      
      	if (!ptr)
      		panic();
      
      after memblock_alloc*() calls.
      
      And, finally, patches 20 and 21 remove panic() calls memblock and
      _nopanic variants from memblock.
      
      This patch (of 21):
      
      The allocation of the page tables memory in openrics uses
      memblock_phys_alloc() and then converts the returned physical address to
      virtual one.  Use memblock_alloc_raw() and add a panic() if the
      allocation fails.
      
      Link: http://lkml.kernel.org/r/1548057848-15136-2-git-send-email-rppt@linux.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarStafford Horne <shorne@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dennis Zhou <dennis@kernel.org>
      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: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Guo Ren <ren_guo@c-sky.com>				[c-sky]
      Cc: Juergen Gross <jgross@suse.com>			[Xen]
      Cc: Rob Herring <robh@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fb054d0d
    • Alexey Dobriyan's avatar
      proc: calculate end pointer for /proc/*/* lookup at compile time · d5a572a4
      Alexey Dobriyan authored
      Compilers like to transform loops like
      
      	for (i = 0; i < n; i++) {
      		[use p[i]]
      	}
      
      into
      	for (p = p0; p < end; p++) {
      		...
      	}
      
      Do it by hand, so that it results in overall simpler loop
      and smaller code.
      
      Space savings:
      
      	$ ./scripts/bloat-o-meter ../vmlinux-001 ../obj/vmlinux
      	add/remove: 0/0 grow/shrink: 2/1 up/down: 4/-9 (-5)
      	Function                                     old     new   delta
      	proc_tid_base_lookup                          17      19      +2
      	proc_tgid_base_lookup                         17      19      +2
      	proc_pident_lookup                           179     170      -9
      
      The same could be done to proc_pident_readdir(), but the code becomes
      bigger for some reason.
      
      [sfr@canb.auug.org.au: merge fix for proc_pident_lookup() API change]
        Link: http://lkml.kernel.org/r/20190131160135.4a8ae70b@canb.auug.org.au
      Link: http://lkml.kernel.org/r/20190114200422.GB9680@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: James Morris <jmorris@namei.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d5a572a4
    • Nikolay Borisov's avatar
      mm: refactor readahead defines in mm.h · b5420237
      Nikolay Borisov authored
      All users of VM_MAX_READAHEAD actually convert it to kbytes and then to
      pages. Define the macro explicitly as (SZ_128K / PAGE_SIZE). This
      simplifies the expression in every filesystem. Also rename the macro to
      VM_READAHEAD_PAGES to properly convey its meaning. Finally remove unused
      VM_MIN_READAHEAD
      
      [akpm@linux-foundation.org: fix fs/io_uring.c, per Stephen]
      Link: http://lkml.kernel.org/r/20181221144053.24318-1-nborisov@suse.comSigned-off-by: default avatarNikolay Borisov <nborisov@suse.com>
      Reviewed-by: default avatarMatthew Wilcox <willy@infradead.org>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Dominique Martinet <asmadeus@codewreck.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Chris Mason <clm@fb.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: David Sterba <dsterba@suse.com>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b5420237
    • Souptick Joarder's avatar
      mm/hmm: convert to use vm_fault_t · b57e622e
      Souptick Joarder authored
      Convert to use vm_fault_t type as return type for fault handler.
      
      kbuild reported warning during testing of
      *mm-create-the-new-vm_fault_t-type.patch* available in below link -
      https://patchwork.kernel.org/patch/10752741/
      
        kernel/memremap.c:46:34: warning: incorrect type in return expression
                                 (different base types)
        kernel/memremap.c:46:34: expected restricted vm_fault_t
        kernel/memremap.c:46:34: got int
      
      This patch has fixed the warnings and also hmm_devmem_fault() is
      converted to return vm_fault_t to avoid further warnings.
      
      [sfr@canb.auug.org.au: drm/nouveau/dmem: update for struct hmm_devmem_ops member change]
        Link: http://lkml.kernel.org/r/20190220174407.753d94e5@canb.auug.org.au
      Link: http://lkml.kernel.org/r/20190110145900.GA1317@jordon-HP-15-Notebook-PCSigned-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Reviewed-by: default avatarJérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b57e622e
    • Zev Weiss's avatar
      kernel/sysctl.c: define minmax conv functions in terms of non-minmax versions · 2bc4fc60
      Zev Weiss authored
      do_proc_do[u]intvec_minmax_conv() had included open-coded versions of
      do_proc_do[u]intvec_conv(); the duplication led to buggy inconsistencies
      (missing range checks).  To reduce the likelihood of such problems in the
      future, we can instead refactor both to be defined in terms of their
      non-bounded counterparts (plus the added check).
      
      Link: http://lkml.kernel.org/r/20190207165138.5oud57vq4ozwb4kh@hatter.bewilderbeest.netSigned-off-by: default avatarZev Weiss <zev@bewilderbeest.net>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2bc4fc60
    • Zev Weiss's avatar
      kernel/sysctl.c: add missing range check in do_proc_dointvec_minmax_conv · 8cf7630b
      Zev Weiss authored
      This bug has apparently existed since the introduction of this function
      in the pre-git era (4500e917 in Thomas Gleixner's history.git,
      "[NET]: Add proc_dointvec_userhz_jiffies, use it for proper handling of
      neighbour sysctls.").
      
      As a minimal fix we can simply duplicate the corresponding check in
      do_proc_dointvec_conv().
      
      Link: http://lkml.kernel.org/r/20190207123426.9202-3-zev@bewilderbeest.netSigned-off-by: default avatarZev Weiss <zev@bewilderbeest.net>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: <stable@vger.kernel.org>	[2.6.2+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8cf7630b
    • Zev Weiss's avatar
      tools/testing/selftests/sysctl/sysctl.sh: add tests for >32-bit values written to 32-bit integers · fec52486
      Zev Weiss authored
      Patch series "sysctl: fix range-checking in do_proc_dointvec_minmax_conv()", v2.
      
      After being left with an unusable system after a typo executing
      something like 'echo $((1<<24)) > /proc/sys/vm/max_map_count', I found
      that do_proc_dointvec_minmax_conv() was missing a check to ensure that
      the converted value actually fits in an int.
      
      The first of the following patches enhances the sysctl selftest such
      that it detects this problem; the second provides a minimal fix
      (suitable for -stable) such that the selftest passes.  The third patch
      then performs a more thorough refactoring to eliminate the code
      duplication that led to the bug in the first place (maintaining the
      passing status of the selftest).
      
      This patch (of 3):
      
      At present this exposes a bug in do_proc_dointvec_minmax_conv() (it
      fails to check for values that are too wide to fit in an int).
      
      Link: http://lkml.kernel.org/r/20190207123426.9202-2-zev@bewilderbeest.netSigned-off-by: default avatarZev Weiss <zev@bewilderbeest.net>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fec52486
  2. 11 Mar, 2019 9 commits
    • Linus Torvalds's avatar
      Merge tag 'linux-watchdog-5.1-rc1' of git://www.linux-watchdog.org/linux-watchdog · a089e4fe
      Linus Torvalds authored
      Pull watchdog updates from Wim Van Sebroeck:
      
       - a new watchdog driver for the Mellanox systems
      
       - renesas-wdt: Document r8a77470 support
      
       - numerous 'Mark expected switch fall-throughs'
      
       - qcom: Add suspend/resume support
      
       - some small fixes and documentation updates
      
      * tag 'linux-watchdog-5.1-rc1' of git://www.linux-watchdog.org/linux-watchdog:
        watchdog: w83877f_wdt: Mark expected switch fall-through
        watchdog: sc520_wdt: Mark expected switch fall-through
        watchdog: sbc60xxwdt: Mark expected switch fall-through
        watchdog: smsc37b787_wdt: Mark expected switch fall-through
        watchdog: sc1200: Mark expected switch fall-through
        watchdog: pc87413: Mark expected switch fall-through
        Documentation/watchdog: Add documentation mlx-wdt driver
        watchdog: mlx-wdt: introduce a watchdog driver for Mellanox systems.
        platform_data/mlxreg: additions for Mellanox watchdog driver.
        watchdog: Update sysfs documentation.
        watchdog: dw: remove useless pr_fmt
        watchdog: pika_wdt: drop pointless static qualifier in pikawdt_init
        watchdog/hpwdt: Update Kconfig documentation
        dt-bindings: watchdog: renesas-wdt: Document r8a77470 support
        watchdog: qcom: Add suspend/resume support
      a089e4fe
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · cf0240a7
      Linus Torvalds authored
      Pull pin control updates from Linus Walleij:
       "This is a calm cycle, not much happened this time around: not even
        much incremental development. Some three new drivers, that is all.
      
        No core changes.
      
        New drivers:
      
         - NXP (ex Freescale) i.MX 8QM driver.
      
         - NXP (ex Freescale) i.MX 8MM driver.
      
         - AT91 SAM9X60 subdriver.
      
        Improvements:
      
         - Support for external interrups (EINT) on Mediatek virtual GPIOs.
      
         - Make BCM2835 pin config fully generic.
      
         - Lots of Renesas SH-PFC incremental improvements"
      
      * tag 'pinctrl-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (70 commits)
        pinctrl: imx: fix scu link errors
        dt-bindings: pinctrl: Document the i.MX50 IOMUXC binding
        pinctrl: qcom: spmi-gpio: Reorder debug print
        pinctrl: nomadik: fix possible object reference leak
        pinctrl: stm32: return error upon hwspinlock failure
        pinctrl: stm32: fix memory leak issue
        pinctrl: sh-pfc: r8a77965: Add DRIF pins, groups and functions
        pinctrl: sh-pfc: r8a77965: Add TMU pins, groups and functions
        pinctrl: sh-pfc: Validate fixed-size field widths at build time
        pinctrl: sh-pfc: sh73a0: Fix fsic_spdif pin groups
        pinctrl: sh-pfc: r8a7792: Fix vin1_data18_b pin group
        pinctrl: sh-pfc: r8a7791: Fix scifb2_data_c pin group
        pinctrl: sh-pfc: emev2: Add missing pinmux functions
        pinctrl: sunxi: Support I/O bias voltage setting on A80
        pinctrl: ingenic: Add LCD pins for the JZ4725B SoC
        pinctrl: samsung: Remove legacy API for handling external wakeup interrupts mask
        pinctrl: bcm2835: Direct GPIO config changes to generic pinctrl
        pinctrl: bcm2835: declare pin config as generic
        pinctrl: qcom: qcs404: Drop unused UFS_RESET macro
        dt-bindings: add documentation for slew rate
        ...
      cf0240a7
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 4f023706
      Linus Torvalds authored
      Pull input updates from Dmitry Torokhov:
      
       - update the ili210x touchscreen driver, refreshing the code and adding
         support for ILI251X line
      
       - add support for st1633 to the st1232 touchscreen driver
      
       - add support for sx8650 to the the sx8654 touchscreen driver
      
       - add support for Evervision FT5726 to the edt-ft5x06 touchscreen
         driver
      
       - add support for gt5688 to the Goodix touchscreen driver
      
       - new vibrator driver for MSM SOCs
      
       - miscellaneous fixes for the rest of input drivers
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (53 commits)
        Input: wacom_serial4 - add support for Wacom ArtPad II tablet
        Input: elan_i2c - add id for touchpad found in Lenovo s21e-20
        Input: raspberrypi-ts - select CONFIG_INPUT_POLLDEV
        Input: msm-vibrator - use correct gpio header
        Input: ti_am335x_tsc - remove set but not used variable 'tscadc_dev'
        Input: i8042 - rework DT node name comparisons
        Input: goodix - print values in case of inconsistencies
        Input: goodix - refer to touchscreen.txt in device tree bindings
        Input: goodix - support Goodix gt5688
        Input: synaptics_i2c - remove redundant spinlock
        Input: db9 - mark expected switch fall-through
        Input: qt2160 - remove redundant spinlock
        Input: st1232 - handle common DT bindings
        Input: ims-pcu - switch to using brightness_set_blocking()
        Input: st1232 - switch to gpiod API
        Input: ili210x - fetch touchscreen geometry from DT
        Input: msm-vibrator - tweak an error message
        Input: tm2-touchkey - acknowledge that setting brightness is a blocking call
        Input: stmfts - acknowledge that setting brightness is a blocking call
        Input: ili210x - switch to using devm_device_add_group()
        ...
      4f023706
    • Linus Torvalds's avatar
      tools: mark 'test_vmalloc.sh' executable · 6bc3fe8e
      Linus Torvalds authored
      Several of these scripts have come in as old-fashioned patches, and in
      the process lost the executable bit.  In most cases it doesn't matter,
      since the test infrastructure will explicitly execute them using the
      proper shell interpreter, but at least in the case of the new vmalloc
      test, the lack of execurable bit caused the test to fail with
      
          ./run_vmtests: line 217: ./test_vmalloc.sh: Permission denied
      
      because of the lacking exectuable permissions bit.
      
      This patch fixes that up.
      
      NOTE! A simple script to look for non-executable scripts in the kernel,
      something like
      
          git ls-files --stage -- '*.sh' |
              grep 100644 |
              cut -f2 |
              xargs grep -l '#!'
      
      will show that there's a lot of other files that _look_ like executable
      shell scripts, but don't have the executable bit set.  I considered just
      scripting them all to be executable, but since it looks like the common
      pattern is to not really require it, I'm just doing the minimal fix as
      pointed out by the kernel test robot.
      
      Fixes: a05ef00c ("selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE")
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Uladzislau Rezki <urezki@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6bc3fe8e
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide · bc119dd9
      Linus Torvalds authored
      Pull IDE updates from David Miller:
       "Nothing super exciting as usual:
      
        1) Switch fallthrus from Gustavo A. R. Silva
      
        2) Kconfig formatting cleanup from Enrico Weigelt
      
        3) OF interface adjustment from Rob Herring"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
        drivers: ide: Kconfig: pedantic formatting
        ide: mark expected switch fall-through
        ide: hpt366: mark expected switch fall-throughs
        ide: Use of_node_name_eq for node name comparisons
      bc119dd9
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 8f49a658
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "First batch of fixes in the new merge window:
      
         1) Double dst_cache free in act_tunnel_key, from Wenxu.
      
         2) Avoid NULL deref in IN_DEV_MFORWARD() by failing early in the
            ip_route_input_rcu() path, from Paolo Abeni.
      
         3) Fix appletalk compile regression, from Arnd Bergmann.
      
         4) If SLAB objects reach the TCP sendpage method we are in serious
            trouble, so put a debugging check there. From Vasily Averin.
      
         5) Memory leak in hsr layer, from Mao Wenan.
      
         6) Only test GSO type on GSO packets, from Willem de Bruijn.
      
         7) Fix crash in xsk_diag_put_umem(), from Eric Dumazet.
      
         8) Fix VNIC mailbox length in nfp, from Dirk van der Merwe.
      
         9) Fix race in ipv4 route exception handling, from Xin Long.
      
        10) Missing DMA memory barrier in hns3 driver, from Jian Shen.
      
        11) Use after free in __tcf_chain_put(), from Vlad Buslov.
      
        12) Handle inet_csk_reqsk_queue_add() failures, from Guillaume Nault.
      
        13) Return value correction when ip_mc_may_pull() fails, from Eric
            Dumazet.
      
        14) Use after free in x25_device_event(), also from Eric"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (72 commits)
        gro_cells: make sure device is up in gro_cells_receive()
        vxlan: test dev->flags & IFF_UP before calling gro_cells_receive()
        net/x25: fix use-after-free in x25_device_event()
        isdn: mISDNinfineon: fix potential NULL pointer dereference
        net: hns3: fix to stop multiple HNS reset due to the AER changes
        ip: fix ip_mc_may_pull() return value
        net: keep refcount warning in reqsk_free()
        net: stmmac: Avoid one more sometimes uninitialized Clang warning
        net: dsa: mv88e6xxx: Set correct interface mode for CPU/DSA ports
        rxrpc: Fix client call queueing, waiting for channel
        tcp: handle inet_csk_reqsk_queue_add() failures
        net: ethernet: sun: Zero initialize class in default case in niu_add_ethtool_tcam_entry
        8139too : Add support for U.S. Robotics USR997901A 10/100 Cardbus NIC
        fou, fou6: avoid uninit-value in gue_err() and gue6_err()
        net: sched: fix potential use-after-free in __tcf_chain_put()
        vhost: silence an unused-variable warning
        vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
        connector: fix unsafe usage of ->real_parent
        vxlan: do not need BH again in vxlan_cleanup()
        net: hns3: add dma_rmb() for rx description
        ...
      8f49a658
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · ffd602eb
      Linus Torvalds authored
      Pull Kbuild updates from Masahiro Yamada:
      
       - do not generate unneeded top-level built-in.a
      
       - let git ignore O= directory entirely
      
       - optimize scripts/kallsyms slightly
      
       - exclude DWARF info from *.s regardless of config options
      
       - fix GCC toolchain search path for Clang to prepare ld.lld support
      
       - do not generate modules.order when CONFIG_MODULES is disabled
      
       - simplify single target rules and remove VPATH for external module
         build
      
       - allow to add optional flags to dpkg-buildpackage when building
         deb-pkg
      
       - move some compiler option tests from Makefile to Kconfig
      
       - various Makefile cleanups
      
      * tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits)
        kbuild: remove scripts/basic/% build target
        kbuild: use -Werror=implicit-... instead of -Werror-implicit-...
        kbuild: clean up scripts/gcc-version.sh
        kbuild: remove cc-version macro
        kbuild: update comment block of scripts/clang-version.sh
        kbuild: remove commented-out INITRD_COMPRESS
        kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig
        kbuild: [bin]deb-pkg: add DPKG_FLAGS variable
        kbuild: move ".config not found!" message from Kconfig to Makefile
        kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing
        kbuild: simplify single target rules
        kbuild: remove empty rules for makefiles
        kbuild: make -r/-R effective in top Makefile for old Make versions
        kbuild: move tools_silent to a more relevant place
        kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig
        kbuild: refactor cc-cross-prefix implementation
        kbuild: hardcode genksyms path and remove GENKSYMS variable
        scripts/gdb: refactor rules for symlink creation
        kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target
        scripts/gdb: do not descend into scripts/gdb from scripts
        ...
      ffd602eb
    • Linus Torvalds's avatar
      Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 5af7f115
      Linus Torvalds authored
      Pull tpm updates from James Morris:
      
       - Clean up the transmission flow
      
         Cleaned up the whole transmission flow. Locking of the chip is now
         done in the level of tpm_try_get_ops() and tpm_put_ops() instead
         taking the chip lock inside tpm_transmit(). The nested calls inside
         tpm_transmit(), used with the resource manager, have been refactored
         out.
      
         Should make easier to perform more complex transactions with the TPM
         without making the subsystem a bigger mess (e.g. encrypted channel
         patches by James Bottomley).
      
       - PPI 1.3 support
      
         TPM PPI 1.3 introduces an additional optional command parameter that
         may be needed for some commands. Display the parameter if the command
         requires such a parameter. Only command 23 (SetPCRBanks) needs one.
      
         The PPI request file will show output like this then:
      
            # echo "23 16" > request
            # cat request
            23 16
      
            # echo "5" > request
            # cat request
            5
      
       - Extend all PCR banks in IMA
      
         Instead of static PCR banks array, the array of available PCR banks
         is now allocated dynamically. The digests sizes are determined
         dynamically using a probe PCR read without relying crypto's static
         list of hash algorithms.
      
         This should finally make sealing of measurements in IMA safe and
         secure.
      
       - TPM 2.0 selftests
      
         Added a test suite to tools/testing/selftests/tpm2 previously outside
         of the kernel tree: https://github.com/jsakkine-intel/tpm2-scripts
      
      * 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (37 commits)
        tpm/ppi: Enable submission of optional command parameter for PPI 1.3
        tpm/ppi: Possibly show command parameter if TPM PPI 1.3 is used
        tpm/ppi: Display up to 101 operations as define for version 1.3
        tpm/ppi: rename TPM_PPI_REVISION_ID to TPM_PPI_REVISION_ID_1
        tpm/ppi: pass function revision ID to tpm_eval_dsm()
        tpm: pass an array of tpm_extend_digest structures to tpm_pcr_extend()
        KEYS: trusted: explicitly use tpm_chip structure from tpm_default_chip()
        tpm: move tpm_chip definition to include/linux/tpm.h
        tpm: retrieve digest size of unknown algorithms with PCR read
        tpm: rename and export tpm2_digest and tpm2_algorithms
        tpm: dynamically allocate the allocated_banks array
        tpm: remove @flags from tpm_transmit()
        tpm: take TPM chip power gating out of tpm_transmit()
        tpm: introduce tpm_chip_start() and tpm_chip_stop()
        tpm: remove TPM_TRANSMIT_UNLOCKED flag
        tpm: use tpm_try_get_ops() in tpm-sysfs.c.
        tpm: remove @space from tpm_transmit()
        tpm: move TPM space code out of tpm_transmit()
        tpm: move tpm_validate_commmand() to tpm2-space.c
        tpm: clean up tpm_try_transmit() error handling flow
        ...
      5af7f115
    • Linus Torvalds's avatar
      Merge branch 'next-integrity' of... · c3665a6b
      Linus Torvalds authored
      Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
      
      Pull integrity updates from James Morris:
       "Mimi Zohar says:
      
         'Linux 5.0 introduced the platform keyring to allow verifying the IMA
          kexec kernel image signature using the pre-boot keys. This pull
          request similarly makes keys on the platform keyring accessible for
          verifying the PE kernel image signature.
      
          Also included in this pull request is a new IMA hook that tags tmp
          files, in policy, indicating the file hash needs to be calculated.
          The remaining patches are cleanup'"
      
      * 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        evm: Use defined constant for UUID representation
        ima: define ima_post_create_tmpfile() hook and add missing call
        evm: remove set but not used variable 'xattr'
        encrypted-keys: fix Opt_err/Opt_error = -1
        kexec, KEYS: Make use of platform keyring for signature verify
        integrity, KEYS: add a reference to platform keyring
      c3665a6b
  3. 10 Mar, 2019 10 commits
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 12ad143e
      Linus Torvalds authored
      Pull perf updates from Thomas Gleixner:
       "Perf updates and fixes:
      
        Kernel:
         - Handle events which have the bpf_event attribute set as side band
           events as they carry information about BPF programs.
         - Add missing switch-case fall-through comments
      
        Libraries:
         - Fix leaks and double frees in error code paths.
         - Prevent buffer overflows in libtraceevent
      
        Tools:
         - Improvements in handling Intel BT/PTS
         - Add BTF ELF markers to perf trace BPF programs to improve output
         - Support --time, --cpu, --pid and --tid filters for perf diff
         - Calculate the column width in perf annotate as the hardcoded 6
           characters for the instruction are not sufficient
         - Small fixes all over the place"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (38 commits)
        perf/core: Mark expected switch fall-through
        perf/x86/intel/uncore: Fix client IMC events return huge result
        perf/ring_buffer: Use high order allocations for AUX buffers optimistically
        perf data: Force perf_data__open|close zero data->file.path
        perf session: Fix double free in perf_data__close
        perf evsel: Probe for precise_ip with simple attr
        perf tools: Read and store caps/max_precise in perf_pmu
        perf hist: Fix memory leak of srcline
        perf hist: Add error path into hist_entry__init
        perf c2c: Fix c2c report for empty numa node
        perf script python: Add Python3 support to intel-pt-events.py
        perf script python: Add Python3 support to event_analyzing_sample.py
        perf script python: add Python3 support to check-perf-trace.py
        perf script python: Add Python3 support to futex-contention.py
        perf script python: Remove mixed indentation
        perf diff: Support --pid/--tid filter options
        perf diff: Support --cpu filter option
        perf diff: Support --time filter option
        perf thread: Generalize function to copy from thread addr space from intel-bts code
        perf annotate: Calculate the max instruction name, align column to that
        ...
      12ad143e
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 262d6a9a
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of fixes for x86:
      
         - Make the unwinder more robust when it encounters a NULL pointer
           call, so the backtrace becomes more useful
      
         - Fix the bogus ORC unwind table alignment
      
         - Prevent kernel panic during kexec on HyperV caused by a cleared but
           not disabled hypercall page.
      
         - Remove the now pointless stacksize increase for KASAN_EXTRA, as
           KASAN_EXTRA is gone.
      
         - Remove unused variables from the x86 memory management code"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/hyperv: Fix kernel panic when kexec on HyperV
        x86/mm: Remove unused variable 'old_pte'
        x86/mm: Remove unused variable 'cpu'
        Revert "x86_64: Increase stack size for KASAN_EXTRA"
        x86/unwind: Add hardcoded ORC entry for NULL
        x86/unwind: Handle NULL pointer calls better in frame unwinder
        x86/unwind/orc: Fix ORC unwind table alignment
      262d6a9a
    • Linus Torvalds's avatar
      Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b6e3cb4e
      Linus Torvalds authored
      Pull x86 boot fix from Thomas Gleixner:
       "A trivial fix for the previous x86/boot pull request which did not
        make it in time"
      
      * 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/boot/KASLR: Always return a value from process_mem_region
      b6e3cb4e
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a15f6b92
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "A single fix to prevent a unmet dependencies warning in Kconfig"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        time: Make VIRT_CPU_ACCOUNTING_GEN depend on GENERIC_CLOCKEVENTS
      a15f6b92
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9e55f87c
      Linus Torvalds authored
      Pull locking fixes from Thomas Gleixner:
       "A few fixes for lockdep:
      
         - initialize lockdep internal RCU head after initializing RCU
      
         - prevent use after free in a alloc_workqueue() error handling path
      
         - plug a memory leak in the workqueue core which fails to free a
           dynamically allocated lock name.
      
         - make Clang happy"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        workqueue, lockdep: Fix a memory leak in wq->lock_name
        workqueue, lockdep: Fix an alloc_workqueue() error path
        locking/lockdep: Only call init_rcu_head() after RCU has been initialized
        locking/lockdep: Avoid a Clang warning
      9e55f87c
    • Linus Torvalds's avatar
      Merge branch 'core-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 077d3daf
      Linus Torvalds authored
      Pull watchdog core update from Thomas Gleixner:
       "A single commit adding a command line parameter which allows to set
        the watchdog threshold on the kernel command-line, so kernels with
        massive debug facilities enabled won't trigger the watchdog during
        early boot and before the threshold can be changed via sysctl"
      
      * 'core-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        watchdog/core: Add watchdog_thresh command line parameter
      077d3daf
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.1-1' of git://git.infradead.org/linux-platform-drivers-x86 · dbbdf54c
      Linus Torvalds authored
      Pull x86 platform driver updates from Darren Hart:
      
       - use MODULE_DEVICE_TABLE across several wmi drivers, keeping
         wmi_device_id and MODULE_ALIAS() declarations in sync
      
       - add several Ideapad models to the no_hw_rfkill list
      
       - add support for new Mellanox platforms, including new fan and LED
         functionality
      
       - address Dell keyboard backlight change event and power button release
         issues
      
       - update dell_rbu to use appropriate memory allocation mechanisms
      
       - several small fixes and Ice Lake support for intel_pmc_core
      
       - fix a suspend regression for Cherry Trail based devices in
         intel_int0002_vgpio
      
       - a few other routine fixes
      
      * tag 'platform-drivers-x86-v5.1-1' of git://git.infradead.org/linux-platform-drivers-x86: (50 commits)
        MAINTAINERS: Include mlxreg.h in Mellanox Platform Driver files
        platform/x86: ideapad-laptop: Add S130-14IGM to no_hw_rfkill list
        platform/x86: mlx-platform: Fix access mode for fan_dir attribute
        platform/x86: mlx-platform: Add UID LED for the next generation systems
        platform/x86: mlx-platform: Add extra CPLD for next generation systems
        platform/x86: wmi-bmof: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: intel-wmi-thunderbolt: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: huawei-wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: dell-wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: dell-wmi-descriptor: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: dell-smbios-wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()
        platform/x86: wmi: add WMI support to MODULE_DEVICE_TABLE()
        platform/x86: wmi: move struct wmi_device_id to mod_devicetable.h
        modpost: file2alias: define size of alias
        platform/x86: touchscreen_dmi: Add info for the CHUWI Hi10 Air tablet
        platform/x86: ideapad-laptop: Add Ideapad 530S-14ARR to no_hw_rfkill list
        platform/x86: ideapad-laptop: Add Yoga C930 to no_hw_rfkill_list
        platform/x86: intel_pmc_core: Quirk to ignore XTAL shutdown
        platform/x86: intel_pmc_core: Add Package cstates residency info
        platform/x86: intel_pmc_core: Add ICL platform support
        ...
      dbbdf54c
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 45ba8d5d
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
       "Several fixes, most notably fix for virtio on swiotlb systems"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost: silence an unused-variable warning
        virtio: hint if callbacks surprisingly might sleep
        virtio-ccw: wire up ->bus_name callback
        s390/virtio: handle find on invalid queue gracefully
        virtio-ccw: diag 500 may return a negative cookie
        virtio_balloon: remove the unnecessary 0-initialization
        virtio-balloon: improve update_balloon_size_func
        virtio-blk: Consider virtio_max_dma_size() for maximum segment size
        virtio: Introduce virtio_max_dma_size()
        dma: Introduce dma_max_mapping_size()
        swiotlb: Add is_swiotlb_active() function
        swiotlb: Introduce swiotlb_max_mapping_size()
      45ba8d5d
    • Linus Torvalds's avatar
      Merge tag 'iommu-updates-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · bb97be23
      Linus Torvalds authored
      Pull IOMMU updates from Joerg Roedel:
      
       - A big cleanup and optimization patch-set for the Tegra GART driver
      
       - Documentation updates and fixes for the IOMMU-API
      
       - Support for page request in Intel VT-d scalable mode
      
       - Intel VT-d dma_[un]map_resource() support
      
       - Updates to the ATS enabling code for PCI (acked by Bjorn) and Intel
         VT-d to align with the latest version of the ATS spec
      
       - Relaxed IRQ source checking in the Intel VT-d driver for some aliased
         devices, needed for future devices which send IRQ messages from more
         than on request-ID
      
       - IRQ remapping driver for Hyper-V
      
       - Patches to make generic IOVA and IO-Page-Table code usable outside of
         the IOMMU code
      
       - Various other small fixes and cleanups
      
      * tag 'iommu-updates-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (60 commits)
        iommu/vt-d: Get domain ID before clear pasid entry
        iommu/vt-d: Fix NULL pointer reference in intel_svm_bind_mm()
        iommu/vt-d: Set context field after value initialized
        iommu/vt-d: Disable ATS support on untrusted devices
        iommu/mediatek: Fix semicolon code style issue
        MAINTAINERS: Add Hyper-V IOMMU driver into Hyper-V CORE AND DRIVERS scope
        iommu/hyper-v: Add Hyper-V stub IOMMU driver
        x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available
        PCI/ATS: Add inline to pci_prg_resp_pasid_required()
        iommu/vt-d: Check identity map for hot-added devices
        iommu: Fix IOMMU debugfs fallout
        iommu: Document iommu_ops.is_attach_deferred()
        iommu: Document iommu_ops.iotlb_sync_map()
        iommu/vt-d: Enable ATS only if the device uses page aligned address.
        PCI/ATS: Add pci_ats_page_aligned() interface
        iommu/vt-d: Fix PRI/PASID dependency issue.
        PCI/ATS: Add pci_prg_resp_pasid_required() interface.
        iommu/vt-d: Allow interrupts from the entire bus for aliased devices
        iommu/vt-d: Add helper to set an IRTE to verify only the bus number
        iommu: Fix flush_tlb_all typo
        ...
      bb97be23
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.1' of git://git.infradead.org/users/hch/dma-mapping · b7a7d1c1
      Linus Torvalds authored
      Pull DMA mapping updates from Christoph Hellwig:
      
       - add debugfs support for dumping dma-debug information (Corentin
         Labbe)
      
       - Kconfig cleanups (Andy Shevchenko and me)
      
       - debugfs cleanups (Greg Kroah-Hartman)
      
       - improve dma_map_resource and use it in the media code
      
       - arch_setup_dma_ops / arch_teardown_dma_ops cleanups
      
       - various small cleanups and improvements for the per-device coherent
         allocator
      
       - make the DMA mask an upper bound and don't fail "too large" dma mask
         in the remaning two architectures - this will allow big driver
         cleanups in the following merge windows
      
      * tag 'dma-mapping-5.1' of git://git.infradead.org/users/hch/dma-mapping: (21 commits)
        Documentation/DMA-API-HOWTO: update dma_mask sections
        sparc64/pci_sun4v: allow large DMA masks
        sparc64/iommu: allow large DMA masks
        sparc64: refactor the ali DMA quirk
        ccio: allow large DMA masks
        dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag
        dma-mapping: remove dma_mark_declared_memory_occupied
        dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig
        dma-mapping: improve selection of dma_declare_coherent availability
        dma-mapping: remove an incorrect __iommem annotation
        of: select OF_RESERVED_MEM automatically
        device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT
        mfd/sm501: depend on HAS_DMA
        dma-mapping: add a kconfig symbol for arch_teardown_dma_ops availability
        dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability
        dma-mapping: move debug configuration options to kernel/dma
        dma-debug: add dumping facility via debugfs
        dma: debug: no need to check return value of debugfs_create functions
        videobuf2: replace a layering violation with dma_map_resource
        dma-mapping: don't BUG when calling dma_map_resource on RAM
        ...
      b7a7d1c1