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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,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 0685DC4742C for ; Thu, 5 Nov 2020 22:41:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 822BD206A4 for ; Thu, 5 Nov 2020 22:41:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cNgK59bR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732372AbgKEWle (ORCPT ); Thu, 5 Nov 2020 17:41:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29046 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbgKEWle (ORCPT ); Thu, 5 Nov 2020 17:41:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604616092; 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=yihvqzIcowGrpHT7MuJY08IBEdS49zuRIZtt6VuD0Ko=; b=cNgK59bRy215+MtW1Vs6SUKwJ5AaEgLp+RBfWPzWcV61w5lg8UKzbTUy6IiCNe68VcPB/H 3o3KNqPhRfm9loJBs34y3Rmk23Gkez5yfJSwV/1/WvbgHVsSJnHeOhEK1SWb1euQwi0NVf wf9e/9ue7U+8oJ6XAJJ4X3GmcMWgvMc= 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-393-u_Iz_1W9P8aiU4zeFgTNNw-1; Thu, 05 Nov 2020 17:41:28 -0500 X-MC-Unique: u_Iz_1W9P8aiU4zeFgTNNw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C282100960C; Thu, 5 Nov 2020 22:41:26 +0000 (UTC) Received: from krava (unknown [10.40.192.38]) by smtp.corp.redhat.com (Postfix) with SMTP id 751A119931; Thu, 5 Nov 2020 22:41:22 +0000 (UTC) Date: Thu, 5 Nov 2020 23:41:21 +0100 From: Jiri Olsa To: Rob Herring Cc: Will Deacon , Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Alexander Shishkin , Namhyung Kim , Raphael Gault , Mark Rutland , Jonathan Cameron , Ian Rogers , Honnappa Nagarahalli , Itaru Kitayama Subject: Re: [PATCH v4 4/9] libperf: Add libperf_evsel__mmap() Message-ID: <20201105224121.GA4112111@krava> References: <20201001140116.651970-1-robh@kernel.org> <20201001140116.651970-5-robh@kernel.org> <20201014110527.GA1349644@krava> <20201019201541.GN1461394@krava> <20201020153527.GD2113901@krava> <20201021112430.GE2189784@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 05, 2020 at 10:19:24AM -0600, Rob Herring wrote: SNIP > > > > > > > > that maps page for each event, then perf_evsel__read > > > > could go through the fast code, no? > > > > > > No, because we're not self-monitoring (pid == 0 and cpu == -1). With > > > the following change: > > > > > > diff --git a/tools/lib/perf/tests/test-evsel.c > > > b/tools/lib/perf/tests/test-evsel.c > > > index eeca8203d73d..1fca9c121f7c 100644 > > > --- a/tools/lib/perf/tests/test-evsel.c > > > +++ b/tools/lib/perf/tests/test-evsel.c > > > @@ -17,6 +17,7 @@ static int test_stat_cpu(void) > > > { > > > struct perf_cpu_map *cpus; > > > struct perf_evsel *evsel; > > > + struct perf_event_mmap_page *pc; > > > struct perf_event_attr attr = { > > > .type = PERF_TYPE_SOFTWARE, > > > .config = PERF_COUNT_SW_CPU_CLOCK, > > > @@ -32,6 +33,15 @@ static int test_stat_cpu(void) > > > err = perf_evsel__open(evsel, cpus, NULL); > > > __T("failed to open evsel", err == 0); > > > > > > + pc = perf_evsel__mmap(evsel, 0); > > > + __T("failed to mmap evsel", pc); > > > + > > > +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) > > > + __T("userspace counter access not supported", pc->cap_user_rdpmc); > > > + __T("userspace counter access not enabled", pc->index); > > > + __T("userspace counter width not set", pc->pmc_width >= 32); > > > +#endif > > > > I'll need to check, I'm surprised this would depend on the way > > you open the event > > Any more thoughts on this? sry I got stuck with other stuff.. I tried your change and pc->cap_user_rdpmc is 0 because the test creates software event, which does not support that when I change that to: .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, I don't see any of those warning you added jirka 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, 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 18434C388F7 for ; Thu, 5 Nov 2020 22:42:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 52D1E20782 for ; Thu, 5 Nov 2020 22:42:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rGwkuJ4I"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gcSEKwkm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52D1E20782 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=tWmJGopoyI6/2Anj+63TXE1QbP31zVPkxbFJIVm86Uc=; b=rGwkuJ4IziIravE2XGYREsd64 vBYES3bnAK6PqKjT/nNv1vzVNaBzPZD7+W7a57G0waAT7JJ2YLRT6qh32y7/0tLLCge8AU6Z/zRsg rT+gLZdymyHHUS26CMyw172Vk2TAHMQ/piMsinmYAVVlvgzhXtkk0E1eiNa0QuEDVu0SuiCVzbBWz AJ0Z9SBr4MZUgupR5fdAVh1uzu+ORaHVlUJlpLZDQ/T7pafcBsOG2HHVyzRhtGMglVzeJGWL2+bE9 /CrUruLuG2N76St8CwqI+axz/yYJ57IOb36PZMghzgjuxdYWwLYHCzQj5aAHMXhZrs1ctvOV3kvgx 3Q39jcewA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kanwk-0004gL-Oz; Thu, 05 Nov 2020 22:41:34 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kanwi-0004fi-IA for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 22:41:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604616090; 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=yihvqzIcowGrpHT7MuJY08IBEdS49zuRIZtt6VuD0Ko=; b=gcSEKwkmJDqaCPVhpDOvXdvc4t0IvO5ThHDellt1W959z/u1srfINFbTND67774PK0A+ez yuFCZgLRVKxJ0JbGIaBI8DV8KOtRUxR2D3EEXoC8BeVRQ+07NGVethkOUTLp0MJb5ekDcz h/mpS8gMA6XK5LI3Oo/I8oDDnCVhH+s= 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-393-u_Iz_1W9P8aiU4zeFgTNNw-1; Thu, 05 Nov 2020 17:41:28 -0500 X-MC-Unique: u_Iz_1W9P8aiU4zeFgTNNw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C282100960C; Thu, 5 Nov 2020 22:41:26 +0000 (UTC) Received: from krava (unknown [10.40.192.38]) by smtp.corp.redhat.com (Postfix) with SMTP id 751A119931; Thu, 5 Nov 2020 22:41:22 +0000 (UTC) Date: Thu, 5 Nov 2020 23:41:21 +0100 From: Jiri Olsa To: Rob Herring Subject: Re: [PATCH v4 4/9] libperf: Add libperf_evsel__mmap() Message-ID: <20201105224121.GA4112111@krava> References: <20201001140116.651970-1-robh@kernel.org> <20201001140116.651970-5-robh@kernel.org> <20201014110527.GA1349644@krava> <20201019201541.GN1461394@krava> <20201020153527.GD2113901@krava> <20201021112430.GE2189784@krava> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_174132_666628_7CF533BD X-CRM114-Status: GOOD ( 22.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ian Rogers , Peter Zijlstra , Catalin Marinas , "linux-kernel@vger.kernel.org" , Arnaldo Carvalho de Melo , Alexander Shishkin , Raphael Gault , Ingo Molnar , Honnappa Nagarahalli , Jonathan Cameron , Namhyung Kim , Itaru Kitayama , Will Deacon , linux-arm-kernel 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 Thu, Nov 05, 2020 at 10:19:24AM -0600, Rob Herring wrote: SNIP > > > > > > > > that maps page for each event, then perf_evsel__read > > > > could go through the fast code, no? > > > > > > No, because we're not self-monitoring (pid == 0 and cpu == -1). With > > > the following change: > > > > > > diff --git a/tools/lib/perf/tests/test-evsel.c > > > b/tools/lib/perf/tests/test-evsel.c > > > index eeca8203d73d..1fca9c121f7c 100644 > > > --- a/tools/lib/perf/tests/test-evsel.c > > > +++ b/tools/lib/perf/tests/test-evsel.c > > > @@ -17,6 +17,7 @@ static int test_stat_cpu(void) > > > { > > > struct perf_cpu_map *cpus; > > > struct perf_evsel *evsel; > > > + struct perf_event_mmap_page *pc; > > > struct perf_event_attr attr = { > > > .type = PERF_TYPE_SOFTWARE, > > > .config = PERF_COUNT_SW_CPU_CLOCK, > > > @@ -32,6 +33,15 @@ static int test_stat_cpu(void) > > > err = perf_evsel__open(evsel, cpus, NULL); > > > __T("failed to open evsel", err == 0); > > > > > > + pc = perf_evsel__mmap(evsel, 0); > > > + __T("failed to mmap evsel", pc); > > > + > > > +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) > > > + __T("userspace counter access not supported", pc->cap_user_rdpmc); > > > + __T("userspace counter access not enabled", pc->index); > > > + __T("userspace counter width not set", pc->pmc_width >= 32); > > > +#endif > > > > I'll need to check, I'm surprised this would depend on the way > > you open the event > > Any more thoughts on this? sry I got stuck with other stuff.. I tried your change and pc->cap_user_rdpmc is 0 because the test creates software event, which does not support that when I change that to: .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, I don't see any of those warning you added jirka _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel