Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp106194pxb; Wed, 20 Oct 2021 17:38:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzRKHagbqaA0z76Q7Z3AXVkU6CdUfHF14FyrOZrxcrnrI93BfyYhlJpcf6Ip2dd63Sd/H2 X-Received: by 2002:a17:90a:7893:: with SMTP id x19mr2631649pjk.197.1634776687180; Wed, 20 Oct 2021 17:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634776687; cv=none; d=google.com; s=arc-20160816; b=gv3YXnWgIpOomh1vNA1UG/q2wgOHktRi3DFv4HZHl0b/G/ZO560gxQfV8tqP5LSnJz /9QYP2P8/vjFQF+S81HokYA26NilNYyUYglYnsnNaHKj+81oAvxH5Tc9E5+/37Nr4SJL ow4dUh5U1UK3eAqp9J1JxAOFHHU3+b2E8iJJyJmR7kB0q5yXJa1J2uiwywKALEQ29MkB N5oJm1qGm61R4lhV59P1Ny1s8tPgvQY0e0FBc+C0BjcJBYgE/KQFVLS5HbesnKuuxyt9 PSvULGUBb9LEEdxXNFsuTiHgEP2roIJq+G5sCzx9oUkoaEb+iPMWdfMhaNs14dxGsTIr x8+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QgZtEC/CJLb97lWCfHQQu7tp9yz2vbo/LQW+y1hG9hI=; b=zkXR3SA/cJqUI6W5I7McL1jNEQW941JJsYaJHXdrL+kF06bmsghFOGODfbN73wNVjm 5O+bEikCl7TjjiSDqbFuUzAhjOxoqpAWXBZOVMJRBljX52v3I32gubzHFGfQVT0BX4mr ejuCtxOoQUwxD0c6MvzoWWKxShDgOtVsp36RkUwmwK1RwGykI3my5bSMi0SkgmGnlwcF v/ok9Ghe2+OMKX/RAhvTiN8VIpURDiSwm2+JbiozvIa9AlXY3XVgLgcOV5Ps8vivIpRe Tknf5EpvSoeqiJ31Zf+BRHjKjchHhoDlkkXbvWAw0MRmmjOnhoh8Z0r01zi0aYyEm5+Z swsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DsXg3f2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si6071989pjq.153.2021.10.20.17.37.53; Wed, 20 Oct 2021 17:38:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DsXg3f2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbhJUAiu (ORCPT + 99 others); Wed, 20 Oct 2021 20:38:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:49306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhJUAiu (ORCPT ); Wed, 20 Oct 2021 20:38:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 411616112D; Thu, 21 Oct 2021 00:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634776595; bh=xeXadm3agqzQ6VGRMKNr2Gx2mtZ4jBL+v1U1Z361QAc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DsXg3f2/fAx+yB3iYvW5sINsPes2kuTGIYekbIoFcHhbcMHwaFAf2kvBL3qqis6fl APPMcxBOs9j5FMj7WfWSRtefRwGUdRCN/C9okPkPT7zL+/jue5qvf8rLGrjP/YTRrT BIoxZCxrLWs+pvXPJIeXdKT10wafeo4KPzCh9gTkMo+lhU7RaTuilQWjqXHzYyzXb5 nVl7djXY4cHnWE15iueXbD5lECHsr9ZeOxhzVAs430nfeFVGyf5LrJNOm/x91VVmcQ M2xvPt6FUu8APTs6yickS/De+P8JXrGTT8/0H568V8q9IrNSLhYzHAMwDPkLgx7m7Y 7AdpaeEJgUZBA== Date: Thu, 21 Oct 2021 09:36:32 +0900 From: Masami Hiramatsu To: Huan Xie Cc: Steven Rostedt , mingo@redhat.com, chenhuacai@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] trace: Add trace any kernel object Message-Id: <20211021093632.a197670625a6595d7082c9f8@kernel.org> In-Reply-To: References: <20211014014445.5734-1-xiehuan09@gmail.com> <20211013222056.312bec0c@oasis.local.home> <20211015220832.f9a13bd4ebbc4881b1e68163@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Oct 2021 00:04:40 +0800 Huan Xie wrote: > > > > For example: > > > > > > > > For the function bio_add_page, we can trace the first argument: > > > > > > > > int bio_add_page(struct bio *bio, struct page *page, > > > > unsigned int len, unsigned int offset) > > > > > > > > #cd /sys/kernel/debug/tracing > > > > #echo 1 > ./trace_object > > > > Hmm, so what happen if there are several events in parallel? > > > > > > #echo 'p bio_add_page arg1=$arg1' > kprobe_events > > > > #echo 1 > ./events/kprobes/p_bio_add_page_0/enable > > > > what about adding a "objfilter" trigger action to update the object > > list? e.g. > > > > echo objfilter:add:arg1:1 if comm == "sync" >> ./events/kprobes/p_bio_add_page_0/trigger > > > > This will "add the value of 'arg1' to objfilter 1 time if the process > > name is sync". > > Thanks. The trigger seems to work in combination with kprobe/uprobe/eprobe. > > I have been trying to implement this feature in recent days, But my > code does not look very elegant at the moment :-) No problem! I can help you to brush up the coding :) > It seems the result of 'cat trace' should also need to be filtered, > Because it will output the functions we don’t want to care about. It actually depends on what object user wants to trace. e.g. network packet trace will not be affected by 'cat trace'. Anyway, we have "options/pause-on-trace" to stop tracing while reading trace file. So user can choose it stop it or not. :) > > I didn't expect this idea to be a relatively large project. :-) > Because you have an exciting idea :) Thank you, -- Masami Hiramatsu