From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbdAYJzv (ORCPT ); Wed, 25 Jan 2017 04:55:51 -0500 Received: from mail.skyhub.de ([78.46.96.112]:35394 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbdAYJzt (ORCPT ); Wed, 25 Jan 2017 04:55:49 -0500 Date: Wed, 25 Jan 2017 10:55:38 +0100 From: Borislav Petkov To: Suravee Suthikulpanit Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, joro@8bytes.org, mingo@redhat.com Subject: Re: [PATCH v8 9/9] perf/amd/iommu: Enable support for multiple IOMMUs Message-ID: <20170125095538.42n2dnmdkhksuplk@pd.tnic> References: <1484551416-5440-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1484551416-5440-10-git-send-email-Suravee.Suthikulpanit@amd.com> <20170125094653.GO6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170125094653.GO6515@twins.programming.kicks-ass.net> User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 25, 2017 at 10:46:53AM +0100, Peter Zijlstra wrote: > Which is absolutely insane. Right, IMO, the simplest thing to do for your purposes is to embed a struct amd_iommu pointer into struct perf_amd_iommu at init time so that you don't have to do all that crazy dance in the PMU functions and iterate over the iommus in get_amd_iommu() each time. Which would then simplify all your other functions. For example: int amd_iommu_pc_get_reg(unsigned int idx, u8 bank, u8 cntr, u8 fxn, u64 *value) should be int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value) and you can save yourself a lot of glue code and get rid of that get_amd_iommu() thing. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.