From patchwork Sun Jan 14 13:50:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 10162607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0822D60390 for ; Sun, 14 Jan 2018 13:51:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05E2B28AA6 for ; Sun, 14 Jan 2018 13:51:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED90328AFB; Sun, 14 Jan 2018 13:51:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A14928AA6 for ; Sun, 14 Jan 2018 13:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=csPr+qN7icWwzBDgxidiZSl07/mfihLq6GqjUXtkBII=; b=j/JiTSKZrE0IQ2 YHpksPkoqEdso68soE5cUaEyg90kKeH/fnvvtrn5iL3CCgTPSujp6Tg74xIvnmdV6UNCfNCMZl/bk afw1uGqXfBU+1e61gmgfNqUDLlQ9gs3WQqW0Ix1wnTBMPFwwochREPsug7P3xuvMcPWgBIrY5eXF2 2x/jugHnrTIQZAm+DGGA8CN3zJC8DU5JhpiIY52G5aaZ/yCIxC3YPv7ioU6Flk81kmDY7woNqOPP8 880gYPBcMJ0XtXydxc9zTVAIOxyopyTsBYoaIVcx6HEuDHJXdkyEmo6Lg4nhsmgFjavDYWJh9soNP 1GGCewoc/BiwzMN+fYJA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eaign-000347-2k; Sun, 14 Jan 2018 13:51:09 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eaigk-0002ui-Bb for linux-arm-kernel@lists.infradead.org; Sun, 14 Jan 2018 13:51:07 +0000 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 8BB2A2175A; Sun, 14 Jan 2018 13:50:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BB2A2175A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: linux-kselftest@vger.kernel.org, shuah@kernel.org, Steven Rostedt Subject: [RESEND PATCH 2/2] selftest: ftrace: Fix to add 256 kprobe events correctly Date: Sun, 14 Jan 2018 22:50:36 +0900 Message-Id: <151593783656.23875.14563972262086825681.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <151593777761.23875.10360397710751679883.stgit@devbox> References: <151593777761.23875.10360397710751679883.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180114_055106_423971_17732408 X-CRM114-Status: GOOD ( 10.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jon Medhurst , Russell King - ARM Linux , linux-kernel@vger.kernel.org, mhiramat@kernel.org, Alex Shi , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Current multiple-kprobe testcase only tries to add kprobe events on first 256 text symbols. However kprobes fails to probe on some text symbols (like blacklisted symbols). Thus in the worst case, the test can not add any kprobe events. To avoid that, continue to try adding kprobe events until 256 events. Also it confirms the number of registered kprobe events. Signed-off-by: Masami Hiramatsu --- .../ftrace/test.d/kprobe/multiple_kprobes.tc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc index e297bd7a2e79..ce361b9d62cf 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc @@ -12,9 +12,24 @@ case `uname -m` in *) OFFS=0;; esac -echo "Setup up kprobes on first 256 text symbols" +if [ -d events/kprobes ]; then + echo 0 > events/kprobes/enable + echo > kprobe_events +fi + +N=0 +echo "Setup up kprobes on first available 256 text symbols" grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ -head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: +while read i; do + echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||: + test $N -eq 256 && break +done + +L=`wc -l kprobe_events` +if [ $L -ne $N ]; then + echo "The number of kprobes events ($L) is not $N" + exit_fail +fi echo 1 > events/kprobes/enable echo 0 > events/kprobes/enable