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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YE/n85ULSpgh6DRf@krava>
Date:   Tue, 16 Mar 2021 00:05:42 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Jin Yao <yao.jin@...ux.intel.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v2 10/27] perf parse-events: Create two hybrid cache
 events

On Thu, Mar 11, 2021 at 03:07:25PM +0800, Jin Yao wrote:

SNIP

> +						config_terms, pmu);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return 0;
> +}
> +
>  int parse_events_add_cache(struct list_head *list, int *idx,
>  			   char *type, char *op_result1, char *op_result2,
>  			   struct parse_events_error *err,
> @@ -474,7 +516,8 @@ int parse_events_add_cache(struct list_head *list, int *idx,
>  	char name[MAX_NAME_LEN], *config_name;
>  	int cache_type = -1, cache_op = -1, cache_result = -1;
>  	char *op_result[2] = { op_result1, op_result2 };
> -	int i, n;
> +	int i, n, ret;
> +	bool hybrid;
>  
>  	/*
>  	 * No fallback - if we cannot get a clear cache type
> @@ -534,6 +577,15 @@ int parse_events_add_cache(struct list_head *list, int *idx,
>  		if (get_config_terms(head_config, &config_terms))
>  			return -ENOMEM;
>  	}
> +
> +	if (!perf_pmu__hybrid_exist())
> +		perf_pmu__scan(NULL);

actualy how about construct like:

	perf_pmu_is_hybrid()
		return hybrid_add_event_cache(...)

	return add_event(...)


with:
	perf_pmu_is_hybrid()
	{
		static bool initialized;

		if (!initialized) {
			initialized = true;
			perf_pmu__scan(NULL)
		}

		return ...
	}

jirka

> +
> +	ret = add_hybrid_cache(list, idx, &attr, config_name ? : name,
> +			       &config_terms, &hybrid);
> +	if (hybrid)
> +		return ret;
> +
>  	return add_event(list, idx, &attr, config_name ? : name, &config_terms);
>  }
>  
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ