From patchwork Sat Mar 15 05:40:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 26320 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 88A2C202DD for ; Sat, 15 Mar 2014 05:44:31 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id lg15sf7815984vcb.3 for ; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) 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=1YksgihJpfZeS/sC9W+1SMfXu7Dw3FyH+XuSI796z+8=; b=h1wKqQhvGSSzr9LTG9uz+38IEPORCBbFRgAGP1o5MbggjYihu4GCPEAJsSge9WsAhq nJ+1vhsVk0wU6t0Fi+npHRBlKM/0qjzew+B0o21sn6AD/d+yXCfU2ggt+wSXlUvkPag4 vEd8pxhtKZTDdcGTftg4WBdoGXvZZuN22U1urPgciRJBlkaKfmggMpC2Ytvr1n1dCUXJ Rixn/cQZxuEtV62sjiUQlGOp+SXOfCe7gLhZDgvo+O8YT4Cm6nU3CEldR9qh+F45K5Yx Y1Yswym9Pw8F1fx4nTcqkIgbvc4PHVZo+QUtWM3POR2aYnAdRo2Foy9ZcpH7xtHiTXNP YJYw== X-Gm-Message-State: ALoCoQmknnE6vmns2e56jIcXdVkUu8mrd+Mz0Z++t+pbPHp8QwVPj9xrpDx0MVfgyESZTLihXInU X-Received: by 10.224.167.8 with SMTP id o8mr4723516qay.0.1394862271173; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.20 with SMTP id h20ls944693qge.54.gmail; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) X-Received: by 10.220.11.141 with SMTP id t13mr28964vct.30.1394862271123; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id lz6si2930857vcb.31.2014.03.14.22.44.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:44:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 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.182; Received: by mail-ve0-f182.google.com with SMTP id jw12so3767788veb.27 for ; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) X-Received: by 10.52.166.103 with SMTP id zf7mr526145vdb.30.1394862271023; Fri, 14 Mar 2014 22:44:31 -0700 (PDT) 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.78.9 with SMTP id i9csp72981vck; Fri, 14 Mar 2014 22:44:30 -0700 (PDT) X-Received: by 10.68.19.164 with SMTP id g4mr13212046pbe.36.1394862270065; Fri, 14 Mar 2014 22:44:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tm9si5267409pab.428.2014.03.14.22.44.00; Fri, 14 Mar 2014 22:44:00 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756118AbaCOFlt (ORCPT + 26 others); Sat, 15 Mar 2014 01:41:49 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:48807 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755822AbaCOFlo (ORCPT ); Sat, 15 Mar 2014 01:41:44 -0400 Received: by mail-pa0-f51.google.com with SMTP id kq14so3522605pab.38 for ; Fri, 14 Mar 2014 22:41:44 -0700 (PDT) X-Received: by 10.69.31.171 with SMTP id kn11mr13434854pbd.47.1394862103931; Fri, 14 Mar 2014 22:41:43 -0700 (PDT) Received: from localhost.localdomain (pdddd29.tkyoac00.ap.so-net.ne.jp. [218.221.221.41]) by mx.google.com with ESMTPSA id iq10sm22299003pbc.14.2014.03.14.22.41.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 22:41:42 -0700 (PDT) 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 v7 3/7] ftrace: Add arm64 support to recordmcount Date: Sat, 15 Mar 2014 14:40:44 +0900 Message-Id: <1394862048-28758-4-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394862048-28758-1-git-send-email-takahiro.akashi@linaro.org> References: <1394705630-12384-1-git-send-email-takahiro.akashi@linaro.org> <1394862048-28758-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.182 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: , Recordmcount utility under scripts is run, after compiling each object, to find out all the locations of calling _mcount() and put them into specific seciton named __mcount_loc. Then linker collects all such information into a table in the kernel image (between __start_mcount_loc and __stop_mcount_loc) for later use by ftrace. This patch adds arm64 specific definitions to identify such locations. There are two types of implementation, C and Perl. On arm64, only C version is used to build the kernel now that CONFIG_HAVE_C_RECORDMCOUNT is on. But Perl version is also maintained. This patch also contains a workaround just in case where a header file, elf.h, on host machine doesn't have definitions of EM_AARCH64 nor R_AARCH64_ABS64. Without them, compiling C version of recordmcount will fail. Signed-off-by: AKASHI Takahiro --- arch/arm64/Kconfig | 2 ++ scripts/recordmcount.c | 7 +++++++ scripts/recordmcount.pl | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 27bbcfc..340e344 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -27,12 +27,14 @@ config ARM64 select HARDIRQS_SW_RESEND select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_TRACEHOOK + select HAVE_C_RECORDMCOUNT select HAVE_DEBUG_BUGVERBOSE select HAVE_DEBUG_KMEMLEAK select HAVE_DMA_API_DEBUG select HAVE_DMA_ATTRS select HAVE_DMA_CONTIGUOUS select HAVE_EFFICIENT_UNALIGNED_ACCESS + select HAVE_FTRACE_MCOUNT_RECORD select HAVE_GENERIC_DMA_COHERENT select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_MEMBLOCK diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 9c22317..e11aa4a 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -40,6 +40,11 @@ #define R_METAG_NONE 3 #endif +#ifndef EM_AARCH64 +#define EM_AARCH64 183 +#define R_AARCH64_ABS64 257 +#endif + static int fd_map; /* File descriptor for file being modified. */ static int mmap_failed; /* Boolean flag. */ static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ @@ -347,6 +352,8 @@ do_file(char const *const fname) case EM_ARM: reltype = R_ARM_ABS32; altmcount = "__gnu_mcount_nc"; break; + case EM_AARCH64: + reltype = R_AARCH64_ABS64; gpfx = '_'; break; case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break; case EM_METAG: reltype = R_METAG_ADDR32; altmcount = "_mcount_wrapper"; diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 91280b8..397b6b8 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -279,6 +279,11 @@ if ($arch eq "x86_64") { $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_ARM_(CALL|PC24|THM_CALL)" . "\\s+(__gnu_mcount_nc|mcount)\$"; +} elsif ($arch eq "arm64") { + $alignment = 3; + $section_type = '%progbits'; + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_AARCH64_CALL26\\s+_mcount\$"; + $type = ".quad"; } elsif ($arch eq "ia64") { $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; $type = "data8";