Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2344384rda; Tue, 24 Oct 2023 22:58:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6PHEkGkBduLzKpZUomZa/ZLmY0BSXNclXh4VpvSPS1ei56cvPYMAzqcS9XboaZi0yJEj9 X-Received: by 2002:a0d:e254:0:b0:5a8:d790:87df with SMTP id l81-20020a0de254000000b005a8d79087dfmr14835991ywe.19.1698213511863; Tue, 24 Oct 2023 22:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698213511; cv=none; d=google.com; s=arc-20160816; b=mkFkeAHrgToRtFavgs0vshEL4rhrBDeOqlhaxApV7UWEa/dfue0gpYiQ/9xrp2W7DD bu5mKR5+peN4vnK+BhCdiATzG+V9O00eyN9baMAfzQ4MDV+8Fo/C8hseaYNnyybkwF4y wdWuiqrJ1IUuVNcY9nCbB/MEmlcmqrc7zkf73i5QqAPXdZ5yScPamg60q7Oy7nFWkXGm odySg8GbWZ0UaVclDIFNFWh8JFlGNO6lLBBKb/fqKodHwrZ2kqrwjfRq06J02rBXC9oI uBw1l5pvDCvZDNGsAGYuaun6tFcOVl16sWUM/6ovL8H31Sua/rE+uLzwxfgFEVNw9j+7 pCEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=M6mi2cPuBCLy0kZ8WIcd3NyJJy+cFR3gqp25vbbhtmA=; fh=seRkYPOnanPQTinUzj1q5Y1EMDmnLrP6IUgx/A9YECo=; b=ZI+p41ef8nixDtY6wOBNv9njtIbBg+KZHzb34KJOGasByZNxZkBJoL46Bl8vI9BwxG x9P45zS9nzEIlXp559gvuBoO7JUCQTfhWrxu6PM9KlSMlZc/cPDw+seli5eTnlI2IPqj e69qHhnnr70IMUKPVBLx+C7W1DEkEJFxwpr4Wxvf0g8WRsYaIufeug6Top48o6f7YmhB pbU+PazdSd2e41C9lzFvvSDod7+Qr7aYMj1+foSVwGKfXJygWj9LY7vN8zhUl9ingdOW z9noWof37nJnGrThBH9sCLkxnDF4IMMIJ1dgaj37pHxdIQFRDBh+lNF7Fmaw4/NbGRRg 8ZQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r129-20020a818187000000b005a81d9f04c9si11417111ywf.191.2023.10.24.22.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 22:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CA307803F60B; Tue, 24 Oct 2023 22:58:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjJYF6W convert rfc822-to-8bit (ORCPT + 99 others); Wed, 25 Oct 2023 01:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJYF6V (ORCPT ); Wed, 25 Oct 2023 01:58:21 -0400 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CEB7AC; Tue, 24 Oct 2023 22:58:17 -0700 (PDT) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-27d3c886671so4634592a91.3; Tue, 24 Oct 2023 22:58:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698213496; x=1698818296; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V05i2ECvWgChxk8nStR6mE0WuTD+NL192RARRKjFwM4=; b=KdKhdXrJbHwks4dDUY5wugqHfzHx2H2YrHU5uE132pdi8CdmzT8dqlXklw/jdwbkI1 bwhP9Vyaic8cFgJghFxDCrSz+lEYgXwHtXeKVDz9HDQ1+rGTwHVaM3OpqQSrpQCPmB72 O95BiQyRmns8yxrVSGXbsz3skrx65ZqvZs5EZ3SRI08s1OO6q7Awhc7NkV/4QGa+IDWy sZ0XdaWSIDSr1PxEw6jMM88L0bLStscDFDJNY24KYQ8Vic8z4/tJ40mSEK62SNl4qB+Y v9nhQFkFPP52a3XL4dVKRuZQyyg8Sw86wpYFymYZ0EqTHhK2lNNSiIPDbUevKSmQ8sC/ puHg== X-Gm-Message-State: AOJu0YwAijsFzLkYRbTwFILNVE2F780e15PyxkA/ocSfA3UHdIweBuW9 UYS7uYzx9QOuUNe6PiUZe9Btt9SDlYUtJbqS3vo= X-Received: by 2002:a17:90a:4b0f:b0:27d:ed83:fdff with SMTP id g15-20020a17090a4b0f00b0027ded83fdffmr478973pjh.16.1698213496543; Tue, 24 Oct 2023 22:58:16 -0700 (PDT) MIME-Version: 1.0 References: <20231012035111.676789-1-namhyung@kernel.org> <20231012091128.GL6307@noisy.programming.kicks-ass.net> In-Reply-To: From: Namhyung Kim Date: Tue, 24 Oct 2023 22:58:05 -0700 Message-ID: Subject: Re: [RFC 00/48] perf tools: Introduce data type profiling (v1) To: Jason Merrill Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Jiri Olsa , Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org, Ben Woodard , Joe Mario , Kees Cook , David Blaikie , Xu Liu , Kan Liang , Ravi Bangoria Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 24 Oct 2023 22:58:29 -0700 (PDT) Hello, On Tue, Oct 24, 2023 at 8:07 PM Jason Merrill wrote: > > On Thu, Oct 12, 2023 at 12:44 PM Namhyung Kim wrote: >> >> On Thu, Oct 12, 2023 at 2:13 AM Peter Zijlstra wrote: >> >> > > This can generate instructions like below. >> > > >> > > ... >> > > 0x123456: mov 0x18(%rdi), %rcx >> > > 0x12345a: mov 0x10(%rcx), %rax <=== sample >> > > 0x12345e: test %rax, %rax >> > > 0x123461: je <...> >> > > ... >> > > >> > > And imagine we have a sample at 0x12345a. Then it cannot find a >> > > variable for %rcx since DWARF didn't generate one (it only knows about >> > > 'bar'). Without compiler support, all it can do is to track the code >> > > execution in each instruction and propagate the type info in each >> > > register and stack location by following the memory access. >> > >> > Right, this has more or less been the 'excuse' for why doing this has >> > been 'difficult' for the past 10+ years :/ >> >> I'm sure I missed some cases, but I managed to make it work on >> usual cases. We can improve it by handling it more cases and >> instructions but it'd be great if we have a better support from the >> toolchains. > > > How helpful would it be for the compiler to generate an unnamed DW_TAG_variable for the temporary in %rcx? That'd be fantastic, and that's exactly what I'm asking. :) > >> >> > > Actually I found a discussion in the DWARF mailing list to support >> > > "inverted location lists" and it seems a perfect fit for this project. >> > > It'd be great if new DWARF would provide a way to lookup variable and >> > > type info using a concrete location info (like a register number). >> > > >> > > https://lists.dwarfstd.org/pipermail/dwarf-discuss/2023-June/002278.html >> > >> > Stephane was going to talk to tools people about this over 10 years ago >> > :-) >> >> Hope that they would make some progress. > > > This seems expensive in debug info size for a lookup optimization; better IMO to construct the reverse lookup table from the existing information, as it sounds like you are doing. Though it would be good to cache that table between runs, and ideally share it with other interested tools. Probably. Then it still needs a standard way to express such data. Maybe we can have an option to generate the table. Thanks, Namhyung