Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3017801imm; Sun, 1 Jul 2018 10:23:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDYGDvTZObaYoDkG3eYXnLU3R/FolxqARtuE9MNKv7H8FeQlv0acd+xJqIrRIA3vQRMUq/ X-Received: by 2002:a62:d24a:: with SMTP id c71-v6mr14210489pfg.242.1530465803014; Sun, 01 Jul 2018 10:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465802; cv=none; d=google.com; s=arc-20160816; b=jWYmRTXKX1+1nhX2OYQ+aV+ceg9BHVtzBFwbW8NB5vMUEXwBAHNn1BeLNQVT0Cq0CS VAGna/iliJqTQ8cQUsgjcEpZbyfbmCIk/USwOtGr4WuVUBetxb1WR/9hjwErAe3JG4GF BEAr+PNK1ezmdXsvepiVc668mfzPcRwjdm7dYOy+6y0aJQQuyNK5/6fQQ95lSh237z68 GvULLL6B7zafi5JcsnGyqERKjS7TnJ7IfyEz2EwNxK7XsxR08LE/WRYlhRrSMixJRp1i 6pQvnVD4NeWoBK1a8JpcuI7/D+K0KYfPfQVhPMb+DsKJErRpltiIHEC2usxfjPXy5Q9Y e1jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ENJdzdKooNrs43Y3rH9aqZO9qtBqN7fG2e2UupqnoDE=; b=PerqvUeG/8t/djBky1QAe50xXsPGVOlkj/BlHORJqNNgHyPM2LuGa+YhNvH8x5zhYT RdyE7qmDYMmAja+1RSVUEfWl1qct+PmT1wV495PFosk9btQ3lp9bZZJjHm+8nAwawqRZ le1aAk4ppFjHm56v1Mf0Ps14D28WQCP+ZIkf/Oak5hz9zLVJMcBEt2tKMrZymlYPV0dq fgTObPNtgv9BMs4q/6QPgmiWSOiZwYZKVFJswtn69CxxyydWcLKR/fjAIts5Hr6FRA5E s4d9+sWa7wlV8TkqYbk2+PTXwKdYmKvSkBMUUVFNrLyX5d8NzFWk4dG2Hm4AKZ8AXL08 lSqA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si9090444pfo.54.2018.07.01.10.23.08; Sun, 01 Jul 2018 10:23:22 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031582AbeGAQiX (ORCPT + 99 others); Sun, 1 Jul 2018 12:38:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36696 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031365AbeGAQiU (ORCPT ); Sun, 1 Jul 2018 12:38:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3EC9BAA6; Sun, 1 Jul 2018 16:38:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 4.17 034/220] ftrace/selftest: Have the reset_trigger code be a bit more careful Date: Sun, 1 Jul 2018 18:20:58 +0200 Message-Id: <20180701160909.759302701@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt (VMware) commit 756b56a9e832e063edc83be7c3889e98c536dd2b upstream. The trigger code is picky in how it can be disabled as there may be dependencies between different events and synthetic events. Change the order on how triggers are reset. 1) Reset triggers of all synthetic events first 2) Remove triggers with actions attached to them 3) Remove all other triggers If this order isn't followed, then some triggers will not be reset, and an error may happen because a trigger is busy. Cc: stable@vger.kernel.org Fixes: cfa0963dc474f ("kselftests/ftrace : Add event trigger testcases") Reviewed-by: Namhyung Kim Acked-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/ftrace/test.d/functions | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -15,14 +15,29 @@ reset_tracer() { # reset the current tra echo nop > current_tracer } -reset_trigger() { # reset all current setting triggers - grep -v ^# events/*/*/trigger | +reset_trigger_file() { + # remove action triggers first + grep -H ':on[^:]*(' $@ | + while read line; do + cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` + file=`echo $line | cut -f1 -d:` + echo "!$cmd" >> $file + done + grep -Hv ^# $@ | while read line; do cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` - echo "!$cmd" > `echo $line | cut -f1 -d:` + file=`echo $line | cut -f1 -d:` + echo "!$cmd" > $file done } +reset_trigger() { # reset all current setting triggers + if [ -d events/synthetic ]; then + reset_trigger_file events/synthetic/*/trigger + fi + reset_trigger_file events/*/*/trigger +} + reset_events_filter() { # reset all current setting filters grep -v ^none events/*/*/filter | while read line; do