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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 3776FC4363D for ; Tue, 22 Sep 2020 18:34:43 +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 DE0CB20756 for ; Tue, 22 Sep 2020 18:34:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hVBv6zoL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RlX9qRnw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE0CB20756 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=6RMhUEUbJGGwbQL8qXxJQW9ESa+OKhPZ7Y/6Re5Ydx0=; b=hVBv6zoLvegzoHQUo0hBL1xiG YhYBXyTsey4Ui76CLWgDG2fRmqvSv5lepq0UVubXc8EA7M5xFPmk6+GPBLN0VcV6fcqNX+csmng8k EfxH/IaC1kj0F3YMDGRQYbHx1kekMpEIWAveoGVRQ5lTkzmPGJFWhUamVZq1AzU4aDgNi2TZobPkC zIb0G0beF4el/O6Z9T2qSQoR7Pb/tarGNNcGcuUezFmdLeKevjDpUA9xLxmJvtv8bsMo3Etnk7K9Y bIXiZrOuDU2LKgClO42MmG357DTCBagTOHEzOxzP9L8ZbCVuwJYiIZfAD58GYYLO+D2T/gL81FXc2 ijuXlp8mw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKn69-0003Yl-Tj; Tue, 22 Sep 2020 18:33:05 +0000 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKn64-0003Wc-Ui for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 18:33:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600799579; 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=WwPXGhPL6xp8ZNIQx0i7iF/a9jrzbtF5yWzgU61LP9c=; b=RlX9qRnwHgCkTACGivUUsXZJpF55Mqm3jM/ZzVBdilTYuzHEbp2yfUzrI1ui83pcfCqfJW y/Lxv22JaLeL9Sac8VE/ry+d4IsriUjfMZ9LCsgVHYSvk1v8I69n5nQEuCo42oaWfUQhBX OlBx85wbV4Ay6fn/+SoySLQqCISSKOU= 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-490-zk5tI3t-M2SXEF54OEKlUQ-1; Tue, 22 Sep 2020 14:32:55 -0400 X-MC-Unique: zk5tI3t-M2SXEF54OEKlUQ-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 456661017DC5; Tue, 22 Sep 2020 18:32:53 +0000 (UTC) Received: from krava (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with SMTP id F2F3578805; Tue, 22 Sep 2020 18:32:49 +0000 (UTC) Date: Tue, 22 Sep 2020 20:32:49 +0200 From: Jiri Olsa To: Rob Herring Subject: Re: [PATCH v3 05/10] libperf: Add libperf_evsel__mmap() Message-ID: <20200922183249.GA2718767@krava> References: <20200911215118.2887710-1-robh@kernel.org> <20200911215118.2887710-6-robh@kernel.org> <20200918143331.GF2626435@krava> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_143301_098321_87B43E55 X-CRM114-Status: GOOD ( 27.80 ) 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 , 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 Tue, Sep 22, 2020 at 09:28:44AM -0600, Rob Herring wrote: > On Fri, Sep 18, 2020 at 8:33 AM Jiri Olsa wrote: > > > > On Fri, Sep 11, 2020 at 03:51:13PM -0600, Rob Herring wrote: > > > In order to support usersapce access, an event must be mmapped. While > > > there's already mmap support for evlist, the usecase is a bit different > > > than the self monitoring with userspace access. So let's add a new > > > perf_evsel__mmap() function to mmap an evsel. This allows implementing > > > userspace access as a fastpath for perf_evsel__read(). > > > > > > The mmapped address is returned by perf_evsel__mmap() primarily for > > > users/tests to check if userspace access is enabled. > > > > > > Signed-off-by: Rob Herring > > > --- > > > v3: > > > - New patch split out from user access patch > > > --- > > > tools/lib/perf/Documentation/libperf.txt | 1 + > > > tools/lib/perf/evsel.c | 31 ++++++++++++++++++++++++ > > > tools/lib/perf/include/internal/evsel.h | 2 ++ > > > tools/lib/perf/include/perf/evsel.h | 2 ++ > > > tools/lib/perf/libperf.map | 1 + > > > 5 files changed, 37 insertions(+) > > > > > > diff --git a/tools/lib/perf/Documentation/libperf.txt b/tools/lib/perf/Documentation/libperf.txt > > > index 0c74c30ed23a..0b4694ce42b9 100644 > > > --- a/tools/lib/perf/Documentation/libperf.txt > > > +++ b/tools/lib/perf/Documentation/libperf.txt > > > @@ -136,6 +136,7 @@ SYNOPSIS > > > struct perf_thread_map *threads); > > > void perf_evsel__close(struct perf_evsel *evsel); > > > void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu); > > > + void *perf_evsel__mmap(struct perf_evsel *evsel, size_t length); > > > int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, > > > struct perf_counts_values *count); > > > int perf_evsel__enable(struct perf_evsel *evsel); > > > diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c > > > index 4dc06289f4c7..99fa53dc0887 100644 > > > --- a/tools/lib/perf/evsel.c > > > +++ b/tools/lib/perf/evsel.c > > > @@ -11,10 +11,12 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > #include > > > +#include > > > > > > void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr) > > > { > > > @@ -156,6 +158,35 @@ void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu) > > > perf_evsel__close_fd_cpu(evsel, cpu); > > > } > > > > > > +void *perf_evsel__mmap(struct perf_evsel *evsel, size_t length) > > > +{ > > > > could you rather use 'int pages' insted of length as we > > do in perf_evlist__mmap, so we keep the same interface > > > > len = (pages + 1) * page_size > > Sure, but what's the reason it is pages minus 1? It seems a bit odd to > pass in 0 here to get 1 page which would be the typical usage. the user mmap page is extra, so when you map 2 pages you actualy map 3, but we want the size of what's available for storing events in the API jirka _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel