Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0AFFC636CC for ; Sun, 19 Feb 2023 09:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2iwo/tptAOLqJiI02zOq3FG608kjPak3XX0NMhP5mlQ=; b=QvwZg1sf4e+1D/JCJgu3vE2ciO aMFP1GZ3vvwMRhaRL5duC+yrwAGHZYtHqXRnGlcOXtRVa/MVpjL2r8kRnA4r5oLAU+z1BRj99v7tB ILXVGVkcW8WNxonI1CcszjD/oRMYyvyYnKOI6ZGZ4mUgC9Uf6PCmG6TV2dBLCvA+fXus5i1l7ssZQ AGT2hwllARCLm7BvKLA/IHMIRBhi3dLJ5RcI7RN//JO4Q8iBGuFHwhaGBt3Udop4sRahxmCQ9VDBb Sln+Trdro6jxMD3F+ksDj/Oha5MV05uP7AskCmnAa+G4SxbtMx8+2o3jFqLSM9x2x7m8RK7Jpekwh RcGJPLiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pTg8m-0017EA-HK; Sun, 19 Feb 2023 09:37:54 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pTg5E-0015cy-Gd for linux-arm-kernel@lists.infradead.org; Sun, 19 Feb 2023 09:34:15 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-53688522d28so18069897b3.12 for ; Sun, 19 Feb 2023 01:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SBnNbiH+hab12DiOKBd4pcQP1xg7aEKLvUH64+SdruU=; b=lMQXrD7/f5Md4Cv/Wu4Z3DRM30d0/Nfh2T/ynQgxAmUmcGDb50w7szQMN0mpyoaGO2 /KdOcvlaYuqHsrNTWXuo8TUwMlOEss4q8f9kTxFsrrK0yzTDOal0zeVsikFKmnYi1xy1 ISw/xdS0uAhog4e1fTOEADlDMT1LTOMPedDe904T1ZO1xypLhlaFsSaeUjrSXaUz6fFk msQHGNFimxoQ+TOS/hoLyrv1/fbNc/ptM/wx+RLmFSGLlTDitFY8whrioOlTCio/r8RJ kf7fNFbYz1FDSf1lcNFUE8BVZf9eCYbnaM+F9qAETfZ5JX+dy6Dc7IZB7eKVK/qH0GCF upeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SBnNbiH+hab12DiOKBd4pcQP1xg7aEKLvUH64+SdruU=; b=VRhivZcswD+Z1X2sMSWdbr1jmrW2UNf8fLnVGHZOXlthp9K+EfL2kCF2lR7YQzvHBj ihZi6ivM8Hq6BKFpilql4bFR5v3aMUzz/PDPgg742h41iJewJOSjuE36OwuTNDAsHBfA iFjOXGby3KvVSdVf1a7QJWbKvTpCuIy90J38IbT6pd3gN2sJd99sV6/Uzow4RzHpheC+ Fl5RhG38O6wXCbUYXGAd5WOzluINRrKsQZOB5VK9DKYp3Q1POW41NUJuHLv595YwygY2 3MBwkESYnRR312OuTW+Ot0nBk4HRfKUWLH9fmO4UBvsrXwFnh8mTH8EJ9TvIWQN71/4+ YVIA== X-Gm-Message-State: AO0yUKVAW9LnaX1KAFY5xk06yiJLH4KPluQ2v2uKa3+z6rtCdcx9duSQ VgmKIhjK+mFylDIPknSpLLQ1lR/BHPpQ X-Google-Smtp-Source: AK7set/W4P4gwQTQ14PucGRNx4H4xnyILVPXxlki8k+imj9Y/kafkRTfhg634nDIsQh4lilI/Yabl8NyXI7+ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:cde9:3fbc:e1f1:6e3b]) (user=irogers job=sendgmr) by 2002:a05:6902:10c6:b0:97a:ebd:a594 with SMTP id w6-20020a05690210c600b0097a0ebda594mr390732ybu.3.1676799250687; Sun, 19 Feb 2023 01:34:10 -0800 (PST) Date: Sun, 19 Feb 2023 01:28:34 -0800 In-Reply-To: <20230219092848.639226-1-irogers@google.com> Message-Id: <20230219092848.639226-38-irogers@google.com> Mime-Version: 1.0 References: <20230219092848.639226-1-irogers@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Subject: [PATCH v1 37/51] perf expr: More explicit NAN handling From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Maxime Coquelin , Alexandre Torgue , Zhengjun Xing , Sandipan Das , James Clark , Kajol Jain , John Garry , Kan Liang , Adrian Hunter , Andrii Nakryiko , Eduard Zingerman , Suzuki Poulouse , Leo Yan , Florian Fischer , Ravi Bangoria , Jing Zhang , Sean Christopherson , Athira Rajeev , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Perry Taylor , Caleb Biggers Cc: Stephane Eranian , Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230219_013412_597191_7078682D X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Comparison and logical operations on NAN won't ensure the result is NAN. Ensure NANs are propogated so that threshold expressions like "tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15" don't yield a number when the components are NAN. Signed-off-by: Ian Rogers --- tools/perf/util/expr.y | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index 635e562350c5..250e444bf032 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -127,7 +127,11 @@ static struct ids handle_id(struct expr_parse_ctx *ctx, char *id, if (!compute_ids || (is_const(LHS.val) && is_const(RHS.val))) { \ assert(LHS.ids == NULL); \ assert(RHS.ids == NULL); \ - RESULT.val = (long)LHS.val OP (long)RHS.val; \ + if (isnan(LHS.val) || isnan(RHS.val)) { \ + RESULT.val = NAN; \ + } else { \ + RESULT.val = (long)LHS.val OP (long)RHS.val; \ + } \ RESULT.ids = NULL; \ } else { \ RESULT = union_expr(LHS, RHS); \ @@ -137,7 +141,11 @@ static struct ids handle_id(struct expr_parse_ctx *ctx, char *id, if (!compute_ids || (is_const(LHS.val) && is_const(RHS.val))) { \ assert(LHS.ids == NULL); \ assert(RHS.ids == NULL); \ - RESULT.val = LHS.val OP RHS.val; \ + if (isnan(LHS.val) || isnan(RHS.val)) { \ + RESULT.val = NAN; \ + } else { \ + RESULT.val = LHS.val OP RHS.val; \ + } \ RESULT.ids = NULL; \ } else { \ RESULT = union_expr(LHS, RHS); \ -- 2.39.2.637.g21b0678d19-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel