alibaba / diagnose-tools

GNU General Public License v3.0
395 stars 166 forks source link

mutex_lock detect #105

Open Jiehon opened 3 years ago

Jiehon commented 3 years ago

mutex_lock dectect mechanism uses new_mutex_lock function by replaced orignal mutex_lock。I wan to why it is accomplished with replace。if it uses kprobe mechsnism, it will cause very mucha overhead?

git-baoyou commented 3 years ago

使用kprobe机制不易于在lock函数的末尾添加探针,这里显然不建议将探针放在函数开始处。另外,使用new_mutex_lock的开销和kprobe并没有显著区别。

Jiehon commented 3 years ago

感谢您的答复。当前我们用epbf在做resource qos monitor,想了解kprobe机制的不足,其中的问题: "使用kprobe机制不易于在lock函数的末尾添加探针,这里显然不建议将探针放在函数开始处" : 当前实现在mutex_lock hook中只是记录了时间戳,及更新radix tree,但没有获取上下文栈信息,kretprobe的弹床函数也对当前实现没有影响吧,kretprobe具体影响是哪里?这里面有什么具体考虑么?