Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp315391imu; Mon, 5 Nov 2018 01:06:04 -0800 (PST) X-Google-Smtp-Source: AJdET5fzgtjAOS4p5BkagmY2D0RRBLnx5hLxHfvH+iDqLHtTzjB6ctCP/SmARy8RIXzRTwCEw3A2 X-Received: by 2002:a17:902:b692:: with SMTP id c18-v6mr21244163pls.191.1541408764716; Mon, 05 Nov 2018 01:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541408764; cv=none; d=google.com; s=arc-20160816; b=Llxxtq41fTj/9tPzlZqXg3jGsmeKfk7bciv0n6dXfrcB4uVEFhjjmH8xwapU/2EQZy ACNUSdNCTV9UxXrhHiLKcOYV/KV98lmcvGKx68oykzUY1or94wJyHei3xbdM+wk8tZVv tTIhDqPZ9BJWDzUxuUfCGuY2CZRfLDpsqBD4n9TXQ3GRCKZA1VHYaCMVGcD/tm6mfmSy YOAqSh+ZLlxrg/tImxvGpsBZiAeZ+lubrYLTmFhhkWBmTVXxWawPy6QDkyhgjnCxgHE5 bsLrc6IS+N1u7m/2MP3vxBFZ5Gin9sPG0TYiOKzLnGm92rJoCDifGVKLcnql3BTEMeWQ 8Sxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uXVmMXEBqsATJVV1t2b6z1esa7HRQsSdZ4+o8xhwUa4=; b=RLkJKSz7jy9fNbDCnbzTjl76Xwnq+GcCaHW1ZcSHHuVd3M/gGwI7zg2UD9mzGdvCiI wx/3yEVcaUjBaYLwjqBUadlT+iGo1N735DIqdcj0Ayx/GeLNHIpTlO5ED/TwznDRSQt/ 1a0YuDb/uPi8Uas0P0RId2EfbMr4GzpDAt8DeV6T2cDu+r+cI3DFT8E8AjwJ77Adk4Gi dLVyZmHNrBESqr/U2Fw2go7otmSrCQT+EL948uWLkJk/r0A0zryHNZfbYOBAaIDnboDV rcrzdVmpvgku3Li8omw+Ymse5SArcltIlu+6I+jOrpVSubLrR4u9WU4zzqKrJbr+Wgsq oTdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wGdGuI7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id g189-v6si41809860pgc.204.2018.11.05.01.05.48; Mon, 05 Nov 2018 01:06:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wGdGuI7f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727489AbeKESYB (ORCPT + 99 others); Mon, 5 Nov 2018 13:24:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:51900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKESYB (ORCPT ); Mon, 5 Nov 2018 13:24:01 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B894D20862; Mon, 5 Nov 2018 09:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541408720; bh=aRftkZl0b6OKtR28FUy2km529pcMGr1YorisXBFAbdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGdGuI7fEI6CMq2a5mMy4BWA+2oMFaSUROnc3fWkpSxeJgQ9BvdRQg0Zi2CA+tAzv pjryAeROA7B12WPzhB8zsdoF6cu9Tjm1Wr+W13xxncV9qbtzBUTxCZzZoGiDQZkmeG ZzuAfp6nuFybn9N4UmOLo2xfFvwpF+8MWo3qusow= From: Masami Hiramatsu To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Tom Zanussi , Ravi Bangoria Subject: [PATCH v2 11/12] tracing: Add generic event-name based remove event method Date: Mon, 5 Nov 2018 18:04:57 +0900 Message-Id: <154140869774.17322.8887303560398645347.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154140838606.17322.15294184388075458777.stgit@devbox> References: <154140838606.17322.15294184388075458777.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a generic method to remove event from dynamic event list. This is same as other system under ftrace. You just need to pass the event name with '!', e.g. # echo p:new_grp/new_event _do_fork > dynamic_events This creates an event, and # echo '!p:new_grp/new_event _do_fork' > dynamic_events Or, # echo '!p:new_grp/new_event' > dynamic_events will remove new_grp/new_event event. Note that this doesn't check the event prefix (e.g. "p:") strictly, because the "group/event" name must be unique. Signed-off-by: Masami Hiramatsu --- Changes in v2: - Instead of checking the given entire line strictly, simply checking the event and group name. --- kernel/trace/trace_dynevent.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_dynevent.c b/kernel/trace/trace_dynevent.c index f17a887abb66..dd1f43588d70 100644 --- a/kernel/trace/trace_dynevent.c +++ b/kernel/trace/trace_dynevent.c @@ -37,10 +37,17 @@ int dyn_event_release(int argc, char **argv, struct dyn_event_operations *type) char *system = NULL, *event, *p; int ret = -ENOENT; - if (argv[0][1] != ':') - return -EINVAL; + if (argv[0][0] == '-') { + if (argv[0][1] != ':') + return -EINVAL; + event = &argv[0][2]; + } else { + event = strchr(argv[0], ':'); + if (!event) + return -EINVAL; + event++; + } - event = &argv[0][2]; p = strchr(event, '/'); if (p) { system = event; @@ -69,7 +76,7 @@ static int create_dyn_event(int argc, char **argv) struct dyn_event_operations *ops; int ret; - if (argv[0][0] == '-') + if (argv[0][0] == '-' || argv[0][0] == '!') return dyn_event_release(argc, argv, NULL); mutex_lock(&dyn_event_ops_mutex);