From patchwork Wed Aug 29 12:17:06 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: 10580219 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 83EF8174A for ; Wed, 29 Aug 2018 12:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 701F12B005 for ; Wed, 29 Aug 2018 12:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61B642B012; Wed, 29 Aug 2018 12:42:02 +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 E863A2B005 for ; Wed, 29 Aug 2018 12:42:01 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F3734D7E; Wed, 29 Aug 2018 12:36:49 +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 80BA6D21 for ; Wed, 29 Aug 2018 12:36:42 +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 B8C251DD50 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 5DE4C3A2AA7 for ; Wed, 29 Aug 2018 21:17:27 +0900 (JST) Received: from mr05.melco.co.jp (unknown [127.0.0.1]) by mr05.imss (Postfix) with ESMTP id 420l4R2bQjzRkFD for ; Wed, 29 Aug 2018 21:17:27 +0900 (JST) Received: from mf04_second.melco.co.jp (unknown [192.168.20.184]) by mr05.melco.co.jp (Postfix) with ESMTP id 420l4R2HcfzRkC3 for ; Wed, 29 Aug 2018 21:17:27 +0900 (JST) Received: from mf04.melco.co.jp (unknown [133.141.98.184]) by mf04_second.melco.co.jp (Postfix) with ESMTP id 420l4R2JktzRkCw for ; Wed, 29 Aug 2018 21:17:27 +0900 (JST) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (unknown [23.103.139.151]) by mf04.melco.co.jp (Postfix) with ESMTP id 420l4R1tBXzRkCn for ; Wed, 29 Aug 2018 21:17:27 +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=jsHQXUHhe6cjqnzZktn6vmWBZvGy2C7FylG7RX101Zg=; b=Yqus80q2HrQ40Du3Xy+EF8MPMw/d7dlomLyxLGoax4sQHnJtetFMakNgANODuHgUl5jbJWv0X778+2wg2XrF7+U7ujyxsIkCh4zBdDO7HIUvI/i2Q/TTfvNeYA8EgNTZwoZ/UzXzPizhhMK68gQiW+n/NTKxLmmruZFRYfkRfZo= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB1708.jpnprd01.prod.outlook.com (52.133.160.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:17:26 +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:17:26 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 15/54] tracing: Add hist_data member to hist_field Thread-Index: AdQ/iwSPSAjeG+gRR5uK6GkNYRLumw== Date: Wed, 29 Aug 2018 12:17:06 +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; TY1PR01MB1708; 6:p0syhzmRsuzRfZaSChw6D73BZ67UixkZclS38imAONQGXNVWvIasY2Me4LAR4wxnb4uxcv/iQWfbWv2QSA54a48wcBhTKL6Wuji2zc2NCeIFqxLWNuBw6HjzyqTZDibxKrA0xSXgIYq72bMUEGOKVUOQReIx9BVhLOqOoj6HT792hgynfMVDwFjfQ5zgjxNT++MnCAcSPHNt2hqnHzbYPJTdes29txTLbqMxTp7JwL4FD8lIqhRbDay0/FxSKsSjY9pVF1MN4zK8viG9Rth1iNVUJItic9hRZrJic6mKejOR5Q637hVBQXFBUezix5R4YCBTy/PgAJ3rgqNnWQyaEs/zS53nePIuHehzf1txqTTTWmew5nUdflhhJOQrAiQJcT4AxECh3SML3R4+vlWbvF2SXY/r08vz23CVWT3M8x8uZgogQNiJErnJw2prJ/+T7okaMCe4Y7mkuVBFV3wsEA==; 5:UtFyJ62yGhkYTsLgRvL6sebemuTS3izSdObcjgsA3BTRiTdMgnQFsmNiBCCdGueynWxoxu3Vj6/TZ5d6q6BHsxz9gNQYhmUkE8TjBR3OuLLEv/xkJkP3wwabN0fRemQGuBxZzPZ8vTCb9jCA6GbDub5GjRGToLBNzzu45LUJZQU=; 7:eL/0MUB8BuPeO4A6TiwX3IsuKQHJLYteMMlSigRchPdSCGuZjpSbRxp02l/g0c8eqczRIoaSxX/jGU7bht/NtK2dG5qMxyDBJguRlE1+MV7KA2QV3bHRGTW7Y3BIlpBUec9DDedoRy/LFZa1FjYeocrCicS7yVH6i5XfA0HPwxXeTJZ0PffGBOL7cv8C5UxKz9H1DGVa3Rc62A3GsgsFe5mcCbUBvV4Ez7dE1ZY26hzWucpr9h/V4tw/5uclfyg7 x-ms-office365-filtering-correlation-id: a38e79d9-7056-44b2-f6f2-08d60da96226 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB1708; x-ms-traffictypediagnostic: TY1PR01MB1708: 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)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699016); SRVR:TY1PR01MB1708; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB1708; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(396003)(39860400002)(346002)(376002)(189003)(199004)(966005)(25786009)(74482002)(81156014)(8676002)(106356001)(5660300001)(105586002)(6506007)(14454004)(81166006)(33656002)(26005)(7736002)(74316002)(186003)(72206003)(305945005)(66066001)(68736007)(97736004)(478600001)(476003)(102836004)(2906002)(8936002)(6666003)(6916009)(486006)(6116002)(1857600001)(316002)(7696005)(2900100001)(5640700003)(3846002)(55016002)(99286004)(53936002)(14444005)(86362001)(256004)(6436002)(6306002)(2501003)(5250100002)(9686003)(575784001)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB1708; H:TY1PR01MB1692.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:0; received-spf: None (protection.outlook.com: aj.MitsubishiElectric.co.jp does not designate permitted sender hosts) x-microsoft-antispam-message-info: Np4dgKcmMnPpO7DnauXVnnrSJMKstojPUlvLtIxVMj2nieQ4TbZfsFYZYYzCA6MKz7LPxDavns5N2LGLdDfduyZKymH+6RA3+ntR0r9WeHK+elsjG6j6mAirO2nSeQv8CRt6/P4ks0fc2tW2hBQMPOGLETgG4bSykkrMdmoMdrBqhgw4PzvNjQ/eFpy8NQeoM4s+uY/pJJT41CeMUvXpyja6Ahw4N19rfa/7Kz5R/trdQgyOHm3hiAioWgNwUq1dERXn0qyVVJ6t3cY0YUBfCIdGqrNaN6HGmKKz8YGK4sEm+/vXwqqpCukI1J5L18eSfnNF0znFFiuQ7bCVDCyJl3opu+49AytZD63tcUZOVNs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: a38e79d9-7056-44b2-f6f2-08d60da96226 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6317 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB1708 Subject: [LTSI-dev] [PATCH 15/54] tracing: Add hist_data member to hist_field 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 Allow hist_data access via hist_field. Some users of hist_fields require or will require more access to the associated hist_data. Link: http://lkml.kernel.org/r/d04cd0768f5228ebb4ac0ba4a847bc4d14d4826f.1516069914.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit b559d003a226911979ceb8469db4c9b621c3bc09) Signed-off-by: Hirotaka MOTAI --- kernel/trace/trace_events_hist.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index a793f8c0..77ebe6b4 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -34,16 +34,17 @@ typedef u64 (*hist_field_fn_t) (struct hist_field *field, void *event, struct hist_field { struct ftrace_event_field *field; unsigned long flags; hist_field_fn_t fn; unsigned int size; unsigned int offset; unsigned int is_signed; struct hist_field *operands[HIST_FIELD_OPERANDS_MAX]; + struct hist_trigger_data *hist_data; }; static u64 hist_field_none(struct hist_field *field, void *event, struct ring_buffer_event *rbe) { return 0; } @@ -415,42 +416,45 @@ static void destroy_hist_field(struct hist_field *hist_field, return; for (i = 0; i < HIST_FIELD_OPERANDS_MAX; i++) destroy_hist_field(hist_field->operands[i], level + 1); kfree(hist_field); } -static struct hist_field *create_hist_field(struct ftrace_event_field *field, +static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, + struct ftrace_event_field *field, unsigned long flags) { struct hist_field *hist_field; if (field && is_function_field(field)) return NULL; hist_field = kzalloc(sizeof(struct hist_field), GFP_KERNEL); if (!hist_field) return NULL; + hist_field->hist_data = hist_data; + if (flags & HIST_FIELD_FL_HITCOUNT) { hist_field->fn = hist_field_counter; goto out; } if (flags & HIST_FIELD_FL_STACKTRACE) { hist_field->fn = hist_field_none; goto out; } if (flags & HIST_FIELD_FL_LOG2) { unsigned long fl = flags & ~HIST_FIELD_FL_LOG2; hist_field->fn = hist_field_log2; - hist_field->operands[0] = create_hist_field(field, fl); + hist_field->operands[0] = create_hist_field(hist_data, field, fl); hist_field->size = hist_field->operands[0]->size; goto out; } if (flags & HIST_FIELD_FL_TIMESTAMP) { hist_field->fn = hist_field_timestamp; hist_field->size = sizeof(u64); goto out; @@ -493,17 +497,17 @@ static void destroy_hist_fields(struct hist_trigger_data *hist_data) hist_data->fields[i] = NULL; } } } static int create_hitcount_val(struct hist_trigger_data *hist_data) { hist_data->fields[HITCOUNT_IDX] = - create_hist_field(NULL, HIST_FIELD_FL_HITCOUNT); + create_hist_field(hist_data, NULL, HIST_FIELD_FL_HITCOUNT); if (!hist_data->fields[HITCOUNT_IDX]) return -ENOMEM; hist_data->n_vals++; if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX)) return -EINVAL; @@ -539,17 +543,17 @@ static int create_val_field(struct hist_trigger_data *hist_data, } else { field = trace_find_event_field(file->event_call, field_name); if (!field || !field->size) { ret = -EINVAL; goto out; } } - hist_data->fields[val_idx] = create_hist_field(field, flags); + hist_data->fields[val_idx] = create_hist_field(hist_data, field, flags); if (!hist_data->fields[val_idx]) { ret = -ENOMEM; goto out; } ++hist_data->n_vals; if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX)) @@ -649,17 +653,17 @@ static int create_key_field(struct hist_trigger_data *hist_data, if (is_string_field(field)) key_size = MAX_FILTER_STR_VAL; else key_size = field->size; } } - hist_data->fields[key_idx] = create_hist_field(field, flags); + hist_data->fields[key_idx] = create_hist_field(hist_data, field, flags); if (!hist_data->fields[key_idx]) { ret = -ENOMEM; goto out; } key_size = ALIGN(key_size, sizeof(u64)); hist_data->fields[key_idx]->size = key_size; hist_data->fields[key_idx]->offset = key_offset;