From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751199AbcHREcw (ORCPT ); Thu, 18 Aug 2016 00:32:52 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:34364 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750720AbcHREcv (ORCPT ); Thu, 18 Aug 2016 00:32:51 -0400 From: Vince Weaver X-Google-Original-From: Vince Weaver Date: Thu, 18 Aug 2016 00:32:25 -0400 (EDT) X-X-Sender: vince@macbook-air To: Peter Zijlstra cc: linux-kernel@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo Subject: Re: perf: rdpmc and PERF_EVENT_IOC_RESET In-Reply-To: <20160817152616.GT30192@twins.programming.kicks-ass.net> Message-ID: References: <20160817152616.GT30192@twins.programming.kicks-ass.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Aug 2016, Peter Zijlstra wrote: > Hurm.. I never considered using RESET with rdpmc(). The typical usage of > rdpmc() I considered is something like: I'm finally trying to hook up PAPI to properly use rdpmc and PAPI likes to use IOC_RESET in various places. I can just special case to not do so when in rdpmc mode, but I got curious if RESET was expected to work. > But the rdpmc user function should: > ... > > Which sign-extends the RDPMC result and adds it to userpg->offset, > resulting in a positive number again. I will have to check to see if PAPI is using the proper code. What happens is the procesed result has bit 49 set for some reason, so the results are 2^49 too big. I've been trying to track it down, but the PAPI code is a bit of a mess (to put it mildly). Vince