From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755592AbbI3Mp1 (ORCPT ); Wed, 30 Sep 2015 08:45:27 -0400 Received: from mga01.intel.com ([192.55.52.88]:6589 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754470AbbI3MpZ (ORCPT ); Wed, 30 Sep 2015 08:45:25 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,612,1437462000"; d="scan'208";a="571298415" From: Alexander Shishkin To: Mathieu Poirier , gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, acme@kernel.org, mingo@redhat.com, corbet@lwn.net Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 18/20] coresight: etm3x: pushing down perf configuration to tracer In-Reply-To: <1442593594-10665-19-git-send-email-mathieu.poirier@linaro.org> References: <1442593594-10665-1-git-send-email-mathieu.poirier@linaro.org> <1442593594-10665-19-git-send-email-mathieu.poirier@linaro.org> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 30 Sep 2015 15:45:20 +0300 Message-ID: <878u7ojctb.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Poirier writes: > +#define ETM3X_SUPPORTED_OPTIONS (ETMCR_CYC_ACC | ETMCR_TIMESTAMP_EN) > + > +static int etm_parse_event_config(struct etm_drvdata *drvdata, > + struct perf_event *event) > +{ > + u64 config = event->attr.config; > + > + /* > + * At this time only cycle accurate and timestamp options are > + * available. As such clear everything else that may have been > + * configured and set the ETM control register based on what was > + * requested. > + */ > + config &= ETM3X_SUPPORTED_OPTIONS; You want to make sure no bits outside of this mask are set in config, though, and return -EINVAL. Below you're even checking for it: > + if (etm_parse_event_config(drvdata, event)) > + return -EINVAL; Regards, -- Alex