From patchwork Tue Apr 12 15:48:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12810906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5098DC433F5 for ; Tue, 12 Apr 2022 15:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iJ9rV8mqYRnn6J1ox+yGqkWTeUrSL5l9UIUbsmzQlaA=; b=Kg0sKVmf4Pd8jQTAhN5pOvOrBY 4RlwRsrydxXh+L4yzZDOJSaiPWXbT9ZN8L1nB1gHR7Lep+BqemGGk9Mddted/CCBlFYsaZ/+56Kxc I16sNAMRfUmH7sGBGj8K4grudHGJRIRUvx2q1UASV7xOGClh6pk6iKyUPR2xWRhuPvdhe5VNoF8We QSEGMkG9a2p/t6yr7lqGrjI0mzFpMWAVfBRsHrkUYhBRMXJ80hIV5VBsgjqsNyQX4EqmfApk3+ylZ XGYz2qsEITnLigPOWPHEIc4dQXqAs0vYSVLahy+/lRGMOl4EdqVKEN3HL1p+nU92M2Un8T02lmc2h LnGRsStw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neIlS-00F07M-D1; Tue, 12 Apr 2022 15:49:10 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neIkr-00Ezsu-Jr for linux-arm-kernel@lists.infradead.org; Tue, 12 Apr 2022 15:48:35 +0000 Received: by mail-yb1-xb49.google.com with SMTP id b65-20020a25e444000000b0063dd00480f8so15034108ybh.13 for ; Tue, 12 Apr 2022 08:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cK/G+RqonStF/h6xatk1gRDJ5hKKNHxh+2wJ+78igxE=; b=EIM0xpglnrgdDge6VWgBXN8lvGL/IrrgKxb8vdaNjShzxCRJlvFBrPzOrFHL5lp+I7 ugxJ9LYMkf/3GQfmoop9DJRQEjENOpNJfNzpxXmYPbZiWVJqpqBsRXdIa5RR1B6TQKWJ YJFpXMWb8qn2tkyio6rJzkXAQp98Uqc6E/PbJB6XFwzeMOX5Up+bWOHCWjdcJl1JfMUF 3XcxNbsZ7xCBuT1vK7ZqYnntZGrY4Rf803wSA4ZHCk2z8RKwhFmxRj6poLOsQ7HchQBi mAv2YzmyYPUdeyA5x4QiTA6n9DQ01xkP3U8h8p/loJfnObWqyPkuG7JiAJQZe8RjcdoK 73vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cK/G+RqonStF/h6xatk1gRDJ5hKKNHxh+2wJ+78igxE=; b=MXH9ouXmKz3TgPBYhKHYcIS3Rd29jUvaJHHXFUWwudGJd0KS+sXEOY8QNp+6vIhm2H khqNk0Sw0qAFVzWeQsDDFliVPYbfrAuO9I4f0XjREK2XGQ1Q7hcYu27La97tQnbdGV+I 6QtPqk4lvwtn6sZQ9mcecjkszIjyKPObsuxwr3cmxhIABdCYPFMs51cHBhux7I8MAYnc k9OA7CNevRLt2eE45vAqB8lfc75L2B/LXoYr8/s1VQ5x/4RNV9aBDRkZDJbWUYWEo6/Y u6O5dGkrCqfnUu0NQkvZkHqMvA14JaQ1Azz/2UWkAfz/GOe5xESG5s7ewMPBv0H4o5xU wd1w== X-Gm-Message-State: AOAM532ByPs/9PVPDGulUrJDkV8TsEa8ZqCZz5nfavNlgh7WT9+wJeag aLChhxfpk9jTHrZjYnOLSZQ2RSvRiLpn X-Google-Smtp-Source: ABdhPJzeeAZlsCG5jbITUmxEHUU6RdnBefMiXkuXksPrPKjHyVQMHFGwRGaloelAD/z0+JPjBhMnEenrZx10 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:5f6f:a698:92a:5d45]) (user=irogers job=sendgmr) by 2002:a05:6902:1083:b0:63e:5325:d6b0 with SMTP id v3-20020a056902108300b0063e5325d6b0mr18951794ybu.431.1649778512269; Tue, 12 Apr 2022 08:48:32 -0700 (PDT) Date: Tue, 12 Apr 2022 08:48:17 -0700 In-Reply-To: <20220412154817.2728324-1-irogers@google.com> Message-Id: <20220412154817.2728324-5-irogers@google.com> Mime-Version: 1.0 References: <20220412154817.2728324-1-irogers@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v2 4/4] perf symbols: More specific architecture end fixing From: Ian Rogers To: John Garry , Will Deacon , Mathieu Poirier , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Clark , Alexandre Truong , German Gomez , Ian Rogers , Dave Marchevsky , Song Liu , Ravi Bangoria , Li Huafei , " =?utf-8?q?Martin_Li=C5=A1ka?= " , William Cohen , Riccardo Mancini , Masami Hiramatsu , Thomas Richter , Lexi Shao , Remi Bernon , Michael Petlan , Denis Nikitin , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_084833_688909_BAEE872F X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make the conditions used for symbol fixup closer to the comments. The logic aims to combine the current conditions as last modified in: https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/ --- tools/perf/arch/arm64/util/machine.c | 19 ++++++++++--------- tools/perf/arch/powerpc/util/machine.c | 18 +++++++++--------- tools/perf/arch/s390/util/machine.c | 17 +++++++++-------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/tools/perf/arch/arm64/util/machine.c b/tools/perf/arch/arm64/util/machine.c index 54fb41de9931..f258c1ebac03 100644 --- a/tools/perf/arch/arm64/util/machine.c +++ b/tools/perf/arch/arm64/util/machine.c @@ -18,16 +18,17 @@ #define SYMBOL_LIMIT (1 << 12) /* 4K */ -void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, - bool is_kernel __maybe_unused) +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel) { - if (p->end == p->start || p->end != c->start) { - if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) || - (strchr(p->name, '[') == NULL && strchr(c->name, '['))) - /* Limit range of last symbol in module and kernel */ - p->end += SYMBOL_LIMIT; - else - p->end = c->start; + if (is_kernel && (p->end == p->start || p->end != c->start) && + ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) || + (strchr(p->name, '[') == NULL && strchr(c->name, '[')))) { + /* Limit range of last symbol in module and kernel */ + p->end += SYMBOL_LIMIT; + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); + } else if (p->end == p->start) { + /* Expand empty symbols. */ + p->end = c->start; pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); } } diff --git a/tools/perf/arch/powerpc/util/machine.c b/tools/perf/arch/powerpc/util/machine.c index a732601f951e..689a48040b64 100644 --- a/tools/perf/arch/powerpc/util/machine.c +++ b/tools/perf/arch/powerpc/util/machine.c @@ -14,16 +14,16 @@ * Therefore do not fill this gap and do not assign it to the kernel dso map. */ -void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, - bool is_kernel __maybe_unused) +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel) ) { - if (p->end == p->start || p->end != c->start) { - if (strchr(p->name, '[') == NULL && strchr(c->name, '[')) - /* Limit the range of last kernel symbol */ - p->end += page_size; - else - p->end = c->start; - pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); + if (is_kernel && (p->end == p->start || p->end != c->start) && + strchr(p->name, '[') == NULL && strchr(c->name, '[')) { + /* Limit the range of last kernel symbol */ + p->end += page_size; + } else if (p->end == p->start) { + /* Expand empty symbols. */ + p->end = c->start; } + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); } diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c index 8622a1b78748..790d98a39c83 100644 --- a/tools/perf/arch/s390/util/machine.c +++ b/tools/perf/arch/s390/util/machine.c @@ -42,15 +42,16 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name) * and beginning of first module's text segment is very big. * Therefore do not fill this gap and do not assign it to the kernel dso map. */ -void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, - bool is_kernel __maybe_unused) +void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel) { - if (p->end == p->start || p->end != c->start) { - if (strchr(p->name, '[') == NULL && strchr(c->name, '[')) - /* Last kernel symbol mapped to end of page */ - p->end = roundup(p->end, page_size); - else - p->end = c->start; + if (is_kernel && (p->end == p->start || p->end != c->start) && + strchr(p->name, '[') == NULL && strchr(c->name, '[')) { + /* Last kernel symbol mapped to end of page */ + p->end = roundup(p->end, page_size); + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); + } else if (p->end == p->start) { + /* Expand empty symbols. */ + p->end = c->start; pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end); } }