Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1337546pxb; Wed, 2 Feb 2022 02:38:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwVPJnux54cXm9IwkFNptDOduCkaGpLoYp4kW2i40p2GbyYcq8CbSCP/ZfIWL7kW5GJee3 X-Received: by 2002:a17:907:8a05:: with SMTP id sc5mr24087981ejc.316.1643798303304; Wed, 02 Feb 2022 02:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643798303; cv=none; d=google.com; s=arc-20160816; b=nJNMhX3D0Nb1TiGOcK/rFyc6NAbU5pygBbGG0r5eQcPmdR8C4AHMqr2v3mv5JuSnw+ fI1Iw8C/b495tQZfaP/ttWPt0SgiwXuvvkIR1ops3FRg2Gi1/FioOwMbFdEPotTw+CN6 zkdriVVcgDjlEEnh1FpDi/giorrw/EJ22kh+uXyvizYdy8nuqaWa/26W8o0oNJVcIZdB /pvBOrd7OWaBQ4sfiWVPe3rmRciVguvWWPjmw1Xrc7q9dIltgsCFTYbJW0avANRCwxhN Ouppp8zON3C4FFGYqGOgIhpup9BylGfJ4sSBEm95d9KHVfu07x7fqEYUDFD234zdxME0 PLGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=CeCMwlNAwf570Z2wvd4HDxQkPnXgfxYZn4cq1D2dOlI=; b=y9/G0iIevsjSpDbQvT2AHaaL9CEDCY12NlRFqb8FJ2DDdTD7qFWC4sFdAy5NuoB2Gv 2ua2cW1/VqhZxk/YlTrADfHzsSoDK4eIfzLj/BnoYYCnHyEYTU5EGjR1Owp2ArVS5z2z /O46+u/Dcao6tPCrQUz31fcXZkIlC0tvCJ0tzBJAj51VjMa31GetPnDNosqzWdVOHgVd LHzdbZAkTX5zGpfYJuBCW1R2Rn5R+WQ/hbpvxtVsP1IB/G+dOV/Ki4xcyFvxPDGm3KM8 BUCnfThcmaTr87TF6Cr5OuZ5uRTyHbdZD0BWK9pQzh98u+/mT/SnyX5YRoIicuLNGZjK BQjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15si13524501edw.582.2022.02.02.02.37.58; Wed, 02 Feb 2022 02:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234073AbiBATy1 (ORCPT + 99 others); Tue, 1 Feb 2022 14:54:27 -0500 Received: from mail-lf1-f43.google.com ([209.85.167.43]:36600 "EHLO mail-lf1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233911AbiBATy0 (ORCPT ); Tue, 1 Feb 2022 14:54:26 -0500 Received: by mail-lf1-f43.google.com with SMTP id z4so36136960lft.3 for ; Tue, 01 Feb 2022 11:54:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CeCMwlNAwf570Z2wvd4HDxQkPnXgfxYZn4cq1D2dOlI=; b=Au9Msmg2lryYyk3+fJKoP1VPxJ7UV1XUMdQBHtp78AYNAamflUBHZLTkHh4c1n70qB L/ubidGp3YhUYdQH3b8ZHgzF2KGWwOO3JGL+R25XUi7ryCPuSwkp4vbEmjeGxCgF1vUU +4hS/RYJqcznlhBpTd9T4goywDJZ78cCzRmfbKvZCQFHCnALkQViPeuF51faxMhNDnN5 CVoBGuPBA08Y2BkP7DsQyql52wpB/93Mdktd6EWn+AraeKcBOwVAq+Q/mxGCwu1Muzn0 tpnLnZWFi2ENiLrT4c+8WTbhYnph3hJd9nr87mvipC8675w1DRIa2vzpLZD2gIgwYIAq 8HQA== X-Gm-Message-State: AOAM531Aj75CYFR7pBaqaQbmbud8eQ2aEOynakFSrHL+bzPSEn/691dA d8JGH9785j3VD22ffbv5pcY0CTSQQH08DA6E2R0= X-Received: by 2002:a05:6512:3186:: with SMTP id i6mr17870320lfe.47.1643745265335; Tue, 01 Feb 2022 11:54:25 -0800 (PST) MIME-Version: 1.0 References: <20220128203950.3371061-1-namhyung@kernel.org> <20220128203950.3371061-4-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Tue, 1 Feb 2022 11:54:14 -0800 Message-ID: Subject: Re: [PATCH 3/3] perf annotate: Try chroot filename for objdump To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , Andi Kleen , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On Mon, Jan 31, 2022 at 11:23 AM Jiri Olsa wrote: > > On Fri, Jan 28, 2022 at 12:39:50PM -0800, Namhyung Kim wrote: > > Likewise, it should use a proper name in case the task runs under > > chroot. The child_process.err was needed to set to -1 to show error > > messages properly in TUI. > > > > Signed-off-by: Namhyung Kim > > --- > > tools/perf/util/annotate.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > > index 01900689dc00..e4c641b240df 100644 > > --- a/tools/perf/util/annotate.c > > +++ b/tools/perf/util/annotate.c > > @@ -33,6 +33,7 @@ > > #include "string2.h" > > #include "util/event.h" > > #include "arch/common.h" > > +#include "namespaces.h" > > #include > > #include > > #include > > @@ -1696,6 +1697,15 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil > > * DSO is the same as when 'perf record' ran. > > */ > > __symbol__join_symfs(filename, filename_size, dso->long_name); > > + > > + if (access(filename, R_OK) && errno == ENOENT && dso->nsinfo) { > > + char *new_name = filename_with_chroot(dso->nsinfo->pid, > > + filename); > > + if (new_name) { > > + strlcpy(filename, new_name, filename_size); > > + free(new_name); > > + } > > + } > > } > > > > free(build_id_path); > > @@ -2036,6 +2046,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) > > memset(&objdump_process, 0, sizeof(objdump_process)); > > objdump_process.argv = objdump_argv; > > objdump_process.out = -1; > > + objdump_process.err = -1; > > is this unrelated fix? Right, it's unrelated. Maybe I can split it if Arnaldo wants. > > otherwise the whole patchset looks good to me > > I guess we'd need to add something like PERF_RECORD_CHROOT to > handle and instrument sys_chroot to handle this completely? Are you talking about an env variable? Maybe we can track chroot syscall. But it needs to be task-specific rather than a global setup. As it hasn't been an issue so far, I think it's ok to have it as a fallback right now. > > Acked-by: Jiri Olsa Thanks for your review! Namhyung > > > if (start_command(&objdump_process)) { > > pr_err("Failure starting to run %s\n", command); > > err = -1; > > -- > > 2.35.0.rc2.247.g8bbb082509-goog > > >