From patchwork Wed Apr 30 09:54:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 29397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 20185203F3 for ; Wed, 30 Apr 2014 09:56:34 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf4681396oah.1 for ; Wed, 30 Apr 2014 02:56:34 -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=wG2QKp5oQ/V37kaMRT8uqvBjsJdmVMDl6BpD+lviVn0=; b=bP9fcRiZm6i+MO/r9iY9lEEOyqxXrQItV9ZYN16HWG3dm9WJwo9mpqLPiQkq3PmawX zCOMak17EPKC8wEaqJmtYlHWGm0llDhXM7TznFiO34AOffgrK/zyyMlk3BwBap/iLC/7 fSHT7TNuKVHHyOaIsZgKNqzV1cRr0ztlAU2IAQ7sqvoQhIhvhD9oKfglN4DokCCuqhFo 3CTQ6qDpg/vbilodRHvUWp0KD/TxX6EPGpSGXiHRWTsK8RWysXh/ZxGxvd3DbiQjyhgA 1HRpii4MaGOKo0g9UBDIpa3dao+L3SaeUr8foYdrsO+r2jQ2hv+WWGia836o8bIOSRE0 EsgA== X-Gm-Message-State: ALoCoQmSLxiSKubfjz4jxpis227bo0F4GWpPi1IyTWVGC/IQ9Xw1gIMuBGNSmUAdY9Uq8hqwKALv X-Received: by 10.42.20.197 with SMTP id h5mr1650346icb.33.1398851794512; Wed, 30 Apr 2014 02:56:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.54 with SMTP id 51ls168263qgi.63.gmail; Wed, 30 Apr 2014 02:56:34 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr2647303vdx.28.1398851794314; Wed, 30 Apr 2014 02:56:34 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id xo2si5198964vec.170.2014.04.30.02.56.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 02:56:34 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so1815305veb.37 for ; Wed, 30 Apr 2014 02:56:34 -0700 (PDT) X-Received: by 10.52.166.102 with SMTP id zf6mr2647253vdb.2.1398851794221; Wed, 30 Apr 2014 02:56:34 -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.221.72 with SMTP id ib8csp265342vcb; Wed, 30 Apr 2014 02:56:33 -0700 (PDT) X-Received: by 10.66.190.4 with SMTP id gm4mr6823642pac.116.1398851792880; Wed, 30 Apr 2014 02:56:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vw5si16372825pab.210.2014.04.30.02.56.32 for ; Wed, 30 Apr 2014 02:56:32 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933514AbaD3J4U (ORCPT + 28 others); Wed, 30 Apr 2014 05:56:20 -0400 Received: from mail-ie0-f180.google.com ([209.85.223.180]:61339 "EHLO mail-ie0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757495AbaD3J4P (ORCPT ); Wed, 30 Apr 2014 05:56:15 -0400 Received: by mail-ie0-f180.google.com with SMTP id as1so1650335iec.11 for ; Wed, 30 Apr 2014 02:56:15 -0700 (PDT) X-Received: by 10.50.112.167 with SMTP id ir7mr37008411igb.27.1398851772489; Wed, 30 Apr 2014 02:56:12 -0700 (PDT) Received: from localhost.localdomain (KD182249095136.au-net.ne.jp. [182.249.95.136]) by mx.google.com with ESMTPSA id x7sm1867848igw.1.2014.04.30.02.56.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 02:56:11 -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 v8 4/8] ftrace: Add arm64 support to recordmcount Date: Wed, 30 Apr 2014 18:54:32 +0900 Message-Id: <1398851676-16389-5-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398851676-16389-1-git-send-email-takahiro.akashi@linaro.org> References: <1394862048-28758-1-git-send-email-takahiro.akashi@linaro.org> <1398851676-16389-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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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. Acked-by: Will Deacon 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 e6e4d37..f467285 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -30,12 +30,14 @@ config ARM64 select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KGDB 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";