Skip to content
  1. Mar 14, 2021
    • Fenghua Yu's avatar
      mm/fork: clear PASID for new mm · 82e69a12
      Fenghua Yu authored
      
      
      When a new mm is created, its PASID should be cleared, i.e.  the PASID is
      initialized to its init state 0 on both ARM and X86.
      
      This patch was part of the series introducing mm->pasid, but got lost
      along the way [1].  It still makes sense to have it, because each address
      space has a different PASID.  And the IOMMU code in
      iommu_sva_alloc_pasid() expects the pasid field of a new mm struct to be
      cleared.
      
      [1] https://lore.kernel.org/linux-iommu/YDgh53AcQHT+T3L0@otcwcpicx3.sc.intel.com/
      
      Link: https://lkml.kernel.org/r/20210302103837.2562625-1-jean-philippe@linaro.org
      Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
      Signed-off-by: default avatarJean-Philippe Brucker <jean-philippe@linaro.org>
      Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
      Cc: Jacob Pan <jacob.jun.pan@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82e69a12
    • Mike Rapoport's avatar
      mm/page_alloc.c: refactor initialization of struct page for holes in memory layout · 0740a50b
      Mike Rapoport authored
      There could be struct pages that are not backed by actual physical memory.
      This can happen when the actual memory bank is not a multiple of
      SECTION_SIZE or when an architecture does not register memory holes
      reserved by the firmware as memblock.memory.
      
      Such pages are currently initialized using init_unavailable_mem() function
      that iterates through PFNs in holes in memblock.memory and if there is a
      struct page corresponding to a PFN, the fields of this page are set to
      default values and it is marked as Reserved.
      
      init_unavailable_mem() does not take into account zone and node the page
      belongs to and sets both zone and node links in struct page to zero.
      
      Before commit 73a6e474 ("mm: memmap_init: iterate over memblock
      regions rather that check each PFN") the holes inside a zone were
      re-initialized during memmap_init() and got their zone/node links right.
      However, after that commit nothing updates the struct pages representing
      such holes.
      
      On a system that has firmware reserved holes in a zone above ZONE_DMA, for
      instance in a configuration below:
      
      	# grep -A1 E820 /proc/iomem
      	7a17b000-7a216fff : Unknown E820 type
      	7a217000-7bffffff : System RAM
      
      unset zone link in struct page will trigger
      
      	VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
      
      in set_pfnblock_flags_mask() when called with a struct page from a range
      other than E820_TYPE_RAM because there are pages in the range of
      ZONE_DMA32 but the unset zone link in struct page makes them appear as a
      part of ZONE_DMA.
      
      Interleave initialization of the unavailable pages with the normal
      initialization of memory map, so that zone and node information will be
      properly set on struct pages that are not backed by the actual memory.
      
      With this change the pages for holes inside a zone will get proper
      zone/node links and the pages that are not spanned by any node will get
      links to the adjacent zone/node.  The holes between nodes will be
      prepended to the zone/node above the hole and the trailing pages in the
      last section that will be appended to the zone/node below.
      
      [akpm@linux-foundation.org: don't initialize static to zero, use %llu for u64]
      
      Link: https://lkml.kernel.org/r/20210225224351.7356-2-rppt@kernel.org
      Fixes: 73a6e474
      
       ("mm: memmap_init: iterate over memblock regions rather that check each PFN")
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Reported-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Reviewed-by: default avatarBaoquan He <bhe@redhat.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Łukasz Majczak <lma@semihalf.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Sarvela, Tomi P" <tomi.p.sarvela@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      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>
      0740a50b
    • Masahiro Yamada's avatar
      init/Kconfig: make COMPILE_TEST depend on HAS_IOMEM · ea29b20a
      Masahiro Yamada authored
      I read the commit log of the following two:
      
      - bc083a64 ("init/Kconfig: make COMPILE_TEST depend on !UML")
      - 334ef6ed
      
       ("init/Kconfig: make COMPILE_TEST depend on !S390")
      
      Both are talking about HAS_IOMEM dependency missing in many drivers.
      
      So, 'depends on HAS_IOMEM' seems the direct, sensible solution to me.
      
      This does not change the behavior of UML. UML still cannot enable
      COMPILE_TEST because it does not provide HAS_IOMEM.
      
      The current dependency for S390 is too strong. Under the condition of
      CONFIG_PCI=y, S390 provides HAS_IOMEM, hence can enable COMPILE_TEST.
      
      I also removed the meaningless 'default n'.
      
      Link: https://lkml.kernel.org/r/20210224140809.1067582-1-masahiroy@kernel.org
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Arnd Bergmann <arnd@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: KP Singh <kpsingh@google.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Quentin Perret <qperret@google.com>
      Cc: Valentin Schneider <valentin.schneider@arm.com>
      Cc: "Enrico Weigelt, metux IT consult" <lkml@metux.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ea29b20a
    • Arnd Bergmann's avatar
      stop_machine: mark helpers __always_inline · cbf78d85
      Arnd Bergmann authored
      With clang-13, some functions only get partially inlined, with a
      specialized version referring to a global variable.  This triggers a
      harmless build-time check for the intel-rng driver:
      
      WARNING: modpost: drivers/char/hw_random/intel-rng.o(.text+0xe): Section mismatch in reference from the function stop_machine() to the function .init.text:intel_rng_hw_init()
      The function stop_machine() references
      the function __init intel_rng_hw_init().
      This is often because stop_machine lacks a __init
      annotation or the annotation of intel_rng_hw_init is wrong.
      
      In this instance, an easy workaround is to force the stop_machine()
      function to be inline, along with related interfaces that did not show the
      same behavior at the moment, but theoretically could.
      
      The combination of the two patches listed below triggers the behavior in
      clang-13, but individually these commits are correct.
      
      Link: https://lkml.kernel.org/r/20210225130153.1956990-1-arnd@kernel.org
      Fixes: fe5595c0 ("stop_machine: Provide stop_machine_cpuslocked()")
      Fixes: ee527cd3
      
       ("Use stop_machine_run in the Intel RNG driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: "Paul E. McKenney" <paulmck@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Valentin Schneider <valentin.schneider@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cbf78d85
    • Arnd Bergmann's avatar
      memblock: fix section mismatch warning · 34dc2efb
      Arnd Bergmann authored
      The inlining logic in clang-13 is rewritten to often not inline some
      functions that were inlined by all earlier compilers.
      
      In case of the memblock interfaces, this exposed a harmless bug of a
      missing __init annotation:
      
      WARNING: modpost: vmlinux.o(.text+0x507c0a): Section mismatch in reference from the function memblock_bottom_up() to the variable .meminit.data:memblock
      The function memblock_bottom_up() references
      the variable __meminitdata memblock.
      This is often because memblock_bottom_up lacks a __meminitdata
      annotation or the annotation of memblock is wrong.
      
      Interestingly, these annotations were present originally, but got removed
      with the explanation that the __init annotation prevents the function from
      getting inlined.  I checked this again and found that while this is the
      case with clang, gcc (version 7 through 10, did not test others) does
      inline the functions regardless.
      
      As the previous change was apparently intended to help the clang builds,
      reverting it to help the newer clang versions seems appropriate as well.
      gcc builds don't seem to care either way.
      
      Link: https://lkml.kernel.org/r/20210225133808.2188581-1-arnd@kernel.org
      Fixes: 5bdba520 ("mm: memblock: drop __init from memblock functions to make it inline")
      Reference: 2cfb3665
      
       ("include/linux/memblock.h: add __init to memblock_set_bottom_up()")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Faiyaz Mohammed <faiyazm@codeaurora.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Aslan Bakirov <aslan@fb.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34dc2efb
  2. Mar 12, 2021
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2021-03-12-1' of git://anongit.freedesktop.org/drm/drm · f78d76e7
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Regular fixes for rc3. The i915 pull was based on the rc1 tag so I
        just cherry-picked the single fix from there to avoid it. The misc and
        amd trees seem to be on okay bases.
      
        It's a bunch of fixes across the tree, amdgpu has most of them a few
        ttm fixes around qxl, and nouveau.
      
        core:
         - Clear holes when converting compat ioctl's between 32-bits and
           64-bits.
      
        docs:
         - Use gitlab for drm bugzilla now.
      
        ttm:
         - Fix ttm page pool accounting.
      
        fbdev:
         - Fix oops in drm_fbdev_cleanup()
      
        shmem:
         - Assorted fixes for shmem helpers.
      
        qxl:
         - unpin qxl bos created as pinned when freeing them, and make ttm
           only warn once on this behavior.
         - Zero head.surface_id correctly in qxl.
      
        atyfb:
         - Use LCD management for atyfb on PPC_MAC.
      
        meson:
         - Shutdown kms poll helper in meson correctly.
      
        nouveau:
         - fix regression in bo syncing
      
        i915:
         - Wedge the GPU if command parser setup fails
      
        amdgpu:
         - Fix aux backlight control
         - Add a backlight override parameter
         - Various display fixes
         - PCIe DPM fix for vega
         - Polaris watermark fixes
         - Additional S0ix fix
      
        radeon:
         - Fix GEM regression
         - Fix AGP dependency handling"
      
      * tag 'drm-fixes-2021-03-12-1' of git://anongit.freedesktop.org/drm/drm: (33 commits)
        drm/nouveau: fix dma syncing for loops (v2)
        drm/i915: Wedge the GPU if command parser setup fails
        drm/compat: Clear bounce structures
        drm/shmem-helpers: vunmap: Don't put pages for dma-buf
        drm: meson_drv add shutdown function
        drm/shmem-helper: Don't remove the offset in vm_area_struct pgoff
        drm/shmem-helper: Check for purged buffers in fault handler
        qxl: Fix uninitialised struct field head.surface_id
        drm/ttm: Fix TTM page pool accounting
        drm/ttm: soften TTM warnings
        drm: Use USB controller's DMA mask when importing dmabufs
        MAINTAINERS: update drm bug reporting URL
        fbdev: atyfb: use LCD management functions for PPC_PMAC also
        fbdev: atyfb: always declare aty_{ld,st}_lcd()
        drm/qxl: fix lockdep issue in qxl_alloc_release_reserved
        drm/qxl: unpin release objects
        drm/fb-helper: only unmap if buffer not null
        drm/amdgpu: fix S0ix handling when the CONFIG_AMD_PMC=m
        drm/radeon: fix AGP dependency
        drm/radeon: also init GEM funcs in radeon_gem_prime_import_sg_table
        ...
      f78d76e7
    • Dave Airlie's avatar
      drm/nouveau: fix dma syncing for loops (v2) · 4042160c
      Dave Airlie authored
      The index variable should only be increased in one place.
      
      Noticed this while trying to track down another oops.
      
      v2: use while loop.
      
      Fixes: f295c8cf
      
       ("drm/nouveau: fix dma syncing warning with debugging on.")
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210311043527.5376-1-airlied@gmail.com
      4042160c
    • Tvrtko Ursulin's avatar
      drm/i915: Wedge the GPU if command parser setup fails · a829f033
      Tvrtko Ursulin authored
      Commit 311a50e7
      
       ("drm/i915: Add support for mandatory cmdparsing")
      introduced mandatory command parsing but setup failures were not
      translated into wedging the GPU which was probably the intent.
      
      Possible errors come in two categories. Either the sanity check on
      internal tables has failed, which should be caught in CI unless an
      affected platform would be missed in testing; or memory allocation failure
      happened during driver load, which should be extremely unlikely but for
      correctness should still be handled.
      
      v2:
       * Tidy coding style. (Chris)
      
      [airlied: cherry-picked to avoid rc1 base]
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Fixes: 311a50e7
      
       ("drm/i915: Add support for mandatory cmdparsing")
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris.p.wilson@intel.com>
      Reviewed-by: default avatarChris Wilson <chris.p.wilson@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210302114213.1102223-1-tvrtko.ursulin@linux.intel.com
      (cherry picked from commit 5a1a659762d35a6dc51047c9127c011303c77b7f)
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      a829f033
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-5.12-2021-03-10' of... · fb198483
      Dave Airlie authored
      
      Merge tag 'amd-drm-fixes-5.12-2021-03-10' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-5.12-2021-03-10:
      
      amdgpu:
      - Fix aux backlight control
      - Add a backlight override parameter
      - Various display fixes
      - PCIe DPM fix for vega
      - Polaris watermark fixes
      - Additional S0ix fix
      
      radeon:
      - Fix GEM regression
      - Fix AGP dependency handling
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210310221141.3974-1-alexander.deucher@amd.com
      fb198483
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2021-03-11' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · e0da9686
      Dave Airlie authored
      
      
      drm-misc-fixes for rc3, rebased on rc2:
      - Fix oops in drm_fbdev_cleanup()
      - unpin qxl bos created as pinned when freeing them,
        and make ttm only warn once on this behavior.
      - Use LCD management for atyfb on PPC_MAC.
      - Use gitlab for drm bugzilla now.
      - Fix ttm page pool accounting.
      - Zero head.surface_id correctly in qxl.
      - Assorted fixes for shmem helpers.
      - Shutdown kms poll helper in meson correctly.
      - Clear holes when converting compat ioctl's between 32-bits and 64-bits.
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/4606f08e-d0e8-c543-5e96-cee2fd728a41@linux.intel.com
      e0da9686
    • Linus Torvalds's avatar
      Merge tag 'media/v5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 28806e4d
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
       "A couple of fixes:
      
         - fix a build issue with CEC
      
         - fix a deadlock at usbtv driver
      
         - fix some null pointer address issues at vsp1 driver
      
         - fix a wrong bitmap setting at rkisp1 driver"
      
      * tag 'media/v5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: rkisp1: params: fix wrong bits settings
        media: v4l: vsp1: Fix uif null pointer access
        media: v4l: vsp1: Fix bru null pointer access
        media: usbtv: Fix deadlock on suspend
        media: rc: compile rc-cec.c into rc-core
      28806e4d
  3. Mar 11, 2021