Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp812962ybm; Wed, 27 May 2020 08:36:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3/AO5oPipWrDviTwEhqKsPR9bkeXYOMaW5RMFf4TUvrZDubNd4nU9VfBf/ZVMKGu4okea X-Received: by 2002:a17:906:858b:: with SMTP id v11mr6318055ejx.348.1590593810406; Wed, 27 May 2020 08:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590593810; cv=none; d=google.com; s=arc-20160816; b=Rf39GblXuckVU8vkhzYi40cnT9GsKaIXCP4+lQy398WZrTZ1krW3u/pDvoH2X5uvNk 1WykYNjKc57u/p/N6nyhYhnhAi3MxPkpx40VIM2F6ccvrLI6SHe7kg6wcm5kjR3LyGMb cwguq+t16dCg9Cv1sH1Ff/l3wBFxe2AUCFOKnD6hAuopJIDnTbta+Z34uCQToyQnX8Dq lBacJRFcmpl3SqShxdRbags3BL3os24hEj8clPW42TBoaWS30eLedr/OT8NVV1KBm+/C PUZimLhFSpvizRvqzjNPtV+BCz5t0vuqU+7puLLtoKiK/rvHTjeWx2jEtOtauoIrVk1b sHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TgWmlq9h7MEFRhAYArTCqlHsgNgDJX7NFnKqNMmx80g=; b=hLU+qk0hx6T4GzAc5acbTfoqQkJJ8m4AbPuQD0rceG4XVY1ND2cOrOl1Qk0k1mvZSf cZkD6tEXGMZGkxn/XUHC0+FVl8VRgoQJrUSefw2oK7brFTCgelxhYGEXwJy0HHxsu/q+ 4KmZm1CS7gKnrv/wgLER+lsciF94VvwaJiGkP1PUBsdGg6cgRs3gkPFULNLIPbKjzkT5 UtYMVCVtAI+zfkoJ2UwjuvETozSTtB5krjBz7lCoLRQkUhOEq2nBhp/vTt9dZcfyRQZb 24jqYHdzYP03k1tEKw6qRApAW04SAjVA26tnkCO9I+9z/YYZOTIOsDi8kfMktnSf6PXy p8mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a8jRghwR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si2080355ejm.361.2020.05.27.08.36.26; Wed, 27 May 2020 08:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a8jRghwR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387761AbgE0K2Q (ORCPT + 99 others); Wed, 27 May 2020 06:28:16 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:37112 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729830AbgE0K2M (ORCPT ); Wed, 27 May 2020 06:28:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590575291; 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=TgWmlq9h7MEFRhAYArTCqlHsgNgDJX7NFnKqNMmx80g=; b=a8jRghwR2vgdxR02p9EKdscDX3aq4S5XbHS/fMBQw/1IIIB0wY3L/stQfTeS6SojfASmq+ aczrXjwraUwVQmtILZYPbP605AxjxnvoNf5Fhul++EPzpjJZvVVpJw06GJjLwRU+wGQhcX Aotsx/tdKZhnIifgZqBW+iBaVH/czsM= 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-400-BUvFFrQHOWq-OZn1AZ_OiQ-1; Wed, 27 May 2020 06:28:09 -0400 X-MC-Unique: BUvFFrQHOWq-OZn1AZ_OiQ-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 6FE2C18FE867; Wed, 27 May 2020 10:28:08 +0000 (UTC) Received: from krava (unknown [10.40.195.83]) by smtp.corp.redhat.com (Postfix) with SMTP id 3124B619C0; Wed, 27 May 2020 10:28:06 +0000 (UTC) Date: Wed, 27 May 2020 12:28:05 +0200 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 v2 1/2] perf evlist: Ensure grouped events with same cpu map Message-ID: <20200527102805.GA420698@krava> References: <20200525065559.6422-1-yao.jin@linux.intel.com> <20200526115155.GE333164@krava> <32c4663a-6934-2a2d-79e2-7a335e3629a2@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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 02:31:03PM +0800, Jin, Yao wrote: SNIP > > Thanks > > Jin Yao > > Issue is found! > > It looks we can't set "pos->leader = pos" in either for_each_group_member() > or in for_each_group_evsel() because it may exit the iteration immediately. > > evlist__for_each_entry(evlist, evsel) { > if (evsel->leader == evsel) > continue; > > if (cpu_maps_matched(evsel->leader, evsel)) > continue; > > pr_warning("WARNING: event cpu maps are not fully matched, " > "disable group\n"); > > for_each_group_member(pos, evsel->leader) { > pos->leader = pos; > pos->core.nr_members = 0; > } > > Let me use the example of '{cycles,unc_cbo_cache_lookup.any_i}' again. > > In evlist: > cycles, > unc_cbo_cache_lookup.any_i, > unc_cbo_cache_lookup.any_i, > unc_cbo_cache_lookup.any_i, > unc_cbo_cache_lookup.any_i, > > When we reach the for_each_group_member at first time, evsel is the first > unc_cbo_cache_lookup.any_i and evsel->leader is cycles. pos is same as the > evsel (the first unc_cbo_cache_lookup.any_i). > > Once we execute "pos->leader = pos;", it's actually "evsel->leader = evsel". > So now evsel->leader is changed to the first unc_cbo_cache_lookup.any_i. > > In next iteration, pos is the second unc_cbo_cache_lookup.any_i. pos->leader > is cycles but unfortunately evsel->leader has been changed to the first > unc_cbo_cache_lookup.any_i. So iteration stops immediately. hum, AFAICS the iteration will not break but continue to next evsel and pass the 'continue' for another group member.. what do I miss? jirka > > I'm now thinking if we can solve this issue by an easy way. > > Thanks > Jin Yao >