From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750810AbdBNMcX (ORCPT ); Tue, 14 Feb 2017 07:32:23 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:33360 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbdBNMb7 (ORCPT ); Tue, 14 Feb 2017 07:31:59 -0500 Date: Tue, 14 Feb 2017 13:31:49 +0100 From: Peter Zijlstra To: Suravee Suthikulpanit Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, joro@8bytes.org, bp@alien8.de, mingo@redhat.com Subject: Re: [PATCH v8 9/9] perf/amd/iommu: Enable support for multiple IOMMUs Message-ID: <20170214123149.GV6515@twins.programming.kicks-ass.net> 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=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 07, 2017 at 08:57:52AM +0700, Suravee Suthikulpanit wrote: > >But instead it looks like you get the counter form: > > > > #define _GET_CNTR(ev) ((u8)(ev->hw.extra_reg.reg)) > > > >Which is absolutely insane. > > > > So, the IOMMU counters are grouped into bank, and there could be > many banks. I use the extra_reg.reg to hold the bank and counter > indices. This will be used to program onto the counter configuration > register. This is handled in get_next_avail_iommu_bnk_cntr() and > clear_avail_iommu_bnk_cntr(). But this is crazy. That's not what extra_regs are for. Also, who cares about the banks, why is this exposed? That is, I would very much expect a linear range of counters. You can always decompose this counter number if you really need to somewhere down near the hardware accessors.