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: 24289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E18932096A for ; Fri, 7 Feb 2014 10:20:10 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c9sf6806501qcz.1 for ; Fri, 07 Feb 2014 02:20:09 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=WHT4ZaVXHg63SHT2jjEY0775F5aQiWel3OmoR2ujSCc=; b=Tp6FLadoC9oT4xELC3OIXVcSRVNdygmjKlcTtH3KKxr7Cd4WmPNnWmMievI7jJgElO tD+ZpGqit0WODh1057KuTtIJsAFPELx28ubYrgRFsqxDO18t6SN9RtBECbi2IMrbAJNd D2X430bofB0+S4eCpfeeDaAS0DHQN718pMblvSy6pjMifPA6FETeO79GQwRXnPvNdspe TIY7oVe1ePKQ5yGQGZrecq/QHg1gJEymQ4uKi7g87N0jDj6iZVHmrG2Rt/GNtEM8gppS u1B13I5wttnJHU+/ZFrqei6nZF6ZCEvadXV7RZ6a6O92LOOtvXfIHqyILTx84LRoppvp GwDQ== X-Gm-Message-State: ALoCoQna6LezLsZIcsBQkT6/GrLVY9jblQuHAImPk/2rrXzMDdmxq4eIYIanyCRhROpS0E7oDo+0 X-Received: by 10.236.184.165 with SMTP id s25mr4933835yhm.0.1391768409923; Fri, 07 Feb 2014 02:20:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.134 with SMTP id b6ls957946qgb.91.gmail; Fri, 07 Feb 2014 02:20:09 -0800 (PST) X-Received: by 10.58.229.164 with SMTP id sr4mr9754732vec.18.1391768409867; Fri, 07 Feb 2014 02:20:09 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ke3si1174227veb.27.2014.02.07.02.20.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:20:09 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so2467018vcb.33 for ; Fri, 07 Feb 2014 02:20:09 -0800 (PST) X-Received: by 10.58.161.227 with SMTP id xv3mr77060veb.31.1391768409796; Fri, 07 Feb 2014 02:20:09 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp91633vcz; Fri, 7 Feb 2014 02:20:08 -0800 (PST) X-Received: by 10.67.22.38 with SMTP id hp6mr6877884pad.53.1391768408558; Fri, 07 Feb 2014 02:20:08 -0800 (PST) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id i4si4462947pad.257.2014.02.07.02.20.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 02:20:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of takahiro.akashi@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id y10so2963955pdj.4 for ; Fri, 07 Feb 2014 02:20:08 -0800 (PST) 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 Cc: arndb@arndb.de, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org, AKASHI Takahiro 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-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.220.174 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: 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 | 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())