Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1531786pxb; Fri, 13 Nov 2020 15:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwftEIKeKWkNZqWvhnbXZI0IPfOGTXLJ/qmSEdl2jstBRqrcFltXsjTYMZy5GlzS0WUPqSM X-Received: by 2002:aa7:d146:: with SMTP id r6mr4911254edo.268.1605310701144; Fri, 13 Nov 2020 15:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605310701; cv=none; d=google.com; s=arc-20160816; b=AOQaka9FLn7lTHw/EgllJERF236WZ3Krs2KfplFUutXKJsiXmziYSyEc2ID7Da1s0c Qsmntok5r0PEOyFeVzEda7CwwlKDe8MPquAA1bEaQQye+lRQJpWaVILu1IvJWzvLO0Yq 4QBtdGAX2zZnRUPEP87YnfA1VwyELaW3Lcc+BMEpEzhB4Ij+m6v/+5VM5yBsdsdL7T6H nE1/jTOsu9sevrvBXJS0Nc0bWjVPxZ/69HqdGlIAiO6mC0pyGmvzF8Mf+IALPrD1Wo6D uDDceB1fMid7YkFj1bL4YifB9EUpsHUNeuL+gfehzwuun8pilMyoxBs3JvZ7nVYic0el ULYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=qcMrfYK8ze+6r6cIMZlWTAkkgr/vzIrXaY04oZOd0DA=; b=fkzEC9w5/uxdq19TRuhU/M2sHMQ784yBltiH9ebQr2ytg8+mLl6WQcmSyKeXiH+2mD 5udm3aTfOHqKE/xrgThNxrZkd21tFTVELVtsLTDx7thj8IaKgdmLb6bNpIOc39ypDEMt zxecr7Onhnv1Ln47GEbG1KvMrP5k+NhcYANdr2eQTTJYvP885ZV67e80TKOmbUTxo4Y2 8kJjm/T6qC+KU/NnSzpxdoDIzMVW3BVvo2w7T8k5lSQegZWcgsGNZdbgNHTGYK9niDVc AygN0JI9SJDjKwBlMjlFVcxuV5Xyui2xt+jgbTNqlOxJ0K4aq4dsJDFW3XPlfs00bXqF KqDg== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 61si7650652edc.400.2020.11.13.15.37.58; Fri, 13 Nov 2020 15:38:21 -0800 (PST) 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726107AbgKMXea (ORCPT + 99 others); Fri, 13 Nov 2020 18:34:30 -0500 Received: from mga09.intel.com ([134.134.136.24]:44689 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbgKMXea (ORCPT ); Fri, 13 Nov 2020 18:34:30 -0500 IronPort-SDR: 1//bveH8+fBGIX8kKf2nRGUGjIG4EXreFCfFBuyEgslsTwQ+vYFf3/WxvVUAR5unLYr1wWQWsD vEVAlHWl2+Jw== X-IronPort-AV: E=McAfee;i="6000,8403,9804"; a="170716667" X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="170716667" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2020 15:34:24 -0800 IronPort-SDR: fa3kPOnzQAgpAoEortaPsAhrXIvRuAfgH62hMjKJpNE/meWsHqhaxcRRkRL4uywqoW3g85k0Tu RnIM5iw4nJJw== X-IronPort-AV: E=Sophos;i="5.77,476,1596524400"; d="scan'208";a="542842902" Received: from tassilo.jf.intel.com ([10.54.74.11]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2020 15:34:17 -0800 Date: Fri, 13 Nov 2020 15:34:15 -0800 From: Andi Kleen To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Jin Yao , John Garry , Paul Clarke , kajoljain , Stephane Eranian , Sandeep Dasgupta , linux-perf-users@vger.kernel.org Subject: Re: [PATCH 5/5] perf metric: Don't compute unused events. Message-ID: <20201113233415.GJ894261@tassilo.jf.intel.com> References: <20201113001651.544348-1-irogers@google.com> <20201113001651.544348-6-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113001651.544348-6-irogers@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch does a lot of stuff and is hard to review. The earlier patches all look good to me. > > static int > __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr, > - int start, int runtime) > + bool compute_ids, int runtime) > { > struct expr_scanner_ctx scanner_ctx = { > - .start_token = start, Okay so why do we not need that anymore? This should probably be a separate change. I'm not sure about the NaN handling. Why can't you use some other value (perhaps 0 with some special case for division) After all the computed values of the dead branch shouldn't be used anyways, so I don't think we need the extra NaN ceremony everywhere. The only thing that really matters is to track that the event is not added and not resolved. I think it would be a lot simpler if we changed the IF syntax. The problem right now is that the condition is after the first expression, so you can't use global state with an early reduction to track if the if branch is dead or not. If we used the C style cond ? a : b it could be cond { set flag } '?' expr { reset flag } : expr { reset flag } scanner checks flag and ignores the event if false This would need changing the JSON files but that should be easy enough with a script. Or maybe at some point need to bite the bullet and build an AST, but for now we probably can get away of not doing it. -Andi