From patchwork Fri Feb 7 10:18:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 3600871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B4AD9F2D6 for ; Fri, 7 Feb 2014 10:23:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6824D2012B for ; Fri, 7 Feb 2014 10:23:34 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 396F22010B for ; Fri, 7 Feb 2014 10:23:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBiYq-0004qQ-Mt; Fri, 07 Feb 2014 10:21:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBiYG-0002vh-Vx; Fri, 07 Feb 2014 10:20:53 +0000 Received: from mail-pd0-f171.google.com ([209.85.192.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBiXt-0002oB-I1 for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 10:20:30 +0000 Received: by mail-pd0-f171.google.com with SMTP id g10so2956762pdj.16 for ; Fri, 07 Feb 2014 02:20:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WHT4ZaVXHg63SHT2jjEY0775F5aQiWel3OmoR2ujSCc=; b=X7tWK2a0YR8aCZ+3CL9FbbtGJLhjI9Il3z2anR2B59KacnDzEaV8yeL+GLRiJCztCp HoECq78IFbDNY0ZNWgDt+bHLIW/qrN9Y0PNfRKBkS5BOTHGClts6NqmBFdj/EiZXz6Xl cYudw9l8iqSV9GxmlGQk395RqEK6LAvrXvSuU6NpFx/lo1fXWu+k015vMgDMJI1YiYSR htOuxSz5XB6uz6MfFv7amgI9KLgjn6UFZ6Ws7NI3FoXa2123JsiXhCTkXf74EpYfkGuS 6g61Vgfr6ylj8IAZlskriqkgWOZX4B6uwAjVJjlev/4qDXfAnFQNcIeNssqf2oKJH3WB 2mXw== X-Gm-Message-State: ALoCoQmCmSzQ3XazxWYYfl6TqSwJB/4TkWLPGD8u0kcKsh5m8r7YiQtl++v5O2LUk/8+s88AKlPf X-Received: by 10.66.155.133 with SMTP id vw5mr6883232pab.124.1391768408173; Fri, 07 Feb 2014 02:20:08 -0800 (PST) Received: from localhost.localdomain (KD182249085115.au-net.ne.jp. [182.249.85.115]) by mx.google.com with ESMTPSA id e6sm12093179pbg.4.2014.02.07.02.20.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:20:06 -0800 (PST) From: AKASHI Takahiro To: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, gkulkarni@caviumnetworks.com, tim.bird@sonymobile.com Subject: [PATCH v3 5/6] arm64: ftrace: Add system call tracepoint Date: Fri, 7 Feb 2014 19:18:55 +0900 Message-Id: <1391768336-5642-6-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391768336-5642-1-git-send-email-takahiro.akashi@linaro.org> References: <1382598488-13511-1-git-send-email-takahiro.akashi@linaro.org> <1391768336-5642-1-git-send-email-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140207_052029_723276_E87E2E7B X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, arndb@arndb.de, linux-kernel@vger.kernel.org, AKASHI Takahiro , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch allows system call entry or exit to be traced as ftrace events, ie. sys_enter_*/sys_exit_*, if CONFIG_FTRACE_SYSCALLS is enabled. Those events appear and can be controlled under ${sysfs}/tracing/events/syscalls/ Signed-off-by: AKASHI Takahiro --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/syscall.h | 1 + arch/arm64/include/asm/unistd.h | 2 ++ arch/arm64/kernel/ptrace.c | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 43fce76..9bdaf5c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -42,6 +42,7 @@ config ARM64 select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_MEMBLOCK select HAVE_PERF_EVENTS + select HAVE_SYSCALL_TRACEPOINTS select IRQ_DOMAIN select MODULES_USE_ELF_RELA select NO_BOOTMEM diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 70ba9d4..383771e 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -18,6 +18,7 @@ #include +extern const void *sys_call_table[]; static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 82ce217..c335479 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -28,3 +28,5 @@ #endif #define __ARCH_WANT_SYS_CLONE #include + +#define NR_syscalls (__NR_syscalls) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 64ce39f..f4c3c4e 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -41,6 +41,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* * TODO: does not yet catch signals sent when the child dies. * in exit.c or in signal.c. @@ -1076,10 +1079,12 @@ asmlinkage int syscall_trace(int dir, struct pt_regs *regs) } if (dir) { + trace_sys_exit(regs, regs->syscallno); tracehook_report_syscall_exit(regs, 0); } else { if (tracehook_report_syscall_entry(regs)) regs->syscallno = ~0UL; + trace_sys_enter(regs, regs->syscallno); } if (is_compat_task())