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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 03837C433B4 for ; Tue, 6 Apr 2021 12:57:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D44F613AE for ; Tue, 6 Apr 2021 12:57:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D44F613AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EWcidDzG0pNJKpAP27KxTH2sDT5XPyR5bfoDZ564MYY=; b=EzwSbpsaT3ivZtsJBxQJNyC9A tyalzV/UJ+wm0ebfuf89uXXBRQwE23QYh42t83FlwlrSMndCmywJOUnJly1SSwt8oR3XfBp/rLxE+ 9JEFKXocHZRtamqkb+CjcGn6vwaTpZ1yEm+jSmmUA2cdIEgGP6vcgFL5sLOBLzSmFNCRnR7Qmo3Dq XiolFrG14vGU2UonWTzeh6FFq1b+/BcW+wCKI4FmMEKg6CPxaRg77fq1UxVs7nXpgSqw9KwnJV1j4 tqrVn3IVQ2B151a0Ym1px5mG/adZ+EwrocT9OAOeEFcVazW20bt2ZkFzXhrZBNGyGlqsOlQCV5viR 9BgVJr1jg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTlF5-002dXJ-IS; Tue, 06 Apr 2021 12:55:39 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lTlF0-002dWt-Mn for linux-arm-kernel@lists.infradead.org; Tue, 06 Apr 2021 12:55:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617713733; 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=AMmsc41eqctpVkzPL+JoDmYt5x6xCyCRYplYE68RQiQ=; b=NMyulwd7NU2Syfok57gX9T4+m6iyFeUXzHT4stlhrhsQv7BSEDN7kVbAGgQbXobwdGYUhz KzBZESndJ9DisbmjcoNm/9nZGw4l2c8kgOkw8XNyEz+z3ctNVG6oxNmD+rlNWt+TUdLiQR GYK1q1oSbzKcOjtZdSwmbX+aGI8X20o= 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-78-wnPWQRIdP3eCSTi9hvlIwQ-1; Tue, 06 Apr 2021 08:55:29 -0400 X-MC-Unique: wnPWQRIdP3eCSTi9hvlIwQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E8E98189C7; Tue, 6 Apr 2021 12:55:27 +0000 (UTC) Received: from krava (unknown [10.40.195.36]) by smtp.corp.redhat.com (Postfix) with SMTP id DA49B1B528; Tue, 6 Apr 2021 12:55:23 +0000 (UTC) Date: Tue, 6 Apr 2021 14:55:22 +0200 From: Jiri Olsa To: John Garry Cc: will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, irogers@google.com, linuxarm@huawei.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, zhangshaokun@hisilicon.com, pc@us.ibm.com Subject: Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events parsing test Message-ID: References: <1616668398-144648-1-git-send-email-john.garry@huawei.com> <1616668398-144648-3-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210406_135534_936574_BC0C40C5 X-CRM114-Status: GOOD ( 27.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 06, 2021 at 01:43:09PM +0100, John Garry wrote: > On 06/04/2021 13:17, Jiri Olsa wrote: > > > > > + ref = &metric->metric_ref; > > > > > + ref->metric_name = pe->metric_name; > > > > > + ref->metric_expr = pe->metric_expr; > > > > > + list_add_tail(&metric->list, compound_list); > > > > > + > > > > > + rc = expr__find_other(pe->metric_expr, NULL, pctx, 0); > > > Hi Jirka, > > > > > > > so this might add new items to pctx->ids, I think you need > > > > to restart the iteration as we do it in __resolve_metric > > > > otherwise you could miss some new keys > > > I thought that I was doing this. Indeed, this code is very much like > > > __resolve_metric();) > > > > > > So expr__find_other() may add a new item to pctx->ids, and we always iterate > > > again, and try to lookup any pmu_events, *, above. If none exist, then we > > hm, I don't see that.. so, what you do is: > > > > hashmap__for_each_entry_safe((&pctx->ids) ....) { > > > > rc = expr__find_other(pe->metric_expr, NULL, pctx, 0); > > } > > > > and what I think we need to do is: > > > > hashmap__for_each_entry_safe((&pctx->ids) ....) { > > > > rc = expr__find_other(pe->metric_expr, NULL, pctx, 0); > > > > break; > > } > > > > each time you resolve another metric, you need to restart > > the pctx->ids iteration, because there will be new items, > > and we are in the middle of it > > Sure, but we will restart anyway. hum, where? you call expr__find_other and continue to next pctx->ids item > > Regardless of this, I don't think what I am doing is safe, i.e. adding new > items in the middle of the iter, so I will change in the way you suggest. it'll always add items in the middle of the iteration jirka > > Thanks, > John > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel