From patchwork Wed Aug 29 12:17:13 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: 10580263 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 B4A32175A for ; Wed, 29 Aug 2018 12:44:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A25E228A10 for ; Wed, 29 Aug 2018 12:44:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94DF82AFB5; Wed, 29 Aug 2018 12:44:26 +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 23B9628A10 for ; Wed, 29 Aug 2018 12:44:26 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1A28CDCA; Wed, 29 Aug 2018 12:36:56 +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 6699CD97 for ; Wed, 29 Aug 2018 12:36:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx04.melco.co.jp (mx04.melco.co.jp [192.218.140.144]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 5F48D1DDE8 for ; Wed, 29 Aug 2018 12:36:42 +0000 (UTC) Received: from mr04.melco.co.jp (mr04 [133.141.98.166]) by mx04.melco.co.jp (Postfix) with ESMTP id 7C77B3A32BE for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mr04.melco.co.jp (unknown [127.0.0.1]) by mr04.imss (Postfix) with ESMTP id 420l5G3XtkzRk8j for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mf04_second.melco.co.jp (unknown [192.168.20.184]) by mr04.melco.co.jp (Postfix) with ESMTP id 420l5G3F1mzRjwX for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mf04.melco.co.jp (unknown [133.141.98.184]) by mf04_second.melco.co.jp (Postfix) with ESMTP id 420l5G3CyRzRkCw for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (unknown [23.103.139.150]) by mf04.melco.co.jp (Postfix) with ESMTP id 420l5G2lHnzRkCn for ; Wed, 29 Aug 2018 21:18:10 +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=o4wCmK9/l1xIjdeO80KNSyIDQlh4uU02Woo6k9DXNTA=; b=bivVpFieRpwZnCJGb8WDP0tRMf7+0ZteR9o96ecLMcq8Cv6Eu1ZvklI5OhKiUKsaX0YYLZP2NqRPOasgiNYxamo+97/h/j4+7AAXsipk6HkK/nEDTgAyf1JamLPxZGgZNuj9NTCiP/N+BgRv4vCCHkZyQIqeeNgRkCdAu7fUyLE= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB1456.jpnprd01.prod.outlook.com (10.174.228.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 29 Aug 2018 12:18:09 +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:09 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 51/54] tracing: Add field modifier parsing hist error for hist triggers Thread-Index: AdQ/jTKs2IQNQA54TByv0FKYqR8vsg== Date: Wed, 29 Aug 2018 12:17:13 +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; TY1PR01MB1456; 6:LhPVcE1QB+rUUfiJKCVvDbcXGkOv8/zbEIIBoyKUpPevO6pnkGC331Vs/Y39n0JrnRa46G17eo3HPEhdWR639xAcMiBLDHKtYqZTerVXSGxdrYgiebua0GFni9b/VOljaI18bWoJjXYndQdbJQLuzfKft9wrH2icb9BVbTdWMVTwU2RV8ktacAQwR79fi4sjiFfCfCyGW+Vw0JNwajJZYAHt0DvVOXtflN8rxNTPgQZbYSYyDOLOukppwQHGJ8viWOrb4S/GhuoXdswOMOmSyeQ6zdeYpGTZ42PMVdEElyIodnE1364oZr1uVJLHenL0UAUtD9oYLQy20Drrb7qylRjpxiCBHsHOuVsKHVQ3uyKeVs1ZRET6LZlxfCmxopR1VxyBpBA5THZf5OnKknnmDDHzK7soJDuCR1l2/3mmWBL2JqlpxcobFYfaraedQVna1/fS3Ix/uJeWsawX57zbIg==; 5:vZQ3xCTOcp76AHXalJHMPNCXknHcIhe89SLupoXQjB+bhW3UxLmA9PGuv5rW9eVWRzqb/slAKVe+RbnFJeq7GIyljb1PHO02WLOBHX5lAROLiaQq4oScqXMPJ6ADGNuCkbv2UGO2+92UxaieOxgRVVbbWefmSHgfWVb4t8kKWZk=; 7:bhzVphRR5NNoBqXf4xp1ZSYCr12L7hOazQtQXirAv3sPOhRvFG0uSBR6d1KHiOSgbCylB96c/H376uKOs2PqucqwnRylxa0XT2anhLfWYiLN8ogldPTH5Wcy8QkW3dDiN0EzZMg4av5/RcwawMryE4OKKS+23JD5woV7rowokuWq2yCdjoq6V5YQxlWloVwej2Mpq8e8imhZ20yDGDYfYQ8lLW6bOwMj44/B4G3JvG06/8Ua4QFvkNNis3ZsLZbH x-ms-office365-filtering-correlation-id: 6d470c9b-abec-45ad-e1cf-08d60da97bdf x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB1456; x-ms-traffictypediagnostic: TY1PR01MB1456: 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)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699016); SRVR:TY1PR01MB1456; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB1456; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(366004)(136003)(346002)(376002)(39860400002)(199004)(189003)(26005)(6116002)(3846002)(6506007)(6666003)(5660300001)(6916009)(74316002)(99286004)(486006)(8676002)(476003)(106356001)(1857600001)(2351001)(105586002)(33656002)(68736007)(81166006)(7696005)(2900100001)(9686003)(186003)(81156014)(97736004)(102836004)(66066001)(7736002)(5640700003)(6436002)(55016002)(6306002)(53936002)(2501003)(478600001)(5250100002)(966005)(14454004)(72206003)(25786009)(316002)(86362001)(2906002)(8936002)(305945005)(74482002)(256004); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB1456; 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: 6/gbjDj3OLt/l9eW+3GuJHHnU1EbTLPj9SXAEXSI4+8Kc8UtwcIcitAwlRFyPHCl1NEIMnOF1Gmz9QK6hJkG7V1jdnYn/VwsgZ9jPoieHZpIgCsv39rXd+Bxn30lQdWQRG8yyPuecXDgLYzk+5xkIwa6XNAD8VzjyHMizncLNU9Q4dO8X0ePSJtStYo8l8u5Me6grOOMgnEhpbPTMAtdU7VPLumZrdWVKHyyB/bSTQnxryel5CiZPtX5olfmyR1B0hXs1zh3LiQS1l02HSp44z5Wa2JsvLg6FztHfgTCnatTSwMTp+yawSyKj+NAb4Ag84X+lkqPW+T/YpP4BtGtN9w4IP1brLIvpvFHyuHUlFs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 6d470c9b-abec-45ad-e1cf-08d60da97bdf X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6517 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB1456 Subject: [LTSI-dev] [PATCH 51/54] tracing: Add field modifier parsing hist error for hist triggers 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 If the user specifies an invalid field modifier for a hist trigger, the current code correctly flags that as an error, but doesn't tell the user what happened. Fix this by invoking hist_err() with an appropriate message when invalid modifiers are specified. Before: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist After: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist ERROR: Invalid field modifier: junkusecs Last command: keys=pid:ts0=common_timestamp.junkusecs Link: http://lkml.kernel.org/r/b043c59fa79acd06a5f14a1d44dee9e5a3cd1248.1524790601.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit dcf234577cd31fa16874e828b90659166ad6b80d) Signed-off-by: Hirotaka MOTAI --- kernel/trace/trace_events_hist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index f231fa2a..b9061ed5 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2461,16 +2461,17 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, *flags |= HIST_FIELD_FL_EXECNAME; else if (strcmp(modifier, "syscall") == 0) *flags |= HIST_FIELD_FL_SYSCALL; else if (strcmp(modifier, "log2") == 0) *flags |= HIST_FIELD_FL_LOG2; else if (strcmp(modifier, "usecs") == 0) *flags |= HIST_FIELD_FL_TIMESTAMP_USECS; else { + hist_err("Invalid field modifier: ", modifier); field = ERR_PTR(-EINVAL); goto out; } } if (strcmp(field_name, "common_timestamp") == 0) { *flags |= HIST_FIELD_FL_TIMESTAMP; hist_data->enable_timestamps = true;