Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3149473pxv; Sun, 27 Jun 2021 20:42:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgwFfVS72nuBMv0x2sk9J7We5kq8dXNFXM5S0pa2QNobUG1nFq/1Is++1WCy8dw39DxsG+ X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr22298398ejb.492.1624851727492; Sun, 27 Jun 2021 20:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624851727; cv=none; d=google.com; s=arc-20160816; b=VT84vJtHUnYuvpbl9Nxv3XDIMg+/d+V6LZl6JXPso8xgJd9rClh8cnAFbTyQuKpM6K aXtPhIK9xKiP0XD/Hhu+nshUsJ8aMAtFg6CSQmiRUMMDclwS0pdkrIzu73iB9lsGSIUt mRV/i5wvNpFpIoPOUVpwkiiGEMhjPJXOUb799RMpxhOBYL/jjg4Eqw4wOsjCsWnVclB/ 7DsbbRd4YslQN0hqz4JXk1DKa4zccxW0DH9IFKblvNG+7BFuRNws/Mt9drKL/MAWJpOh 5BmRurdReO707hzLSPt+xRcHa7Aqp5mtBPSHMH9Rd1e26qtJsNbfJiUNeNxZkL0pvpJi pPRQ== 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=TA9GkBikXPkJmyUCmRN+fLpWXV97fC3gAkW1HN3aY3A=; b=zoBjbR0bEeiiBtn09CG2dtvf39l9C3RjFakOAreKi7xcMH9A9PIVsPVOixGJExUcfg YgijA0/cr8XA8WBhfFl57WRTDJUWldxAVxt6MHzGB+a9XO8hyH2wfS7dfUxY5Opl0z+m oglv3tJxSSGNyj4mRAK1YtEwccBjUDNfOyql76R0hgadnyeeVONRLdjanuoYpp7Ryvab JJZUNpe2J2sPvQswhGtzD/rDJfGPIaRS2rrOgB/x0ytMYOqcYCEinz06QMI9R+0cubOK PEjdHb8YWCWt/98e6oNWv/nPqPB9A0c0WmjeZMokXo+NyHgHPyYjVc+ap25Rsoc1Ghv+ C4YA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si12868926ejl.599.2021.06.27.20.41.44; Sun, 27 Jun 2021 20:42:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232034AbhF1Dlp (ORCPT + 99 others); Sun, 27 Jun 2021 23:41:45 -0400 Received: from mail-lj1-f169.google.com ([209.85.208.169]:44861 "EHLO mail-lj1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbhF1Dlp (ORCPT ); Sun, 27 Jun 2021 23:41:45 -0400 Received: by mail-lj1-f169.google.com with SMTP id u25so7760472ljj.11 for ; Sun, 27 Jun 2021 20:39:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TA9GkBikXPkJmyUCmRN+fLpWXV97fC3gAkW1HN3aY3A=; b=SJOnmEDzsOmte1Cwt5WWx6xVcQt7vODZxGo2CjiXS2aWTvgxjNc6YM64KqRwjI7U/k 8nRERv6wPamq12OwLBtexFMJL6LwB6UHxLt4Gv803TvIBftClLZrHe/RubkbKGfWSi88 eulX/vV9rprvdwLkP2P+2IPXj3WYCCldD16+jLbjJBTNJ9GBuQmjY9PjI7rq3i5YaxRY 0k+PV1N3XnxJcH5tgXnj0Atb1enLMCtgTChJOYf4iBueaiJgQUpw6JLzVr5O89k5PtYs +LlUzUZvogif8bg/CgFjT+28qa21ducUSCW17Wly7OJAM/4+RhXVqsVn0lMCXZ3mmgkz u50w== X-Gm-Message-State: AOAM532Z5khF8a9aY10hdH5ZXtgJYd2szWEaqLftb6FgfE0sKR4dUMwQ HmR2YX4/wT4fozIGmAz4KG2HaSnnNABPjlRTLAU= X-Received: by 2002:a2e:8e82:: with SMTP id z2mr18085641ljk.275.1624851558515; Sun, 27 Jun 2021 20:39:18 -0700 (PDT) MIME-Version: 1.0 References: <20210622153918.688500-1-jolsa@kernel.org> In-Reply-To: From: Namhyung Kim Date: Sun, 27 Jun 2021 20:39:07 -0700 Message-ID: Subject: Re: [RFC 00/10] perf: Add build id parsing fault detection/fix To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ian Rogers , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Michael Petlan , Riccardo Mancini Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 27, 2021 at 10:25 AM Jiri Olsa wrote: > > On Wed, Jun 23, 2021 at 12:48:30PM -0700, Namhyung Kim wrote: > > Hi Jiri, > > > > Thanks for your work! > > > > On Tue, Jun 22, 2021 at 2:19 PM Jiri Olsa wrote: > > > > > > On Tue, Jun 22, 2021 at 03:14:04PM -0300, Arnaldo Carvalho de Melo wrote: > > > > Em Tue, Jun 22, 2021 at 10:47:54AM -0700, Ian Rogers escreveu: > > > > > On Tue, Jun 22, 2021 at 10:39 AM Arnaldo Carvalho de Melo > > > > > wrote: > > > > > > > > > > > > Em Tue, Jun 22, 2021 at 05:39:08PM +0200, Jiri Olsa escreveu: > > > > > > > hi, > > > > > > > this *RFC* patchset adds support to detect faults during > > > > > > > mmap2's build id parsing and a way to fix such maps in > > > > > > > generated perf.data. > > > > > > > > > > > > > > It adds support to record build id faults count for session > > > > > > > and store it in perf.data and perf inject support to find > > > > > > > these maps and reads build ids for them in user space. > > > > > > > > > > > > > It's probably best explained by the workflow: > > > > > > > > > > > > > > Record data with --buildid-mmap option: > > > > > > > > > > > > > > # perf record --buildid-mmap ... > > > > > > > ... > > > > > > > [ perf record: Woken up 1 times to write data ] > > > > > > > [ perf record: Failed to parse 4 build ids] > > > > > > > [ perf record: Captured and wrote 0.008 MB perf.data ] > > > > > > > > > > > > > > Check if there's any build id fault reported: > > > > > > > > > > > > > > # perf report --header-only > > > > > > > ... > > > > > > > # build id mmap stats: FAULTS 4, LOST 0, NOT FIXED > > > > > > > > > > > > > > There is, check the stats: > > > > > > > > > > > > > > # perf report --stat > > > > > > > > > > > > > > Aggregated stats: > > > > > > > TOTAL events: 104 > > > > > > > .... > > > > > > > BUILD_ID fails: 4 (14.3%) > > > > > > > > > > > > > > Yep, let's fix it: > > > > > > > > > > > > > > # perf inject --buildid-mmap2 -i perf.data -o perf-fixed.data > > > > > > > > > > > > Can we make it possible to automate this with --fixup-buildids or a > > > > > > perfconfig 'record' knob? > > > > > > > > > > > > This would entail requesting that build-ids that _fail_ be sent to the > > > > > > side-band thread we have in 'perf record', this way we wouldn't have to > > > > > > traverse the whole perf.data file, be it with 'perf-record' at the end > > > > > > of a session with faulty build ids, or in a similar fashion using 'perf > > > > > > inject' as you suggest. > > > > > > > > > > > > I even think that we can have all these modes and let the user to decide > > > > > > how important is this for them and how convenient they want the whole > > > > > > process to be. > > > > > > right, that might be good to decide first.. because as I said, > > > I never hit faulted build id, so it probably needs the special > > > setup you guys are using.. could you try on your setup and check > > > how many faulted build ids you see? > > > > Did you check data mmaps? It might be easy to get faults > > from data files and we don't know if it's an ELF or not > > before reading the ELF header in the first page. > > well, AFAICS the mmap event is sent right after the elf file > is loaded, so it does not have a chance to be swapped out I'm talking about the normal data files when we use perf record -d. Those mmap files might not have page 0 in memory. I'm afraid it's reported as a build-id fault. Thanks, Namhyung