Re: [PATCH v2] bootconfig: use memblock_free_late to free xbc memory to buddy

2024-04-14 Thread Qiang Zhang
ddr, size); >- else >+ else if (addr) > memblock_free_late(__pa(addr), size); > } > >Can you update with this fix? Sure. > >Thank you, > > >On Fri, 12 Apr 2024 22:18:20 +0900 >Masami Hiramatsu (Google) wrote: > >> On Fri

Re: [PATCH RESEND] bootconfig: use memblock_free_late to free xbc memory to buddy

2024-04-12 Thread Qiang Zhang
On Fri, Apr 12, 2024 at 04:34:48PM +0900, Masami Hiramatsu wrote: >On Fri, 12 Apr 2024 10:41:04 +0800 >qiang4.zh...@linux.intel.com wrote: > >> From: Qiang Zhang >> >> On the time to free xbc memory, memblock has handed over memory to buddy >> allocator. So it

Re: [PATCH] bootconfig: use memblock_free_late to free xbc memory to buddy

2024-04-11 Thread Qiang Zhang
On Fri, Apr 12, 2024 at 10:03:26AM +0800, qiang4.zh...@linux.intel.com wrote: >From: Qiang Zhang > >On the time to free xbc memory, memblock has handed over memory to buddy >allocator. So it doesn't make sense to free memory back to memblock. >memblock_free() called by xbc_exit()

[PATCH] irq_work: record irq_work_queue() call stack

2021-03-31 Thread qiang . zhang
From: Zqiang Add the irq_work_queue() call stack into the KASAN auxiliary stack in order to improve KASAN reports. this will let us know where the irq work be queued. Signed-off-by: Zqiang --- kernel/irq_work.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH] lib: stackdepot: turn depot_lock spinlock to raw_spinlock

2021-03-29 Thread qiang . zhang
From: Zqiang [2.670635] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:951 [2.670638] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 19, name: pgdatinit0 [2.670768] Call Trace: [2.670800] dump_stack+0x93/0xc2 [2.670826]

[PATCH v2] loop: call __loop_clr_fd() with lo_mutex locked to avoid autoclear race

2021-03-26 Thread qiang . zhang
From: Zqiang lo->lo_refcnt = 0 CPU0 CPU1 lo_open()lo_open() mutex_lock(>lo_mutex) atomic_inc(>lo_refcnt) lo_refcnt == 1 mutex_unlock(>lo_mutex)

[PATCH] loop: Fix use of unsafe lo->lo_mutex locks

2021-03-25 Thread qiang . zhang
From: Zqiang lo->lo_refcnt = 0 CPU0 CPU1 lo_open()lo_open() mutex_lock(>lo_mutex) atomic_inc(>lo_refcnt) lo_refcnt == 1 mutex_unlock(>lo_mutex)

[PATCH v3] bpf: Fix memory leak in copy_process()

2021-03-16 Thread qiang . zhang
From: Zqiang The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) backtrace: [] alloc_pid+0x66/0x560 [] copy_process+0x1465/0x25e0 [] kernel_clone+0xf3/0x670 []

[PATCH v2] bpf: Fix memory leak in copy_process()

2021-03-15 Thread qiang . zhang
From: Zqiang The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) backtrace: [] alloc_pid+0x66/0x560 [] copy_process+0x1465/0x25e0 [] kernel_clone+0xf3/0x670 []

[PATCH v2] bpf: Fix memory leak in copy_process()

2021-03-15 Thread qiang . zhang
From: Zqiang The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) backtrace: [] alloc_pid+0x66/0x560 [] copy_process+0x1465/0x25e0 [] kernel_clone+0xf3/0x670 []

[PATCH] bpf: Fix memory leak in copy_process()

2021-03-15 Thread qiang . zhang
From: Zqiang The syzbot report a memleak follow: BUG: memory leak unreferenced object 0x888101b41d00 (size 120): comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) backtrace: [] alloc_pid+0x66/0x560 [] copy_process+0x1465/0x25e0 [] kernel_clone+0xf3/0x670 []

[PATCH] ARM: Fix incorrect use of smp_processor_id() by syzbot report

2021-03-11 Thread qiang . zhang
From: Zqiang BUG: using smp_processor_id() in preemptible [] code: syz-executor.0/15841 caller is debug_smp_processor_id+0x20/0x24 lib/smp_processor_id.c:64 The smp_processor_id() is used in a code segment when preemption has been disabled, otherwise, when preemption is enabled this

[PATCH v2] workqueue: Move the position of debug_work_activate() in __queue_work()

2021-02-17 Thread qiang . zhang
From: Zqiang The debug_work_activate() is called on the premise that the work can be inserted, because if wq be in WQ_DRAINING status, insert work may be failed. Fixes: e41e704bc4f4 ("workqueue: improve destroy_workqueue() debuggability") Signed-off-by: Zqiang Reviewed-by: Lai Jiangshan ---

[PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()

2021-02-17 Thread qiang . zhang
From: Zqiang The RCU read critical area already by preempt_disable/enable() (equivalent to rcu_read_lock_sched/unlock_sched()) mark, so remove rcu_read_lock/unlock(). Signed-off-by: Zqiang --- kernel/workqueue.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/workqueue.c

[PATCH v5] kvfree_rcu: Release page cache under memory pressure

2021-02-11 Thread qiang . zhang
From: Zqiang Add free per-cpu existing krcp's page cache operation in shrink callback function, and also during shrink period, simple delay schedule fill page work, to avoid refill page while free krcp page cache. Signed-off-by: Zqiang Co-developed-by: Uladzislau Rezki (Sony) --- v1->v4:

[PATCH] workqueue: Move the position of debug_work_activate() in __queue_work()

2021-02-11 Thread qiang . zhang
From: Zqiang The debug_work_activate() is called on the premise that the work can be inserted, because if wq be in WQ_DRAINING status, insert work may be failed. Signed-off-by: Zqiang --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/workqueue.c

[PATCH v4] kvfree_rcu: Release page cache under memory pressure

2021-02-07 Thread qiang . zhang
From: Zqiang Add free per-cpu existing krcp's page cache operation, when the system is under memory pressure. Signed-off-by: Zqiang Co-developed-by: Uladzislau Rezki (Sony) --- v1->v2->v3->v4: During the test a page shrinker is pretty active, because of low memory condition. callback

[PATCH] uprobes: Fix kasan UAF reported by syzbot

2021-02-02 Thread qiang . zhang
From: Zqiang Call Trace: __dump_stack [inline] dump_stack+0x107/0x163 print_address_description.constprop.0.cold+0x5b/0x2f8 __kasan_report [inline] kasan_report.cold+0x7c/0xd8 uprobe_cmp [inline] __uprobe_cmp [inline] rb_find_add [inline] __insert_uprobe [inline] insert_uprobe [inline]

[PATCH v3] kvfree_rcu: Release page cache under memory pressure

2021-01-30 Thread qiang . zhang
From: Zqiang Add free per-cpu existing krcp's page cache operation, when the system is under memory pressure. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index

[PATCH v2] kvfree_rcu: Release page cache under memory pressure

2021-01-28 Thread qiang . zhang
From: Zqiang Add free per-cpu existing krcp's page cache operation, when the system is under memory pressure. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 25 + 1 file changed, 25 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index

[PATCH] kvfree_rcu: Release page cache under memory pressure

2021-01-28 Thread qiang . zhang
From: Zqiang Add free per-cpu existing krcp's page cache operation, when the system is under memory pressure. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index

[PATCH] sched/core: add rcu_read_lock/unlock() protection

2021-01-26 Thread qiang . zhang
From: Zqiang Due to for_each_process_thread belongs to RCU read operation, need to add rcu_read_lock/unlock() protection. Signed-off-by: Zqiang --- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index

[PATCH] PM: remove PF_WQ_WORKER mask

2021-01-24 Thread qiang . zhang
From: Zqiang Due to kworker also is kernel thread, it's already included PF_KTHREAD mask, so remove PF_WQ_WORKER mask. Signed-off-by: Zqiang --- kernel/power/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/process.c b/kernel/power/process.c index

[PATCH] rcu: Release per-cpu krcp page cache when CPU going offline

2021-01-20 Thread qiang . zhang
From: Zqiang If CPUs go offline, the corresponding krcp's page cache can not be use util the CPU come back online, or maybe the CPU will never go online again, this commit therefore free krcp's page cache when CPUs go offline. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 47

[PATCH] workqueue: tracing the name of the workqueue instead of it's address

2021-01-04 Thread qiang . zhang
From: Zqiang This patch tracing workqueue name instead of it's address, the new format is as follows. workqueue_queue_work: work struct=84e3df56 function= drm_fb_helper_dirty_work workqueue=events req_cpu=256 cpu=1 This tell us to know which workqueue our work is queued.

[PATCH] ipc/sem.c: Convert kfree_rcu() to call_rcu() in freeary function

2020-12-30 Thread qiang . zhang
From: Zqiang Due to freeary function is called with spinlock be held, the synchronize_rcu function may be called in kfree_rcu function, the schedule may be happen in spinlock critical region, need to replace kfree_rcu() with call_rcu(). Fixes: 693a8b6eecce ("ipc,rcu: Convert call_rcu(free_un)

[PATCH] udlfb: Fix memory leak in dlfb_usb_probe

2020-12-14 Thread qiang . zhang
From: Zqiang The dlfb_alloc_urb_list function is called in dlfb_usb_probe function, after that if an error occurs, the dlfb_free_urb_list function need to be called. BUG: memory leak unreferenced object 0x88810adde100 (size 32): comm "kworker/1:0", pid 17, jiffies 4294947788 (age 19.520s)

[PATCH] kasan: fix slab double free when cpu-hotplug

2020-12-04 Thread qiang . zhang
From: Zqiang When a CPU offline, the per-cpu quarantine's offline be set true, after this, if the quarantine_put be called in this CPU, the objects will be free and return false, free objects doesn't to be done, due to return false, the slab memory manager will free this objects. Fixes:

[PATCH v2] rcu: kasan: record and print kvfree_call_rcu call stack

2020-11-19 Thread qiang . zhang
From: Zqiang Add kasan_record_aux_stack function for kvfree_call_rcu function to record call stacks. Cc: Walter Wu Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: "Paul E. McKenney" Signed-off-by: Zqiang --- v1->v2: Add Cc tags. kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH] srcu: Remove srcu_cblist_invoking member from sdp

2020-11-18 Thread qiang . zhang
From: Zqiang Workqueue can ensure the multiple same sdp->work sequential execution in rcu_gp_wq, not need srcu_cblist_invoking to prevent concurrent execution, so remove it. Signed-off-by: Zqiang --- include/linux/srcutree.h | 1 - kernel/rcu/srcutree.c| 8 ++-- 2 files changed, 2

[PATCH] rcu: kasan: record and print kvfree_call_rcu call stack

2020-11-17 Thread qiang . zhang
From: Zqiang Add kasan_record_aux_stack function for kvfree_call_rcu function to record call stacks. Signed-off-by: Zqiang --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index da3414522285..a252b2f0208d 100644

[PATCH] kthread_worker: Add flush delayed work func

2020-11-11 Thread qiang . zhang
From: Zqiang Add 'kthread_flush_delayed_work' func, the principle of this func is wait for a dwork to finish executing the last queueing. Signed-off-by: Zqiang --- kernel/kthread.c | 24 1 file changed, 24 insertions(+) diff --git a/kernel/kthread.c

[PATCH v2] kthread_worker: re-set CPU affinities if CPU come online

2020-10-28 Thread qiang . zhang
From: Zqiang When someone CPU offlined, the 'kthread_worker' which bind this CPU, will run anywhere, if this CPU online, recovery of 'kthread_worker' affinity by cpuhp notifiers. Signed-off-by: Zqiang --- v1->v2: rename variable kworker_online to kthread_worker_online. add 'cpuhp_node' and

[PATCH] io-wq: set task TASK_INTERRUPTIBLE state before schedule_timeout

2020-10-26 Thread qiang . zhang
From: Zqiang In 'io_wqe_worker' thread, if the work which in 'wqe->work_list' be finished, the 'wqe->work_list' is empty, and after that the '__io_worker_idle' func return false, the task state is TASK_RUNNING, need to be set TASK_INTERRUPTIBLE before call schedule_timeout func. Signed-off-by:

[PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread qiang . zhang
From: Zqiang When someone CPU offlined, the 'kthread_worker' which bind this CPU, will run anywhere, if this CPU online, recovery of 'kthread_worker' affinity by cpuhp notifiers. Signed-off-by: Zqiang --- include/linux/kthread.h | 2 ++ kernel/kthread.c| 35

[PATCH] io-wq: fix 'task->pi_lock' spin lock protect

2020-10-23 Thread qiang . zhang
From: Zqiang The set CPU affinity func 'do_set_cpus_allowed' may be operate 'task_rq', need add rq lock protect, replace 'pi_lock' spinlock protect with task_rq_lock func. Signed-off-by: Zqiang --- fs/io-wq.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/io-wq.c

[PATCH] workqueue: replace call_rcu with kfree_rcu

2020-10-14 Thread qiang . zhang
From: Zqiang The pwq's rcu callback func only to release 'pwq' resources, can use 'kfree_rcu' instead of 'call_rcu' func. Signed-off-by: Zqiang --- kernel/workqueue.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index

[PATCH v4] kthread_worker: Prevent queuing delayed work from timer_fn when it is being canceled

2020-10-14 Thread qiang . zhang
From: Zqiang There is a small race window when a delayed work is being canceled and the work still might be queued from the timer_fn: CPU0CPU1 kthread_cancel_delayed_work_sync() __kthread_cancel_work_sync() __kthread_cancel_work()

[PATCH] usb: gadget: function: printer: Fix usb function descriptors leak

2020-10-14 Thread qiang . zhang
From: Zqiang If an error occurs after call 'usb_assign_descriptors' func, the 'usb_free_all_descriptors' need to be call to release memory space occupied by function descriptors. Signed-off-by: Zqiang --- drivers/usb/gadget/function/f_printer.c | 1 + 1 file changed, 1 insertion(+) diff