From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDBDBC433DB for ; Tue, 9 Mar 2021 21:45:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 880D264FE4 for ; Tue, 9 Mar 2021 21:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231998AbhCIVoe (ORCPT ); Tue, 9 Mar 2021 16:44:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51247 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231904AbhCIVo3 (ORCPT ); Tue, 9 Mar 2021 16:44:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615326268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=koe2J3N8r9a5CU+J8F/n0A6tOoEJ/6fnrqwsvp2b9PY=; b=iJYGyBOzQzGhODVEl0EaB13fd0vXjRtj7AwKSEdjhC5/XgwnaauNPXAgSfdryiSFc3Hmrd vcAqESEMNtsgrlZ+7QKAJWlgPOS9J5m3+oGOGxqvKLQTmk2wOQaeAOmrP62NUI6J4mV3Ch CSVUjfSZD+DXylqBjyK/+rZbQZYqmw0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-OcC09FOQOBGjl8yUKioDCA-1; Tue, 09 Mar 2021 16:44:26 -0500 X-MC-Unique: OcC09FOQOBGjl8yUKioDCA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7CDF94DC1; Tue, 9 Mar 2021 21:44:24 +0000 (UTC) Received: from krava (unknown [10.40.194.152]) by smtp.corp.redhat.com (Postfix) with SMTP id A187F60C13; Tue, 9 Mar 2021 21:44:22 +0000 (UTC) Date: Tue, 9 Mar 2021 22:44:21 +0100 From: Jiri Olsa To: "Jin, Yao" Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com Subject: Re: [PATCH v3] perf pmu: Validate raw event with sysfs exported format bits Message-ID: References: <20210308031506.23019-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09, 2021 at 11:00:02AM +0800, Jin, Yao wrote: SNIP > > > if (format->value != PERF_PMU_FORMAT_VALUE_CONFIG) > > > continue; > > > > > > Is it right? > > > > sure, what I meant was to process only PERF_PMU_FORMAT_VALUE_CONFIG > > and then call break, because there's no need to iterate further > > > > jirka > > > > Sorry, maybe I still misunderstood what you suggested. > > My understanding is we still need to iterate the whole formats list even we > find a PERF_PMU_FORMAT_VALUE_CONFIG. > > root@kbl-ppc:/sys/devices/cpu/format# ls > any cmask edge event frontend in_tx in_tx_cp inv ldlat offcore_rsp pc umask > root@kbl-ppc:/sys/devices/cpu/format# cat any > config:21 > root@kbl-ppc:/sys/devices/cpu/format# cat cmask > config:24-31 > root@kbl-ppc:/sys/devices/cpu/format# cat edge > config:18 > root@kbl-ppc:/sys/devices/cpu/format# cat edge > config:18 > root@kbl-ppc:/sys/devices/cpu/format# cat event > config:0-7 > root@kbl-ppc:/sys/devices/cpu/format# cat frontend > config1:0-23 > root@kbl-ppc:/sys/devices/cpu/format# cat in_tx_cp > config:33 > root@kbl-ppc:/sys/devices/cpu/format# cat inv > config:23 > root@kbl-ppc:/sys/devices/cpu/format# cat ldlat > config1:0-15 > root@kbl-ppc:/sys/devices/cpu/format# cat offcore_rsp > config1:0-63 > root@kbl-ppc:/sys/devices/cpu/format# cat pc > config:19 > root@kbl-ppc:/sys/devices/cpu/format# cat umask > config:8-15 > > If we break the loop when we get the first PERF_PMU_FORMAT_VALUE_CONFIG, we > will only get the format 'any', right? ugh, yep.. we need all of them ;-) sry thanks, jirka