From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423607AbdEYIKH (ORCPT ); Thu, 25 May 2017 04:10:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423468AbdEYIJs (ORCPT ); Thu, 25 May 2017 04:09:48 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9318E6409A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9318E6409A Date: Thu, 25 May 2017 10:09:38 +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 13/13] perf tools: add feature header record to pipe-mode Message-ID: <20170525080938.GL14467@krava> References: <20170523074853.54892-1-davidcc@google.com> <20170523074853.54892-14-davidcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170523074853.54892-14-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.38]); Thu, 25 May 2017 08:09:42 +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:53AM -0700, David Carrillo-Cisneros wrote: SNIP > +int perf_event__process_feature(struct perf_tool *tool, > + union perf_event *event, > + struct perf_session *session __maybe_unused) > +{ > + struct feat_fd fd = { .fd = 0 }; > + struct feature_event *fe = (struct feature_event *)event; > + int type = fe->header.type; > + u64 feat = fe->header_id; > + > + if (type < 0 || type >= PERF_RECORD_HEADER_MAX) { > + pr_warning("invalid record type %d\n", type); > + return 0; > + } > + if (feat == HEADER_RESERVED) > + return -1; > + > + if (feat > HEADER_LAST_FEATURE) > + return 0; I think we should warn in here > + > + if (!feat_ops[feat].process) > + return 0; > + > + /* > + * no print routine > + */ superfluous comment > + if (!feat_ops[feat].print) > + return 0; > + > + fd.buf = (void *)fe->data; > + fd.size = event->header.size - sizeof(event->header); > + fd.ph = &session->header; > + > + if (!tool->show_feat_hdr) > + return 0; some of the features could provide data for processing, should we call process unconditionaly and check this just before calling print? thanks, jirka