From patchwork Wed Aug 29 12:17:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" X-Patchwork-Id: 10580185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C71B174A for ; Wed, 29 Aug 2018 12:39:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C2572AFFD for ; Wed, 29 Aug 2018 12:39:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8045F2B004; Wed, 29 Aug 2018 12:39:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 757802AFFD for ; Wed, 29 Aug 2018 12:39:57 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D4B77D35; Wed, 29 Aug 2018 12:36:43 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp2.linuxfoundation.org (smtp2.linux-foundation.org [172.17.192.36]) by mail.linuxfoundation.org (Postfix) with ESMTPS id DA30CD15 for ; Wed, 29 Aug 2018 12:36:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx05.melco.co.jp (mx05.melco.co.jp [192.218.140.145]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 15A851DD11 for ; Wed, 29 Aug 2018 12:36:39 +0000 (UTC) Received: from mr05.melco.co.jp (mr05 [133.141.98.165]) by mx05.melco.co.jp (Postfix) with ESMTP id 93AC73A325F for ; Wed, 29 Aug 2018 21:18:03 +0900 (JST) Received: from mr05.melco.co.jp (unknown [127.0.0.1]) by mr05.imss (Postfix) with ESMTP id 420l5749WMzRkCl for ; Wed, 29 Aug 2018 21:18:03 +0900 (JST) Received: from mf03_second.melco.co.jp (unknown [192.168.20.183]) by mr05.melco.co.jp (Postfix) with ESMTP id 420l573sslzRkC3 for ; Wed, 29 Aug 2018 21:18:03 +0900 (JST) Received: from mf03.melco.co.jp (unknown [133.141.98.183]) by mf03_second.melco.co.jp (Postfix) with ESMTP id 420l573QgtzRk8v for ; Wed, 29 Aug 2018 21:18:03 +0900 (JST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (unknown [23.103.139.175]) by mf03.melco.co.jp (Postfix) with ESMTP id 420l573DCszRk38 for ; Wed, 29 Aug 2018 21:18:03 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitsubishielectricgroup.onmicrosoft.com; s=selector1-mitsubishielectricgroup-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1/QDos06QSawxtIIJ6VgbYumAcCzAvT6UJ3Trmaxr+k=; b=fjFcB/pAOAIfxfQvtIEIh5IAXzeV+EJybmWWaE9F5gKUfyCnbT2kLJnWl34r38rdGVBH7x2K/5Hgb4fHOmDC82hMvulTfAnax6jOwClHlCvLfW3dNJ9MGAKRohp03AmrnLKgGfj4lvnW6D/ec27PgScxwTdEMvLV/JcvXmObFOw= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB0762.jpnprd01.prod.outlook.com (10.167.158.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Wed, 29 Aug 2018 12:18:02 +0000 Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa]) by TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa%2]) with mapi id 15.20.1080.015; Wed, 29 Aug 2018 12:18:02 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 34/54] tracing: Allow whitespace to surround hist trigger filter Thread-Index: AdQ/jIbMZ+8jTNyJQju4GorjAelKtg== Date: Wed, 29 Aug 2018 12:17:10 +0000 Deferred-Delivery: Wed, 29 Aug 2018 12:15:00 +0000 Message-ID: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-melpop: 1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Motai.Hirotaka@aj.MitsubishiElectric.co.jp; x-originating-ip: [153.231.200.201] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TY1PR01MB0762; 6:8qvpXJUJ+6ubZzbnWEFBq9f7T6ovt3QVagpZ83rNgmWHqm5YxPz08kaioh1LRD87Osvb7m4yzq6kdfQ86LqYbi2orL6g1DhPiWq1dnZmn+WkAFxKtFzVWKj/ONZJL3OeiUtf0dg1fbLL3kAM5Vn2Gj/59z+wAebsDaSfTxOKOzPb3VaOq/G7zvmKXfbr0gAY5GEbqDQd0AjF6mLEDD+34Tzin4PloCnCfxI5GP2SKcLAP/puyH2Tk13//ROVPHh71L0oo+Y+Itw1re/RRhm7Ug6Q++g9AOWYnsAd/KRyDjydmjvoi4fN2KfrJfpKb6x+GsXdcKUPZzRfU05ikK/5ZxOfjgGJAspWtOW2gIr8g75FEltSG1bmUKXN0jiOBFI45aAZa8AQ1gMAD7OtsBlBXGI6P6rdNwyXiSbEds1XRinG1qyURFcM2y0HKIcHA72D5dSl6HymJIqLuRgsqxSz6Q==; 5:lifo9utL49C/he1WEoBPdWzT8KlWhwYFla/GR6ShPiP0DCrE91MboL4EsKMbIqgB/9C0eoPCTYTkTxSvAR4fCuXYRDJf8R7ddUKB5iUm9FZLolxqmGlA/EdDWL24a8eOdlcvPD63DvmT3mqeiwk+WP9DXgRClDJdvzd0sdwiOgQ=; 7:BHIKoeAfrO6yGoTWZTdZ+Kn51xvHNMDyZTJ14ARRhCb4EJXIPSD4D9DZqq7qNu2iwYdLAtWj4rx3RZbQi4MHFQ4bvmydXvMv8Zhl/SZzQiyj1RYyy/+I7ThNX0MT4Bbm7rBeVE6O3vTZwxtIKwtXDJGbyXnd/4cj4SxkRX2qDs8hZUzXBYPfFYuFd1ID4w08PStJbEO58hsWvJ6PrmFhXibSaQ4uRbOv2i34DDxjLOsxzUiX/5kDIKGwHP4yRQ1N x-ms-office365-filtering-correlation-id: 39bb33f4-45a1-49f7-f76d-08d60da977bb x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB0762; x-ms-traffictypediagnostic: TY1PR01MB0762: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(42068640409301)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699016); SRVR:TY1PR01MB0762; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB0762; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(346002)(376002)(136003)(366004)(199004)(189003)(7696005)(186003)(72206003)(6116002)(478600001)(3846002)(1857600001)(256004)(74482002)(5250100002)(5660300001)(966005)(2501003)(99286004)(2900100001)(8936002)(53936002)(68736007)(33656002)(9686003)(2906002)(97736004)(6306002)(26005)(476003)(7736002)(305945005)(74316002)(6666003)(316002)(14454004)(486006)(55016002)(81166006)(5640700003)(66066001)(8676002)(86362001)(6436002)(2351001)(6506007)(106356001)(25786009)(6916009)(105586002)(102836004)(575784001)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB0762; H:TY1PR01MB1692.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: aj.MitsubishiElectric.co.jp does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9Lv+C654X+WS4bxj//4OJQKnkicj+AWpRWmh/UWvyAd/eTia+1VQhMjrPA0lyL/dv77MZakXFxWt4dVrJuTiLHd9AZz/gaKIz/pcs7+G6ymUFrdHkwqDz7X+jRbiauxK5GFfGJP6MaM0qPx6BeD1dwX3Ipjo7/rgRIcl43gC6qj4V4Lx+GfRzl/gwJqHzgQyD7dPxVAgAyeInID/zS1eoBVnfgvLlaxDClzysDz++ZapnJ7YLbb/FgGE/i8gYS8clm2wc+oGipARQsZuZeRCyxdW0XUYkIfqEsKDemkVfaAEzYqpl+zdcYuPGJN57m0UonO4hzYuGvf5+825na9waUN9rIeBW/DX1MgfKst/jWU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 39bb33f4-45a1-49f7-f76d-08d60da977bb X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6417 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB0762 Subject: [LTSI-dev] [PATCH 34/54] tracing: Allow whitespace to surround hist trigger filter X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP The existing code only allows for one space before and after the 'if' specifying the filter for a hist trigger. Add code to make that more permissive as far as whitespace goes. Specifically, we want to allow spaces in the trigger itself now that we have additional syntax (onmatch/onmax) where spaces are more natural e.g. spaces after commas in param lists. Link: http://lkml.kernel.org/r/1053090c3c308d4f431accdeb59dff4b511d4554.1516069914.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit ec5ce0987541087dbea5af346bdb85eb04b0f0a2) Signed-off-by: Hirotaka MOTAI --- kernel/trace/trace_events_hist.c | 37 +++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 7bcc32a7..7e88daae 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -5157,29 +5157,56 @@ static int event_hist_trigger_func(struct event_command *cmd_ops, unsigned int hist_trigger_bits = TRACING_MAP_BITS_DEFAULT; struct event_trigger_data *trigger_data; struct hist_trigger_attrs *attrs; struct event_trigger_ops *trigger_ops; struct hist_trigger_data *hist_data; struct synth_event *se; const char *se_name; bool remove = false; - char *trigger; + char *trigger, *p; int ret = 0; if (!param) return -EINVAL; if (glob[0] == '!') remove = true; - /* separate the trigger from the filter (k:v [if filter]) */ - trigger = strsep(¶m, " \t"); - if (!trigger) - return -EINVAL; + /* + * separate the trigger from the filter (k:v [if filter]) + * allowing for whitespace in the trigger + */ + p = trigger = param; + do { + p = strstr(p, "if"); + if (!p) + break; + if (p == param) + return -EINVAL; + if (*(p - 1) != ' ' && *(p - 1) != '\t') { + p++; + continue; + } + if (p >= param + strlen(param) - strlen("if") - 1) + return -EINVAL; + if (*(p + strlen("if")) != ' ' && *(p + strlen("if")) != '\t') { + p++; + continue; + } + break; + } while (p); + + if (!p) + param = NULL; + else { + *(p - 1) = '\0'; + param = strstrip(p); + trigger = strstrip(trigger); + } attrs = parse_hist_trigger_attrs(trigger); if (IS_ERR(attrs)) return PTR_ERR(attrs); if (attrs->map_bits) hist_trigger_bits = attrs->map_bits;