From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423658AbdEYINQ (ORCPT ); Thu, 25 May 2017 04:13:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423476AbdEYIJW (ORCPT ); Thu, 25 May 2017 04:09:22 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 94E3180049 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 94E3180049 Date: Thu, 25 May 2017 10:09:17 +0200 From: Jiri Olsa To: David Carrillo-Cisneros Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Andi Kleen , Simon Que , Wang Nan , Jiri Olsa , He Kuang , Masami Hiramatsu , David Ahern , Namhyung Kim , Stephane Eranian , Paul Turner Subject: Re: [PATCH v2 10/13] perf header: add a buffer to struct feat_fd Message-ID: <20170525080917.GJ14467@krava> References: <20170523074853.54892-1-davidcc@google.com> <20170523074853.54892-11-davidcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170523074853.54892-11-davidcc@google.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 25 May 2017 08:09:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 23, 2017 at 12:48:50AM -0700, David Carrillo-Cisneros wrote: SNIP > @@ -795,11 +831,19 @@ static int write_pmu_mappings(struct feat_fd *fd, > struct perf_evlist *evlist __maybe_unused) > { > struct perf_pmu *pmu = NULL; > - off_t offset = lseek(fd->fd, 0, SEEK_CUR); > - __u32 pmu_num = 0; > + u32 pmu_num = 0; > int ret; > > - /* write real pmu_num later */ > + /* > + * Do a first pass to count number of pmu to avoid lseek so this > + * works in pipe mode as well. > + */ > + while ((pmu = perf_pmu__scan(pmu))) { > + if (!pmu->name) > + continue; > + pmu_num++; > + } please put this functionality into preceeding separate patch thanks, jirka