Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1010908pxx; Thu, 29 Oct 2020 22:29:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzpmGtrIvlA1A2+lvk28vFDdQ75Kjnnop3fzJEwHrnxse8+P+zz3zP/BBd/T/b8tmPqEM8 X-Received: by 2002:a17:906:b03:: with SMTP id u3mr776239ejg.3.1604035757301; Thu, 29 Oct 2020 22:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604035757; cv=none; d=google.com; s=arc-20160816; b=yPrshQXwwb6W7XriiXclKPvCIyWt6kR+j6zR8C6ko7L3N0d80eY7AUmHd4W1o8GQRp y2U82nE4eK5bDjsD91Jq+y4xNVQyMEyVQ5j11S/CqFVhzYTxOZ6J3Z1lb6vbD6F6s5eq pwY21lEEWQneFRJvaCkJMJ/mGThvljABGjAauC71s/7pAEWuvr6EGT/MEx2FXW9vG2Ic SzM9zM+jUIwLsq6eud373aHALJePB+TcfUAQXNfMimwLDpVKOMi0sz3n9H5rzlRBYc1u sl3WPAUbCB/NkZHBVDKAhTIvV4W9OLQD4FZlUTsDOdb4d+lBoHk/mzcI684mxO58cG82 7Gsw== 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=q8cfJHzGpbY9F0GkWPXtJI8dzSVuahW/++/+8hRP0Qc=; b=grcPlDeFerZq8BgW2O0prGF7YQFN1cW2RfrtJBuxvCPVVl9ebXlJRwZMZHLuJlhEP+ KZe+86VxpOIDnQHtgzutTwqyWDWIgriUmhiQCUf1eznG1k83mh/0mQKX17AfiD/384gs WECUqUiojkPLT+LXlKrWwdpn9e89uY2i4d315ZmWEmuRSgCk52C9GUYgw20//PkySdAT oD9l1tzRH6JgdIYDO78MUxL64mazfUCOsHi9QUEixuTU6Mr1Y10Sbv3f5Hg6ElzD1eF2 CXNIFUSqmAhzdA7DkxJPtBRP1azUc0RLFpJMz5ZmM1NW8tJXtYcnNzU6If7UbVLCIZw+ JTtg== 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 q6si3529571edw.213.2020.10.29.22.28.54; Thu, 29 Oct 2020 22:29:17 -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 S1725816AbgJ3F0d (ORCPT + 99 others); Fri, 30 Oct 2020 01:26:33 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:40496 "EHLO mail-wm1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgJ3F0d (ORCPT ); Fri, 30 Oct 2020 01:26:33 -0400 Received: by mail-wm1-f52.google.com with SMTP id k18so1797474wmj.5; Thu, 29 Oct 2020 22:26:31 -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=q8cfJHzGpbY9F0GkWPXtJI8dzSVuahW/++/+8hRP0Qc=; b=SToyTWgASSiOKFaMN97lbrUe1sWD6XyyY6E4qrrwieJT4a7f2C161UWBM/rvDuP8O6 LaO1/nLi3FuK3Y6b4sNhGNGoj8gWxZWX/vSaWlUm8Z4ir564x41WYyT0ahZylHrxWLsP l5YETWJw9flO8Aefi+MJRw/QcovNHrEtukTYVXpBMoKYpYEklDub9wlPlNZI9lfxA6K+ KKUoAjv+HkqjUPMFWQ27S+f2o0C9zYCZE4Wr31PGRfd7OMxpfCWP640y8ubrXDD4TjKq dJJfgmk9JD+IQdIJ5tDjIrD5Wx33TYL7AzwTIQBWsZpgD8PWnU8Y93Mf6fgj3s2S2ird kp2g== X-Gm-Message-State: AOAM530dO5G3WyLmL3C86DFkvGk+l36I37Z7wIK7U/9kV83F+vVErq9S DxTdCUXceh3zejbMISTMNEsV/6tPlqOUfELIM18= X-Received: by 2002:a7b:cb46:: with SMTP id v6mr564893wmj.146.1604035591169; Thu, 29 Oct 2020 22:26:31 -0700 (PDT) MIME-Version: 1.0 References: <20201006131703.GR2628@hirez.programming.kicks-ass.net> <20201008070231.GS2628@hirez.programming.kicks-ass.net> <50338de81b34031db8637337f08b89b588476211.camel@klomp.org> In-Reply-To: <50338de81b34031db8637337f08b89b588476211.camel@klomp.org> From: Namhyung Kim Date: Fri, 30 Oct 2020 14:26:19 +0900 Message-ID: Subject: Re: Additional debug info to aid cacheline analysis To: Mark Wielaard Cc: Peter Zijlstra , Stephane Eranian , linux-toolchains@vger.kernel.org, Arnaldo Carvalho de Melo , linux-kernel , Ingo Molnar , Jiri Olsa , Ian Rogers , "Phillips, Kim" , Mark Rutland , Andi Kleen , Masami Hiramatsu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, Oct 8, 2020 at 6:38 PM Mark Wielaard wrote: > > Hi, > > On Thu, 2020-10-08 at 09:02 +0200, Peter Zijlstra wrote: > > Some time ago, I had my intern pursue the other 2 approaches for > > > symbolization. The one I see as most promising is by using the DWARF > > > information (no BPF needed). The good news is that I believe we do not > > > need more information than what is already there. We just need the > > > compiler to generate valid DWARF at most optimization levels, which I > > > believe is not the case for LLVM based compilers but maybe okay for > > > GCC. > > > > Right, I think GCC improved a lot on this front over the past few years. > > Also added Andi and Masami, who have worked on this or related topics. > > For GCC Alexandre Oliva did a really thorough write up of all the > various optimization and their effect on debugging/DWARF: > https://www.fsfla.org/~lxoliva/writeups/gOlogy/gOlogy.html Thanks for the link. Looks very nice. > > GCC using -fvar-tracking and -fvar-tracking-assignments is pretty good > at keeping track of where variables are held (in memory or registers) > when in the program, even through various optimizations. > > -fvar-tracking-assignments is the default with -g -O2. > Except for the upstream linux kernel code. Most distros enable it > again, but you do want to enable it by hand when building from the > upstream linux git repo. Please correct me if I'm wrong. This seems to track local variables. But I'm not sure it's enough for this purpose as we want to know types of any memory references (not directly from a variable). Let's say we have a variable like below: struct xxx a; a.b->c->d++; And we have a sample where 'd' is updated, then how can we know it's from the variable 'a'? Maybe we don't need to know it, but we should know it accesses the 'd' field in the struct 'c'. Probably we can analyze the asm code and figure out it's from 'a' and accessing 'd' at the moment. I'm curious if there's a way in the DWARF to help this kind of work. Thanks Namhyung