From patchwork Thu Mar 13 10:13:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 26186 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7F9E9206A0 for ; Thu, 13 Mar 2014 10:14:50 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf3102804oag.8 for ; Thu, 13 Mar 2014 03:14:49 -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=z8Fs5JWJBOsHlQunMifhqzPlhBIN2UrF5UXHR2vcxh4=; b=FFkEvgJ6IO5kFl+YdWYBWEgGFEgeV4hRXD4ZgvGGAH6eYx9iImkOhXmgABYnfdyavA rTjK5iySMeZlMMOVoK6e3gk9specYPFEpGNmMG7l2lzYk13gbBWpMbVXwFznb6PDVNfo ssN42SmPXyUNddlomuJ38qc39rSMco9mvb19zAvxA8Q8vOYzKLZe1LISnwxLRTYIHMlX mETn+XjwhAl/Oe0PeLX2ghCVMWcjdAtV+7ZUh7IRfNu8x/29Nn0riZ0c+KJnyiSxOAwC nRjKnvGZWhVbyQi5G7y+vUDDoL4wi8rnwGiqAWsoSpM/Lz0BvgYiT4/0eeC2DWgb442b WMEQ== X-Gm-Message-State: ALoCoQn/IJn9TwGzz/jvdNn23HIMrOGmx+qXMlwaGSsOPTju6QY+ygyyXAuGlfyNs5ZhuLz4VRog X-Received: by 10.43.163.199 with SMTP id mp7mr354755icc.6.1394705689808; Thu, 13 Mar 2014 03:14:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.33.203 with SMTP id j69ls215905qgj.27.gmail; Thu, 13 Mar 2014 03:14:49 -0700 (PDT) X-Received: by 10.221.29.196 with SMTP id rz4mr741791vcb.8.1394705689641; Thu, 13 Mar 2014 03:14:49 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id eb8si641567vdb.47.2014.03.13.03.14.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 03:14:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.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.220.182; Received: by mail-vc0-f182.google.com with SMTP id ks9so835295vcb.13 for ; Thu, 13 Mar 2014 03:14:49 -0700 (PDT) X-Received: by 10.52.241.106 with SMTP id wh10mr619118vdc.16.1394705689541; Thu, 13 Mar 2014 03:14:49 -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 i9csp355902vck; Thu, 13 Mar 2014 03:14:49 -0700 (PDT) X-Received: by 10.68.193.166 with SMTP id hp6mr1248722pbc.144.1394705688086; Thu, 13 Mar 2014 03:14:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mu18si1068813pab.190.2014.03.13.03.14.47; Thu, 13 Mar 2014 03:14:47 -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 S1754095AbaCMKOk (ORCPT + 26 others); Thu, 13 Mar 2014 06:14:40 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:47024 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753991AbaCMKOh (ORCPT ); Thu, 13 Mar 2014 06:14:37 -0400 Received: by mail-pd0-f172.google.com with SMTP id p10so877329pdj.17 for ; Thu, 13 Mar 2014 03:14:37 -0700 (PDT) X-Received: by 10.66.149.7 with SMTP id tw7mr1326282pab.72.1394705677128; Thu, 13 Mar 2014 03:14:37 -0700 (PDT) Received: from localhost.localdomain (KD182249091179.au-net.ne.jp. [182.249.91.179]) by mx.google.com with ESMTPSA id yj1sm7505037pab.30.2014.03.13.03.14.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Mar 2014 03:14:36 -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 v6 3/7] ftrace: Add arm64 support to recordmcount Date: Thu, 13 Mar 2014 19:13:46 +0900 Message-Id: <1394705630-12384-4-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394705630-12384-1-git-send-email-takahiro.akashi@linaro.org> References: <1393564724-3966-1-git-send-email-takahiro.akashi@linaro.org> <1394705630-12384-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.220.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 | 9 +++++++++ scripts/recordmcount.pl | 5 +++++ 3 files changed, 16 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..047c8cd 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,10 @@ 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; + altmcount = "_mcount"; + 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";