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: <551986BC.3000409@gmail.com>
Date:	Mon, 30 Mar 2015 11:24:12 -0600
From:	David Ahern <dsahern@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>,
	Stephane Eranian <eranian@...gle.com>
CC:	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jiri Olsa <jolsa@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	John Stultz <john.stultz@...aro.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] perf, record: Add clockid parameter

On 3/28/15 1:55 AM, Peter Zijlstra wrote:
> @@ -1085,6 +1093,8 @@ static int __perf_evsel__open(struct per
>   	}
>
>   fallback_missing_features:
> +	if (perf_missing_features.clockid)
> +		evsel->attr.use_clockid = 0;
>   	if (perf_missing_features.cloexec)
>   		flags &= ~(unsigned long)PERF_FLAG_FD_CLOEXEC;
>   	if (perf_missing_features.mmap2)
> @@ -1122,6 +1132,16 @@ static int __perf_evsel__open(struct per
>   				goto try_fallback;
>   			}
>   			set_rlimit = NO_CHANGE;
> +
> +			/*
> +			 * If we succeeded but had to kill clockid, fail and
> +			 * have perf_evsel__open_strerror() print us a nice
> +			 * error.
> +			 */
> +			if (perf_missing_features.clockid) {
> +				err = -EINVAL;
> +				goto out_close;
> +			}
>   		}
>   	}
>
> @@ -1155,7 +1175,10 @@ static int __perf_evsel__open(struct per
>   	if (err != -EINVAL || cpu > 0 || thread > 0)
>   		goto out_close;
>
> -	if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
> +	if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
> +		perf_missing_features.clockid = true;
> +		goto fallback_missing_features;
> +	} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
>   		perf_missing_features.cloexec = true;
>   		goto fallback_missing_features;
>   	} else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {

...

> @@ -2158,6 +2188,12 @@ int perf_evsel__open_strerror(struct per
>   	"The PMU counters are busy/taken by another profiler.\n"
>   	"We found oprofile daemon running, please stop it and try again.");
>   		break;
> +
> +	case EINVAL:
> +		if (perf_missing_features.clockid)
> +			return scnprintf(msg, size, "%s", "clockid not supported.");
> +		break;
> +
>   	default:
>   		break;
>   	}
>

This works but the result is not always intuitive as to why it failed.

On a kernel that does not support the clock id you get:
     $ perf sched record -k mono -- sleep 1
     Error:
     clockid not supported.

And on a kernel that supports clockid but not for NMI:

     $ perf record -k realtime -a -- sleep 1
     Error:
     clockid not supported.

     --> H/W counters so realtime is not allowed

Same message though different root causes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ