1. May 07, 2022
    • Luis Chamberlain's avatar
      f2fs: call bdev_zone_sectors() only once on init_blkz_info() · d46db459
      Luis Chamberlain authored
      
      
      Instead of calling bdev_zone_sectors() multiple times, call
      it once and cache the value locally. This will make the
      subsequent change easier to read.
      
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: default avatarPankaj Raghav <p.raghav@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      d46db459
    • Niels Dossche's avatar
      f2fs: extend stat_lock to avoid potential race in statfs · 4de85145
      Niels Dossche authored
      There are multiple calculations and reads of fields of sbi that should
      be protected by stat_lock. As stat_lock is not used to read these
      values in statfs, this can lead to inconsistent results.
      Extend the locking to prevent this issue.
      Commit c9c8ed50
      
       ("f2fs: fix to avoid potential race on
      sbi->unusable_block_count access/update")
      already added the use of sbi->stat_lock in statfs in
      order to make the calculation of multiple, different fields atomic so
      that results are consistent. This is similar to that patch regarding the
      change in statfs.
      
      Signed-off-by: default avatarNiels Dossche <dossche.niels@gmail.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      4de85145
    • Jaegeuk Kim's avatar
      f2fs: avoid infinite loop to flush node pages · a7b8618a
      Jaegeuk Kim authored
      
      
      xfstests/generic/475 can give EIO all the time which give an infinite loop
      to flush node page like below. Let's avoid it.
      
      [16418.518551] Call Trace:
      [16418.518553]  ? dm_submit_bio+0x48/0x400
      [16418.518574]  ? submit_bio_checks+0x1ac/0x5a0
      [16418.525207]  __submit_bio+0x1a9/0x230
      [16418.525210]  ? kmem_cache_alloc+0x29e/0x3c0
      [16418.525223]  submit_bio_noacct+0xa8/0x2b0
      [16418.525226]  submit_bio+0x4d/0x130
      [16418.525238]  __submit_bio+0x49/0x310 [f2fs]
      [16418.525339]  ? bio_add_page+0x6a/0x90
      [16418.525344]  f2fs_submit_page_bio+0x134/0x1f0 [f2fs]
      [16418.525365]  read_node_page+0x125/0x1b0 [f2fs]
      [16418.525388]  __get_node_page.part.0+0x58/0x3f0 [f2fs]
      [16418.525409]  __get_node_page+0x2f/0x60 [f2fs]
      [16418.525431]  f2fs_get_dnode_of_data+0x423/0x860 [f2fs]
      [16418.525452]  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
      [16418.525458]  ? __mod_memcg_state.part.0+0x2a/0x30
      [16418.525465]  ? __mod_memcg_lruvec_state+0x27/0x40
      [16418.525467]  ? __xa_set_mark+0x57/0x70
      [16418.525472]  f2fs_do_write_data_page+0x10e/0x7b0 [f2fs]
      [16418.525493]  f2fs_write_single_data_page+0x555/0x830 [f2fs]
      [16418.525514]  ? sysvec_apic_timer_interrupt+0x4e/0x90
      [16418.525518]  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
      [16418.525523]  f2fs_write_cache_pages+0x303/0x880 [f2fs]
      [16418.525545]  ? blk_flush_plug_list+0x47/0x100
      [16418.525548]  f2fs_write_data_pages+0xfd/0x320 [f2fs]
      [16418.525569]  do_writepages+0xd5/0x210
      [16418.525648]  filemap_fdatawrite_wbc+0x7d/0xc0
      [16418.525655]  filemap_fdatawrite+0x50/0x70
      [16418.525658]  f2fs_sync_dirty_inodes+0xa4/0x230 [f2fs]
      [16418.525679]  f2fs_write_checkpoint+0x16d/0x1720 [f2fs]
      [16418.525699]  ? ttwu_do_wakeup+0x1c/0x160
      [16418.525709]  ? ttwu_do_activate+0x6d/0xd0
      [16418.525711]  ? __wait_for_common+0x11d/0x150
      [16418.525715]  kill_f2fs_super+0xca/0x100 [f2fs]
      [16418.525733]  deactivate_locked_super+0x3b/0xb0
      [16418.525739]  deactivate_super+0x40/0x50
      [16418.525741]  cleanup_mnt+0x139/0x190
      [16418.525747]  __cleanup_mnt+0x12/0x20
      [16418.525749]  task_work_run+0x6d/0xa0
      [16418.525765]  exit_to_user_mode_prepare+0x1ad/0x1b0
      [16418.525771]  syscall_exit_to_user_mode+0x27/0x50
      [16418.525774]  do_syscall_64+0x48/0xc0
      [16418.525776]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      a7b8618a
    • Jaegeuk Kim's avatar
      f2fs: use flush command instead of FUA for zoned device · c550e25b
      Jaegeuk Kim authored
      
      
      The block layer for zoned disk can reorder the FUA'ed IOs. Let's use flush
      command to keep the write order.
      
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      c550e25b
    • Dongliang Mu's avatar
      f2fs: remove WARN_ON in f2fs_is_valid_blkaddr · dc2f78e2
      Dongliang Mu authored
      
      
      Syzbot triggers two WARNs in f2fs_is_valid_blkaddr and
      __is_bitmap_valid. For example, in f2fs_is_valid_blkaddr,
      if type is DATA_GENERIC_ENHANCE or DATA_GENERIC_ENHANCE_READ,
      it invokes WARN_ON if blkaddr is not in the right range.
      The call trace is as follows:
      
       f2fs_get_node_info+0x45f/0x1070
       read_node_page+0x577/0x1190
       __get_node_page.part.0+0x9e/0x10e0
       __get_node_page
       f2fs_get_node_page+0x109/0x180
       do_read_inode
       f2fs_iget+0x2a5/0x58b0
       f2fs_fill_super+0x3b39/0x7ca0
      
      Fix these two WARNs by replacing WARN_ON with dump_stack.
      
      Reported-by: default avatar <syzbot+763ae12a2ede1d99d4dc@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      dc2f78e2
  2. Apr 26, 2022
  3. Apr 25, 2022
  4. Apr 24, 2022
  5. Apr 23, 2022
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2022-04-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · c18a2a28
      Dave Airlie authored
      
      
      Two fixes for the raspberrypi panel initialisation, one fix for a logic
      inversion in radeon, a build and pm refcounting fix for vc4, two reverts
      for drm_of_get_bridge that caused a number of regression and a locking
      regression for amdgpu.
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220422084403.2xrhf3jusdej5yo4@houat
      c18a2a28
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · c00c5e1d
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Fix some syzbot-detected bugs, as well as other bugs found by I/O
        injection testing.
      
        Change ext4's fallocate to consistently drop set[ug]id bits when an
        fallocate operation might possibly change the user-visible contents of
        a file.
      
        Also, improve handling of potentially invalid values in the the
        s_overhead_cluster superblock field to avoid ext4 returning a negative
        number of free blocks"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        jbd2: fix a potential race while discarding reserved buffers after an abort
        ext4: update the cached overhead value in the superblock
        ext4: force overhead calculation if the s_overhead_cluster makes no sense
        ext4: fix overhead calculation to account for the reserved gdt blocks
        ext4, doc: fix incorrect h_reserved size
        ext4: limit length to bitmap_maxbytes - blocksize in punch_hole
        ext4: fix use-after-free in ext4_search_dir
        ext4: fix bug_on in start_this_handle during umount filesystem
        ext4: fix symlink file size not match to file content
        ext4: fix fallocate to use file_modified to update permissions consistently
      c00c5e1d
    • Linus Torvalds's avatar
      Merge tag 'ata-5.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · 2e5991fa
      Linus Torvalds authored
      Pull ATA fix from Damien Le Moal:
       "A single fix to avoid a NULL pointer dereference in the pata_marvell
        driver with adapters not supporting DMA, from Zheyu"
      
      * tag 'ata-5.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        ata: pata_marvell: Check the 'bmdma_addr' beforing reading
      2e5991fa
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · bb4ce2c6
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "The main and larger change here is a workaround for AMD's lack of
        cache coherency for encrypted-memory guests.
      
        I have another patch pending, but it's waiting for review from the
        architecture maintainers.
      
        RISC-V:
      
         - Remove 's' & 'u' as valid ISA extension
      
         - Do not allow disabling the base extensions 'i'/'m'/'a'/'c'
      
        x86:
      
         - Fix NMI watchdog in guests on AMD
      
         - Fix for SEV cache incoherency issues
      
         - Don't re-acquire SRCU lock in complete_emulated_io()
      
         - Avoid NULL pointer deref if VM creation fails
      
         - Fix race conditions between APICv disabling and vCPU creation
      
         - Bugfixes for disabling of APICv
      
         - Preserve BSP MSR_KVM_POLL_CONTROL across suspend/resume
      
        selftests:
      
         - Do not use bitfields larger than 32-bits, they differ between GCC
           and clang"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        kvm: selftests: introduce and use more page size-related constants
        kvm: selftests: do not use bitfields larger than 32-bits for PTEs
        KVM: SEV: add cache flush to solve SEV cache incoherency issues
        KVM: SVM: Flush when freeing encrypted pages even on SME_COHERENT CPUs
        KVM: SVM: Simplify and harden helper to flush SEV guest page(s)
        KVM: selftests: Silence compiler warning in the kvm_page_table_test
        KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog
        x86/kvm: Preserve BSP MSR_KVM_POLL_CONTROL across suspend/resume
        KVM: SPDX style and spelling fixes
        KVM: x86: Skip KVM_GUESTDBG_BLOCKIRQ APICv update if APICv is disabled
        KVM: x86: Pend KVM_REQ_APICV_UPDATE during vCPU creation to fix a race
        KVM: nVMX: Defer APICv updates while L2 is active until L1 is active
        KVM: x86: Tag APICv DISABLE inhibit, not ABSENT, if APICv is disabled
        KVM: Initialize debugfs_dentry when a VM is created to avoid NULL deref
        KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abused
        KVM: RISC-V: Use kvm_vcpu.srcu_idx, drop RISC-V's unnecessary copy
        KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
        RISC-V: KVM: Restrict the extensions that can be disabled
        RISC-V: KVM: Remove 's' & 'u' as valid ISA extension
      bb4ce2c6
    • Thomas Richter's avatar
      perf test: Fix error message for test case 71 on s390, where it is not supported · 5bb017d4
      Thomas Richter authored
      Test case 71 'Convert perf time to TSC' is not supported on s390.
      
      Subtest 71.1 is skipped with the correct message, but subtest 71.2 is
      not skipped and fails.
      
      The root cause is function evlist__open() called from
      test__perf_time_to_tsc().  evlist__open() returns -ENOENT because the
      event cycles:u is not supported by the selected PMU, for example
      platform s390 on z/VM or an x86_64 virtual machine.
      
      The PMU driver returns -ENOENT in this case. This error is leads to the
      failure.
      
      Fix this by returning TEST_SKIP on -ENOENT.
      
      Output before:
       71: Convert perf time to TSC:
       71.1: TSC support:             Skip (This architecture does not support)
       71.2: Perf time to TSC:        FAILED!
      
      Output after:
       71: Convert perf time to TSC:
       71.1: TSC support:             Skip (This architecture does not support)
       71.2: Perf time to TSC:        Skip (perf_read_tsc_conversion is not supported)
      
      This also happens on an x86_64 virtual machine:
         # uname -m
         x86_64
         $ ./perf test -F 71
          71: Convert perf time to TSC  :
          71.1: TSC support             : Ok
          71.2: Perf time to TSC        : FAILED!
         $
      
      Committer testing:
      
      Continues to work on x86_64:
      
        $ perf test 71
         71: Convert perf time to TSC    :
         71.1: TSC support               : Ok
         71.2: Perf time to TSC          : Ok
        $
      
      Fixes: 290fa68b
      
       ("perf test tsc: Fix error message when not supported")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Chengdong Li <chengdongli@tencent.com>
      Cc: chengdongli@tencent.com
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220420062921.1211825-1-tmricht@linux.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5bb017d4
    • Leo Yan's avatar
      perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event · ccb17cae
      Leo Yan authored
      Since commit bb30acae ("perf report: Bail out --mem-mode if mem
      info is not available") "perf mem report" and "perf report --mem-mode"
      don't report result if the PERF_SAMPLE_DATA_SRC bit is missed in sample
      type.
      
      The commit ffab4870 ("perf: arm-spe: Fix perf report
      --mem-mode") partially fixes the issue.  It adds PERF_SAMPLE_DATA_SRC
      bit for Arm SPE event, this allows the perf data file generated by
      kernel v5.18-rc1 or later version can be reported properly.
      
      On the other hand, perf tool still fails to be backward compatibility
      for a data file recorded by an older version's perf which contains Arm
      SPE trace data.  This patch is a workaround in reporting phase, when
      detects ARM SPE PMU event and without PERF_SAMPLE_DATA_SRC bit, it will
      force to set the bit in the sample type and give a warning info.
      
      Fixes: bb30acae
      
       ("perf report: Bail out --mem-mode if mem info is not available")
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Tested-by: default avatarGerman Gomez <german.gomez@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220414123201.842754-1-leo.yan@linaro.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ccb17cae
    • Leo Yan's avatar
      perf script: Always allow field 'data_src' for auxtrace · c6d8df01
      Leo Yan authored
      If use command 'perf script -F,+data_src' to dump memory samples with
      Arm SPE trace data, it reports error:
      
        # perf script -F,+data_src
        Samples for 'dummy:u' event do not have DATA_SRC attribute set. Cannot print 'data_src' field.
      
      This is because the 'dummy:u' event is absent DATA_SRC bit in its sample
      type, so if a file contains AUX area tracing data then always allow
      field 'data_src' to be selected as an option for perf script.
      
      Fixes: e55ed342
      
       ("perf arm-spe: Synthesize memory event")
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220417114837.839896-1-leo.yan@linaro.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c6d8df01
    • Guilherme Amadio's avatar
      perf clang: Fix header include for LLVM >= 14 · d22588d7
      Guilherme Amadio authored
      
      
      The header TargetRegistry.h has moved in LLVM/clang 14.
      
      Committer notes:
      
      The problem as noticed when building in ubuntu:22.04:
      
          90    98.61 ubuntu:22.04                  : FAIL gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)
            util/c++/clang.cpp:23:10: fatal error: llvm/Support/TargetRegistry.h: No such file or directory
               23 | #include "llvm/Support/TargetRegistry.h"
                  |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            compilation terminated.
      
      Fixed after applying this patch.
      
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarGuilherme Amadio <amadio@gentoo.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://twitter.com/GuilhermeAmadio/status/1514970524232921088
      Link: http://lore.kernel.org/lkml/Ylp0M/VYgHOxtcnF@gentoo.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d22588d7