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: <20151216085334.GL6357@twins.programming.kicks-ass.net>
Date:	Wed, 16 Dec 2015 09:53:34 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	acme@...nel.org, jolsa@...nel.org, mingo@...nel.org,
	linux-kernel@...r.kernel.org, eranian@...gle.com,
	namhyung@...nel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 08/10] x86, perf: Support sysfs files depending on SMT
 status

On Tue, Dec 15, 2015 at 04:54:24PM -0800, Andi Kleen wrote:

> +ssize_t events_ht_sysfs_show(struct device *dev, struct device_attribute *attr,
> +			  char *page)
> +{
> +	struct perf_pmu_events_ht_attr *pmu_attr =
> +		container_of(attr, struct perf_pmu_events_ht_attr, attr);
> +	bool ht_on = false;
> +	int cpu;
> +
> +	/*
> +	 * Report conditional events depending on Hyper-Threading.
> +	 *
> +	 * Check all online CPUs if any have a thread sibling,
> +	 * as perf may measure any of them.
> +	 *
> +	 * This is overly conservative as usually the HT special
> +	 * handling is not needed if the other CPU thread is idle.
> +	 *
> +	 * Note this does not (cannot) handle the case when thread
> +	 * siblings are invisible, for example with virtualization
> +	 * if they are owned by some other guest.  The user tool
> +	 * has to re-read when a thread sibling gets onlined later.
> +	 */
> +	for_each_online_cpu (cpu) {
> +		ht_on = cpumask_weight(topology_sibling_cpumask(cpu)) > 1;
> +		if (ht_on)
> +			break;
> +	}

At the very least you want {get,put}_online_cpus() around that I
suspect.

But I would rather we generalize and save the state from fixup_ht_bug().

That is, at that subsys_initcall() time all our SMP init is done and
userspace isn't running yet to mess things up, so we can more or less
trust the topology masks to be complete.

So at that time detect if HT is enabled or not and store that
information in x86_pmu.flags for later use here.


> +
> +	return sprintf(page, "%s",
> +			ht_on ?
> +			pmu_attr->event_str_ht :
> +			pmu_attr->event_str_noht);
> +}
--
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