From patchwork Wed Aug 29 12:17:12 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: 10580177 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 92090175A for ; Wed, 29 Aug 2018 12:39:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 826192AFF6 for ; Wed, 29 Aug 2018 12:39:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 764BE2AFF8; Wed, 29 Aug 2018 12:39:19 +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 112212AFF7 for ; Wed, 29 Aug 2018 12:39:19 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 73155D63; Wed, 29 Aug 2018 12:36:42 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1D4BCCE9 for ; Wed, 29 Aug 2018 12:36:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx06.melco.co.jp (mx06.melco.co.jp [192.218.140.146]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D777C709 for ; Wed, 29 Aug 2018 12:36:37 +0000 (UTC) Received: from mr06.melco.co.jp (mr06 [133.141.98.164]) by mx06.melco.co.jp (Postfix) with ESMTP id 41F413A3280 for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mr06.melco.co.jp (unknown [127.0.0.1]) by mr06.imss (Postfix) with ESMTP id 420l5G1TNSzRk5W for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mf03_second.melco.co.jp (unknown [192.168.20.183]) by mr06.melco.co.jp (Postfix) with ESMTP id 420l5G170WzRkFm for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from mf03.melco.co.jp (unknown [133.141.98.183]) by mf03_second.melco.co.jp (Postfix) with ESMTP id 420l5G100yzRk8v for ; Wed, 29 Aug 2018 21:18:10 +0900 (JST) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (unknown [23.103.139.149]) by mf03.melco.co.jp (Postfix) with ESMTP id 420l5G0hFfzRk38 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=7ukX7wao0ITc3aHRHtfrwf8gct40Nq6c+d1QMOTXRcw=; b=pM1xxFHFQXWSXi8kxd6bhL5n+iPYz4vqyCVTXBgEkGs1SQn/RuAIZ3nXixEQymcrh2afwVj0lW3Se6tmRnK0mXjEuI8Yo399eH3Pr755jkpFNfHWu7z7jaltT7fC2UzCbkbIH2B//tNmWNW2ALW8IHuIwfVh5r/9QxFtCVVve60= 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 50/54] tracing: Add field parsing hist error for hist triggers Thread-Index: AdQ/jSkmUINm2vDJTdKd7GQyCODICw== Date: Wed, 29 Aug 2018 12:17:12 +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:9by4Gt21PkNzZCWq8wAdWakk+i4LCLYlMmVx4csX7m8K8BZ9XbrFTmZEMWooxJ8rMrqXzEWscR3f0Rl3ybKZUL9TCBs4agVrtqT7ECeSnZG0sJ2e25rjXtyJuiYxd+6GIxkmEjequQwvmvjuQX2WX4bOxFhwr6qSWovhj26Cjr+UUmBrwBkktDlvZUGjK8NMdR/wudnJcAtmXRkkx8Qgcn7tEaLLwVtDOX1Q/i9SKyTnlinbHHRDTquv6K8z8aw8B6m1atSzxfCT2/D0zoFRMkvlObrAlo1I/o0xX9KM5tiCMjELKapug7C7Hf3WafmuUFmvOgSACc/FOkX01Gfo74eVO7ADIc+XgX8KH9sPDg00lgROWxIWxk+sriTonjJfZQca0NWjyZZQ2fmPW46kKFGKYzOTISKraJUvA6Lyv1t6vh0F1BoaQEaJxy2kWaXaUSXdQT4iY4MdjDBFmLpSWQ==; 5:WqNtawV7Gza1crzkLRnxj3/034TPZSUTDVsrtbPEXdRL3t84aKsjE0KLqGF2SoMvyMCbFosM2nQHeOJ5+/W47mIE2aWA/9d3MsnCW2UPc9WYO2nqX3IgjtU98A4VFzYmSZXC0yZsm2USMS6Xzuq8YM/eoTyorS5dkKiCaGElvEU=; 7:U425TOYBvoQpAOBBPoSStBII3iNXNn+aNBeeFQXza8fE5R+7mE5IZ33dzbRunpIRxERKouO2NCRNc7VopHt8xnfUUipxxhbO2vlJ8gidzpT6dZkl/VXL4Bc7iQZCuTvWRRXL0owBHWbrKhsM3S2tOKF8fSuLip/cc1Hoq7fbKP5Gq7drdXSCXRGTEp6jnJCltB592NibhSHO2MoqYqg8JhzQ2P+wzw+7Mr+nbtKtYMwXAmecTtKoR4vhxbpIui6w x-ms-office365-filtering-correlation-id: af7ad24d-5b8e-4edb-c29f-08d60da97bbc 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)(575784001)(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: DDqIf3IHzlk2HJ7/fi9eh3kDg/SeCLT87o12aw2JXNZVlbVIcCZClWAqaa45oBBL8MIR3+PFc9omGqE771FWwMUVA+CxnlQacENgRsP6iYU2uoRx445Z5sKOzT3aniy90JqOCC8k01mmkbTM4z5k33csWbh6CWQDW5GbCvZKNs2CJhxFP9lk0HR0OhpbTn2jBuIsQEurEzHwC2g9jkXrbY3N7rkkq9YqYcAzrREWZ8TxbLywdfLfhK0vtcs2UW4WyRB8gwHtR68S7H8p8L5hv876Hp3tlQ8s1L7G+m6NFiU21hTw3LxQeR0S7ADelhYZrwsi9MC55FGV64eMBmYKE6anp6xhKXff9N46rpi+Fgk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: af7ad24d-5b8e-4edb-c29f-08d60da97bbc X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6507 (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 50/54] tracing: Add field 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 a nonexistent field 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 nonexistent fields are specified. Before: # echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist After: # echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist ERROR: Couldn't find field: pid Last command: keys=pid:ts0=common_timestamp.usecs Link: http://lkml.kernel.org/r/fdc8746969d16906120f162b99dd71c741e0b62c.1524790601.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi Reported-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit 5ec432d7bf9dd3b4a2b84f8974e3adb71f45fb1d) 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 66c87be4..f231fa2a 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2476,16 +2476,17 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file, hist_data->enable_timestamps = true; if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) hist_data->attrs->ts_in_usecs = true; } else if (strcmp(field_name, "cpu") == 0) *flags |= HIST_FIELD_FL_CPU; else { field = trace_find_event_field(file->event_call, field_name); if (!field || !field->size) { + hist_err("Couldn't find field: ", field_name); field = ERR_PTR(-EINVAL); goto out; } } out: kfree(str); return field;