Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp648867ybz; Wed, 22 Apr 2020 05:28:03 -0700 (PDT) X-Google-Smtp-Source: APiQypIdNlFAwU/ku9er+a97xSFlnc2xcnc8ibtS1NGEbKxoDsLm6bkDTTwRf7dKK8YRSnH3el8l X-Received: by 2002:a17:906:bb07:: with SMTP id jz7mr15749197ejb.317.1587558482954; Wed, 22 Apr 2020 05:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587558482; cv=none; d=google.com; s=arc-20160816; b=XrUb25418ccc3ceQHBq0wCraFBvvaGKk5RakQqU8IhKnc4q25SZlAiaJwa4pvVzRGw RwnD0AfyK24TTVe9KndnwHbhjapONxXYBga/LuteuksbsqmWTcOpCBiR0RT3E6ky28ZR oItwybvCV6j/ZDbgNZegZobnBwi2FLYhNCmPCWJi63TwoJQ1ZptQSMV+jvXRl3cN+90T GAGYIZ7HSjk1DfgwViYb8ybDJY7B41PSSUfW/THmJtKCCFFyXukV/3hoxdtmeStN5bvO tQp9ENcRoDt/QkikoNeZD8e99boFvK8aF0hdSKisaQLB8yJaYpcJR4s0Y7BkbFjl6Imf A6Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=X515GPmaEYYMaiVErI/rIw4H1RAtOpAprW4ANRn2/XU=; b=oy72kh7mETaLYjqaNXHS9PSL/kPSwal3CDshnDJjsp6IEchc5RduVLo1Qvvem4bbba 1oYfq2Qz0oLd7adbhCCIV7fZZAcox/oeRMLOmtOKqYF1DXaTbNiNexPuTr8dpn3lhgGN SDiM6jrWdKP79O3KZIZIKLDoxmDcSGhVu4HLAvEdX2z68bC2J9C2WxZozitB2sV+Jjmu hNpsQM3dfdvpo1Nfr2qD3Pk0OR9gByxeyPddx4lwG/WQ/NebDiDvvu2UCqDtNrV92wwa Mks/2xb2dNB/FhPfBZHw5TeAVQzeJwVb2ylS/HOnftYZiRwuIBVoKXiOC4vlpreR3o/w d6HA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q28si394051edb.518.2020.04.22.05.27.40; Wed, 22 Apr 2020 05:28:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbgDVMUY (ORCPT + 99 others); Wed, 22 Apr 2020 08:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728800AbgDVMRq (ORCPT ); Wed, 22 Apr 2020 08:17:46 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51AF2C03C1A8; Wed, 22 Apr 2020 05:17:46 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jREJp-0007tb-DZ; Wed, 22 Apr 2020 14:17:33 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id E355D1C0813; Wed, 22 Apr 2020 14:17:28 +0200 (CEST) Date: Wed, 22 Apr 2020 12:17:28 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf expr: Add expr_scanner_ctx object Cc: Jiri Olsa , Alexander Shishkin , Andi Kleen , Anju T Sudhakar , Benjamin Herrenschmidt , "Greg Kroah-Hartman" , Jin Yao , Joe Mario , Kajol Jain , Kan Liang , Madhavan Srinivasan , Mamatha Inamdar , Mark Rutland , Michael Ellerman , Michael Petlan , Namhyung Kim , Paul Mackerras , Peter Zijlstra , Ravi Bangoria , Sukadev Bhattiprolu , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200401203340.31402-3-kjain@linux.ibm.com> References: <20200401203340.31402-3-kjain@linux.ibm.com> MIME-Version: 1.0 Message-ID: <158755784848.28353.17588548435578970529.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 871f9f599db8d9d2387c0717e712af405290edea Gitweb: https://git.kernel.org/tip/871f9f599db8d9d2387c0717e712af405290edea Author: Jiri Olsa AuthorDate: Thu, 02 Apr 2020 02:03:35 +05:30 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 16 Apr 2020 12:19:13 -03:00 perf expr: Add expr_scanner_ctx object Add the expr_scanner_ctx object to hold user data for the expr scanner. Currently it holds only start_token, Kajol Jain will use it to hold 24x7 runtime param. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Anju T Sudhakar Cc: Benjamin Herrenschmidt Cc: Greg Kroah-Hartman Cc: Jin Yao Cc: Joe Mario Cc: Kajol Jain Cc: Kan Liang Cc: Madhavan Srinivasan Cc: Mamatha Inamdar Cc: Mark Rutland Cc: Michael Ellerman Cc: Michael Petlan Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Sukadev Bhattiprolu Cc: Thomas Gleixner Cc: linuxppc-dev@lists.ozlabs.org Link: http://lore.kernel.org/lkml/20200401203340.31402-3-kjain@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/expr.c | 6 ++++-- tools/perf/util/expr.h | 4 ++++ tools/perf/util/expr.l | 10 +++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index c8ccc54..c3382d5 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -3,7 +3,6 @@ #include #include "expr.h" #include "expr-bison.h" -#define YY_EXTRA_TYPE int #include "expr-flex.h" #ifdef PARSER_DEBUG @@ -30,11 +29,14 @@ static int __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr, int start) { + struct expr_scanner_ctx scanner_ctx = { + .start_token = start, + }; YY_BUFFER_STATE buffer; void *scanner; int ret; - ret = expr_lex_init_extra(start, &scanner); + ret = expr_lex_init_extra(&scanner_ctx, &scanner); if (ret) return ret; diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h index b9e53f2..0938ad1 100644 --- a/tools/perf/util/expr.h +++ b/tools/perf/util/expr.h @@ -15,6 +15,10 @@ struct expr_parse_ctx { struct expr_parse_id ids[MAX_PARSE_ID]; }; +struct expr_scanner_ctx { + int start_token; +}; + void expr__ctx_init(struct expr_parse_ctx *ctx); void expr__add_id(struct expr_parse_ctx *ctx, const char *id, double val); int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr); diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l index eaad292..2582c24 100644 --- a/tools/perf/util/expr.l +++ b/tools/perf/util/expr.l @@ -76,13 +76,13 @@ sym [0-9a-zA-Z_\.:@]+ symbol {spec}*{sym}*{spec}*{sym}* %% - { - int start_token; + struct expr_scanner_ctx *sctx = expr_get_extra(yyscanner); - start_token = expr_get_extra(yyscanner); + { + int start_token = sctx->start_token; - if (start_token) { - expr_set_extra(NULL, yyscanner); + if (sctx->start_token) { + sctx->start_token = 0; return start_token; } }