lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170907124605.01f0025a@gandalf.local.home>
Date:   Thu, 7 Sep 2017 12:46:05 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Tom Zanussi <tom.zanussi@...ux.intel.com>
Cc:     tglx@...utronix.de, mhiramat@...nel.org, namhyung@...nel.org,
        vedang.patel@...el.com, bigeasy@...utronix.de,
        joel.opensrc@...il.com, joelaf@...gle.com,
        mathieu.desnoyers@...icios.com, baohong.liu@...el.com,
        linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Subject: Re: [PATCH v2 20/40] tracing: Add simple expression support to hist
 triggers

On Tue,  5 Sep 2017 16:57:32 -0500
Tom Zanussi <tom.zanussi@...ux.intel.com> wrote:

>  #define DEFINE_HIST_FIELD_FN(type)					\
>  	static u64 hist_field_##type(struct hist_field *hist_field,	\
>  				     void *event,			\
> @@ -148,6 +192,7 @@ enum hist_field_flags {
>  	HIST_FIELD_FL_TIMESTAMP_USECS	= 2048,
>  	HIST_FIELD_FL_VAR		= 4096,
>  	HIST_FIELD_FL_VAR_ONLY		= 8192,
> +	HIST_FIELD_FL_EXPR		= 16384,

When numbers get this big, I'm a fan of:

	HIST_FIELD_FL_TIMESTAMP_USECS	= (1 << 11),
	HIST_FIELD_FL_VAR		= (1 << 12),
	HIST_FIELD_FL_VAR_ONLY		= (1 << 13),
	HIST_FIELD_FL_EXPR		= (1 << 14),

It makes it much easier to debug with printk()s and also know how many
bits you are actually using.

>  };
>  
>  struct var_defs {
> @@ -218,6 +263,8 @@ static const char *hist_field_name(struct hist_field *field,
>  		field_name = hist_field_name(field->operands[0], ++level);
>  	else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
>  		field_name = "$common_timestamp";
> +	else if (field->flags & HIST_FIELD_FL_EXPR)
> +		field_name = field->name;
>  
>  	if (field_name == NULL)
>  		field_name = "";
> @@ -441,6 +488,115 @@ static void hist_trigger_elt_comm_init(struct tracing_map_elt *elt)
>  	.elt_init	= hist_trigger_elt_comm_init,
>  };
>  
> +static const char *get_hist_field_flags(struct hist_field *hist_field)
> +{
> +	const char *flags_str = NULL;
> +
> +	if (hist_field->flags & HIST_FIELD_FL_HEX)
> +		flags_str = "hex";
> +	else if (hist_field->flags & HIST_FIELD_FL_SYM)
> +		flags_str = "sym";
> +	else if (hist_field->flags & HIST_FIELD_FL_SYM_OFFSET)
> +		flags_str = "sym-offset";
> +	else if (hist_field->flags & HIST_FIELD_FL_EXECNAME)
> +		flags_str = "execname";
> +	else if (hist_field->flags & HIST_FIELD_FL_SYSCALL)
> +		flags_str = "syscall";
> +	else if (hist_field->flags & HIST_FIELD_FL_LOG2)
> +		flags_str = "log2";
> +	else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP_USECS)
> +		flags_str = "usecs";
> +
> +	return flags_str;
> +}

Also, can you make the moving of the code a separate patch before this
patch. It makes git blame and such nicer.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ