Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2931339pxy; Mon, 3 May 2021 11:08:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0NLThUk9mNE8JuDah1n4nNpEqMO5IpTw5LPrGOfQoVkEpSAoc1qoZC7m/6myM/rp+inls X-Received: by 2002:aa7:9785:0:b029:28e:925e:b471 with SMTP id o5-20020aa797850000b029028e925eb471mr7144279pfp.30.1620065333811; Mon, 03 May 2021 11:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065333; cv=none; d=google.com; s=arc-20160816; b=yfs04wOhCItypdMmvKpWLs7gfr08kxh0xhJG95YrmkK4IuNIesCb/KT44lwLmeoPeW lZ91XDE0IkrkP2kKfwh7iDCX/n+xzq8hX8XlzyVIz1psrld8QqoxPNZ62zpnRNP+ggBV L6xzcfSc1+i6MMx31wofhGn0Phl9e/vnh48z1iMGDclgwuxlNHnH11nyG4IjpwFZedEG pNlE3Tsom8n8E9Yd2I3aBGXVTfIjB+38hjs+AaWTi3nfbn9FGpAM5NwpWUTBSTcI9dQg cTH/9/HWfNa4PbsEzslX+lJ47R9HosKk/MLRCiccOqJlvRXQPLpNbMMiSRVRZe2iq3ti oPnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lTUcMzd5Nf+frprwDIaCDinkx4BHLgItG4wFaCZjUcM=; b=wh1mHTF5/f9O3OSskyqFqar5PBQKjvDMQ3dVVtdS650m4CYHpl1cbze85lP/8kGJbR hy2AXY+z9efhYczuLRvKs11DqqDEdWa+1V6AdbZJ/IdPeMNT39ooab/43D2Tl5CMk+Y6 Ctvc5vviJbysVt8XhiJYKYApL+nz2oJlE13NvdijTgGG/KzXuqslly0xilU+SpuWo/wk mycCJI+cFpYcbkDABvnpVNWLZLdPW+UQfvk0yrAGxsrD1FdORSd368DrevXx6sNplz1E WjGrA3bUzXqoiVt1YPhogRbk0bs/YSIcctZyp4F71sySSm3sfIj4Q+XS37Bbl4I7f/w+ rUaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RqyWgy5W; 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 y18si415797plp.181.2021.05.03.11.08.40; Mon, 03 May 2021 11:08:53 -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=RqyWgy5W; 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 S233361AbhECOKu (ORCPT + 99 others); Mon, 3 May 2021 10:10:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45424 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbhECOKs (ORCPT ); Mon, 3 May 2021 10:10:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620050994; 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=lTUcMzd5Nf+frprwDIaCDinkx4BHLgItG4wFaCZjUcM=; b=RqyWgy5WF271jFkrOiPvM5aI44mdEV/glq4ks6q6evPSSNg27A97ej1M7K6DRIq3kSQIOL otsjfCDDcAsn4AoR7qZpm0J55fzoYQ9F/nIgnIiuYlch4/ZUJTqqdlgPul8A4k9ZZIU4Qy F+1ipXzKvVCsH80i0n1OHcmIp1pmI7Q= 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-510-z_XFjwjLOBSjOkl3aheTGg-1; Mon, 03 May 2021 10:09:51 -0400 X-MC-Unique: z_XFjwjLOBSjOkl3aheTGg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C8868042C7; Mon, 3 May 2021 14:09:49 +0000 (UTC) Received: from krava (unknown [10.40.195.47]) by smtp.corp.redhat.com (Postfix) with SMTP id 3E9092BFE2; Mon, 3 May 2021 14:09:46 +0000 (UTC) Date: Mon, 3 May 2021 16:09:45 +0200 From: Jiri Olsa To: Song Liu Cc: Song Liu , "linux-kernel@vger.kernel.org" , Kernel Team , "acme@kernel.org" , "acme@redhat.com" , "namhyung@kernel.org" , "jolsa@kernel.org" Subject: Re: [PATCH v5 5/5] perf-stat: introduce bpf_counter_ops->disable() Message-ID: References: <20210425214333.1090950-1-song@kernel.org> <20210425214333.1090950-6-song@kernel.org> <5257A59A-CC47-4CA7-9C15-CD6E20DC4BD0@fb.com> <7DBDECAE-D100-44C0-B5D3-DE48631430B5@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7DBDECAE-D100-44C0-B5D3-DE48631430B5@fb.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 29, 2021 at 10:40:01PM +0000, Song Liu wrote: SNIP > >>>>> #include "../perf.h" > >>>>> @@ -421,6 +422,9 @@ static void __evlist__disable(struct evlist *evlist, char *evsel_name) > >>>>> if (affinity__setup(&affinity) < 0) > >>>>> return; > >>>>> > >>>>> + evlist__for_each_entry(evlist, pos) > >>>>> + bpf_counter__disable(pos); > >>>> > >>>> I was wondering why you don't check evsel__is_bpf like > >>>> for the enable case.. and realized that we don't skip > >>>> bpf evsels in __evlist__enable and __evlist__disable > >>>> like we do in read_affinity_counters > >>>> > >>>> so I guess there's extra affinity setup and bunch of > >>>> wrong ioctls being called? > >>> > >>> We actually didn't do wrong ioctls because the following check: > >>> > >>> if (... || !pos->core.fd) > >>> continue; > >>> > >>> in __evlist__enable and __evlist__disable. That we don't allocate > >>> core.fd for is_bpf events. > >>> > >>> It is probably good to be more safe with an extra check of > >>> evsel__is_bpf(). But it is not required with current code. > >> > >> hum, but it will do all the affinity setup no? for no reason, > >> if there's no non-bpb event > > > > Yes, it will do the affinity setup. Let me see how to get something > > like all_counters_use_bpf here (or within builtin-stat.c). > > > > Would something like the following work? It is not clean (skipping some > useful logic in __evlist__[enable|disable]). But it seems to work in the > tests. sorry for late reply, but I can't no longer apply this: patching file tools/perf/builtin-stat.c Hunk #1 FAILED at 572. Hunk #2 FAILED at 581. 2 out of 2 hunks FAILED -- saving rejects to file tools/perf/builtin-stat.c.rej patching file tools/perf/util/evlist.c Hunk #1 FAILED at 425. 1 out of 1 hunk FAILED -- saving rejects to file tools/perf/util/evlist.c.rej ah, I see the patchset got already merged.. not sure why I'm doing review then ;-) thanks, jirka