From patchwork Tue Feb 25 09:23:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 25256 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3BC3820558 for ; Tue, 25 Feb 2014 09:24:47 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf4402750pdj.8 for ; Tue, 25 Feb 2014 01:24:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=wyYXjUHTN8AD9WhEAoERi1ctbcP+bkf6Bbm6FBPcwGo=; b=V4ytwkEZ78a4evzQEZOTklmRKcc8kO7FXQa+yJgapITmL5qmbkPNtd2gB2HBosmVAv jisFfjfgc1CcZoXs3or+284CZ5DieJHyrP8lbZ6G/SJobpgxsPtrg2k+DM+Le1lCk448 LDsGKV5EezKvyBhxdRexURlR+Jxe2UG8qP/M+okYdDSx2QHbSt3Ix0kFyjW3Mr8Rrrqd y1tc9epPYf2Ls2IlOkhp2OA1JKbZtUFcSFngTO8yjak7+I3yw0SSfgoVKmr9pOQyi4S5 whlskOeFfwRHufFAVbRKXG6Yutqf+ORI6OlugtrOXaQeRyBZc/z49uY4xfz4NcXdPMEp jf7A== X-Gm-Message-State: ALoCoQn3g5oN5+6tC2rRHuhr8Gjz6IFfixJqYseN1CIzkucKUydEnUj9rQCpYo1X+nBtxMN8ulvA X-Received: by 10.68.197.73 with SMTP id is9mr2111508pbc.0.1393320286459; Tue, 25 Feb 2014 01:24:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.161 with SMTP id d30ls1668940qge.4.gmail; Tue, 25 Feb 2014 01:24:46 -0800 (PST) X-Received: by 10.58.207.13 with SMTP id ls13mr163190vec.13.1393320286179; Tue, 25 Feb 2014 01:24:46 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id av10si6667625ved.36.2014.02.25.01.24.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:24:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id jw12so115191veb.18 for ; Tue, 25 Feb 2014 01:24:46 -0800 (PST) X-Received: by 10.220.131.210 with SMTP id y18mr216698vcs.12.1393320286107; Tue, 25 Feb 2014 01:24:46 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp123922vcz; Tue, 25 Feb 2014 01:24:45 -0800 (PST) X-Received: by 10.68.131.202 with SMTP id oo10mr5289946pbb.35.1393320284540; Tue, 25 Feb 2014 01:24:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uc9si20058444pac.239.2014.02.25.01.24.43; Tue, 25 Feb 2014 01:24:43 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbaBYJYi (ORCPT + 26 others); Tue, 25 Feb 2014 04:24:38 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:59103 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753236AbaBYJYd (ORCPT ); Tue, 25 Feb 2014 04:24:33 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so3645899pbc.7 for ; Tue, 25 Feb 2014 01:24:33 -0800 (PST) X-Received: by 10.66.144.200 with SMTP id so8mr494565pab.15.1393320273170; Tue, 25 Feb 2014 01:24:33 -0800 (PST) Received: from localhost.localdomain (KD182249093189.au-net.ne.jp. [182.249.93.189]) by mx.google.com with ESMTPSA id iq10sm8497678pbc.14.2014.02.25.01.24.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:24:32 -0800 (PST) From: AKASHI Takahiro To: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, tim.bird@sonymobile.com Cc: gkulkarni@caviumnetworks.com, dsaxena@linaro.org, arndb@arndb.de, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v4 5/7] arm64: ftrace: Add system call tracepoint Date: Tue, 25 Feb 2014 18:23:14 +0900 Message-Id: <1393320196-2942-6-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393320196-2942-1-git-send-email-takahiro.akashi@linaro.org> References: <1391768336-5642-1-git-send-email-takahiro.akashi@linaro.org> <1393320196-2942-1-git-send-email-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 | 9 +++++++++ 4 files changed, 13 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 6954959..b1dcdb4 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -43,6 +43,7 @@ config ARM64 select HAVE_MEMBLOCK select HAVE_PATA_PLATFORM 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 c70133e..dc90f9f 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. @@ -1062,6 +1065,9 @@ asmlinkage int syscall_trace(int dir, struct pt_regs *regs) { unsigned long saved_reg; + if (dir && unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) + trace_sys_exit(regs, regs_return_value(regs)); + if (test_thread_flag(TIF_SYSCALL_TRACE)) { if (is_compat_task()) { /* AArch32 uses ip (r12) for scratch */ @@ -1087,5 +1093,8 @@ asmlinkage int syscall_trace(int dir, struct pt_regs *regs) regs->regs[7] = saved_reg; } + if (!dir && unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) + trace_sys_enter(regs, regs->syscallno); + return regs->syscallno; }