Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5250869imb; Thu, 7 Mar 2019 11:05:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwSDtCH28K6ia6dRBH19tCa492HmHdYT9Ql8yyVMN9X/NPuFTFwqolvbeJoPuYwowhu+ETL X-Received: by 2002:a63:2147:: with SMTP id s7mr12210605pgm.361.1551985546426; Thu, 07 Mar 2019 11:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551985546; cv=none; d=google.com; s=arc-20160816; b=TyVm90jqDsXPvLHMVomnvlREP3Nm5I01so3eOO3596T536y+IKd2CTjiI6hB8H3/bh znVSgzXdTu4w4t3IXhq7yXyTkt1TEqSYn7O1/ERkk2Go0NPlV7fOorEXFU4QAuYkNt3F FXlPFrnLs5bFlIZ5n0iUtKK3H3se2HjnzHVh1n/L1CJQbKCauBlyYmZQbW2R8QBavTxW r6R83zc868M2QccHrKIw62xgGq1Z5dwXYqKrm9icW/k3yX+ERP55nzCxrPxw+oAZNt0y q6wksHIi//+3hDHyuNh4wGg46KSjzb7ksS9s4dUN3R/jv5YV/j1CVcnxMIjp75+6YXDd j0aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2FnGMkPJdvA1Y298TTv0dulKvH9JE+0L5G7TxM+6MzA=; b=PzY4iY/2MQqzVaBji+4C1+sQbAVGP8eM/+4c34Viw1cmugxpRtw0l2ewpEaiGt9Mdw FZlhUdXykZgQx4yo30bZv0LElKmUcCr3IH5Z6Q8dwL/ygrihn1wWeAanjBReiwz6j0RI duomXu9egQ2Soq3UrolAJ7IdyuNnBPlTpxsIIjIPla2ObGpy94TB8NLFpKAiSgEFWi5v yTZ1Yj2WiMU4FqBuVfLrNvWXohr61A2l1LdOkg0wxtaZHGeZG5LmW6c3di5gMTn3aYwV xlrYPbYNJW+8oHCLymGx5dM9jYAwuVRkNc2WrUSFYNFim66xn5sfJcQVs09NuSG+DzY/ sqlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si4750140plr.333.2019.03.07.11.05.31; Thu, 07 Mar 2019 11:05:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfCGTDf (ORCPT + 99 others); Thu, 7 Mar 2019 14:03:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48014 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbfCGTDf (ORCPT ); Thu, 7 Mar 2019 14:03:35 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B8AF81DFC; Thu, 7 Mar 2019 19:03:35 +0000 (UTC) Received: from sandy.ghostprotocols.net (ovpn-112-41.phx2.redhat.com [10.3.112.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9503A29684; Thu, 7 Mar 2019 19:03:34 +0000 (UTC) Received: by sandy.ghostprotocols.net (Postfix, from userid 1000) id 718464BF3; Thu, 7 Mar 2019 16:03:30 -0300 (BRT) Date: Thu, 7 Mar 2019 16:03:30 -0300 From: Arnaldo Carvalho de Melo To: Stephane Eranian Cc: linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, peterz@infradead.org, mingo@elte.hu, jolsa@redhat.com, acme@kernel.org Subject: Re: [PATCH] perf/core: restore mmap record type correctly Message-ID: <20190307190330.GA2443@redhat.com> References: <20190307185233.225521-1-eranian@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307185233.225521-1-eranian@google.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 07 Mar 2019 19:03:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Mar 07, 2019 at 10:52:33AM -0800, Stephane Eranian escreveu: > On mmap(), perf_events generates a RECORD_MMAP record and then checks > which events are interested in this record. There are currently 2 versions > of mmap records: RECORD_MMAP and RECORD_MMAP2. MMAP2 is larger. The event > configuration controls which version the user level tool accepts. If the > event->attr.mmap2=1 field then MMAP2 record is returned. The > perf_event_mmap_output() takes care of this. It checks attr->mmap2 and corrects > the record fields before putting it in the sampling buffer of the event. > At the end the function restores the modified MMAP record fields. > > The problem is that the function restores the size but not the > type. Thus, if a subsequent event only accepts MMAP type, then it would > instead receive an MMAP2 record with a size of MMAP record. > > This patch fixes the problem by restoring the record type on exit. Right, simple enough, bug fixed, Peter, I'm taking this one, ok? - Arnaldo > Signed-off-by: Stephane Eranian > --- > kernel/events/core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 5f59d848171e..f170cd12beed 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -7188,6 +7188,7 @@ static void perf_event_mmap_output(struct perf_event *event, > struct perf_output_handle handle; > struct perf_sample_data sample; > int size = mmap_event->event_id.header.size; > + u32 type = mmap_event->event_id.header.type; > int ret; > > if (!perf_event_mmap_match(event, data)) > @@ -7231,6 +7232,7 @@ static void perf_event_mmap_output(struct perf_event *event, > perf_output_end(&handle); > out: > mmap_event->event_id.header.size = size; > + mmap_event->event_id.header.type = type; > } > > static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) > -- > 2.21.0.360.g471c308f928-goog