Skip to content
  1. Jan 25, 2021
    • Andrey Konovalov's avatar
      kasan, mm: fix conflicts with init_on_alloc/free · ce5716c6
      Andrey Konovalov authored
      A few places where SLUB accesses object's data or metadata were missed
      in a previous patch.  This leads to false positives with hardware
      tag-based KASAN when bulk allocations are used with init_on_alloc/free.
      
      Fix the false-positives by resetting pointer tags during these accesses.
      
      (The kasan_reset_tag call is removed from slab_alloc_node, as it's added
       into maybe_wipe_obj_freeptr.)
      
      Link: https://linux-review.googlesource.com/id/I50dd32838a666e173fe06c3c5c766f2c36aae901
      Link: https://lkml.kernel.org/r/093428b5d2ca8b507f4a79f92f9929b35f7fada7.1610731872.git.andreyknvl@google.com
      Fixes: aa1ef4d7
      
       ("kasan, mm: reset tags when accessing metadata")
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Marco Elver <elver@google.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Peter Collingbourne <pcc@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ce5716c6
    • Andrey Konovalov's avatar
      kasan: fix HW_TAGS boot parameters · 76bc99e8
      Andrey Konovalov authored
      
      
      The initially proposed KASAN command line parameters are redundant.
      
      This change drops the complex "kasan.mode=off/prod/full" parameter and
      adds a simpler kill switch "kasan=off/on" instead.  The new parameter
      together with the already existing ones provides a cleaner way to
      express the same set of features.
      
      The full set of parameters with this change:
      
        kasan=off/on             - whether KASAN is enabled
        kasan.fault=report/panic - whether to only print a report or also panic
        kasan.stacktrace=off/on  - whether to collect alloc/free stack traces
      
      Default values:
      
        kasan=on
        kasan.fault=report
        kasan.stacktrace=on  (if CONFIG_DEBUG_KERNEL=y)
        kasan.stacktrace=off (otherwise)
      
      Link: https://linux-review.googlesource.com/id/Ib3694ed90b1e8ccac6cf77dfd301847af4aba7b8
      Link: https://lkml.kernel.org/r/4e9c4a4bdcadc168317deb2419144582a9be6e61.1610736745.git.andreyknvl@google.com
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Peter Collingbourne <pcc@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      76bc99e8
    • Lecopzer Chen's avatar
      kasan: fix incorrect arguments passing in kasan_add_zero_shadow · 5dabd171
      Lecopzer Chen authored
      kasan_remove_zero_shadow() shall use original virtual address, start and
      size, instead of shadow address.
      
      Link: https://lkml.kernel.org/r/20210103063847.5963-1-lecopzer@gmail.com
      Fixes: 0207df4f
      
       ("kernel/memremap, kasan: make ZONE_DEVICE with work with KASAN")
      Signed-off-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5dabd171
    • Lecopzer Chen's avatar
      kasan: fix unaligned address is unhandled in kasan_remove_zero_shadow · a11a496e
      Lecopzer Chen authored
      During testing kasan_populate_early_shadow and kasan_remove_zero_shadow,
      if the shadow start and end address in kasan_remove_zero_shadow() is not
      aligned to PMD_SIZE, the remain unaligned PTE won't be removed.
      
      In the test case for kasan_remove_zero_shadow():
      
          shadow_start: 0xffffffb802000000, shadow end: 0xffffffbfbe000000
      
          3-level page table:
            PUD_SIZE: 0x40000000 PMD_SIZE: 0x200000 PAGE_SIZE: 4K
      
      0xffffffbf80000000 ~ 0xffffffbfbdf80000 will not be removed because in
      kasan_remove_pud_table(), kasan_pmd_table(*pud) is true but the next
      address is 0xffffffbfbdf80000 which is not aligned to PUD_SIZE.
      
      In the correct condition, this should fallback to the next level
      kasan_remove_pmd_table() but the condition flow always continue to skip
      the unaligned part.
      
      Fix by correcting the condition when next and addr are neither aligned.
      
      Link: https://lkml.kernel.org/r/20210103135621.83129-1-lecopzer@gmail.com
      Fixes: 0207df4f
      
       ("kernel/memremap, kasan: make ZONE_DEVICE with work with KASAN")
      Signed-off-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: YJ Chiang <yj.chiang@mediatek.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a11a496e
    • Shakeel Butt's avatar
      mm: fix numa stats for thp migration · 5c447d27
      Shakeel Butt authored
      Currently the kernel is not correctly updating the numa stats for
      NR_FILE_PAGES and NR_SHMEM on THP migration.  Fix that.
      
      For NR_FILE_DIRTY and NR_ZONE_WRITE_PENDING, although at the moment
      there is no need to handle THP migration as kernel still does not have
      write support for file THP but to be more future proof, this patch adds
      the THP support for those stats as well.
      
      Link: https://lkml.kernel.org/r/20210108155813.2914586-2-shakeelb@google.com
      Fixes: e71769ae
      
       ("mm: enable thp migration for shmem thp")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarYang Shi <shy828301@gmail.com>
      Reviewed-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      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>
      5c447d27
    • Shakeel Butt's avatar
      mm: memcg: fix memcg file_dirty numa stat · 8a8792f6
      Shakeel Butt authored
      The kernel updates the per-node NR_FILE_DIRTY stats on page migration
      but not the memcg numa stats.
      
      That was not an issue until recently the commit 5f9a4f4a ("mm:
      memcontrol: add the missing numa_stat interface for cgroup v2") exposed
      numa stats for the memcg.
      
      So fix the file_dirty per-memcg numa stat.
      
      Link: https://lkml.kernel.org/r/20210108155813.2914586-1-shakeelb@google.com
      Fixes: 5f9a4f4a
      
       ("mm: memcontrol: add the missing numa_stat interface for cgroup v2")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Acked-by: default avatarYang Shi <shy828301@gmail.com>
      Reviewed-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8a8792f6
    • Roman Gushchin's avatar
      mm: memcg/slab: optimize objcg stock draining · 3de7d4f2
      Roman Gushchin authored
      Imran Khan reported a 16% regression in hackbench results caused by the
      commit f2fe7b09 ("mm: memcg/slab: charge individual slab objects
      instead of pages").  The regression is noticeable in the case of a
      consequent allocation of several relatively large slab objects, e.g.
      skb's.  As soon as the amount of stocked bytes exceeds PAGE_SIZE,
      drain_obj_stock() and __memcg_kmem_uncharge() are called, and it leads
      to a number of atomic operations in page_counter_uncharge().
      
      The corresponding call graph is below (provided by Imran Khan):
      
        |__alloc_skb
        |    |
        |    |__kmalloc_reserve.isra.61
        |    |    |
        |    |    |__kmalloc_node_track_caller
        |    |    |    |
        |    |    |    |slab_pre_alloc_hook.constprop.88
        |    |    |     obj_cgroup_charge
        |    |    |    |    |
        |    |    |    |    |__memcg_kmem_charge
        |    |    |    |    |    |
        |    |    |    |    |    |page_counter_try_charge
        |    |    |    |    |
        |    |    |    |    |refill_obj_stock
        |    |    |    |    |    |
        |    |    |    |    |    |drain_obj_stock.isra.68
        |    |    |    |    |    |    |
        |    |    |    |    |    |    |__memcg_kmem_uncharge
        |    |    |    |    |    |    |    |
        |    |    |    |    |    |    |    |page_counter_uncharge
        |    |    |    |    |    |    |    |    |
        |    |    |    |    |    |    |    |    |page_counter_cancel
        |    |    |    |
        |    |    |    |
        |    |    |    |__slab_alloc
        |    |    |    |    |
        |    |    |    |    |___slab_alloc
        |    |    |    |    |
        |    |    |    |slab_post_alloc_hook
      
      Instead of directly uncharging the accounted kernel memory, it's
      possible to refill the generic page-sized per-cpu stock instead.  It's a
      much faster operation, especially on a default hierarchy.  As a bonus,
      __memcg_kmem_uncharge_page() will also get faster, so the freeing of
      page-sized kernel allocations (e.g.  large kmallocs) will become faster.
      
      A similar change has been done earlier for the socket memory by the
      commit 475d0487 ("mm: memcontrol: use per-cpu stocks for socket
      memory uncharging").
      
      Link: https://lkml.kernel.org/r/20210106042239.2860107-1-guro@fb.com
      Fixes: f2fe7b09
      
       ("mm: memcg/slab: charge individual slab objects instead of pages")
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Reported-by: default avatarImran Khan <imran.f.khan@oracle.com>
      Tested-by: default avatarImran Khan <imran.f.khan@oracle.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Reviewed-by: default avatarMichal Koutn <mkoutny@suse.com>
      Cc: Michal Koutný <mkoutny@suse.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3de7d4f2
    • Mike Rapoport's avatar
      mm: fix initialization of struct page for holes in memory layout · d3921cb8
      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 if this page
      are set to default values and the page 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.
      
      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);
      
      because there are pages in both ZONE_DMA32 and ZONE_DMA (unset zone link
      in struct page) in the same pageblock.
      
      Update init_unavailable_mem() to use zone constraints defined by an
      architecture to properly setup the zone link and use node ID of the
      adjacent range in memblock.memory to set the node link.
      
      Link: https://lkml.kernel.org/r/20210111194017.22696-3-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 avatarAndrea Arcangeli <aarcange@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      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>
      d3921cb8
    • Mike Rapoport's avatar
      x86/setup: don't remove E820_TYPE_RAM for pfn 0 · bde9cfa3
      Mike Rapoport authored
      Patch series "mm: fix initialization of struct page for holes in  memory layout", v3.
      
      Commit 73a6e474
      
       ("mm: memmap_init: iterate over memblock regions
      rather that check each PFN") exposed several issues with the memory map
      initialization and these patches fix those issues.
      
      Initially there were crashes during compaction that Qian Cai reported
      back in April [1].  It seemed back then that the problem was fixed, but
      a few weeks ago Andrea Arcangeli hit the same bug [2] and there was an
      additional discussion at [3].
      
      [1] https://lore.kernel.org/lkml/8C537EB7-85EE-4DCF-943E-3CC0ED0DF56D@lca.pw
      [2] https://lore.kernel.org/lkml/20201121194506.13464-1-aarcange@redhat.com
      [3] https://lore.kernel.org/mm-commits/20201206005401.qKuAVgOXr%akpm@linux-foundation.org
      
      This patch (of 2):
      
      The first 4Kb of memory is a BIOS owned area and to avoid its allocation
      for the kernel it was not listed in e820 tables as memory.  As the result,
      pfn 0 was never recognised by the generic memory management and it is not
      a part of neither node 0 nor ZONE_DMA.
      
      If set_pfnblock_flags_mask() would be ever called for the pageblock
      corresponding to the first 2Mbytes of memory, having pfn 0 outside of
      ZONE_DMA would trigger
      
      	VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
      
      Along with reserving the first 4Kb in e820 tables, several first pages are
      reserved with memblock in several places during setup_arch().  These
      reservations are enough to ensure the kernel does not touch the BIOS area
      and it is not necessary to remove E820_TYPE_RAM for pfn 0.
      
      Remove the update of e820 table that changes the type of pfn 0 and move
      the comment describing why it was done to trim_low_memory_range() that
      reserves the beginning of the memory.
      
      Link: https://lkml.kernel.org/r/20210111194017.22696-2-rppt@kernel.org
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      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>
      bde9cfa3
  2. Jan 24, 2021
    • Linus Torvalds's avatar
      Merge branch 'mtd/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · e1ae4b0b
      Linus Torvalds authored
      Pull mtd fixes from Miquel Raynal.
      
      * 'mtd/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd: rawnand: omap: Use BCH private fields in the specific OOB layout
        mtd: spinand: Fix MTD_OPS_AUTO_OOB requests
        mtd: rawnand: intel: check the mtd name only after setting the variable
        mtd: rawnand: nandsim: Fix the logic when selecting Hamming soft ECC engine
        mtd: rawnand: gpmi: fix dst bit offset when extracting raw payload
      e1ae4b0b
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 077e81d5
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Another bunch  of driver fixes"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: sprd: depend on COMMON_CLK to fix compile tests
        Revert "i2c: imx: Remove unused .id_table support"
        i2c: octeon: check correct size of maximum RECV_LEN packet
        i2c: tegra: Create i2c_writesl_vi() to use with VI I2C for filling TX FIFO
        i2c: bpmp-tegra: Ignore unknown I2C_M flags
        i2c: tegra: Wait for config load atomically while in ISR
      077e81d5
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 15cfb0f0
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Twelve minor fixes, all in drivers or doc.
      
        Most of the fixes are pretty obvious (although we had two goes to get
        the UFS sysfs doc right) and the biggest change is in the ufs driver
        which they've extensively tested"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ibmvfc: Set default timeout to avoid crash during migration
        scsi: target: tcmu: Fix use-after-free of se_cmd->priv
        scsi: fnic: Fix memleak in vnic_dev_init_devcmd2
        scsi: libfc: Avoid invoking response handler twice if ep is already completed
        scsi: scsi_transport_srp: Don't block target in failfast state
        scsi: docs: ABI: sysfs-driver-ufs: Rectify table formatting
        scsi: ufs: Fix tm request when non-fatal error happens
        scsi: ufs: Fix livelock of ufshcd_clear_ua_wluns()
        scsi: ibmvfc: Fix missing cast of ibmvfc_event pointer to u64 handle
        scsi: ufs: ufshcd-pltfrm depends on HAS_IOMEM
        scsi: megaraid_sas: Fix MEGASAS_IOC_FIRMWARE regression
        scsi: docs: ABI: sysfs-driver-ufs: Add DeepSleep power mode
      15cfb0f0
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-kunit-fixes-5.11-rc5' of... · 929b9796
      Linus Torvalds authored
      Merge tag 'linux-kselftest-kunit-fixes-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kunit fixes from Shuah :
       "Five fixes to the kunit tool and documentation from Daniel Latypov and
        David Gow"
      
      * tag 'linux-kselftest-kunit-fixes-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        kunit: tool: move kunitconfig parsing into __init__, make it optional
        kunit: tool: fix minor typing issue with None status
        kunit: tool: surface and address more typing issues
        Documentation: kunit: include example of a parameterized test
        kunit: tool: Fix spelling of "diagnostic" in kunit_parser
      929b9796
  3. Jan 23, 2021
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/dm-fixes-2' of... · fe75a218
      Linus Torvalds authored
      Merge tag 'for-5.11/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mike Snitzer:
      
       - Fix DM integrity crash if "recalculate" used without "internal_hash"
      
       - Fix DM integrity "recalculate" support to prevent recalculating
         checksums if we use internal_hash or journal_hash with a key (e.g.
         HMAC). Use of crypto as a means to prevent malicious corruption
         requires further changes and was never a design goal for
         dm-integrity's primary usecase of detecting accidental corruption.
      
       - Fix a benign dm-crypt copy-and-paste bug introduced as part of a fix
         that was merged for 5.11-rc4.
      
       - Fix DM core's dm_get_device() to avoid filesystem lookup to get block
         device (if possible).
      
      * tag 'for-5.11/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm: avoid filesystem lookup in dm_get_dev_t()
        dm crypt: fix copy and paste bug in crypt_alloc_req_aead
        dm integrity: conditionally disable "recalculate" feature
        dm integrity: fix a crash if "recalculate" used without "internal_hash"
      fe75a218
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-v5.11-2-2021-01-22' of... · faba877b
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-v5.11-2-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull more perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix id index used in Intel PT for heterogeneous systems
      
       - Fix overrun issue in 'perf script' for dynamically-allocated PMU type
         number
      
       - Fix 'perf stat' metrics containing the 'duration_time' synthetic
         event
      
       - Fix system PMU 'perf stat' metrics
      
      * tag 'perf-tools-fixes-v5.11-2-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf script: Fix overrun issue for dynamically-allocated PMU type number
        perf metricgroup: Fix system PMU metrics
        perf metricgroup: Fix for metrics containing duration_time
        perf evlist: Fix id index for heterogeneous systems
      faba877b
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 1c304c77
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
      
       - Correctly mask out bits 63:60 in a kernel tag check fault address
         (specified as unknown by the architecture). Previously they were just
         zeroed but for kernel pointers they need to be all ones.
      
       - Fix a panic (unexpected kernel BRK exception) caused by kprobes being
         reentered due to an interrupt.
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: kprobes: Fix Uexpected kernel BRK exception at EL1
        kasan, arm64: fix pointer tags in KASAN reports
      1c304c77
    • Linus Torvalds's avatar
      Merge tag 'ceph-for-5.11-rc5' of git://github.com/ceph/ceph-client · a9034304
      Linus Torvalds authored
      Pull ceph fixes from Ilya Dryomov:
       "A patch to zero out sensitive cryptographic data and two minor
        cleanups prompted by the fact that a bunch of code was moved in this
        cycle"
      
      * tag 'ceph-for-5.11-rc5' of git://github.com/ceph/ceph-client:
        libceph: fix "Boolean result is used in bitwise operation" warning
        libceph, ceph: disambiguate ceph_connection_operations handlers
        libceph: zero out session key and connection secret
      a9034304
    • Linus Torvalds's avatar
      Merge tag 'fixes-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock · df7da31d
      Linus Torvalds authored
      Pull typo fix from Mike Rapoport:
       "Fix typo in comment of memblock_phys_alloc_try_nid()"
      
      * tag 'fixes-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
        mm/memblock: Fix typo in comment of memblock_phys_alloc_try_nid()
      df7da31d
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 59a4560e
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "MMC core:
         - Fix initialization of block size when ext_csd isn't present
      
        MMC host:
         - sdhci-brcmstb: Fix mmc timeout errors on S5 suspend
         - sdhci-of-dwcmshc: Fix request accessing RPMB
         - sdhci-xenon: Fix 1.8v regulator stabilization"
      
      * tag 'mmc-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: core: don't initialize block size from ext_csd if not present
        mmc: sdhci-brcmstb: Fix mmc timeout errors on S5 suspend
        mmc: sdhci-xenon: fix 1.8v regulator stabilization
        mmc: sdhci-of-dwcmshc: fix rpmb access
      59a4560e
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.11-2' of... · 9887e9af
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
       "A small collection of bug-fixes and model-specific quirks"
      
      * tag 'platform-drivers-x86-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: thinkpad_acpi: Add P53/73 firmware to fan_quirk_table for dual fan control
        platform/x86: hp-wmi: Don't log a warning on HPWMI_RET_UNKNOWN_COMMAND errors
        platform/x86: intel-vbtn: Drop HP Stream x360 Convertible PC 11 from allow-list
        platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634
        platform/x86: amd-pmc: Fix CONFIG_DEBUG_FS check
        platform/x86: thinkpad_acpi: correct palmsensor error checking
        platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron 7352
        platform/x86: touchscreen_dmi: Add swap-x-y quirk for Goodix touchscreen on Estar Beauty HD tablet
        platform/x86: i2c-multi-instantiate: Don't create platform device for INT3515 ACPI nodes
        platform/surface: SURFACE_PLATFORMS should depend on ACPI
        platform/surface: surface_gpe: Fix non-PM_SLEEP build warnings
        tools/power/x86/intel-speed-select: Set higher of cpuinfo_max_freq or base_frequency
        tools/power/x86/intel-speed-select: Set scaling_max_freq to base_frequency
      9887e9af
    • Qais Yousef's avatar
      arm64: kprobes: Fix Uexpected kernel BRK exception at EL1 · 75bd4bff
      Qais Yousef authored
      I was hitting the below panic continuously when attaching kprobes to
      scheduler functions
      
      	[  159.045212] Unexpected kernel BRK exception at EL1
      	[  159.053753] Internal error: BRK handler: f2000006 [#1] PREEMPT SMP
      	[  159.059954] Modules linked in:
      	[  159.063025] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.11.0-rc4-00008-g1e2a199f6ccd #56
      	[rt-app] <notice> [1] Exiting.[  159.071166] Hardware name: ARM Juno development board (r2) (DT)
      	[  159.079689] pstate: 600003c5 (nZCv DAIF -PAN -UAO -TCO BTYPE=--)
      
      	[  159.085723] pc : 0xffff80001624501c
      	[  159.089377] lr : attach_entity_load_avg+0x2ac/0x350
      	[  159.094271] sp : ffff80001622b640
      	[rt-app] <notice> [0] Exiting.[  159.097591] x29: ffff80001622b640 x28: 0000000000000001
      	[  159.105515] x27: 0000000000000049 x26: ffff000800b79980
      
      	[  159.110847] x25: ffff00097ef37840 x24: 0000000000000000
      	[  159.116331] x23: 00000024eacec1ec x22: ffff00097ef12b90
      	[  159.121663] x21: ffff00097ef37700 x20: ffff800010119170
      	[rt-app] <notice> [11] Exiting.[  159.126995] x19: ffff00097ef37840 x18: 000000000000000e
      	[  159.135003] x17: 0000000000000001 x16: 0000000000000019
      	[  159.140335] x15: 0000000000000000 x14: 0000000000000000
      	[  159.145666] x13: 0000000000000002 x12: 0000000000000002
      	[  159.150996] x11: ffff80001592f9f0 x10: 0000000000000060
      	[  159.156327] x9 : ffff8000100f6f9c x8 : be618290de0999a1
      	[  159.161659] x7 : ffff80096a4b1000 x6 : 0000000000000000
      	[  159.166990] x5 : ffff00097ef37840 x4 : 0000000000000000
      	[  159.172321] x3 : ffff000800328948 x2 : 0000000000000000
      	[  159.177652] x1 : 0000002507d52fec x0 : ffff00097ef12b90
      	[  159.182983] Call trace:
      	[  159.185433]  0xffff80001624501c
      	[  159.188581]  update_load_avg+0x2d0/0x778
      	[  159.192516]  enqueue_task_fair+0x134/0xe20
      	[  159.196625]  enqueue_task+0x4c/0x2c8
      	[  159.200211]  ttwu_do_activate+0x70/0x138
      	[  159.204147]  sched_ttwu_pending+0xbc/0x160
      	[  159.208253]  flush_smp_call_function_queue+0x16c/0x320
      	[  159.213408]  generic_smp_call_function_single_interrupt+0x1c/0x28
      	[  159.219521]  ipi_handler+0x1e8/0x3c8
      	[  159.223106]  handle_percpu_devid_irq+0xd8/0x460
      	[  159.227650]  generic_handle_irq+0x38/0x50
      	[  159.231672]  __handle_domain_irq+0x6c/0xc8
      	[  159.235781]  gic_handle_irq+0xcc/0xf0
      	[  159.239452]  el1_irq+0xb4/0x180
      	[  159.242600]  rcu_is_watching+0x28/0x70
      	[  159.246359]  rcu_read_lock_held_common+0x44/0x88
      	[  159.250991]  rcu_read_lock_any_held+0x30/0xc0
      	[  159.255360]  kretprobe_dispatcher+0xc4/0xf0
      	[  159.259555]  __kretprobe_trampoline_handler+0xc0/0x150
      	[  159.264710]  trampoline_probe_handler+0x38/0x58
      	[  159.269255]  kretprobe_trampoline+0x70/0xc4
      	[  159.273450]  run_rebalance_domains+0x54/0x80
      	[  159.277734]  __do_softirq+0x164/0x684
      	[  159.281406]  irq_exit+0x198/0x1b8
      	[  159.284731]  __handle_domain_irq+0x70/0xc8
      	[  159.288840]  gic_handle_irq+0xb0/0xf0
      	[  159.292510]  el1_irq+0xb4/0x180
      	[  159.295658]  arch_cpu_idle+0x18/0x28
      	[  159.299245]  default_idle_call+0x9c/0x3e8
      	[  159.303265]  do_idle+0x25c/0x2a8
      	[  159.306502]  cpu_startup_entry+0x2c/0x78
      	[  159.310436]  secondary_start_kernel+0x160/0x198
      	[  159.314984] Code: d42000c0 aa1e03e9 d42000c0 aa1e03e9 (d42000c0)
      
      After a bit of head scratching and debugging it turned out that it is
      due to kprobe handler being interrupted by a tick that causes us to go
      into (I think another) kprobe handler.
      
      The culprit was kprobe_breakpoint_ss_handler() returning DBG_HOOK_ERROR
      which leads to the Unexpected kernel BRK exception.
      
      Reverting commit ba090f9c ("arm64: kprobes: Remove redundant
      kprobe_step_ctx") seemed to fix the problem for me.
      
      Further analysis showed that kcb->kprobe_status is set to
      KPROBE_REENTER when the error occurs. By teaching
      kprobe_breakpoint_ss_handler() to handle this status I can no  longer
      reproduce the problem.
      
      Fixes: ba090f9c
      
       ("arm64: kprobes: Remove redundant kprobe_step_ctx")
      Signed-off-by: default avatarQais Yousef <qais.yousef@arm.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Link: https://lore.kernel.org/r/20210122110909.3324607-1-qais.yousef@arm.com
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      75bd4bff
  4. Jan 22, 2021
    • Krzysztof Kozlowski's avatar
      i2c: sprd: depend on COMMON_CLK to fix compile tests · 9ecd1d2b
      Krzysztof Kozlowski authored
      The I2C_SPRD uses Common Clock Framework thus it cannot be built on
      platforms without it (e.g. compile test on MIPS with LANTIQ):
      
          /usr/bin/mips-linux-gnu-ld: drivers/i2c/busses/i2c-sprd.o: in function `sprd_i2c_probe':
          i2c-sprd.c:(.text.sprd_i2c_probe+0x254): undefined reference to `clk_set_parent'
      
      Fixes: 4a2d5f66
      
       ("i2c: Enable compile testing for more drivers")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Reviewed-by: default avatarBaolin Wang <baolin.wang7@gmail.com>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      9ecd1d2b
    • Fabio Estevam's avatar
      Revert "i2c: imx: Remove unused .id_table support" · a4166340
      Fabio Estevam authored
      Coldfire platforms are non-DT users of this driver, so
      keep the .id_table support.
      
      This reverts commit c610199c.
      
      Fixes: c610199c
      
       (i2c: imx: Remove unused .id_table support")
      Reported-by: default avatarSascha Hauer <sha@pengutronix.de>
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      a4166340
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/openrisc/linux · 83d09ad4
      Linus Torvalds authored
      Pull OpenRISC fixes from Stafford Horne:
      
       - Compiler warning fixup for new Litex SoC driver
      
       - Sparse warning fixup for iounmap
      
      * tag 'for-linus' of git://github.com/openrisc/linux:
        openrisc: io: Add missing __iomem annotation to iounmap()
        soc: litex: Fix compile warning when device tree is not configured
      83d09ad4
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2021-01-22' of git://anongit.freedesktop.org/drm/drm · 36ada250
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Regular fixes pull, nothing too major in here, just some core fixes,
        one vc4, bunch of i915 and a bunch of amdgpu.
      
        core:
         - atomic: Release state on error
         - syncobj: Fix use-after-free
         - ttm: Don't use GFP_TRANSHUGE_LIGTH
         - vram-helper: Fix memory leak in vmap
      
        vc4:
         - Unify driver naming for PCM
      
        i915:
         - HDCP fixes
         - PMU wakeref fix
         - Fix HWSP validity race
         - Fix DP protocol converter accidental 4:4:4->4:2:0 conversion for RGB
      
        amdgpu:
         - Green Sardine fixes
         - Vangogh fixes
         - Renoir fixes
         - Misc display fixes"
      
      * tag 'drm-fixes-2021-01-22' of git://anongit.freedesktop.org/drm/drm: (21 commits)
        drm/amdgpu: update mmhub mgcg&ls for mmhub_v2_3
        drm/amdgpu: modify GCR_GENERAL_CNTL for Vangogh
        drm/amdgpu/pm: no need GPU status set since mmnbif_gpu_BIF_DOORBELL_FENCE_CNTL added in FSDL
        drm/amd/display: Fixed corruptions on HPDRX link loss restore
        drm/amd/display: Use hardware sequencer functions for PG control
        drm/amd/display: Change function decide_dp_link_settings to avoid infinite looping
        drm/amd/display: Allow PSTATE chnage when no displays are enabled
        drm/amd/display: Update dram_clock_change_latency for DCN2.1
        drm/amdgpu: remove gpu info firmware of green sardine
        drm/amd/display: DCN2X Find Secondary Pipe properly in MPO + ODM Case
        drm/syncobj: Fix use-after-free
        drm/vram-helper: Reuse existing page mappings in vmap
        drm/atomic: put state on error path
        drm/i915: Only enable DFP 4:4:4->4:2:0 conversion when outputting YCbCr 4:4:4
        drm/i915: Check for rq->hwsp validity after acquiring RCU lock
        drm/i915/pmu: Don't grab wakeref when enabling events
        drm/i915/gt: Prevent use of engine->wa_ctx after error
        drm/vc4: Unify PCM card's driver_name
        drm/ttm: stop using GFP_TRANSHUGE_LIGHT
        drm/i915/hdcp: Get conn while content_type changed
        ...
      36ada250
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-5.11-2021-01-21' of... · 06ee38dc
      Dave Airlie authored
      
      Merge tag 'amd-drm-fixes-5.11-2021-01-21' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-5.11-2021-01-21:
      
      amdgpu:
      - Green Sardine fixes
      - Vangogh fixes
      - Renoir fixes
      - Misc display fixes
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexdeucher@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210121160129.3981-1-alexander.deucher@amd.com
      06ee38dc
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2021-01-21' of... · 5f9986a6
      Dave Airlie authored
      
      Merge tag 'drm-intel-fixes-2021-01-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      drm/i915 fixes for v5.11-rc5:
      - HDCP fixes
      - PMU wakeref fix
      - Fix HWSP validity race
      - Fix DP protocol converter accidental 4:4:4->4:2:0 conversion for RGB
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Jani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/87a6t2kzgb.fsf@intel.com
      5f9986a6
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2021-01-20' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · f722f5be
      Dave Airlie authored
      
      
      Short summary of fixes pull (less than what git shortlog provides):
      
       * drm/atomic: Release state on error
       * drm/syncobj: Fix use-after-free
       * drm/ttm: Don't use GFP_TRANSHUGE_LIGTH
       * drm/vc4: Unify driver naming for PCM
       * drm/vram-helper: Fix memory leak in vmap
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/YAgdYGNoH7pC29rz@linux-uq9g
      f722f5be
    • Jin Yao's avatar
      perf script: Fix overrun issue for dynamically-allocated PMU type number · 8adc0a06
      Jin Yao authored
      
      
      When unpacking the event which is from dynamic PMU, the array
      output[OUTPUT_TYPE_MAX] may be overrun. For example, type number of SKL
      uncore_imc is 10, but OUTPUT_TYPE_MAX is 7 now (OUTPUT_TYPE_MAX =
      PERF_TYPE_MAX + 1).
      
      /* In builtin-script.c */
      
      process_event()
      {
              unsigned int type = output_type(attr->type);
      
              if (output[type].fields == 0)
                      return;
      }
      
      output[10] is overrun.
      
      Create a type OUTPUT_TYPE_OTHER for dynamic PMU events, then
      output_type(attr->type) will return OUTPUT_TYPE_OTHER here.
      
      Note that if PERF_TYPE_MAX ever changed, then there would be a conflict
      between old perf.data files that had a dynamicaliy allocated PMU number
      that would then be the same as a fixed PERF_TYPE.
      
      Example:
      
        # perf record --switch-events -C 0 -e "{cpu-clock,uncore_imc/data_reads/,uncore_imc/data_writes/}:SD" -a -- sleep 1
        # perf script
      
        Before:
               swapper     0 [000] 1479253.987551:     277766               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.987797:     246709               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988127:     329883               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988273:     146393               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988523:     249977               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988877:     354090               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989023:     145940               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989383:     359856               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989523:     140082               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
      
        After:
               swapper     0 [000] 1397040.402011:     272384               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402011:       5396  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402011:        967 uncore_imc/data_writes/:
               swapper     0 [000] 1397040.402259:     249153               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402259:       7231  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402259:       1297 uncore_imc/data_writes/:
               swapper     0 [000] 1397040.402508:     249108               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402508:       5333  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402508:       1008 uncore_imc/data_writes/:
      
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Link: https://lore.kernel.org/r/20201209005828.21302-1-yao.jin@linux.intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8adc0a06
    • John Garry's avatar
      perf metricgroup: Fix system PMU metrics · 3d6e79ee
      John Garry authored
      Joakim reports that getting "perf stat" for multiple system PMU metrics
      segfaults:
      
        $ perf stat -a -I 1000 -M imx8mm_ddr_write.all,imx8mm_ddr_write.all
        Segmentation fault
        $
      
      While the same works without issue for a single metric.
      
      The logic in metricgroup__add_metric_sys_event_iter() is broken, in that
      add_metric() @m argument should be NULL for each new metric. Fix by not
      passing a holder for that, and rather make local in
      metricgroup__add_metric_sys_event_iter().
      
      Fixes: be335ec2
      
       ("perf metricgroup: Support adding metrics for system PMUs")
      Reported-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linuxarm@openeuler.org
      Link: https://lore.kernel.org/r/1611050655-44020-1-git-send-email-john.garry@huawei.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d6e79ee
    • John Garry's avatar
      perf metricgroup: Fix for metrics containing duration_time · 9c880c24
      John Garry authored
      Metrics containing duration_time cause a segfault:
      
        $ perf stat -v -M L1D_Cache_Fill_BW sleep 1
        Using CPUID GenuineIntel-6-3D-4
        metric expr 64 * l1d.replacement / 1000000000 / duration_time for L1D_Cache_Fill_BW
        found event duration_time
        found event l1d.replacement
        adding {l1d.replacement}:W,duration_time
        l1d.replacement -> cpu/umask=0x1,(null)=0x1e8483,event=0x51/
        Segmentation fault
        $
      
      In commit c2337d67 ("perf metricgroup: Fix metrics using aliases
      covering multiple PMUs"), the logic in find_evsel_group() when iter'ing
      events was changed to not only select events in same group, but also for
      aliased PMUs.
      
      Checking whether events were for aliased PMUs was done by comparing the
      event PMU name. This was not safe for duration_time event, which has no
      associated PMU (and no PMU name), so fix by checking if the event PMU name
      is set also.
      
      Committer testing:
      
      Reproduced the bug, then, on a:
      
        $ grep -m1 ^'model name' /proc/cpuinfo
        model name	: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
        $
      
      We now get:
      
        $ perf stat -M L1D_Cache_Fill_BW sleep 1
      
         Performance counter stats for 'sleep 1':
      
                     4,141      l1d.replacement:u
             1,001,285,107 ns   duration_time:u
      
               1.001285107 seconds time elapsed
      
               0.000000000 seconds user
               0.001119000 seconds sys
      
        $
      
      Detais from -v:
      
        Using CPUID GenuineIntel-6-8E-A
        metric expr 64 * l1d.replacement / 1000000000 / duration_time for L1D_Cache_Fill_BW
        found event duration_time
        found event l1d.replacement
        adding {l1d.replacement}:W,duration_time
        l1d.replacement -> cpu/(null)=0x1e8483,umask=0x1,event=0x51/
        Control descriptor is not initialized
        Warning:
        kernel.perf_event_paranoid=2, trying to fall back to excluding kernel and hypervisor  samples
        Warning:
        kernel.perf_event_paranoid=2, trying to fall back to excluding kernel and hypervisor  samples
        l1d.replacement:u: 4592 612201 612201
        duration_time:u: 1001478621 1001478621 1001478621
      
      Fixes: c2337d67
      
       ("perf metricgroup: Fix metrics using aliases covering multiple PMUs")
      Reported-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linuxarm@openeuler.org
      Link: https://lore.kernel.org/r/1611159518-226883-1-git-send-email-john.garry@huawei.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9c880c24
    • Adrian Hunter's avatar
      perf evlist: Fix id index for heterogeneous systems · fc705fec
      Adrian Hunter authored
      perf_evlist__set_sid_idx() updates perf_sample_id with the evlist map
      index, CPU number and TID. It is passed indexes to the evsel's cpu and
      thread maps, but references the evlist's maps instead. That results in
      using incorrect CPU numbers on heterogeneous systems. Fix it by using
      evsel maps.
      
      The id index (PERF_RECORD_ID_INDEX) is used by AUX area tracing when in
      sampling mode. Having an incorrect CPU number causes the trace data to
      be attributed to the wrong CPU, and can result in decoder errors because
      the trace data is then associated with the wrong process.
      
      Committer notes:
      
      Keep the class prefix convention in the function name, switching from
      perf_evlist__set_sid_idx() to perf_evsel__set_sid_idx().
      
      Fixes: 3c659eed
      
       ("perf tools: Add id index")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20210121125446.11287-1-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fc705fec
    • Hannes Reinecke's avatar
      dm: avoid filesystem lookup in dm_get_dev_t() · 809b1e49
      Hannes Reinecke authored
      This reverts commit
      644bda6f ("dm table: fall back to getting device using name_to_dev_t()")
      
      dm_get_dev_t() is just used to convert an arbitrary 'path' string
      into a dev_t. It doesn't presume that the device is present; that
      check will be done later, as the only caller is dm_get_device(),
      which does a dm_get_table_device() later on, which will properly
      open the device.
      
      So if the path string already _is_ in major:minor representation
      we can convert it directly, avoiding a recursion into the filesystem
      to lookup the block device.
      
      This avoids a hang in multipath_message() when the filesystem is
      inaccessible.
      
      Fixes: 644bda6f
      
       ("dm table: fall back to getting device using name_to_dev_t()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      809b1e49
    • Ignat Korchagin's avatar
      dm crypt: fix copy and paste bug in crypt_alloc_req_aead · 004b8ae9
      Ignat Korchagin authored
      In commit d68b2958 ("dm crypt: use GFP_ATOMIC when allocating
      crypto requests from softirq") code was incorrectly copy and pasted
      from crypt_alloc_req_skcipher()'s crypto request allocation code to
      crypt_alloc_req_aead(). It is OK from runtime perspective as both
      simple encryption request pointer and AEAD request pointer are part of
      a union, but may confuse code reviewers.
      
      Fixes: d68b2958
      
       ("dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq")
      Cc: stable@vger.kernel.org # v5.9+
      Reported-by: default avatarPavel Machek <pavel@denx.de>
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      004b8ae9
    • Mikulas Patocka's avatar
      dm integrity: conditionally disable "recalculate" feature · 5c024064
      Mikulas Patocka authored
      
      
      Otherwise a malicious user could (ab)use the "recalculate" feature
      that makes dm-integrity calculate the checksums in the background
      while the device is already usable. When the system restarts before all
      checksums have been calculated, the calculation continues where it was
      interrupted even if the recalculate feature is not requested the next
      time the dm device is set up.
      
      Disable recalculating if we use internal_hash or journal_hash with a
      key (e.g. HMAC) and we don't have the "legacy_recalculate" flag.
      
      This may break activation of a volume, created by an older kernel,
      that is not yet fully recalculated -- if this happens, the user should
      add the "legacy_recalculate" flag to constructor parameters.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reported-by: default avatarDaniel Glockner <dg@emlix.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      5c024064
    • Linus Torvalds's avatar
      Merge tag 'fs_for_v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 9f29bd8b
      Linus Torvalds authored
      Pull fs and udf fixes from Jan Kara:
       "A lazytime handling fix from Eric Biggers and a fix of UDF session
        handling for large devices"
      
      * tag 'fs_for_v5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        udf: fix the problem that the disc content is not displayed
        fs: fix lazytime expiration handling in __writeback_single_inode()
      9f29bd8b
    • Mikulas Patocka's avatar
      dm integrity: fix a crash if "recalculate" used without "internal_hash" · 2d06dfec
      Mikulas Patocka authored
      
      
      Recalculate can only be specified with internal_hash.
      
      Cc: stable@vger.kernel.org # v4.19+
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      2d06dfec
    • Linus Torvalds's avatar
      Merge tag 'printk-for-5.11-printk-rework-fixup' of... · 2561bbbe
      Linus Torvalds authored
      Merge tag 'printk-for-5.11-printk-rework-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
      
      Pull printk fixes from Petr Mladek:
      
       - Fix line counting and buffer size calculation. Both regressions
         caused that a reader buffer might not get filled as much as possible.
      
       - Restore non-documented behavior of printk() reader API and make it
         official.
      
         It did not fill the last byte of the provided buffer before 5.10. Two
         architectures, powerpc and um, used it to add the trailing '\0'.
         There might theoretically be more callers depending on this behavior
         in userspace.
      
      * tag 'printk-for-5.11-printk-rework-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
        printk: fix buffer overflow potential for print_text()
        printk: fix kmsg_dump_get_buffer length calulations
        printk: ringbuffer: fix line counting
      2561bbbe
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 6a52f4cf
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Modify a helper function in the ACPI core to match the behavior
        expected by its users so as to prevent NULL pointer dereferences and
        occasional memory corruption from occurring (Hans de Goede)"
      
      * tag 'acpi-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: scan: Make acpi_bus_get_device() clear return pointer on error
      6a52f4cf
    • Linus Torvalds's avatar
      Merge tag 'sound-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 120fbdb8
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Here is a collection of sound fixes targeted for 5.11-rc5. Most
        notably, USB-audio still got a few intensive changes for covering the
        regressions while the rest are all small fixes.
      
         - A trivial fix for sequencer OSS emulation error path
      
         - HD-audio runtime PM regression fix, a few quirks and new IDs
      
         - USB-audio regression fixes for Pioneer device, Logitech webcams,
           etc
      
         - ASoC SOF Intel coverage
      
         - MAINTAINERS file update
      
         - A fix in the jack handling in ASoC HDMI codec"
      
      * tag 'sound-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: usb-audio: Fix hw constraints dependencies
        ALSA: hda: Balance runtime/system PM if direct-complete is disabled
        ALSA: usb-audio: Avoid implicit feedback on Pioneer devices
        ALSA: usb-audio: Set sample rate for all sharing EPs on UAC1
        ALSA: usb-audio: Fix UAC1 rate setup for secondary endpoints
        MAINTAINERS: update qcom ASoC drivers list
        MAINTAINERS: update maintainers of qcom audio
        ALSA: hda: Add Cometlake-R PCI ID
        ALSA: seq: oss: Fix missing error check in snd_seq_oss_synth_make_info()
        ALSA: hda/via: Add minimum mute flag
        ALSA: hda/realtek - Limit int mic boost on Acer Aspire E5-575T
        ALSA: usb-audio: Always apply the hw constraints for implicit fb sync
        ASoC: SOF: Intel: fix page fault at probe if i915 init fails
        ALSA: hda: Add AlderLake-P PCI ID and HDMI codec vid
        ASoC: SOF: Intel: hda: Avoid checking jack on system suspend
        ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN
        ASoC: SOF: Intel: hda: Resume codec to do jack detection
        MAINTAINERS: update references to stm32 audio bindings
        ASoC: hdmi-codec: Fix return value in hdmi_codec_set_jack()
      120fbdb8