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] [day] [month] [year] [list]
Message-ID: <20130514071424.GB15942@dyad.programming.kicks-ass.net>
Date:	Tue, 14 May 2013 09:14:24 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	steven.kinney@....com
Cc:	linux-kernel@...r.kernel.org, mingo@...hat.com,
	iommu@...ts.linux-foundation.org, joro@...tes.org,
	Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Subject: Re: [PATCH 2/2] IOMMU/AMD: IOMMU PC PERF uncore PMU implementation

On Mon, May 13, 2013 at 04:44:13PM -0500, steven.kinney@....com wrote:
> From: Steven L Kinney <Steven.Kinney@....com>
> 
> Implement a perf PMU to handle IOMMU PC perf events.  This PMU will handle
> static counter perf events relative to the AMD IOMMU Performance Counters.
> 
> To invoke the AMD IOMMU PMU issue a perf tool command such as:
> 
> ./perf stat -e amd_iommu/config=<config-data>,config1=<config1-data>/u <command>
> 
> For example:
> 
> ./perf stat -e amd_iommu/config=0x8000000000000005,config1=0/u <command>
> 
> The resulting count will be how many IOMMU total peripheral memory
> operations were performed during the command execution window.
> 
> Signed-off-by: Steven Kinney <steven.kinney@....com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
> ---

> +PMU_FORMAT_ATTR(iommu_raw, "config:63");

> +static int perf_iommu_init(struct perf_event *event)
> +{
> +	struct hw_perf_event *hwc = &event->hw;
> +	struct perf_iommu *perf_iommu;
> +	u64 config, config1;
> +
> +	/* initialize the cntr_assign_mask */
> +	cntr_assign_mask = 0;
> +
> +	/* test the event attr type check for PMU enumeration */
> +	if (event->attr.type != event->pmu->type)
> +		return -ENOENT;
> +
> +	perf_iommu = &perf_iommu_fetch;
> +
> +	if (perf_iommu) {
> +		config = event->attr.config;
> +		config1 = event->attr.config1;
> +	} else
> +		return -EINVAL;
> +
> +	if (event->pmu != &perf_iommu->pmu)
> +		return -ENOENT;
> +
> +	/* make sure the event->attr.config is raw (vendor specific) */
> +	if (!(config & IOMMU_PC_RAW_CONFIG_MASK))
> +		return -EINVAL;

Is this really needed? Non of the uncore PMU drivers have a magic config bit
either. Seems weird to me.

> +	/* integrate with iommu base devid (0000), assume one iommu */
> +	perf_iommu->max_banks =
> +		amd_iommu_pc_get_max_banks(IOMMU_BASE_DEVID);
> +	perf_iommu->max_counters =
> +		amd_iommu_pc_get_max_counters(IOMMU_BASE_DEVID);
> +
> +	/* update the hw_perf_event struct with the iommu config data */
> +	hwc->config = config;
> +	hwc->extra_reg.config = config1;
> +
> +	return 0;
> +}

Also it might make sense to add a few event aliases to both this IOMMU and the
AMD uncore driver.

Search for uncore_.*_events in arch/x86/kernel/cpu/perf_event_intel_uncore.c
for examples.

This way you can also make the IOMMU a tad more useful by providing some events
you think are the most useful for people interested in this thing.
--
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