Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2502054pxv; Sat, 24 Jul 2021 19:20:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9kOJ6RehRaIdZXBqIm0J2gYV9k//7xmpvQtvUjj74QBf6JmFhZOYZ7YDRB1U/tlDK5EWo X-Received: by 2002:a5e:d91a:: with SMTP id n26mr8373486iop.96.1627179636940; Sat, 24 Jul 2021 19:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627179636; cv=none; d=google.com; s=arc-20160816; b=mFtVrv+slNNUfQUo4TxR6gcImnpLfnSxMT2lOwecIFpb5jAS7hZ594p4UrJBHZgjMf WZoU+ntDotVVTKRgopgIZkuALmj+BjnNgA2jdmpkh+IxFIepvPUtMGeu6X3DMVE4HGQm B75IdhCFyyXObyKhx5zMC7j4Vl/jrArAfCXPj4kHO0JY/qW3xV/idZig05CQ5RMllvAr YjoxYohN6+F6kQwHlhm63WQ6KGLIeWFJVuKFzZv18FNpv69u7zfSANBvklRUareoas4m j47XWg0dUUA26k72alsSawNwQrPhhZyzrsdy63X6gVLtFk8+DjTqXEDgjULvVa+cHCC8 IFkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=zfjLtkm2nuJpcyce2FySt9dJHErswSAM0ESWd3wkoNM=; b=xXd0TJJUu9qM4rRY3CSW9SU5SsYjQgAuvhWPELz/5I8akJjTVXGPTuwwxPbMCFUmxg XhQHqCEvK1s2s0H/XVWIgejZhF5CancB6nmZCk8Li5+Kukt0RRu9FVnbWHGPDKfh77Qc qcEd+iLRpdDjuKTIscuM/WslEQjLg4KjMR4H9WbOocq8LPsDPzw14MPto4QxwDDabKiK 66C1OfhBa50rJVNMTXDoscNqKXkCcDv0F0UHiuNgD399l3owIl5Ti5kKl06XnbMm0hFu yszS3CAr8q2T58TAGuNK8L3pVqka/uycAUE0S+Gvd8cyHn1/+ZwUSnbfR042Qo1P/tuM 90DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q3X00iSc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si40624784jat.46.2021.07.24.19.20.24; Sat, 24 Jul 2021 19:20:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q3X00iSc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbhGYBiC (ORCPT + 99 others); Sat, 24 Jul 2021 21:38:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:52626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbhGYBiB (ORCPT ); Sat, 24 Jul 2021 21:38:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA9D06069E; Sun, 25 Jul 2021 02:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627179512; bh=hIfW1IzXB/tUQDC6Im2ycdKDhMMDxDiPL+5D+VbyHZ8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q3X00iScxuHd6Lyg4xuXM1//SU1pqjwvzbnoiBKqYr/DVAk2koFXpqZxiBmj0UIx1 J6lnxeMIf229iEmG45I5BJ92O0GvCcu7vj74ahksBIP8VVeqMKemu/BkHOIrWzSW6I muZ2F8BFn+CIk+WjqYP1d7ITo4ATM7CmfC7+SvljE7sflqKT/idrY/emvjy9+y24Wa 3jjLT4HaGogN4JdXRDBTLxuAdxO5nS/aT4rM8cYuzbZvC7BY8GeUSpdULmw4XFbh8S AeShIWSdogBPL586KRKTnP5XAKUbbxI0RnX0qagC+c6XNwkFrUxxHx0S52w5fuB+Ds NG+ifcwCjzerw== Date: Sun, 25 Jul 2021 11:18:30 +0900 From: Masami Hiramatsu To: Masami Hiramatsu Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Tom Zanussi , Namhyung Kim Subject: Re: [PATCH v2 2/2] tracing: Allow execnames to be passed as args for synthetic events Message-Id: <20210725111830.2f424ae3978443241b6d4a2d@kernel.org> In-Reply-To: <20210724193145.c63b44aa843e05ed9c0b4fdc@kernel.org> References: <20210722142705.992001628@goodmis.org> <20210722142837.458596338@goodmis.org> <20210723011935.efb25bc4a23ebd567243ed0f@kernel.org> <20210722123234.636d5363@oasis.local.home> <20210723101133.3378369c618c53f2e71d3e4c@kernel.org> <20210722212438.5933e714@rorschach.local.home> <20210724193145.c63b44aa843e05ed9c0b4fdc@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, 24 Jul 2021 19:31:45 +0900 Masami Hiramatsu wrote: > Hi Steve, > > On Thu, 22 Jul 2021 21:24:38 -0400 > Steven Rostedt wrote: > > > On Fri, 23 Jul 2021 10:11:33 +0900 > > Masami Hiramatsu wrote: > > > > > I understand. As far as I can see the code, it looks a bit complicated. > > > To simplify it, I need to understand the spec for "hist_field" > > > for keys and for vars. And maybe need to split both case. > > > > I'll give you a hint that took me a bit to figure out. > > > > 1) The execname is saved at the start of the histogram and not by one > > of the ->fn() functions. > > > > It's saved by hist_trigger_elt_data_init() if the elt_data->comm is > > allocated. That function is part of the "tracing_map_ops" which gets > > assigned by tracing_map_create() (in tracing_map.c) as the "elt_init" > > function, which is called when getting a new elt element by > > get_free_elt(). > > > > 2) That elt_data->comm is only allocated if it finds a "hist_field" > > that has HIST_FIELD_FL_EXECNAME flag set. It currently only looks for > > that flag in the "keys" fields, which means that .execname is useless > > for everything else. This patch changed it to search all hist_fields so > > that it can find that flag if a variable has it set (which I added). > > Thanks for the hints, but actually, that part looks good to me. > > So, what I pointed was the part of update_var_execname(). Below diff > is what I intended. > This moves HIST_FIELD_FL_EXECNAME setup in the create_hist_field() > as same as other flags, and removed the add-hoc update_var_execname() > fixup function. > > I confirmed it passed the ftracetest trigger testcases and your > example code. > > Thank you, > I found a bug in this change. [..] > @@ -1682,6 +1703,16 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, > goto out; > } > > + if ((flags & HIST_FIELD_FL_EXECNAME) && var_name) { > + flags |= HIST_FIELD_FL_STRING | HIST_FIELD_FL_VAR; Here, we don't need to check 'var_name' and remove HIST_FIELD_FL_VAR, since it must be set in the flag. if (flags & HIST_FIELD_FL_EXECNAME) { flags |= HIST_FIELD_FL_STRING; > + hist_field->size = MAX_FILTER_STR_VAL; > + hist_field->is_signed = 0; > + > + hist_field->type = "char[]"; > + hist_field->fn = hist_field_execname; > + goto out; > + } > + Thank you, -- Masami Hiramatsu