1. 03 6月, 2023 5 次提交
    • J
      block: don't allow the same type rq_qos add more than once · 8ce9b7c4
      Jinke Han 提交于
      mainline inclusion
      from mainline-v6.0-rc1
      commit 14a6e2eb
      category: bugfix
      bugzilla: 188088, https://gitee.com/openeuler/kernel/issues/I66GIL
      CVE: NA
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=14a6e2eb7df5c7897c15b109cba29ab0c4a791b6
      
      ----------------------------------------------------------------------
      
      In our test of iocost, we encountered some list add/del corruptions of
      inner_walk list in ioc_timer_fn.
      
      The reason can be described as follows:
      
      cpu 0					cpu 1
      ioc_qos_write				ioc_qos_write
      
      ioc = q_to_ioc(queue);
      if (!ioc) {
              ioc = kzalloc();
      					ioc = q_to_ioc(queue);
      					if (!ioc) {
      						ioc = kzalloc();
      						...
      						rq_qos_add(q, rqos);
      					}
              ...
              rq_qos_add(q, rqos);
              ...
      }
      
      When the io.cost.qos file is written by two cpus concurrently, rq_qos may
      be added to one disk twice. In that case, there will be two iocs enabled
      and running on one disk. They own different iocgs on their active list. In
      the ioc_timer_fn function, because of the iocgs from two iocs have the
      same root iocg, the root iocg's walk_list may be overwritten by each other
      and this leads to list add/del corruptions in building or destroying the
      inner_walk list.
      
      And so far, the blk-rq-qos framework works in case that one instance for
      one type rq_qos per queue by default. This patch make this explicit and
      also fix the crash above.
      Signed-off-by: NJinke Han <hanjinke.666@bytedance.com>
      Reviewed-by: NMuchun Song <songmuchun@bytedance.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220720093616.70584-1-hanjinke.666@bytedance.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
      
      Conflicts:
      	block/blk-rq-qos.h
      	block/blk-wbt.c
      Signed-off-by: NLi Nan <linan122@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      8ce9b7c4
    • L
      blk-iocost: use spin_lock_irqsave in adjust_inuse_and_calc_cost · 60e8843c
      Li Nan 提交于
      hulk inclusion
      category: bugfix
      bugzilla: 188152, https://gitee.com/openeuler/kernel/issues/I67BPT
      CVE: NA
      
      -------------------------------
      
      adjust_inuse_and_calc_cost() use spin_lock_irq and IRQ will enable when
      unlock. DEADLOCK might happen if we have held other locks before:
      
        ================================
        WARNING: inconsistent lock state
        5.10.0-02758-g8e5f91fd772f #26 Not tainted
        --------------------------------
        inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
        kworker/2:3/388 [HC0[0]:SC0[0]:HE0:SE1] takes:
        ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: spin_lock_irq
        ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: bfq_bio_merge+0x141/0x390
        {IN-HARDIRQ-W} state was registered at:
          __lock_acquire+0x3d7/0x1070
          lock_acquire+0x197/0x4a0
          __raw_spin_lock_irqsave
          _raw_spin_lock_irqsave+0x3b/0x60
          bfq_idle_slice_timer_body
          bfq_idle_slice_timer+0x53/0x1d0
          __run_hrtimer+0x477/0xa70
          __hrtimer_run_queues+0x1c6/0x2d0
          hrtimer_interrupt+0x302/0x9e0
          local_apic_timer_interrupt
          __sysvec_apic_timer_interrupt+0xfd/0x420
          run_sysvec_on_irqstack_cond
          sysvec_apic_timer_interrupt+0x46/0xa0
          asm_sysvec_apic_timer_interrupt+0x12/0x20
        irq event stamp: 837522
        hardirqs last  enabled at (837521): [<ffffffff84b9419d>] __raw_spin_unlock_irqrestore
        hardirqs last  enabled at (837521): [<ffffffff84b9419d>] _raw_spin_unlock_irqrestore+0x3d/0x40
        hardirqs last disabled at (837522): [<ffffffff84b93fa3>] __raw_spin_lock_irq
        hardirqs last disabled at (837522): [<ffffffff84b93fa3>] _raw_spin_lock_irq+0x43/0x50
        softirqs last  enabled at (835852): [<ffffffff84e00558>] __do_softirq+0x558/0x8ec
        softirqs last disabled at (835845): [<ffffffff84c010ff>] asm_call_irq_on_stack+0xf/0x20
      
        other info that might help us debug this:
         Possible unsafe locking scenario:
      
               CPU0
               ----
          lock(&bfqd->lock);
          <Interrupt>
            lock(&bfqd->lock);
      
         *** DEADLOCK ***
      
        3 locks held by kworker/2:3/388:
         #0: ffff888107af0f38 ((wq_completion)kthrotld){+.+.}-{0:0}, at: process_one_work+0x742/0x13f0
         #1: ffff8881176bfdd8 ((work_completion)(&td->dispatch_work)){+.+.}-{0:0}, at: process_one_work+0x777/0x13f0
         #2: ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: spin_lock_irq
         #2: ffff888118c00c28 (&bfqd->lock){?.-.}-{2:2}, at: bfq_bio_merge+0x141/0x390
      
        stack backtrace:
        CPU: 2 PID: 388 Comm: kworker/2:3 Not tainted 5.10.0-02758-g8e5f91fd772f #26
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
        Workqueue: kthrotld blk_throtl_dispatch_work_fn
        Call Trace:
         __dump_stack lib/dump_stack.c:77 [inline]
         dump_stack+0x107/0x167
         print_usage_bug
         valid_state
         mark_lock_irq.cold+0x32/0x3a
         mark_lock+0x693/0xbc0
         mark_held_locks+0x9e/0xe0
         __trace_hardirqs_on_caller
         lockdep_hardirqs_on_prepare.part.0+0x151/0x360
         trace_hardirqs_on+0x5b/0x180
         __raw_spin_unlock_irq
         _raw_spin_unlock_irq+0x24/0x40
         spin_unlock_irq
         adjust_inuse_and_calc_cost+0x4fb/0x970
         ioc_rqos_merge+0x277/0x740
         __rq_qos_merge+0x62/0xb0
         rq_qos_merge
         bio_attempt_back_merge+0x12c/0x4a0
         blk_mq_sched_try_merge+0x1b6/0x4d0
         bfq_bio_merge+0x24a/0x390
         __blk_mq_sched_bio_merge+0xa6/0x460
         blk_mq_sched_bio_merge
         blk_mq_submit_bio+0x2e7/0x1ee0
         __submit_bio_noacct_mq+0x175/0x3b0
         submit_bio_noacct+0x1fb/0x270
         blk_throtl_dispatch_work_fn+0x1ef/0x2b0
         process_one_work+0x83e/0x13f0
         process_scheduled_works
         worker_thread+0x7e3/0xd80
         kthread+0x353/0x470
         ret_from_fork+0x1f/0x30
      
      Fixes: b0853ab4 ("blk-iocost: revamp in-period donation snapbacks")
      Signed-off-by: NLi Nan <linan122@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      60e8843c
    • Y
      blk-iocost: don't allow to configure bio based device · e11c64a9
      Yu Kuai 提交于
      hulk inclusion
      category: bugfix
      bugzilla: 188033, https://gitee.com/openeuler/kernel/issues/I663ZP
      CVE: NA
      
      --------------------------------
      
      iocost is based on rq_qos, which can only work for request based device,
      thus it doesn't make sense to configure iocost for bio based device.
      Signed-off-by: NYu Kuai <yukuai3@huawei.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLi Nan <linan122@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      e11c64a9
    • O
      !899 [sync] PR-895: config: enable CONFIG_BPF_STREAM_PARSER=y on arm64 · f0a5a36e
      openeuler-ci-bot 提交于
      Merge Pull Request from: @openeuler-sync-bot 
       
      
      Origin pull request: 
      https://gitee.com/openeuler/kernel/pulls/895 
       
      PR sync from: Liu Jian liujian56@huawei.com https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/thread/H22NWZPMQBGSVUV22ISL3FTVOXQH676J/ 
       
      Link:https://gitee.com/openeuler/kernel/pulls/899 
      
      Reviewed-by: Jialin Zhang <zhangjialin11@huawei.com> 
      Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
      f0a5a36e
    • L
      config: enable CONFIG_BPF_STREAM_PARSER=y on arm64 · 653a605c
      Liu Jian 提交于
      hulk inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I79J3X
      CVE: N/A
      
      ----------------------------------------------------
      
      It is already enabled by default on the x86 and loongarch platforms, so
      let's enable it on the arm64 platform.
      Signed-off-by: NLiu Jian <liujian56@huawei.com>
      Reviewed-by: NWei Yongjun <weiyongjun1@huawe.com>
      (cherry picked from commit ace86952)
      653a605c
  2. 02 6月, 2023 6 次提交
  3. 01 6月, 2023 29 次提交