Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp819612pxb; Tue, 12 Apr 2022 14:20:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywoOsTHtgGZya6qY8car78Wy42f8SOpBJ2sBWXFlO9mAdjcmu6ZonUF406PkEzEHmBwiDb X-Received: by 2002:a05:6a00:130e:b0:4cc:3c7d:4dec with SMTP id j14-20020a056a00130e00b004cc3c7d4decmr39956335pfu.32.1649798432912; Tue, 12 Apr 2022 14:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649798432; cv=none; d=google.com; s=arc-20160816; b=OZKsKvBNe4SC2AZJRQB2zeSWWtJFoYgoB8pUJntSF1Sa9LLEf7YosBl4TLnbioEaeP 0OAD/olmZ+vitqcrhZ1wvOHavI3g8/DJ1DE2OKspfWyo/W1T8EvURKBwokyF0+HVtRNl u1wgDvGI/CwzIAjkjJFr1O9OZgvjSeQvjKJ3jIC7i/kSGWHTM+NpN3qff/1OHOBSsNzZ hmGwG7Jk4r9PdGsUaE/gROyyGYZttOicxAGzBijSyzDKI5yWh+csJvqxIMlqEw0TtXns drO9aKmNqycy4F7q+sdl+SIIvqX01b/C15amts4ezp9yqSLddbjmNq0ZajvP81yjtetS o4DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jxc4olMcFemhUosxpLZMJRYJVIAs9QLO7H3uZTwv/Ug=; b=gQ0jBSskymDi2lL3Gz7p10GBmjLUhOcLPt2dAOey5hgy1qddQ81sXfTpfp9FJbUiDg kPJqh0FxQcoub7EOg6uKTMU5FEYE02PiXH0RQeQ9ZDGMS24Ox+BSbw7QuTQSMWM9ji2p 5qBsnVCK/NRZeWynXio2F0hcSwSpZvCO5+IBakIvfp9jaeNPUJrjrDSgN1DA4Ox9onYz JC4RshJzyfK4O/AEgE7b1Feem+BOMJJ2MHEGMT0hEEH+nwdNAI8UTx+y5DvFekU+s7dy IL8h9x6wrEDX6hcQENSL8EyeOTyWMCgLUWHCntIXdG8+27p7o6rut/ULJslUfM9YC3FD RpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=fggUObJo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id rm14-20020a17090b3ece00b001bd14e0308fsi13165122pjb.103.2022.04.12.14.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=fggUObJo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21478106118; Tue, 12 Apr 2022 13:33:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237387AbiDKK6H (ORCPT + 99 others); Mon, 11 Apr 2022 06:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245016AbiDKK6F (ORCPT ); Mon, 11 Apr 2022 06:58:05 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 986CF3B2B6 for ; Mon, 11 Apr 2022 03:55:51 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id f3so14291604pfe.2 for ; Mon, 11 Apr 2022 03:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jxc4olMcFemhUosxpLZMJRYJVIAs9QLO7H3uZTwv/Ug=; b=fggUObJo9DosRdizR6rxqIHDU+ijm4JyvHLzSkknOhcGpXc5MnKgFTISpxN14REZ5l 3rqgkxaunu41WZ9TSKUuGCQfmKe3AArxukPB/zKzyKp/9sbljUy3bkwhw9R8lPtUIKOH 7iYB7iiC+38TLGq5mFfcKo6QUymU5FacvYe0m2VUDZAoEoBLJ48k4z737tIdDSxky3yq 2e6j4G9O+i+qgAD1+2t+RwhYp7tIlXoRDJ6ctxSkXeDIdbckE1Rl82cJzCSEcLwDL4IW nXMNkGBtYOroCd2HprdC8m3GiJZp7YPEZXLbojNUtX5o8yJXcd6s46NUByTFUwhCKWbZ f3Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jxc4olMcFemhUosxpLZMJRYJVIAs9QLO7H3uZTwv/Ug=; b=HYS5LLDisOGPUDO6A4Bad/4fTr1I2v26VW/atJKOBDjxfnXtta5y7eWU0FFjd9QoMx J/1N7CDJZf6fMOkttTYYJNRy0yvtPrp1+5dNNqGPsnyQgynF70lE+QxLoSjB7UkPmr83 jSBWKSj1Xxd3Arp/Kyl1yikHIP3j98z2gC1EOPz4OSy2HgtR86VU2DRxpUIdUWEFmtaW PN53YQD5tgFxIKTm/P6OmgF02FXzEchriMt3+BxAiQHfelJ3A8VUZCcr3OIBYeBHVYmG tAdk/vxWegwK1Xya+WuU3Xw0Xaory9BryiC6gqKLuNvheChXwNKyHTFT/phU1kGeG1P/ 3Ffg== X-Gm-Message-State: AOAM530jqt0kKqpFVTgFo/qhxfeC6AX51hs9fs9lpGfyFWzdR33blgHH kxL4h132zfotQp+3njwZQ7gi7w== X-Received: by 2002:a05:6a00:174f:b0:4fd:aed5:b5e4 with SMTP id j15-20020a056a00174f00b004fdaed5b5e4mr32119192pfc.39.1649674550954; Mon, 11 Apr 2022 03:55:50 -0700 (PDT) Received: from hsinchu16.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id v26-20020aa7809a000000b00505bf88a17bsm3496127pff.214.2022.04.11.03.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 03:55:50 -0700 (PDT) From: Eric Lin To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, iii@linux.ibm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: paul.walmsley@sifive.com, Eric Lin Subject: [PATCH v2 1/1] perf jitdump: Add riscv64 support. Date: Mon, 11 Apr 2022 18:54:38 +0800 Message-Id: <20220411105438.21366-2-eric.lin@sifive.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220411105438.21366-1-eric.lin@sifive.com> References: <20220411105438.21366-1-eric.lin@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch enable perf jitdump for riscv64 and it tested with V8 on qemu rv64. Qemu rv64: $ perf record -e cpu-clock -c 1000 -g -k mono ./d8_rv64 --perf-prof --no-write-protect-code-memory test.js $ perf inject -j -i perf.data -o perf.data.jitted $ perf report -i perf.data.jitted Output: To display the perf.data header info, please use --header/--header-only options. Total Lost Samples: 0 Samples: 87K of event 'cpu-clock' Event count (approx.): 87974000 Children Self Command Shared Object Symbol .... 0.28% 0.06% d8_rv64 d8_rv64 [.] _ZN2v88i nternal6WasmJs7InstallEPNS0_7IsolateEb 0.28% 0.00% d8_rv64 d8_rv64 [.] _ZN2v88i nternal10ParserBaseINS0_6ParserEE22ParseLogicalExpressionEv 0.28% 0.03% d8_rv64 jitted-112-76.so [.] Builtin: InterpreterEntryTrampoline 0.12% 0.00% d8_rv64 d8_rv64 [.] _ZN2v88i nternal19ContextDeserializer11DeserializeEPNS0_7IsolateENS0_6HandleINS0_13JSGlob alProxyEEENS_33DeserializeInternalFieldsCallbackE 0.12% 0.01% d8_rv64 jitted-112-651.so [.] Builtin: CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit .... Signed-off-by: Eric Lin --- tools/perf/arch/riscv/Makefile | 1 + tools/perf/util/genelf.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index 1aa9dd772489..a8d25d005207 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -2,3 +2,4 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 +PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index 3db3293213a9..ae138afe6c56 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -38,6 +38,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent #elif defined(__s390x__) #define GEN_ELF_ARCH EM_S390 #define GEN_ELF_CLASS ELFCLASS64 +#elif defined(__riscv) && __riscv_xlen == 64 +#define GEN_ELF_ARCH EM_RISCV +#define GEN_ELF_CLASS ELFCLASS64 #else #error "unsupported architecture" #endif -- 2.35.1