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=-5.8 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,URIBL_BLOCKED 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 E6FB0C56202 for ; Wed, 25 Nov 2020 16:44:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74BAB2083E for ; Wed, 25 Nov 2020 16:44:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TMRdnRBI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730734AbgKYQoL (ORCPT ); Wed, 25 Nov 2020 11:44:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31787 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730291AbgKYQoL (ORCPT ); Wed, 25 Nov 2020 11:44:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606322650; 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=1x5ldeypHKqgSD2erJagGTCtFUho7Af4kwDff883iVQ=; b=TMRdnRBISkVCLqlxwxEaHNDUomc9gijivPuQHd/dLv8A89iDS10tXtuBaW+39UsJVgDyNn 3Kc75m5DKOTL6dYrZ4nNad2cQbEJaR8wLnWdJTiMP0KB4SPKMjH7QHnT50R2p+3AbhKNL1 94FzBu1xjb4e6mEIQeJuTJwoLlvHMl4= 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-42-8ZAIy8PbPY6Ht9RfYmeCUg-1; Wed, 25 Nov 2020 11:44:01 -0500 X-MC-Unique: 8ZAIy8PbPY6Ht9RfYmeCUg-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 4B946107ACE3; Wed, 25 Nov 2020 16:44:00 +0000 (UTC) Received: from krava (unknown [10.40.192.200]) by smtp.corp.redhat.com (Postfix) with SMTP id 0789160BE2; Wed, 25 Nov 2020 16:43:57 +0000 (UTC) Date: Wed, 25 Nov 2020 17:43:57 +0100 From: Jiri Olsa To: Song Liu Cc: "linux-kernel@vger.kernel.org" , Kernel Team , "peterz@infradead.org" , "mingo@redhat.com" , "acme@kernel.org" , "mark.rutland@arm.com" , "alexander.shishkin@linux.intel.com" , "namhyung@kernel.org" Subject: Re: [RFC 2/2] perf-stat: enable counting events for BPF programs Message-ID: <20201125164357.GN2164284@krava> References: <20201119045046.1491106-1-songliubraving@fb.com> <20201119045046.1491106-3-songliubraving@fb.com> <20201124195108.GB2164284@krava> <3331CA57-F1EE-4C66-8E79-E5A7DA91F880@fb.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 Wed, Nov 25, 2020 at 12:02:13AM +0000, Song Liu wrote: > > > > On Nov 24, 2020, at 3:43 PM, Song Liu wrote: > > > > > > > >> On Nov 24, 2020, at 11:51 AM, Jiri Olsa wrote: > >> > >> On Wed, Nov 18, 2020 at 08:50:46PM -0800, Song Liu wrote: > >> > >> SNIP > >> > >>> +static int bpf_program_profiler__install_pe(struct evsel *evsel, int cpu, > >>> + int fd) > >>> +{ > >>> + struct bpf_prog_profiler_bpf *skel = evsel->bpf_counter.skel; > >>> + > >>> + return bpf_map_update_elem(bpf_map__fd(skel->maps.events), > >>> + &cpu, &fd, BPF_ANY); > >>> +} > >>> + > >>> +struct bpf_counter_ops bpf_program_profiler_ops = { > >>> + .load = bpf_program_profiler__load, > >>> + .enable = bpf_program_profiler__enable, > >>> + .read = bpf_program_profiler__read, > >>> + .destroy = bpf_program_profiler__destroy, > >>> + .install_pe = bpf_program_profiler__install_pe, > >>> +}; > >> > >> hum, what's the point of this ops? you plan some other ops? > >> we could just define stat callbacks right? > > Which callbacks do you mean here? I would like to try that as > well. I meant just to drop that ops struct and have load/enable/read.. functions called from stat code jirka