From patchwork Thu Apr 7 23:05:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12805904 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 8306CC433F5 for ; Thu, 7 Apr 2022 23:07:10 +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=OtMTq0Y9BjexaCcQLWwYdzv66LSxk+t/kssSuFbLJOo=; b=DEsM2lkVXug3C/DlPIrvYgT7xN EcAMj/+Eujd9Ec3d9eEeun7TOcSpAIsL2gtysjwaYs08BL+4n2V+MeK+asPXVzlFntBfWSo+yoUXL 6tCduhEZYwatMm2fLd8p848iIhlmQ8RV/aOiL/UxXLOLZKU0AzT2MI+i6zeYMoqMncJx0Mg1a7UNz /TbajUsR0HYkUwv2M8xE4yyBFP9x8yycaHC58iLpvkyK8s6n8akV2hzzM5z6DBYqdGuSjNR8/UWNy dz3BAtFgyXFjPSetFP646wK4KOM9Cv4iQnKdmamHr9TNwsLI1GlXrMNGM81ZSMdmQNO2d3DI2my2L WnupXluA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncbCW-00EJ1R-AK; Thu, 07 Apr 2022 23:06:04 +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 1ncbBt-00EIng-If for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 23:05:27 +0000 Received: by mail-yb1-xb49.google.com with SMTP id h8-20020a25e208000000b00628c0565607so5351458ybe.0 for ; Thu, 07 Apr 2022 16:05:24 -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=BlnS9L2b1HywEaYijfWcFOwOQSJE9EtkTs1ukixmBPw=; b=ZoLWREi9IpzQjcNCRfvCg0QXxxgq/g/dr8q8lw6hiFwbYUfHDU1oOZdHzFe2C0x/Wj +G6TEXOTNFkXW2gltwODOW5zukJ6c3lNHMPBcvQp5GI18h87PtXgxM98avfGpH8OyZ5u nzT1o4ojmpF6V/vD2FRe+PGmy0ImyLDV3ZUqcR6ZYZaSKgCLKh4p5yqqe4XuvwTZxhV1 wKnssK5d/ODNrMayMxzcqVNtNCahdn67ngyBl7U3zRKpGFBBKd8ViX3vlJtwMuf7SlpI f+UB8KrczQtgb/Md34bcUsQs03hgQY4AgrDM31NMENxStRmUWp+7sf0pLroD9Ku6pL1D dq8w== 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=BlnS9L2b1HywEaYijfWcFOwOQSJE9EtkTs1ukixmBPw=; b=V/jNJKG9N1Pav4Hn/Jt3QpazbZ/ndt+0+U+XLzliTvXyt+gCPQ/iaSk0rLybTjGyGP pPbzyM4Pnc2HPmMpBJLqLYvhIsxG9Xp5RaJ9oEhrQK/odK+s3Mz7SFeCfCHQ90ISg2YT 5dzJFv5xeaP9v5PHSQShRPu2be4Na1RsrK7XhsMxZOvZLUk9uqo8pvaTqYkDpYKfxU9B MIKq3l7c4N2XdaLPa3BSJ6VX/E4I6eK3JIUzJPGcWiGVBGKWCXWiKTtHmWpOJQZzbwbT cxYJfU5EnJ4ixk1AcYccOQ3PbkXOxkrutqeQyZLcleBt/yjf7fkHjRJmVawGGZ/LkkBI 8evw== X-Gm-Message-State: AOAM533NLHFTUvCvzHtyqNqkEi20EqGXcGhIn+1AzRiXEfEGckZId9ox eYtQgzP7kSopN0aAZIYbuVNVmXdYc+CQ X-Google-Smtp-Source: ABdhPJwO6aQe2goGLlpoTWwXzoYnXPSLIf1haTI2XYvRcrDVlYdlMfH8R5T02DhVCFDBY/64pzF+0lrd295k X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:560:aa27:649e:a07d]) (user=irogers job=sendgmr) by 2002:a05:6902:392:b0:633:621f:166f with SMTP id f18-20020a056902039200b00633621f166fmr12458396ybs.166.1649372724286; Thu, 07 Apr 2022 16:05:24 -0700 (PDT) Date: Thu, 7 Apr 2022 16:05:03 -0700 In-Reply-To: <20220407230503.1265036-1-irogers@google.com> Message-Id: <20220407230503.1265036-6-irogers@google.com> Mime-Version: 1.0 References: <20220407230503.1265036-1-irogers@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH 5/5] 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-20220407_160525_688938_CFE44251 X-CRM114-Status: GOOD ( 17.11 ) 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/ Signed-off-by: Ian Rogers --- 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); } }