Re: [PATCH 0/5] PM: domains: Add helpers for multi PM domains to avoid open-coding
On 28-12-23, 12:41, Ulf Hansson wrote: > For OPP integration, as a follow up I am striving to make the > dev_pm_opp_attach_genpd() redundant. Instead I think we should move towards > using dev_pm_opp_set_config()->_opp_set_required_devs(), which would allow us > to > use the helpers that $subject series is adding. Big thanks for that :) -- viresh
[RFC PATCH] kprobes: Use synchronize_rcu_tasks_rude in kprobe_optimizer
There is a deadlock scenario in kprobe_optimizer(): pid A pid B pid C kprobe_optimizer() do_exit() perf_kprobe_init() mutex_lock(&kprobe_mutex) exit_tasks_rcu_start() mutex_lock(&kprobe_mutex) synchronize_rcu_tasks() zap_pid_ns_processes() // waiting kprobe_mutex // waiting tasks_rcu_exit_srcu kernel_wait4() // waiting pid C exit To avoid this deadlock loop, use synchronize_rcu_tasks_rude() in kprobe_optimizer() rather than synchronize_rcu_tasks(). synchronize_rcu_tasks_rude() can also promise that all preempted tasks have scheduled, but it will not wait tasks_rcu_exit_srcu. Signed-off-by: Chen Zhongjin --- arch/Kconfig | 2 +- kernel/kprobes.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index f4b210ab0612..dc6a18854017 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -104,7 +104,7 @@ config STATIC_CALL_SELFTEST config OPTPROBES def_bool y depends on KPROBES && HAVE_OPTPROBES - select TASKS_RCU if PREEMPTION + select TASKS_RUDE_RCU config KPROBES_ON_FTRACE def_bool y diff --git a/kernel/kprobes.c b/kernel/kprobes.c index d5a0ee40bf66..09056ae50c58 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -623,7 +623,7 @@ static void kprobe_optimizer(struct work_struct *work) * Note that on non-preemptive kernel, this is transparently converted * to synchronoze_sched() to wait for all interrupts to have completed. */ - synchronize_rcu_tasks(); + synchronize_rcu_tasks_rude(); /* Step 3: Optimize kprobes after quiesence period */ do_optimize_kprobes(); -- 2.25.1
Re: [PATCH V1] net: qrtr: ns: Return 0 if server port is not present
Hello: This patch was applied to netdev/net.git (main) by David S. Miller : On Thu, 21 Dec 2023 15:36:51 +0530 you wrote: > When a 'DEL_CLIENT' message is received from the remote, the corresponding > server port gets deleted. A DEL_SERVER message is then announced for this > server. As part of handling the subsequent DEL_SERVER message, the name- > server attempts to delete the server port which results in a '-ENOENT' error. > The return value from server_del() is then propagated back to qrtr_ns_worker, > causing excessive error prints. > To address this, return 0 from control_cmd_del_server() without checking the > return value of server_del(), since the above scenario is not an error case > and hence server_del() doesn't have any other error return value. > > [...] Here is the summary with links: - [V1] net: qrtr: ns: Return 0 if server port is not present https://git.kernel.org/netdev/net/c/9bf2e9165f90 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
[syzbot] [virtualization?] KMSAN: uninit-value in virtqueue_add (4)
Hello, syzbot found the following issue on: HEAD commit:fbafc3e621c3 Merge tag 'for_linus' of git://git.kernel.org.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=173df3e9e8 kernel config: https://syzkaller.appspot.com/x/.config?x=e0c7078a6b901aa3 dashboard link: https://syzkaller.appspot.com/bug?extid=d7521c1e3841ed075a42 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1300b4a1e8 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=130b0379e8 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/1520f7b6daa4/disk-fbafc3e6.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/8b490af009d5/vmlinux-fbafc3e6.xz kernel image: https://storage.googleapis.com/syzbot-assets/202ca200f4a4/bzImage-fbafc3e6.xz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+d7521c1e3841ed075...@syzkaller.appspotmail.com = BUG: KMSAN: uninit-value in vring_map_one_sg drivers/virtio/virtio_ring.c:380 [inline] BUG: KMSAN: uninit-value in virtqueue_add_split drivers/virtio/virtio_ring.c:614 [inline] BUG: KMSAN: uninit-value in virtqueue_add+0x21c6/0x6530 drivers/virtio/virtio_ring.c:2210 vring_map_one_sg drivers/virtio/virtio_ring.c:380 [inline] virtqueue_add_split drivers/virtio/virtio_ring.c:614 [inline] virtqueue_add+0x21c6/0x6530 drivers/virtio/virtio_ring.c:2210 virtqueue_add_sgs+0x186/0x1a0 drivers/virtio/virtio_ring.c:2244 __virtscsi_add_cmd drivers/scsi/virtio_scsi.c:467 [inline] virtscsi_add_cmd+0x838/0xad0 drivers/scsi/virtio_scsi.c:501 virtscsi_queuecommand+0x896/0xa60 drivers/scsi/virtio_scsi.c:598 scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1516 [inline] scsi_queue_rq+0x4874/0x5790 drivers/scsi/scsi_lib.c:1758 blk_mq_dispatch_rq_list+0x13f8/0x3600 block/blk-mq.c:2049 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:170 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:184 [inline] __blk_mq_sched_dispatch_requests+0x10af/0x2500 block/blk-mq-sched.c:309 blk_mq_sched_dispatch_requests+0x160/0x2d0 block/blk-mq-sched.c:333 blk_mq_run_work_fn+0xd0/0x280 block/blk-mq.c:2434 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x104e/0x1e70 kernel/workqueue.c:2700 worker_thread+0xf45/0x1490 kernel/workqueue.c:2781 kthread+0x3ed/0x540 kernel/kthread.c:388 ret_from_fork+0x66/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Uninit was created at: __alloc_pages+0x9a4/0xe00 mm/page_alloc.c:4591 alloc_pages_mpol+0x62b/0x9d0 mm/mempolicy.c:2133 alloc_pages mm/mempolicy.c:2204 [inline] folio_alloc+0x1da/0x380 mm/mempolicy.c:2211 filemap_alloc_folio+0xa5/0x430 mm/filemap.c:974 __filemap_get_folio+0xa5a/0x1760 mm/filemap.c:1918 ext4_da_write_begin+0x7f8/0xec0 fs/ext4/inode.c:2891 generic_perform_write+0x3f5/0xc40 mm/filemap.c:3918 ext4_buffered_write_iter+0x564/0xaa0 fs/ext4/file.c:299 ext4_file_write_iter+0x20f/0x3460 __kernel_write_iter+0x329/0x930 fs/read_write.c:517 dump_emit_page fs/coredump.c:888 [inline] dump_user_range+0x593/0xcd0 fs/coredump.c:915 elf_core_dump+0x528d/0x5a40 fs/binfmt_elf.c:2077 do_coredump+0x32c9/0x4920 fs/coredump.c:764 get_signal+0x2185/0x2d10 kernel/signal.c:2890 arch_do_signal_or_restart+0x53/0xca0 arch/x86/kernel/signal.c:309 exit_to_user_mode_loop+0xe8/0x320 kernel/entry/common.c:168 exit_to_user_mode_prepare+0x163/0x220 kernel/entry/common.c:204 irqentry_exit_to_user_mode+0xd/0x30 kernel/entry/common.c:309 irqentry_exit+0x16/0x40 kernel/entry/common.c:412 exc_page_fault+0x246/0x6f0 arch/x86/mm/fault.c:1564 asm_exc_page_fault+0x2b/0x30 arch/x86/include/asm/idtentry.h:570 Bytes 0-4095 of 4096 are uninitialized Memory access of size 4096 starts at 88812c79c000 CPU: 0 PID: 997 Comm: kworker/0:1H Not tainted 6.7.0-rc7-syzkaller-3-gfbafc3e621c3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Workqueue: kblockd blk_mq_run_work_fn = --- This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at syzkal...@googlegroups.com. syzbot will keep track of this issue. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. If the report is already addressed, let syzbot know by replying with: #syz fix: exact-commit-title If you want syzbot to run the reproducer, reply with: #syz test: git://repo/address.git branch-or-commit-hash If you attach or paste a git patch, syzbot will apply it before testing. If you want to overwrite report's subsystems, reply with: #syz set subsystems: new-subsystem (See the list of subsystem names on the web dashboard) If the report is a duplicate of another one, reply with: #sy
Re: [PATCH v7] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms
Hello, Il giorno dom 31 dic 2023 alle ore 06:35 Masahiro Yamada ha scritto: > > On Tue, Dec 5, 2023 at 6:48 AM Alessandro Carminati (Red Hat) > wrote: > > > > In the kernel environment, situations frequently arise where identical > > names are shared among symbols within both the core image and modules. > > While this doesn't pose issues for the kernel's binary itself, it > > complicates trace or probe operations using tools like kprobe. > > > > This patch introduces "kas_alias" to address this challenge. > > > > During the kernel's build process, just before linking the vmlinux > > image in the "scripts/link-vmlinux.sh", symbol name frequencies are > > collected. > > This collection includes both the core kernel components and modules. > > Subsequently, within the same action, the nm data relative to vmlinux > > is modified by adding aliases based on the comprehensive symbol > > information gathered. > > > > The collection process occurs in two phases: > > > > 1. First phase: Executed during the linking of vmlinux, "kas_alias" scans > >all symbols provided by the 'nm' data against the vmlinux core image > >and all objects used for module linkage. This phase requires all > >modules objects to be produced at this stage, thereby adding a vmlinux > >dependency for linking modules in 'scripts/Makefile.modfinal'. > > > > 2. Second phase: In a subsequent run in the same build, "kas_alias" > >processes module objects and injects aliases into the objects' symbol > >tables where necessary. This operation is done by modifying > >'scripts/Makefile.modfinal' to include an action for each processed > >module. > > > > Example: > > > > Consider the symbol "device_show", you can expect an output like the > > following: > > > > ~ # cat /proc/kallsyms | grep " name_show" > > caa2bb4f01c8 t name_show > > caa2bb4f01c8 t name_show@kernel_irq_irqdesc_c_264 > > caa2bb9c1a30 t name_show > > caa2bb9c1a30 t name_show@drivers_pnp_card_c_186 > > caa2bbac4754 t name_show > > caa2bbac4754 t name_show@drivers_regulator_core_c_678 > > caa2bbba4900 t name_show > > caa2bbba4900 t name_show@drivers_base_power_wakeup_stats_c_93 > > caa2bbec4038 t name_show > > caa2bbec4038 t name_show@drivers_rtc_sysfs_c_26 > > caa2bbecc920 t name_show > > caa2bbecc920 t name_show@drivers_i2c_i2c_core_base_c_660 > > caa2bbed3840 t name_show > > caa2bbed3840 t name_show@drivers_i2c_i2c_dev_c_100 > > caa2bbef7210 t name_show > > caa2bbef7210 t name_show@drivers_pps_sysfs_c_66 > > caa2bbf03328 t name_show > > caa2bbf03328 t name_show@drivers_hwmon_hwmon_c_72 > > caa2bbff6f3c t name_show > > caa2bbff6f3c t name_show@drivers_remoteproc_remoteproc_sysfs_c_215 > > caa2bbff8d78 t name_show > > caa2bbff8d78 t name_show@drivers_rpmsg_rpmsg_core_c_455 > > caa2bbfff7a4 t name_show > > caa2bbfff7a4 t name_show@drivers_devfreq_devfreq_c_1395 > > caa2bc001f60 t name_show > > caa2bc001f60 t name_show@drivers_extcon_extcon_c_389 > > caa2bc009890 t name_show > > caa2bc009890 t name_show@drivers_iio_industrialio_core_c_1396 > > caa2bc01212c t name_show > > caa2bc01212c t name_show@drivers_iio_industrialio_trigger_c_51 > > caa2bc025e2c t name_show > > caa2bc025e2c t name_show@drivers_fpga_fpga_mgr_c_618 > > caa2a052102c t name_show[hello] > > caa2a052102c t name_show@hello_hello_c_8[hello] > > caa2a051955c t name_show[rpmsg_char] > > caa2a051955c t name_show@drivers_rpmsg_rpmsg_char_c_365 [rpmsg_char] > > > > where hello, is a plain helloworld module built OOT. > > > > Tested-by: Masami Hiramatsu (Google) > > Signed-off-by: Alessandro Carminati (Red Hat) > > > > > > --- > > > > NOTE1: > > About the symbols name duplication that happens as consequence of the > > inclusion compat_binfmt_elf.c does, it is evident that this corner is > > inherently challenging the addr2line approach. > > Attempting to conceal this limitation would be counterproductive. > > > > compat_binfmt_elf.c includes directly binfmt_elf.c, addr2line can't help > > but report all functions and data declared by that file, coming from > > binfmt_elf.c. > > > > My position is that, rather than producing a more complicated pipeline > > to handle this corner case, it is better to fix the compat_binfmt_elf.c > > anomaly. > > > > This patch does not deal with the two potentially problematic symbols > > defined by compat_binfmt_elf.c > > > > Changes from v1: > > * Integrated changes requested by Masami to exclude symbols with prefixes > > "_cfi" and "_pfx". > > * Introduced a small framework to handle patterns that need to be excluded > > from the alias production. > > * Excluded other symbols using the framework. > > * Introduced the ability to discriminate between text and data symbols. > > * Added two new config symbols in this version: > > CONFIG_KALLSYMS_ALIAS_DATA, which allows data for data, and > > CONFIG_
RE: [PATCH next v2 5/5] locking/osq_lock: Optimise decode_cpu() and per_cpu_ptr().
From: Waiman Long > Sent: 01 January 2024 04:14 ... > You really like micro-optimization. They all add up :-) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)