Skip to content
Permalink
Vinod-Koul/drm…
Switch branches/tags

Commits on Jul 15, 2021

  1. drm/msm/dsi: Pass DSC params to drm_panel

    When DSC is enabled, we need to pass the DSC parameters to panel driver
    as well, so add a dsc parameter in panel and set it when DSC is enabled
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  2. drm/msm/dsi: Add support for DSC configuration

    When DSC is enabled, we need to configure DSI registers accordingly and
    configure the respective stream compression registers.
    
    Add support to calculate the register setting based on DSC params and
    timing information and configure these registers.
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  3. drm/msm/disp/dpu1: Add support for DSC in topology

    For DSC to work we typically need a 2,2,1 configuration. This should
    suffice for resolutions upto 4k. For more resolutions like 8k this won't
    work.
    
    The topology information is provided by DTS so we try to deduce the
    topology required for DSC.
    Furthermore, we can use 1 DSC encoder in lesser resolutions, but that is
    not power efficient according to Abhinav, it is better to use 2 mixers
    as that will split width/2 and is proven to be power efficient.
    
    Also, the panel has been tested only with 2,2,1 configuration, so for
    now we blindly create 2,2,1 topology when DSC is enabled
    
    Co-developed-by: Abhinav Kumar <abhinavk@codeaurora.org>
    Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  4. drm/msm/disp/dpu1: Add support for DSC in encoder

    When DSC is enabled in DT, we need to configure the encoder for DSC
    configuration, calculate DSC parameters for the given timing.
    
    This patch adds that support by adding dpu_encoder_prep_dsc() which is
    invoked when DSC is enabled in DT
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  5. drm/msm/disp/dpu1: Don't use DSC with mode_3d

    We cannot enable mode_3d when we are using the DSC. So pass
    configuration to detect DSC is enabled and not enable mode_3d
    when we are using DSC
    
    We add a helper dpu_encoder_helper_get_dsc_mode() to detect dsc
    enabled and pass this to .setup_intf_cfg()
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  6. drm/msm/disp/dpu1: Add DSC support in hw_ctl

    Later gens of hardware have DSC bits moved to hw_ctl, so configure these
    bits so that DSC would work there as well
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  7. drm/msm/disp/dpu1: Add DSC for SDM845 to hw_catalog

    This add SDM845 DSC blocks into hw_catalog
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  8. drm/msm/disp/dpu1: Add DSC support in RM

    This add the bits in RM to enable the DSC blocks
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  9. drm/msm/disp/dpu1: Add support for DSC in pingpong block

    In SDM845, DSC can be enabled by writing to pingpong block registers, so
    add support for DSC in hw_pp
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  10. drm/msm/disp/dpu1: Add support for DSC

    Display Stream Compression (DSC) is one of the hw blocks in dpu, so add
    support by adding hw blocks for DSC
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021
  11. drm/msm/dsi: add support for dsc data

    Display Stream Compression (DSC) parameters need to be calculated. Add
    helpers and struct msm_display_dsc_config in msm_drv for this
    msm_display_dsc_config uses drm_dsc_config for DSC parameters.
    
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    vinodkoul authored and intel-lab-lkp committed Jul 15, 2021

Commits on Jun 27, 2021

  1. Linux 5.13

    torvalds committed Jun 27, 2021
  2. Revert "signal: Allow tasks to cache one sigqueue struct"

    This reverts commits 4bad58e (and
    399f8dd, which tried to fix it).
    
    I do not believe these are correct, and I'm about to release 5.13, so am
    reverting them out of an abundance of caution.
    
    The locking is odd, and appears broken.
    
    On the allocation side (in __sigqueue_alloc()), the locking is somewhat
    straightforward: it depends on sighand->siglock.  Since one caller
    doesn't hold that lock, it further then tests 'sigqueue_flags' to avoid
    the case with no locks held.
    
    On the freeing side (in sigqueue_cache_or_free()), there is no locking
    at all, and the logic instead depends on 'current' being a single
    thread, and not able to race with itself.
    
    To make things more exciting, there's also the data race between freeing
    a signal and allocating one, which is handled by using WRITE_ONCE() and
    READ_ONCE(), and being mutually exclusive wrt the initial state (ie
    freeing will only free if the old state was NULL, while allocating will
    obviously only use the value if it was non-NULL, so only one or the
    other will actually act on the value).
    
    However, while the free->alloc paths do seem mutually exclusive thanks
    to just the data value dependency, it's not clear what the memory
    ordering constraints are on it.  Could writes from the previous
    allocation possibly be delayed and seen by the new allocation later,
    causing logical inconsistencies?
    
    So it's all very exciting and unusual.
    
    And in particular, it seems that the freeing side is incorrect in
    depending on "current" being single-threaded.  Yes, 'current' is a
    single thread, but in the presense of asynchronous events even a single
    thread can have data races.
    
    And such asynchronous events can and do happen, with interrupts causing
    signals to be flushed and thus free'd (for example - sending a
    SIGCONT/SIGSTOP can happen from interrupt context, and can flush
    previously queued process control signals).
    
    So regardless of all the other questions about the memory ordering and
    locking for this new cached allocation, the sigqueue_cache_or_free()
    assumptions seem to be fundamentally incorrect.
    
    It may be that people will show me the errors of my ways, and tell me
    why this is all safe after all.  We can reinstate it if so.  But my
    current belief is that the WRITE_ONCE() that sets the cached entry needs
    to be a smp_store_release(), and the READ_ONCE() that finds a cached
    entry needs to be a smp_load_acquire() to handle memory ordering
    correctly.
    
    And the sequence in sigqueue_cache_or_free() would need to either use a
    lock or at least be interrupt-safe some way (perhaps by using something
    like the percpu 'cmpxchg': it doesn't need to be SMP-safe, but like the
    percpu operations it needs to be interrupt-safe).
    
    Fixes: 399f8dd ("signal: Prevent sigqueue caching after task got released")
    Fixes: 4bad58e ("signal: Allow tasks to cache one sigqueue struct")
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    torvalds committed Jun 27, 2021

Commits on Jun 26, 2021

  1. Merge tag 's390-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/…

    …git/s390/linux
    
    Pull s390 fixes from Vasily Gorbik:
    
     - Fix a couple of late pt_regs flags handling findings of conversion to
       generic entry.
    
     - Fix potential register clobbering in stack switch helper.
    
     - Fix thread/group masks for offline cpus.
    
     - Fix cleanup of mdev resources when remove callback is invoked in
       vfio-ap code.
    
    * tag 's390-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
      s390/stack: fix possible register corruption with stack switch helper
      s390/topology: clear thread/group maps for offline cpus
      s390/vfio-ap: clean up mdev resources when remove callback invoked
      s390: clear pt_regs::flags on irq entry
      s390: fix system call restart with multiple signals
    torvalds committed Jun 26, 2021
  2. Merge tag 'pinctrl-v5.13-3' of git://git.kernel.org/pub/scm/linux/ker…

    …nel/git/linusw/linux-pinctrl
    
    Pull pin control fixes from Linus Walleij:
     "Two last-minute fixes:
    
       - Put an fwnode in the errorpath in the SGPIO driver
    
       - Fix the number of GPIO lines per bank in the STM32 driver"
    
    * tag 'pinctrl-v5.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
      pinctrl: stm32: fix the reported number of GPIO lines per bank
      pinctrl: microchip-sgpio: Put fwnode in error case during ->probe()
    torvalds committed Jun 26, 2021

Commits on Jun 25, 2021

  1. Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g…

    …it/jejb/scsi
    
    Pull SCSI fixes from James Bottomley:
     "Two small fixes, both in upper layer drivers (scsi disk and cdrom).
    
      The sd one is fixing a commit changing revalidation that came from the
      block tree a while ago (5.10) and the sr one adds handling of a
      condition we didn't previously handle for manually removed media"
    
    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
      scsi: sd: Call sd_revalidate_disk() for ioctl(BLKRRPART)
      scsi: sr: Return appropriate error code when disk is ejected
    torvalds committed Jun 25, 2021
  2. Merge branch 'akpm' (patches from Andrew)

    Merge misc fixes from Andrew Morton:
     "24 patches, based on 4a09d38.
    
      Subsystems affected by this patch series: mm (thp, vmalloc, hugetlb,
      memory-failure, and pagealloc), nilfs2, kthread, MAINTAINERS, and
      mailmap"
    
    * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (24 commits)
      mailmap: add Marek's other e-mail address and identity without diacritics
      MAINTAINERS: fix Marek's identity again
      mm/page_alloc: do bulk array bounds check after checking populated elements
      mm/page_alloc: __alloc_pages_bulk(): do bounds check before accessing array
      mm/hwpoison: do not lock page again when me_huge_page() successfully recovers
      mm,hwpoison: return -EHWPOISON to denote that the page has already been poisoned
      mm/memory-failure: use a mutex to avoid memory_failure() races
      mm, futex: fix shared futex pgoff on shmem huge page
      kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()
      kthread_worker: split code for canceling the delayed work timer
      mm/vmalloc: unbreak kasan vmalloc support
      KVM: s390: prepare for hugepage vmalloc
      mm/vmalloc: add vmalloc_no_huge
      nilfs2: fix memory leak in nilfs_sysfs_delete_device_group
      mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk()
      mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes
      mm: page_vma_mapped_walk(): get vma_address_end() earlier
      mm: page_vma_mapped_walk(): use goto instead of while (1)
      mm: page_vma_mapped_walk(): add a level of indentation
      mm: page_vma_mapped_walk(): crossing page table boundary
      ...
    torvalds committed Jun 25, 2021
  3. userfaultfd: uapi: fix UFFDIO_CONTINUE ioctl request definition

    This ioctl request reads from uffdio_continue structure written by
    userspace which justifies _IOC_WRITE flag.  It also writes back to that
    structure which justifies _IOC_READ flag.
    
    See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
    
    Fixes: f619147 ("userfaultfd: add UFFDIO_CONTINUE ioctl")
    Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
    Acked-by: Peter Xu <peterx@redhat.com>
    Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
    Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    glebfm authored and torvalds committed Jun 25, 2021
  4. Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/…

    …kernel/git/wsa/linux
    
    Pull i2c fixes from Wolfram Sang:
     "Three more driver bugfixes and an annotation fix for the core"
    
    * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
      i2c: robotfuzz-osif: fix control-request directions
      i2c: dev: Add __user annotation
      i2c: cp2615: check for allocation failure in cp2615_i2c_recv()
      i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
    torvalds committed Jun 25, 2021
  5. Merge tag 'devprop-5.13-rc8' of git://git.kernel.org/pub/scm/linux/ke…

    …rnel/git/rafael/linux-pm
    
    Pull device properties framework fix from Rafael Wysocki:
     "Fix a NULL pointer dereference introduced by a recent commit and
      occurring when device_remove_software_node() is used with a device
      that has never been registered (Heikki Krogerus)"
    
    * tag 'devprop-5.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
      software node: Handle software node injection to an existing device properly
    torvalds committed Jun 25, 2021
  6. Merge tag 'for-linus-5.13b-rc8-tag' of git://git.kernel.org/pub/scm/l…

    …inux/kernel/git/xen/tip
    
    Pull xen fix from Juergen Gross:
     "A fix for a regression introduced in 5.12: when migrating an irq
      related to a Xen user event to another cpu, a race might result
      in a WARN() triggering"
    
    * tag 'for-linus-5.13b-rc8-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
      xen/events: reset active flag for lateeoi events later
    torvalds committed Jun 25, 2021
  7. Merge tag 'for-linus-urgent' of git://git.kernel.org/pub/scm/virt/kvm…

    …/kvm
    
    Pull kvm fixes from Paolo Bonzini:
     "A selftests fix for ARM, and the fix for page reference count
      underflow. This is a very small fix that was provided by Nick Piggin
      and tested by myself"
    
    * tag 'for-linus-urgent' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
      KVM: do not allow mapping valid but non-reference-counted pages
      KVM: selftests: Fix mapping length truncation in m{,un}map()
    torvalds committed Jun 25, 2021
  8. Merge tag 'x86_urgent_for_v5.13' of git://git.kernel.org/pub/scm/linu…

    …x/kernel/git/tip/tip
    
    Pull x86 fixes from Borislav Petkov:
     "Two more urgent FPU fixes:
    
       - prevent unprivileged userspace from reinitializing supervisor
         states
    
       - prepare init_fpstate, which is the buffer used when initializing
         FPU state, properly in case the skip-writing-state-components
         XSAVE* variants are used"
    
    * tag 'x86_urgent_for_v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      x86/fpu: Make init_fpstate correct with optimized XSAVE
      x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate()
    torvalds committed Jun 25, 2021
  9. Merge tag 'ceph-for-5.13-rc8' of https://github.com/ceph/ceph-client

    Pull ceph fixes from Ilya Dryomov:
     "Two regression fixes from the merge window: one in the auth code
      affecting old clusters and one in the filesystem for proper
      propagation of MDS request errors.
    
      Also included a locking fix for async creates, marked for stable"
    
    * tag 'ceph-for-5.13-rc8' of https://github.com/ceph/ceph-client:
      libceph: set global_id as soon as we get an auth ticket
      libceph: don't pass result into ac->ops->handle_reply()
      ceph: fix error handling in ceph_atomic_open and ceph_lookup
      ceph: must hold snap_rwsem when filling inode for async create
    torvalds committed Jun 25, 2021
  10. Merge tag 'netfs-fixes-20210621' of git://git.kernel.org/pub/scm/linu…

    …x/kernel/git/dhowells/linux-fs
    
    Pull netfs fixes from David Howells:
     "This contains patches to fix netfs_write_begin() and afs_write_end()
      in the following ways:
    
      (1) In netfs_write_begin(), extract the decision about whether to skip
          a page out to its own helper and have that clear around the region
          to be written, but not clear that region. This requires the
          filesystem to patch it up afterwards if the hole doesn't get
          completely filled.
    
      (2) Use offset_in_thp() in (1) rather than manually calculating the
          offset into the page.
    
      (3) Due to (1), afs_write_end() now needs to handle short data write
          into the page by generic_perform_write(). I've adopted an
          analogous approach to ceph of just returning 0 in this case and
          letting the caller go round again.
    
      It also adds a note that (in the future) the len parameter may extend
      beyond the page allocated. This is because the page allocation is
      deferred to write_begin() and that gets to decide what size of THP to
      allocate."
    
    Jeff Layton points out:
     "The netfs fix in particular fixes a data corruption bug in cephfs"
    
    * tag 'netfs-fixes-20210621' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
      netfs: fix test for whether we can skip read when writing beyond EOF
      afs: Fix afs_write_end() to handle short writes
    torvalds committed Jun 25, 2021
  11. Merge tag 'gpio-fixes-for-v5.13' of git://git.kernel.org/pub/scm/linu…

    …x/kernel/git/brgl/linux
    
    Pull gpio fixes from Bartosz Golaszewski:
    
     - fix wake-up interrupt support on gpio-mxc
    
     - zero the padding bytes in a structure passed to user-space in the
       GPIO character device
    
     - require HAS_IOPORT_MAP in two drivers that need it to fix a Kbuild
       issue
    
    * tag 'gpio-fixes-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
      gpio: AMD8111 and TQMX86 require HAS_IOPORT_MAP
      gpiolib: cdev: zero padding during conversion to gpioline_info_changed
      gpio: mxc: Fix disabled interrupt wake-up support
    torvalds committed Jun 25, 2021
  12. Merge tag 'sound-5.13-rc8' of git://git.kernel.org/pub/scm/linux/kern…

    …el/git/tiwai/sound
    
    Pull sound fixes from Takashi Iwai:
     "Two small changes have been cherry-picked as a last material for 5.13:
      a coverage after UMN revert action and a stale MAINTAINERS entry fix"
    
    * tag 'sound-5.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
      MAINTAINERS: remove Timur Tabi from Freescale SOC sound drivers
      ASoC: rt5645: Avoid upgrading static warnings to errors
    torvalds committed Jun 25, 2021
  13. gpio: AMD8111 and TQMX86 require HAS_IOPORT_MAP

    Both of these drivers use ioport_map(), so they need to
    depend on HAS_IOPORT_MAP. Otherwise, they cannot be built
    even with COMPILE_TEST on architectures without an ioport
    implementation, such as ARCH=um.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    jmberg-intel authored and brgl committed Jun 25, 2021
  14. mailmap: add Marek's other e-mail address and identity without diacri…

    …tics
    
    Some of my commits were sent with identities
      Marek Behun <marek.behun@nic.cz>
      Marek Behún <marek.behun@nic.cz>
    while the correct one is
      Marek Behún <kabel@kernel.org>
    
    Put this into mailmap so that git shortlog prints all my commits under
    one identity.
    
    Link: https://lkml.kernel.org/r/20210616113624.19351-2-kabel@kernel.org
    Signed-off-by: Marek Behún <kabel@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    elkablo authored and torvalds committed Jun 25, 2021
  15. MAINTAINERS: fix Marek's identity again

    Fix my name to use diacritics, since MAINTAINERS supports it.
    
    Fix my e-mail address in MAINTAINERS' marvell10g PHY driver description,
    I accidentally put my other e-mail address here.
    
    Link: https://lkml.kernel.org/r/20210616113624.19351-1-kabel@kernel.org
    Signed-off-by: Marek Behún <kabel@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    elkablo authored and torvalds committed Jun 25, 2021
  16. mm/page_alloc: do bulk array bounds check after checking populated el…

    …ements
    
    Dan Carpenter reported the following
    
      The patch 0f87d9d: "mm/page_alloc: add an array-based interface
      to the bulk page allocator" from Apr 29, 2021, leads to the following
      static checker warning:
    
            mm/page_alloc.c:5338 __alloc_pages_bulk()
            warn: potentially one past the end of array 'page_array[nr_populated]'
    
    The problem can occur if an array is passed in that is fully populated.
    That potentially ends up allocating a single page and storing it past
    the end of the array.  This patch returns 0 if the array is fully
    populated.
    
    Link: https://lkml.kernel.org/r/20210618125102.GU30378@techsingularity.net
    Fixes: 0f87d9d ("mm/page_alloc: add an array-based interface to the bulk page allocator")
    Signed-off-by: Mel Gorman <mgorman@techsinguliarity.net>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: Jesper Dangaard Brouer <brouer@redhat.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    gormanm authored and torvalds committed Jun 25, 2021
  17. mm/page_alloc: __alloc_pages_bulk(): do bounds check before accessing…

    … array
    
    In the event that somebody would call this with an already fully
    populated page_array, the last loop iteration would do an access beyond
    the end of page_array.
    
    It's of course extremely unlikely that would ever be done, but this
    triggers my internal static analyzer.  Also, if it really is not
    supposed to be invoked this way (i.e., with no NULL entries in
    page_array), the nr_populated<nr_pages check could simply be removed
    instead.
    
    Link: https://lkml.kernel.org/r/20210507064504.1712559-1-linux@rasmusvillemoes.dk
    Fixes: 0f87d9d ("mm/page_alloc: add an array-based interface to the bulk page allocator")
    Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Villemoes authored and torvalds committed Jun 25, 2021
  18. mm/hwpoison: do not lock page again when me_huge_page() successfully …

    …recovers
    
    Currently me_huge_page() temporary unlocks page to perform some actions
    then locks it again later.  My testcase (which calls hard-offline on
    some tail page in a hugetlb, then accesses the address of the hugetlb
    range) showed that page allocation code detects this page lock on buddy
    page and printed out "BUG: Bad page state" message.
    
    check_new_page_bad() does not consider a page with __PG_HWPOISON as bad
    page, so this flag works as kind of filter, but this filtering doesn't
    work in this case because the "bad page" is not the actual hwpoisoned
    page.  So stop locking page again.  Actions to be taken depend on the
    page type of the error, so page unlocking should be done in ->action()
    callbacks.  So let's make it assumed and change all existing callbacks
    that way.
    
    Link: https://lkml.kernel.org/r/20210609072029.74645-1-nao.horiguchi@gmail.com
    Fixes: commit 78bb920 ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error")
    Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    nhoriguchi authored and torvalds committed Jun 25, 2021
  19. mm,hwpoison: return -EHWPOISON to denote that the page has already be…

    …en poisoned
    
    When memory_failure() is called with MF_ACTION_REQUIRED on the page that
    has already been hwpoisoned, memory_failure() could fail to send SIGBUS
    to the affected process, which results in infinite loop of MCEs.
    
    Currently memory_failure() returns 0 if it's called for already
    hwpoisoned page, then the caller, kill_me_maybe(), could return without
    sending SIGBUS to current process.  An action required MCE is raised
    when the current process accesses to the broken memory, so no SIGBUS
    means that the current process continues to run and access to the error
    page again soon, so running into MCE loop.
    
    This issue can arise for example in the following scenarios:
    
     - Two or more threads access to the poisoned page concurrently. If
       local MCE is enabled, MCE handler independently handles the MCE
       events. So there's a race among MCE events, and the second or latter
       threads fall into the situation in question.
    
     - If there was a precedent memory error event and memory_failure() for
       the event failed to unmap the error page for some reason, the
       subsequent memory access to the error page triggers the MCE loop
       situation.
    
    To fix the issue, make memory_failure() return an error code when the
    error page has already been hwpoisoned.  This allows memory error
    handler to control how it sends signals to userspace.  And make sure
    that any process touching a hwpoisoned page should get a SIGBUS even in
    "already hwpoisoned" path of memory_failure() as is done in page fault
    path.
    
    Link: https://lkml.kernel.org/r/20210521030156.2612074-3-nao.horiguchi@gmail.com
    Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
    Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jue Wang <juew@google.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Aili Yao authored and torvalds committed Jun 25, 2021
  20. mm/memory-failure: use a mutex to avoid memory_failure() races

    Patch series "mm,hwpoison: fix sending SIGBUS for Action Required MCE", v5.
    
    I wrote this patchset to materialize what I think is the current
    allowable solution mentioned by the previous discussion [1].  I simply
    borrowed Tony's mutex patch and Aili's return code patch, then I queued
    another one to find error virtual address in the best effort manner.  I
    know that this is not a perfect solution, but should work for some
    typical case.
    
    [1]: https://lore.kernel.org/linux-mm/20210331192540.2141052f@alex-virtual-machine/
    
    This patch (of 2):
    
    There can be races when multiple CPUs consume poison from the same page.
    The first into memory_failure() atomically sets the HWPoison page flag
    and begins hunting for tasks that map this page.  Eventually it
    invalidates those mappings and may send a SIGBUS to the affected tasks.
    
    But while all that work is going on, other CPUs see a "success" return
    code from memory_failure() and so they believe the error has been
    handled and continue executing.
    
    Fix by wrapping most of the internal parts of memory_failure() in a
    mutex.
    
    [akpm@linux-foundation.org: make mf_mutex local to memory_failure()]
    
    Link: https://lkml.kernel.org/r/20210521030156.2612074-1-nao.horiguchi@gmail.com
    Link: https://lkml.kernel.org/r/20210521030156.2612074-2-nao.horiguchi@gmail.com
    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
    Reviewed-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: Aili Yao <yaoaili@kingsoft.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jue Wang <juew@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    aegl authored and torvalds committed Jun 25, 2021
Older