Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3029626rdb; Mon, 4 Dec 2023 14:47:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHecSbu34yntFEOtjvIFHu4R2+Q5g/zYJZ95DGFOlTsameOJ3lXVQQ8kOQhw0XQsgrZvtEu X-Received: by 2002:a17:90b:4f41:b0:285:dbc9:dc18 with SMTP id pj1-20020a17090b4f4100b00285dbc9dc18mr320264pjb.38.1701730028794; Mon, 04 Dec 2023 14:47:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701730028; cv=none; d=google.com; s=arc-20160816; b=ellOlIJjLgY7YKuHvnAgJD2lZZ6uxhP2+p6rlRKlSXQ+nkqx8BJNcKdLDNgXGxj5EP eEDJ9lxMpXgpTRFn6wM22zRiU1cjG4lPVHENeWL/44YxI0rmsLT6AUGR95+7KOQh8sO6 CY/pgnLtrJjD+ZLCogS0vh/a+0IqYtaOPVA7IiGCEAnn7uO7kTcLHMNe2IAFvBK8gdp+ Xn//ckFJv+tMkyOfyO8jfmzJPbWI07JrfyiTPg3jCLB5gK28oyUVSKT990mO0oC0fLj4 1+3KTJrMKLxpFZKfmVK+nugGtnTPIeBiGIZkQoNlkuAyWGq5WqDDLNraxaIUZHQDJxC0 jDdA== 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=k2I75dH8lNto/fxTXLO2VC8UvnFVQpLa9MloHrvqsBE=; fh=4Kgt7kDtVrIXe4cKNywMQAY7jLnutXL9uOkaTa5MrMg=; b=0yJoVYkSyBSNl/pKSUmyipxKkyz6H/Gpt+099BWDcj52qsEFp9ko3tn2gxeZVYjk+z pEn88Btl0D6Tk9d0oUnezwYm4t9iQ9D2xK2dOaGRyGPyMFvzpXS5OZe67oWBq5oQOKBX UXmQAftWOyYALUmrxPdLe0Z9/cX205XsIPmbQJVzxU7dk+eGb79fW5QfeKdNFVDTwIns 43SSAMxLDznYYm4qqF32DYgJwTg1v6MHoYjrpWTmbt4UIJvW/vqGu6ngNWjLtHdn6JFr vUcJNqoC67VGd6PWwCR49q3K7H1B+29WEiW4ktMnRuCWOB8qyPjUowIgouw1DN9MuGoF kolA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a6-20020a17090ad80600b002867ef0ad7esi3787159pjv.97.2023.12.04.14.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:47:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 67A3B8079ACB; Mon, 4 Dec 2023 14:47:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234280AbjLDWqp convert rfc822-to-8bit (ORCPT + 99 others); Mon, 4 Dec 2023 17:46:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234255AbjLDWqn (ORCPT ); Mon, 4 Dec 2023 17:46:43 -0500 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9138A9B; Mon, 4 Dec 2023 14:46:49 -0800 (PST) Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5c229dabbb6so1901720a12.0; Mon, 04 Dec 2023 14:46:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701730009; x=1702334809; 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=LwdYS3W7LrNgkr4g+R3rXOTMxy7LyncKsnMZAwvDxzA=; b=OSHrbVPDciijAzOaY3+sreYE3LmiSUC3WFrGdv9aku/jm0RaxNNommO3PnVczzHxGX vcT/OWOV6gGXceQDzIOJlzGW7Nf/NQI9MZe+1Wr8/gXutBrsMmf+meLnR9ZU7cycm4G5 P6QOmGBCxX6Ujzcjquvz9Sk2TXGl8kSUQqsALOV5YNmwJisGnPEO+HH1NnbbWb00wMd7 o1DfPx7qVKzc92i6pYoTEWXUwzxYVDCXCJX/QQbb8TXX4eoVq0I69vhTh4Rc0vXbrX4u sEPt78mHMTPbq6K2sA8JTnoSCieqT47yusu5KteG+KblMHkK6qRuwGh2uK1swShyJtoY GaAQ== X-Gm-Message-State: AOJu0YyHHXUNehOvQcT9tqvHq0g+uwGzxTiDjfgA7AVN5T8aBJZi/vtv TPlcfOfWVyoIVUYTEj+pQgZYrk6HN760SlQZ+oQ= X-Received: by 2002:a05:6a20:8f15:b0:18c:159b:777 with SMTP id b21-20020a056a208f1500b0018c159b0777mr31046328pzk.26.1701730008727; Mon, 04 Dec 2023 14:46:48 -0800 (PST) MIME-Version: 1.0 References: <20231128175441.721579-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Mon, 4 Dec 2023 14:46:37 -0800 Message-ID: Subject: Re: [PATCHSET 0/8] perf annotate: Make annotation_options global (v1) To: Ian Rogers Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:47:06 -0800 (PST) On Thu, Nov 30, 2023 at 10:37 AM Ian Rogers wrote: > > On Wed, Nov 29, 2023 at 3:56 PM Namhyung Kim wrote: > > > > Hi Ian, > > > > On Tue, Nov 28, 2023 at 11:14 AM Ian Rogers wrote: > > > > > > On Tue, Nov 28, 2023 at 9:54 AM Namhyung Kim wrote: > > > > > > > > Hello, > > > > > > > > It used to have annotation_options for each command separately (for > > > > example, perf report, annotate, and top), but we can make it global as > > > > they never used together (with different settings). This would save > > > > some memory for each symbol when annotation is enabled. > > > > > > > > This code is available at 'perf/annotate-option-v1' branch in > > > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git > > > > > > > > Thanks, > > > > Namhyung > > > > > > Thanks for doing this and I think it is progress. I think there is a > > > common problem with having things be an option rather than say part of > > > session. Having a global variable seems unfortunate but I'm not sure > > > if in all locations we have easy access to the session. > > > > That's not the case when you deal with hist entry or TUI browser. > > I think that's the reason we have the option in the annotation. > > > > > > > The rough > > > structure with annotations as I understand it is: > > > > > > session has machines > > > a machine has dsos > > > a dso has symbols > > > a symbol has an annotation > > > > That's true. But the annotation struct is used only if > > symbol__annotation_init() is called. > > Right. I find this approach likely to lead to errors, such as a symbol > created globally before symbol__annotation_init() was called breaking > the container_of assumptions. Sure, but that's a different issue. Maybe we can add a hash table to map a symbol to annotation or annotated_source directly. But I don't think we need annotation_option for each symbol/annotation. > > > > > > > Annotation is something of unfortunate abstraction as it covers things > > > like an IPC per symbol (why hard code to just IPC?) and things like > > > source files and line numbers. > > > > Right, that's why I splitted the struct annotated_branch. > > > > > > > > A recent success story where we got rid of a configuration variable > > > was by switching to lazy allocation with sorting by name for symbols > > > within a dso. If we could have a lazy allocation model with > > > annotations then maybe we can do away with large hammers like global > > > options. > > > > Maybe I can move the pointer to option into the annotated_source > > which is allocated lazily. But I don't think it needs to keep the option > > for each symbol or annotation. It's usually to control some display > > behaviors in the disasm output globally. So I think it's better to have > > a global variable. > > Sgtm. My point wasn't to criticize, I think this is a good change, I > was just trying to imagine doing things in a way that could overall > reduce complexity Yep, thanks for your review. Can I get your ACKs? :) Namhyung