1. 27 May, 2022 6 commits
    • Zhihao Cheng's avatar
      ubi: fastmap: Check wl_pool for free peb before wear leveling · 14072ee3
      Zhihao Cheng authored
      UBI fetches free peb from wl_pool during wear leveling, so UBI should
      check wl_pool's empty status before wear leveling. Otherwise, UBI will
      miss wear leveling chances when free pebs are run out.
      Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      14072ee3
    • Zhihao Cheng's avatar
      ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty · d09e9a2b
      Zhihao Cheng authored
      There at least 6 PEBs reserved on UBI device:
      1. EBA_RESERVED_PEBS[1]
      2. WL_RESERVED_PEBS[1]
      3. UBI_LAYOUT_VOLUME_EBS[2]
      4. MIN_FASTMAP_RESERVED_PEBS[2]
      
      When all ubi volumes take all their PEBs, there are 3 (EBA_RESERVED_PEBS +
      WL_RESERVED_PEBS + MIN_FASTMAP_RESERVED_PEBS - MIN_FASTMAP_TAKEN_PEBS[1])
      free PEBs. Since commit f9c34bb5 ("ubi: Fix producing anchor PEBs")
      and commit 4b68bf9a ("ubi: Select fastmap anchor PEBs considering
      wear level rules") applied, there is only 1 (3 - FASTMAP_ANCHOR_PEBS[1] -
      FASTMAP_NEXT_ANCHOR_PEBS[1]) free PEB to fill pool and wl_pool, after
      filling pool, wl_pool is always empty. So, UBI could be stuck in an
      infinite loop:
      
      	ubi_thread	   system_wq
      wear_leveling_worker <--------------------------------------------------
        get_peb_for_wl							|
          // fm_wl_pool, used = size = 0					|
          schedule_work(&ubi->fm_work)					|
      									|
      		    update_fastmap_work_fn				|
      		      ubi_update_fastmap				|
      			ubi_refill_pools				|
      			// ubi->free_count - ubi->beb_rsvd_pebs < 5	|
      			// wl_pool is not filled with any PEBs		|
      			schedule_erase(old_fm_anchor)			|
      			ubi_ensure_anchor_pebs				|
      			  __schedule_ubi_work(wear_leveling_worker)	|
      									|
      __erase_worker								|
        ensure_wear_leveling							|
          __schedule_ubi_work(wear_leveling_worker) --------------------------
      
      , which cause high cpu usage of ubi_bgt:
      top - 12:10:42 up 5 min,  2 users,  load average: 1.76, 0.68, 0.27
      Tasks: 123 total,   3 running,  54 sleeping,   0 stopped,   0 zombie
      
        PID USER PR   NI VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
       1589 root 20   0   0      0      0 R  45.0  0.0   0:38.86 ubi_bgt0d
        319 root 20   0   0      0      0 I  15.2  0.0   0:15.29 kworker/0:3-eve
        371 root 20   0   0      0      0 I  14.9  0.0   0:12.85 kworker/3:3-eve
         20 root 20   0   0      0      0 I  11.3  0.0   0:05.33 kworker/1:0-eve
        202 root 20   0   0      0      0 I  11.3  0.0   0:04.93 kworker/2:3-eve
      
      In commit 4b68bf9a ("ubi: Select fastmap anchor PEBs considering
      wear level rules"), there are three key changes:
        1) Choose the fastmap anchor when the most free PEBs are available.
        2) Enable anchor move within the anchor area again as it is useful
           for distributing wear.
        3) Import a candidate fm anchor and check this PEB's erase count during
           wear leveling. If the wear leveling limit is exceeded, use the used
           anchor area PEB with the lowest erase count to replace it.
      
      The anchor candidate can be removed, we can check fm_anchor PEB's erase
      count during wear leveling. Fix it by:
        1) Removing 'fm_next_anchor' and check 'fm_anchor' during wear leveling.
        2) Preferentially filling one free peb into fm_wl_pool in condition of
           ubi->free_count > ubi->beb_rsvd_pebs, then try to reserve enough
           free count for fastmap non anchor pebs after the above prerequisites
           are met.
      Then, there are at least 1 PEB in pool and 1 PEB in wl_pool after calling
      ubi_refill_pools() with all erase works done.
      
      Fetch a reproducer in [Link].
      
      Fixes: 4b68bf9a ("ubi: Select fastmap anchor PEBs ... rules")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=215407Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      d09e9a2b
    • Haowen Bai's avatar
      ubifs: Use NULL instead of using plain integer as pointer · 532aef59
      Haowen Bai authored
      This fixes the following sparse warnings:
      fs/ubifs/xattr.c:680:58: warning: Using plain integer as NULL pointer
      Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      532aef59
    • Minghao Chi's avatar
      ubifs: Simplify the return expression of run_gc() · 5bff56ed
      Minghao Chi authored
      Simplify the return expression.
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
      Reviewed-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      5bff56ed
    • Baokun Li's avatar
      jffs2: fix memory leak in jffs2_do_fill_super · c14adb1c
      Baokun Li authored
      If jffs2_iget() or d_make_root() in jffs2_do_fill_super() returns
      an error, we can observe the following kmemleak report:
      
      --------------------------------------------
      unreferenced object 0xffff888105a65340 (size 64):
        comm "mount", pid 710, jiffies 4302851558 (age 58.239s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff859c45e5>] kmem_cache_alloc_trace+0x475/0x8a0
          [<ffffffff86160146>] jffs2_sum_init+0x96/0x1a0
          [<ffffffff86140e25>] jffs2_do_mount_fs+0x745/0x2120
          [<ffffffff86149fec>] jffs2_do_fill_super+0x35c/0x810
          [<ffffffff8614aae9>] jffs2_fill_super+0x2b9/0x3b0
          [...]
      unreferenced object 0xffff8881bd7f0000 (size 65536):
        comm "mount", pid 710, jiffies 4302851558 (age 58.239s)
        hex dump (first 32 bytes):
          bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb  ................
          bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb  ................
        backtrace:
          [<ffffffff858579ba>] kmalloc_order+0xda/0x110
          [<ffffffff85857a11>] kmalloc_order_trace+0x21/0x130
          [<ffffffff859c2ed1>] __kmalloc+0x711/0x8a0
          [<ffffffff86160189>] jffs2_sum_init+0xd9/0x1a0
          [<ffffffff86140e25>] jffs2_do_mount_fs+0x745/0x2120
          [<ffffffff86149fec>] jffs2_do_fill_super+0x35c/0x810
          [<ffffffff8614aae9>] jffs2_fill_super+0x2b9/0x3b0
          [...]
      --------------------------------------------
      
      This is because the resources allocated in jffs2_sum_init() are not
      released. Call jffs2_sum_exit() to release these resources to solve
      the problem.
      
      Fixes: e631ddba ("[JFFS2] Add erase block summary support (mount time improvement)")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      c14adb1c
    • Haowen Bai's avatar
      jffs2: Use kzalloc instead of kmalloc/memset · 22abf318
      Haowen Bai authored
      Use kzalloc rather than duplicating its implementation, which
      makes code simple and easy to understand.
      Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
      [rw: Fixed printk string]
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      22abf318
  2. 16 May, 2022 1 commit
  3. 15 May, 2022 8 commits
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.18-rc7' of... · 0cdd776e
      Linus Torvalds authored
      Merge tag 'driver-core-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fixes from Greg KH:
       "Here is one fix, and three documentation updates for 5.18-rc7.
      
        The fix is for the firmware loader which resolves a long-reported
        problem where the credentials of the firmware loader could be set to a
        userspace process without enough permissions to actually load the
        firmware image. Many Android vendors have been reporting this for
        quite some time.
      
        The documentation updates are for the embargoed-hardware-issues.rst
        file to add a new entry, change an existing one, and sort the list to
        make changes easier in the future.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'driver-core-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        Documentation/process: Update ARM contact for embargoed hardware issues
        Documentation/process: Add embargoed HW contact for Ampere Computing
        Documentation/process: Make groups alphabetical and use tabs consistently
        firmware_loader: use kernel credentials when reading firmware
      0cdd776e
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 5becde60
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are two small driver fixes for 5.18-rc7 that resolve reported
        problems:
      
         - slimbus driver irq bugfix
      
         - interconnect sync state bugfix
      
        Both of these have been in linux-next with no reported problems"
      
      * tag 'char-misc-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        slimbus: qcom: Fix IRQ check in qcom_slim_probe
        interconnect: Restore sync state by ignoring ipa-virt in provider count
      5becde60
    • Linus Torvalds's avatar
      Merge tag 'tty-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 6811a466
      Linus Torvalds authored
      Pull tty/serial driver fixes from Greg KH:
       "Here are some small tty n_gsm and serial driver fixes for 5.18-rc7
        that resolve reported problems. They include:
      
         - n_gsm fixes for reported issues
      
         - 8250_mtk driver fixes for some platforms
      
         - fsl_lpuart driver fix for reported problem.
      
         - digicolor driver fix for reported problem.
      
        All have been in linux-next for a while with no reported problems"
      
      * tag 'tty-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        fsl_lpuart: Don't enable interrupts too early
        tty: n_gsm: fix invalid gsmtty_write_room() result
        tty: n_gsm: fix mux activation issues in gsm_config()
        tty: n_gsm: fix buffer over-read in gsm_dlci_data()
        serial: 8250_mtk: Fix register address for XON/XOFF character
        serial: 8250_mtk: Make sure to select the right FEATURE_SEL
        serial: 8250_mtk: Fix UART_EFR register address
        tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe()
      6811a466
    • Linus Torvalds's avatar
      Merge tag 'usb-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · fc49583c
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small fixes for reported issues with some USB drivers.
        They include:
      
         - xhci fixes for xhci-mtk platform driver
      
         - typec driver fixes for reported problems.
      
         - cdc-wdm read-stuck fix
      
         - gadget driver fix for reported race condition
      
         - new usb-serial driver ids
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: xhci-mtk: remove bandwidth budget table
        usb: xhci-mtk: fix fs isoc's transfer error
        usb: gadget: fix race when gadget driver register via ioctl
        usb: typec: tcpci_mt6360: Update for BMC PHY setting
        usb: gadget: uvc: allow for application to cleanly shutdown
        usb: typec: tcpci: Don't skip cleanup in .remove() on error
        usb: cdc-wdm: fix reading stuck on device close
        USB: serial: qcserial: add support for Sierra Wireless EM7590
        USB: serial: option: add Fibocom MA510 modem
        USB: serial: option: add Fibocom L610 modem
        USB: serial: pl2303: add device id for HP LM930 Display
      fc49583c
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.18-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · bc403203
      Linus Torvalds authored
      Pull powerpc fix from Michael Ellerman:
      
       - Fix KVM PR on 32-bit, which was broken by some MMU code refactoring.
      
      Thanks to: Alexander Graf, and Matt Evans.
      
      * tag 'powerpc-5.18-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        KVM: PPC: Book3S PR: Enable MSR_DR for switch_mmu_context()
      bc403203
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 79dc4fc2
      Linus Torvalds authored
      Pull x86 fix from Thomas Gleixner:
       "A single fix for the handling of unpopulated sub-pmd spaces.
      
        The copy & pasta from the corresponding s390 code screwed up the
        address calculation for marking the sub-pmd ranges via memset by
        omitting the ALIGN_DOWN() to calculate the proper start address.
      
        It's a mystery why this code is not generic and shared because there
        is nothing architecture specific in there, but that's too intrusive
        for a backportable fix"
      
      * tag 'x86-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Fix marking of unused sub-pmd ranges
      79dc4fc2
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 990e798d
      Linus Torvalds authored
      Pull scheduler fix from Thomas Gleixner:
       "The recent expansion of the sched switch tracepoint inserted a new
        argument in the middle of the arguments. This reordering broke BPF
        programs which relied on the old argument list.
      
        While tracepoints are not considered stable ABI, it's not trivial to
        make BPF cope with such a change, but it's being worked on. For now
        restore the original argument order and move the new argument to the
        end of the argument list"
      
      * tag 'sched-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/tracing: Append prev_state to tp args instead
      990e798d
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · fb756280
      Linus Torvalds authored
      Pull irq fix from Thomas Gleixner:
       "A single fix for a recent (introduced in 5.16) regression in the core
        interrupt code.
      
        The consolidation of the interrupt handler invocation code added an
        unconditional warning when generic_handle_domain_irq() is invoked from
        outside hard interrupt context. That's overbroad as the requirement
        for invoking these handlers in hard interrupt context is only required
        for certain interrupt types. The subsequently called code already
        contains a warning which triggers conditionally for interrupt chips
        which indicate this requirement in their properties.
      
        Remove the overbroad one"
      
      * tag 'irq-urgent-2022-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq: Remove WARN_ON_ONCE() in generic_handle_domain_irq()
      fb756280
  4. 14 May, 2022 1 commit
  5. 13 May, 2022 24 commits