From patchwork Wed Oct 28 06:38:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 11862521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07E56C4363A for ; Wed, 28 Oct 2020 06:40:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CEEC21775 for ; Wed, 28 Oct 2020 06:40:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZS3dEzpQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nV00rakW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CEEC21775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OE75lwwexDfTCttM7CmyEQwFkgTiZfiQWE8kZ+2f2JA=; b=ZS3dEzpQx2Ykt0TiozdQuUB1pT llytlLPLm1cPgCozEfWC1u9leH51x335eeknwbs+VElQi8DzmWms7BjfXbkRmMjOGKv+zNefOPGw8 5WNY1gYJlrcMfRvHXUdLwowGcQ8Jwu1wSJu0+VqSRXwJbRP5skOPWFMcQg/WVWllvvqMCuOCCrjgV my2MkPmR4axTVz6xF7wCR6J71DSzQpgsTqJQ09y2NTJNP7zHJzI/kWa4YB+T6wwfaR5yRwdTuTH/E h831VQ615hl7VjNpuAK1nEOcw6OWvUw5AUWlCfcSF5oiFLDsYAFCXzytQrnxeyTfNrqMXQZ8zo4N6 QNhnX8zQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXf6q-0006aW-HU; Wed, 28 Oct 2020 06:39:00 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXf6c-0006Ve-LE for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2020 06:38:48 +0000 Received: by mail-pg1-x544.google.com with SMTP id s22so2184553pga.9 for ; Tue, 27 Oct 2020 23:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wv05kmOFvRldoma6qnDe7plfeMpK62X6ArmvDV4JzoI=; b=nV00rakW8JlSD1SHXjoiEXZxrs7z4VK3jGg0yl2ZbPohKluY3m61nbAlcNRZZuat0G 9Re8IAXm2yVXkSWn6+GjdEM1JXJ3fIJbt1DREEn7HgBaqDEBMpAQq8z/etVLIoJ4lh8X 06It32w6HxUOxGn9DOzY9vTjzMAHX6BEjddiWDtWQkkjAxM/7ae0PTiKu347bEjscC99 ZPYh3ck4lSn5YP/+9zYaAIoq9T/AUBBvXcl0IwQFy84Zy4IyQ7YI+nCT/uX0v2y68vF0 7rpUkHTtGct3nf78uCp7+m+OOlxyHkm5pcJEr66O+5MkutQacG3gz8Q0/K8DSylBr8wU Eg2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wv05kmOFvRldoma6qnDe7plfeMpK62X6ArmvDV4JzoI=; b=pCvWuny6q9EMTbYReiMPezX4pb5cxr2UmHuEGjIcDsvf9NaN7Bsg/yhvsXve6hHrI/ uGChLPDteu+p76KZvwVsfGFJ5dNouQ/J7gPRxslwN2RfOdiOXPaHOdvbKT0qCMPtdgVw pcuI0sK3PzepuiDPCuOFfykFCU54xgb49O9TQzxBk6QExNgalD1RJkTXAlxkI2swXkNt LKlZ6ax40lpuY/sugtnxoU7z/bUp7NABq0oJdl/tZw6BZo8dZD3MiRBkPrS0q68GPGab 68Q4aFp/wE9eW3aS7UP58mmi1M8hNHqkO0Iw9e5r7jPP4GuisFO7g141R/j8o5S+gPpU EjUw== X-Gm-Message-State: AOAM5321VbZOWvio4f+vObOtvwTOX3gtvJyxOqNCN/sPwoPSulCtifov Gei8YnTaAF5/yPHG8OQZgpTp6A== X-Google-Smtp-Source: ABdhPJzCxbyMI5u9s8pS+n9iTgmH92Oh+pM1meZA3+X6X7cJKGjPkU7+klC2EYxtJ+2mK5HMrznLdw== X-Received: by 2002:a62:6507:0:b029:155:3b11:b458 with SMTP id z7-20020a6265070000b02901553b11b458mr6044291pfb.45.1603867124515; Tue, 27 Oct 2020 23:38:44 -0700 (PDT) Received: from localhost ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id n6sm4058809pjj.34.2020.10.27.23.38.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Oct 2020 23:38:43 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , Mathieu Poirier , Kemeng Shi , "Naveen N. Rao" , Ian Rogers , Al Grant , James Clark , Wei Li , =?utf-8?q?Andr=C3=A9_Przywara?= , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/9] perf mem: Only initialize memory event for recording Date: Wed, 28 Oct 2020 14:38:08 +0800 Message-Id: <20201028063813.8562-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201028063813.8562-1-leo.yan@linaro.org> References: <20201028063813.8562-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201028_023846_772107_36973509 X-CRM114-Status: GOOD ( 17.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It's needless to initialize memory events for reporting, this patch moves memory event initialization for only recording. Furthermore, the change allows to parse perf data on cross platforms, e.g. perf tool can report result properly even the machine doesn't support the memory events. Signed-off-by: Leo Yan Acked-by: Ian Rogers --- tools/perf/builtin-mem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 31144f586e77..f3dc2d2b879c 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -78,6 +78,11 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) OPT_END() }; + if (perf_mem_events__init()) { + pr_err("failed: memory events not supported\n"); + return -1; + } + argc = parse_options(argc, argv, options, record_mem_usage, PARSE_OPT_KEEP_UNKNOWN); @@ -436,11 +441,6 @@ int cmd_mem(int argc, const char **argv) NULL }; - if (perf_mem_events__init()) { - pr_err("failed: memory events not supported\n"); - return -1; - } - argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands, mem_usage, PARSE_OPT_KEEP_UNKNOWN);