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]
Date:   Wed, 15 Feb 2017 11:28:57 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc:     linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
        peterz@...radead.org, joro@...tes.org, mingo@...hat.com
Subject: Re: [PATCH v9 8/8] perf/amd/iommu: Enable support for multiple IOMMUs

On Wed, Feb 15, 2017 at 02:13:29PM +0700, Suravee Suthikulpanit wrote:
> > So you can define a static struct pmu in the driver and do struct
> > assignment directly instead of writing them one-by-one.
> 
> I believe this is the same suggestion you have made in V8.

Here's what I mean:

---
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index d9313d20a715..ac11d0755707 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -416,6 +416,17 @@ const struct attribute_group *amd_iommu_attr_groups[] = {
 	NULL,
 };
 
+static struct pmu iommu_pmu = {
+	.event_init	= perf_iommu_event_init,
+	.add		= perf_iommu_add,
+	.del		= perf_iommu_del,
+	.start		= perf_iommu_start,
+	.stop		= perf_iommu_stop,
+	.read		= perf_iommu_read,
+	.task_ctx_nr	= perf_invalid_context,
+	.attr_groups	= amd_iommu_attr_groups,
+};
+
 static __init int
 init_one_perf_amd_iommu(struct perf_amd_iommu *perf_iommu, unsigned int idx)
 {
@@ -431,14 +442,7 @@ init_one_perf_amd_iommu(struct perf_amd_iommu *perf_iommu, unsigned int idx)
 
 	snprintf(perf_iommu->name, PERF_AMD_IOMMU_NAME_SIZE, "amd_iommu_%u", idx);
 
-	perf_iommu->pmu.event_init  = perf_iommu_event_init;
-	perf_iommu->pmu.add         = perf_iommu_add;
-	perf_iommu->pmu.del         = perf_iommu_del;
-	perf_iommu->pmu.start       = perf_iommu_start;
-	perf_iommu->pmu.stop        = perf_iommu_stop;
-	perf_iommu->pmu.read        = perf_iommu_read;
-	perf_iommu->pmu.task_ctx_nr = perf_invalid_context;
-	perf_iommu->pmu.attr_groups = amd_iommu_attr_groups;
+	perf_iommu->pmu = iommu_pmu;
 
 	ret = perf_pmu_register(&perf_iommu->pmu, perf_iommu->name, -1);
 	if (ret)

> The initialized ones should be functioning independently (as separate PMUs).
> So, it should be alright to just leave them. I'll add the warning message
> as you suggested.

Yes, you need at least a warning message so that people know why some of
the IOMMUs are missing.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ