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: <25f7b261-3f2a-942d-8d3f-d501d9dc9612@amd.com>
Date:   Wed, 1 Dec 2021 09:30:14 -0600
From:   Kim Phillips <kim.phillips@....com>
To:     Stephane Eranian <eranian@...gle.com>, linux-kernel@...r.kernel.org
Cc:     peterz@...radead.org, acme@...hat.com, jolsa@...hat.com,
        songliubraving@...com, mpe@...erman.id.au, maddy@...ux.ibm.com
Subject: Re: [PATCH v3 11/13] perf tools: improve IBS error handling

Hi Stephane,

This v3 looks like it's the same as in the v1 of the series,
which got nacked by acme.

Please use the newer patches provided.  Instructions to do
so haven't changed since then.

Thanks,

Kim

On 11/30/21 7:02 PM, Stephane Eranian wrote:
> From: Kim Phillips <kim.phillips@....com>
> 
> This patch improves the error message returned on failed perf_event_open() on
> AMD when using IBS.
> 
> Signed-off-by: Kim Phillips <kim.phillips@....com>
> ---
>   tools/perf/util/evsel.c | 42 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 42 insertions(+)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index ac0127be0459..39e9063c0a80 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2852,12 +2852,52 @@ static bool find_process(const char *name)
>   	return ret ? false : true;
>   }
>   
> +static bool is_amd;
> +
> +static char *fgrep(FILE *inf, const char *str)
> +{
> +	char line[256];
> +	int slen = strlen(str);
> +
> +	while (!feof(inf)) {
> +		if (!fgets(line, 256, inf))
> +			break;
> +		if (strncmp(line, str, slen))
> +			continue;
> +
> +		return strdup(line);
> +	}
> +
> +	return NULL;
> +}
> +
> +static void detect_amd(void)
> +{
> +	FILE *inf = fopen("/proc/cpuinfo", "r");
> +	char *res;
> +
> +	if (!inf)
> +		return;
> +
> +	res = fgrep(inf, "vendor_id");
> +
> +	if (res) {
> +		char *s = strchr(res, ':');
> +
> +		is_amd = s && !strcmp(s, ": AuthenticAMD\n");
> +		free(res);
> +	}
> +	fclose(inf);
> +}
> +
>   int evsel__open_strerror(struct evsel *evsel, struct target *target,
>   			 int err, char *msg, size_t size)
>   {
>   	char sbuf[STRERR_BUFSIZE];
>   	int printed = 0, enforced = 0;
>   
> +	detect_amd();
> +
>   	switch (err) {
>   	case EPERM:
>   	case EACCES:
> @@ -2950,6 +2990,8 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
>   			return scnprintf(msg, size, "wrong clockid (%d).", clockid);
>   		if (perf_missing_features.aux_output)
>   			return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel.");
> +		if (is_amd && (evsel->core.attr.precise_ip || !strncmp(evsel->pmu_name, "ibs", 3)) && (evsel->core.attr.exclude_kernel))
> +			return scnprintf(msg, size, "AMD IBS can't exclude kernel events.  Try running at a higher privilege level.");
>   		break;
>   	case ENODATA:
>   		return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. "
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ