Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3563736pxy; Tue, 4 May 2021 05:15:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5eU03Axab3cwBZPrAp+zrZp/7mABR0601VHYkaR9aoTuD3xtNQhCAMQxcaoKRBsmUSFBx X-Received: by 2002:a17:902:d2cc:b029:ed:2984:d73c with SMTP id n12-20020a170902d2ccb02900ed2984d73cmr25678264plc.54.1620130507318; Tue, 04 May 2021 05:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620130507; cv=none; d=google.com; s=arc-20160816; b=NVQM4fLdD5hg+WFuNI06P+Dda5nfy9II4JYBAplkPknRwC6Lw5NZmMJVaWgjP+k0r0 0SlEJUNZlGdSQGUo2vVxP0wA4+Qqr55c3CWLxEN4WlNheCc+D6x7stOBMwQ2TcKeiy6h fuw0Tsenvpsmo/Zz0kK2y87fSc+hJpBeYvIApy6lRATSjXigj5zns0bNDTtlnCUL1K30 0Ij2QNCOPwRZOp8hLFir+fUBPWPj++BZAuwZQgtiizxK5hL6j2EofwqyfznCFkGwUKXi w9TTmCZuAFY5xqsrHzJKr+nbz6eMp6TNrOpvt2BMNSrQFh3j9LsYiIe6mITk4WV/CaHY k6Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hPWmdQx8VD/dPdH29Dt+eddBPPsgip0TGuW5o0LBVzk=; b=b9Ee1wZoAa8PWYA4VqDEA3ZGE6uhWWQkun8+6PUfzyZklAp9ewfOYot7khuQvAaN1Q 6PBn08KISyFBIOo17FPCGzeXem3fXI5zfp7jL1T3ZYDtEz/QNq3d2cR0gvyoUVVEzQ0p zLqF2yIQRGHw8YESV500IxKXjCkryIg1JbcJAbPRE840dtfVZY8jtoa6kSLwPgdHyJzQ J6SdM9/ZWsgnJNHfy3p0BJLk0RB0cgwvYwcvtReKiuPdymNfWrYdy/zuc71qtmBVc927 PnbgSUWUTbK8G2rYs3JncheiXmJ4ITTh2yv1I3Ux3wnzQVkHSVpNdZpG6HrNU1PLXSQ5 iPuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=j1eQr4al; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si3277793pjc.163.2021.05.04.05.14.54; Tue, 04 May 2021 05:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=j1eQr4al; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbhEDMOs (ORCPT + 99 others); Tue, 4 May 2021 08:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbhEDMOs (ORCPT ); Tue, 4 May 2021 08:14:48 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFF6C061574; Tue, 4 May 2021 05:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hPWmdQx8VD/dPdH29Dt+eddBPPsgip0TGuW5o0LBVzk=; b=j1eQr4albLLU7f+2BcLjQ//IUT 6Cg10KLWwGZlqvfsnb3pTC6POpaWz2jEvuWeVLjybqcCyhij0WuGi4xNNwyNl5Xt1jJLjD9oyTWhe pJRuNs1ra+QdcYmo8mreyE9dso4iEzWnw3mTNdMH9RgpWpO/kQh00F0lSoXmkuwgSKlwyG5SDdiYC 8aQjTiSnkZHAtNnLTSH19w5F7HNZiQZPyEAXRDvrK9kUpUhgTz1qioiWJK0od++5ERb/blTSaCIvm TKDvpJRlVYzr1u9cTnjuzoH5lbNeh0GtnQLLrXK96/r7l/XQdtX0mjZgwvJBLSAp3GVmWyHBHXd6/ 1RapkG1Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1ldtvt-00GAIl-7N; Tue, 04 May 2021 12:13:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C3F293001CD; Tue, 4 May 2021 14:13:44 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B297520D11F61; Tue, 4 May 2021 14:13:44 +0200 (CEST) Date: Tue, 4 May 2021 14:13:44 +0200 From: Peter Zijlstra To: "Suthikulpanit, Suravee" Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, iommu@lists.linux-foundation.org, mingo@redhat.com, joro@8bytes.org, Jon.Grimm@amd.com, amonakov@ispras.ru, David Coe Subject: Re: [PATCH] x86/events/amd/iommu: Fix invalid Perf result due to IOMMU PMC power-gating Message-ID: References: <20210504065236.4415-1-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 04, 2021 at 06:58:29PM +0700, Suthikulpanit, Suravee wrote: > Peter, > > On 5/4/2021 4:39 PM, Peter Zijlstra wrote: > > On Tue, May 04, 2021 at 01:52:36AM -0500, Suravee Suthikulpanit wrote: > > > > > 2. Since AMD IOMMU PMU does not support interrupt mode, the logic > > > can be simplified to always start counting with value zero, > > > and accumulate the counter value when stopping without the need > > > to keep track and reprogram the counter with the previously read > > > counter value. > > > > This relies on the hardware counter being the full 64bit wide, is it? > > > > The HW counter value is 48-bit. Not sure why it needs to be 64-bit? > I might be missing some points here? Could you please describe? How do you deal with the 48bit overflow if you don't use the interrupt?