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: <20200220113530.GA565976@krava>
Date:   Thu, 20 Feb 2020 12:35:30 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     kan.liang@...ux.intel.com
Cc:     acme@...nel.org, mingo@...hat.com, peterz@...radead.org,
        linux-kernel@...r.kernel.org, mark.rutland@....com,
        namhyung@...nel.org, ravi.bangoria@...ux.ibm.com,
        yao.jin@...ux.intel.com, ak@...ux.intel.com
Subject: Re: [PATCH 4/5] perf metricgroup: Support metric constraint

On Wed, Feb 19, 2020 at 11:08:39AM -0800, kan.liang@...ux.intel.com wrote:

SNIP

> +static bool violate_nmi_constraint;
> +
> +static bool metricgroup__has_constraint(struct pmu_event *pe)
> +{
> +	if (!pe->metric_constraint)
> +		return false;
> +
> +	if (!strcmp(pe->metric_constraint, "NO_NMI_WATCHDOG") &&
> +	    sysctl__nmi_watchdog_enabled()) {
> +		pr_warning("Splitting metric group %s into standalone metrics.\n",
> +			   pe->metric_name);
> +		violate_nmi_constraint = true;

no static flags plz.. can't you just print that rest of the warning in here?

jirka

> +		return true;
> +	}
> +
> +	return false;
> +}
> +
>  static int metricgroup__add_metric(const char *metric, struct strbuf *events,
>  				   struct list_head *group_list)
>  {
> @@ -460,7 +490,10 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
>  			if (events->len > 0)
>  				strbuf_addf(events, ",");
>  
> -			metricgroup__add_metric_weak_group(events, ids, idnum);
> +			if (metricgroup__has_constraint(pe))
> +				metricgroup__add_metric_non_group(events, ids, idnum);
> +			else
> +				metricgroup__add_metric_weak_group(events, ids, idnum);
>  
>  			eg = malloc(sizeof(struct egroup));
>  			if (!eg) {
> @@ -544,6 +577,13 @@ int metricgroup__parse_groups(const struct option *opt,
>  	strbuf_release(&extra_events);
>  	ret = metricgroup__setup_events(&group_list, perf_evlist,
>  					metric_events);
> +
> +	if (violate_nmi_constraint) {
> +		pr_warning("Try disabling the NMI watchdog to comply NO_NMI_WATCHDOG metric constraint:\n"
> +			   "    echo 0 > /proc/sys/kernel/nmi_watchdog\n"
> +			   "    perf stat ...\n"
> +			   "    echo 1 > /proc/sys/kernel/nmi_watchdog\n");
> +	}
>  out:
>  	metricgroup__free_egroups(&group_list);
>  	return ret;
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ