From patchwork Mon Nov 13 01:38:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118687 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1251395qgn; Sun, 12 Nov 2017 17:39:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMZVTDw5oWUMFfn1wxQIVJoOvuMuGlzpNw+OW/iTjTB4qwsXzmW5UP0BZP23Gk+zRkaE9KIO X-Received: by 10.99.120.7 with SMTP id t7mr6951307pgc.360.1510537192879; Sun, 12 Nov 2017 17:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537192; cv=none; d=google.com; s=arc-20160816; b=IHZdVr7HCkOHcLsBzBvA987fyZweO84apNHA1KjRiWFya6C2CvvdcCfb5h99h7y1ht YKCXrADSisREeoA6Cz05IqFDCFjcgNhfeujYQCC12NG0yWvtlSSZkAcXQK9adcHB3SvW c81HBP3oZKF+e402eySI1cWcQpYu0Lq8oKKPWie6B6h7JqBIlynI6VpsXsZRttcfrBD0 tPWJZaARaQEgaRKjmGUDi3bfTvr1knLnsx4edtuP4BYuHeb3Lr6HOu5K4c4aeuWgb+Ml Xq8vlfF0fF9NtXBwUiZ3XSdBjBQzhtTpNvmHgwvZR00fPZ0cFvIVh0P9JwHCTnv+vmcN lmcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=AilkLP65WJtXLX36fGeYTEjYTC9dRyLGd+aEAX7QDmg=; b=NfAWIGSWyF61+iFHZhEz+vpfDHKmi7K4P3plFGpximiBuhJ0jkyfYQKiYwCZ+SldCU lBPs0O2Lp0FaOSsC/7KZfqmpPXDOLi9UiixURGA6goC5KkPuiSRxLWvxFxvxR1pFh6/M Vtak1MQzQ4zmMqgdqlRRGyJX1fDNa/JdxSAOJvSLZXWo/F7lmk/s3Y95ZGTT2eXlvk0Y ZXoeivmOwL0q+fEU11uYSPN5nxcEskpT5zZU/8l7RE9aalWPwk5/CR/fpKbNWVwXNzpy HvmxeyTkfy2NsxaFRb+mnz5DRtTAYrnTD3WwcG+JWNIi5iZjbS9Itv8O8CqpuF1mI3nr T/TQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si9754690pll.591.2017.11.12.17.39.52; Sun, 12 Nov 2017 17:39:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751716AbdKMBji (ORCPT + 27 others); Sun, 12 Nov 2017 20:39:38 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10464 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbdKMBjf (ORCPT ); Sun, 12 Nov 2017 20:39:35 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06504; Mon, 13 Nov 2017 09:39:24 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:04 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 1/7] perf mmap: Fix perf backward recording Date: Mon, 13 Nov 2017 01:38:03 +0000 Message-ID: <20171113013809.212417-2-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.5A08F7CC.002F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 033002f6874cb7a4148c8b0635151f06 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org perf record backward recording doesn't work as we expected: it never overwrite when ring buffer full. Test: (Run a busy printing task background like this: while True: print 123 send SIGUSR2 to perf to capture snapshot.) # ./perf record --overwrite -e raw_syscalls:sys_enter -e raw_syscalls:sys_exit --exclude-perf -a --switch-output [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101520743 ] [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101521251 ] [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101521692 ] ^C[ perf record: Woken up 1 times to write data ] [ perf record: Dump perf.data.2017110101521936 ] [ perf record: Captured and wrote 0.826 MB perf.data. ] # ./perf script -i ./perf.data.2017110101520743 | head -n3 perf 2717 [000] 12449.310785: raw_syscalls:sys_enter: NR 16 (5, 2400, 0, 59, 100, 0) perf 2717 [000] 12449.310790: raw_syscalls:sys_enter: NR 7 (4112340, 2, ffffffff, 3df, 100, 0) python 2545 [000] 12449.310800: raw_syscalls:sys_exit: NR 1 = 4 # ./perf script -i ./perf.data.2017110101521251 | head -n3 perf 2717 [000] 12449.310785: raw_syscalls:sys_enter: NR 16 (5, 2400, 0, 59, 100, 0) perf 2717 [000] 12449.310790: raw_syscalls:sys_enter: NR 7 (4112340, 2, ffffffff, 3df, 100, 0) python 2545 [000] 12449.310800: raw_syscalls:sys_exit: NR 1 = 4 # ./perf script -i ./perf.data.2017110101521692 | head -n3 perf 2717 [000] 12449.310785: raw_syscalls:sys_enter: NR 16 (5, 2400, 0, 59, 100, 0) perf 2717 [000] 12449.310790: raw_syscalls:sys_enter: NR 7 (4112340, 2, ffffffff, 3df, 100, 0) python 2545 [000] 12449.310800: raw_syscalls:sys_exit: NR 1 = 4 Timestamps are never change, but my background task is a dead loop, can easily overwhelme the ring buffer. This patch fix it by force unsetting PROT_WRITE for backward ring buffer, so all backward ring buffer become overwrite ring buffer. Test result: # ./perf record --overwrite -e raw_syscalls:sys_enter -e raw_syscalls:sys_exit --exclude-perf -a --switch-output [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101285323 ] [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101290053 ] [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2017110101290446 ] ^C[ perf record: Woken up 1 times to write data ] [ perf record: Dump perf.data.2017110101290837 ] [ perf record: Captured and wrote 0.826 MB perf.data. ] # ./perf script -i ./perf.data.2017110101285323 | head -n3 python 2545 [000] 11064.268083: raw_syscalls:sys_exit: NR 1 = 4 python 2545 [000] 11064.268084: raw_syscalls:sys_enter: NR 1 (1, 12cc330, 4, 7fc237280370, 7fc2373d0700, 2c7b0) python 2545 [000] 11064.268086: raw_syscalls:sys_exit: NR 1 = 4 # ./perf script -i ./perf.data.2017110101290 | head -n3 failed to open ./perf.data.2017110101290: No such file or directory # ./perf script -i ./perf.data.2017110101290053 | head -n3 python 2545 [000] 11071.564062: raw_syscalls:sys_enter: NR 1 (1, 12cc330, 4, 7fc237280370, 7fc2373d0700, 2c7b0) python 2545 [000] 11071.564064: raw_syscalls:sys_exit: NR 1 = 4 python 2545 [000] 11071.564066: raw_syscalls:sys_enter: NR 1 (1, 12cc330, 4, 7fc237280370, 7fc2373d0700, 2c7b0) # ./perf script -i ./perf.data.2017110101290 | head -n3 perf.data.2017110101290053 perf.data.2017110101290446 perf.data.2017110101290837 # ./perf script -i ./perf.data.2017110101290446 | head -n3 sshd 1321 [000] 11075.499473: raw_syscalls:sys_exit: NR 14 = 0 sshd 1321 [000] 11075.499474: raw_syscalls:sys_enter: NR 14 (2, 7ffe98899490, 0, 8, 0, 3000) sshd 1321 [000] 11075.499474: raw_syscalls:sys_exit: NR 14 = 0 # ./perf script -i ./perf.data.2017110101290837 | head -n3 python 2545 [000] 11079.280844: raw_syscalls:sys_exit: NR 1 = 4 python 2545 [000] 11079.280847: raw_syscalls:sys_enter: NR 1 (1, 12cc330, 4, 7fc237280370, 7fc2373d0700, 2c7b0) python 2545 [000] 11079.280850: raw_syscalls:sys_exit: NR 1 = 4 Signed-off-by: Wang Nan --- tools/perf/util/evlist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.10.1 diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index c6c891e..4c5daba 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -799,22 +799,28 @@ perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused, } static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx, - struct mmap_params *mp, int cpu_idx, + struct mmap_params *_mp, int cpu_idx, int thread, int *_output, int *_output_backward) { struct perf_evsel *evsel; int revent; int evlist_cpu = cpu_map__cpu(evlist->cpus, cpu_idx); + struct mmap_params *mp; evlist__for_each_entry(evlist, evsel) { struct perf_mmap *maps = evlist->mmap; + struct mmap_params rdonly_mp; int *output = _output; int fd; int cpu; + mp = _mp; if (evsel->attr.write_backward) { output = _output_backward; maps = evlist->backward_mmap; + rdonly_mp = *_mp; + rdonly_mp.prot &= ~PROT_WRITE; + mp = &rdonly_mp; if (!maps) { maps = perf_evlist__alloc_mmap(evlist); From patchwork Mon Nov 13 01:38:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118688 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1251423qgn; Sun, 12 Nov 2017 17:39:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMbgMe9P04+rCy/0ExlAI8jQniT8w0v894aYrtoiMEY6DRm0s36Tom4XoZYgODSXvU0drLs/ X-Received: by 10.98.149.72 with SMTP id p69mr8248536pfd.76.1510537195531; Sun, 12 Nov 2017 17:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537195; cv=none; d=google.com; s=arc-20160816; b=ix1H7gPhMKK4lN2+4ZIZShynF62I/Ifux2qjL9ZouRjVbGVE0na1hbK1VXJfmByHOp z0+H4KLw6DMmYVk7nfbdJ8StXqeKvlwg7NXwbHps328XAsxNoRp3l4FjIcOdekiHo9zY DNv1+agf6kU9L3n6DyURSaNeR8KSolc66902QTEO6Kr8ysGuMi2w7TvhWNiAvVHH1NQu 0K+PWZmYSCWwOAtoUDmN9S/0Mb9fgN8vO7m6nbvYCVwClzfs8lk1REA8XiGLJAPAERue iBHJX713VBL7uQ72hSAK/UEc9dIc1GykyEyHUp+gOgytQG5L8tzx48O3LXKZkY5awton JFwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=K0icIH2J13j4yRQwQZgIniOaRQ10cRfMBKWaFuXOBXw=; b=NZOYWG3ctlGuyHy9vCs0qISvYQXw6WAIBw7xxeT6L6uhlb5C3dIg+Cdy+gRkUUhlYm ZPuGEmY8ojsoEa976brhWnr0y4ZwqiTRSzxQAZahs1OqaorTTBXs5HBgKIvqUlX+L0MQ iDyWfV8acZpR+yY1fcM4uJ910/y0Mce9XqHCxJrZdqxd4FsmRUwkh5vGE10/ptlTyYTc 9z9YsK20gkekGMxG++BxvCVhnx+L3y23WHA5tWTaitu/ImZtQtNb45NlFYY5JtSAXm4Y kI2fsSLresJz3DyeVBwJnBE23vzUGV97z7r1YDQvfAYqnfzYa87kxCnnKBrpLGhRbiCU kGzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si9754690pll.591.2017.11.12.17.39.55; Sun, 12 Nov 2017 17:39:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751869AbdKMBjx (ORCPT + 27 others); Sun, 12 Nov 2017 20:39:53 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10466 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbdKMBji (ORCPT ); Sun, 12 Nov 2017 20:39:38 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06519; Mon, 13 Nov 2017 09:39:25 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:05 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 2/7] perf tests: Set evlist of test__backward_ring_buffer() to !overwrite Date: Mon, 13 Nov 2017 01:38:04 +0000 Message-ID: <20171113013809.212417-3-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.5A08F7CD.0067, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 21ed9f37a6d18bd8fd2e94e38a30da64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting overwrite in perf_evlist__mmap() is meaningless because the event in this evlist is already have 'overwrite' postfix and goes to backward ring buffer automatically. Pass 'false' to perf_evlist__mmap() to make it similar to others. Signed-off-by: Wang Nan --- tools/perf/tests/backward-ring-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.1 diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c index d233ad3..992c917 100644 --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c @@ -58,7 +58,7 @@ static int do_test(struct perf_evlist *evlist, int mmap_pages, int err; char sbuf[STRERR_BUFSIZE]; - err = perf_evlist__mmap(evlist, mmap_pages, true); + err = perf_evlist__mmap(evlist, mmap_pages, false); if (err < 0) { pr_debug("perf_evlist__mmap: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); From patchwork Mon Nov 13 01:38:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118692 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1252072qgn; Sun, 12 Nov 2017 17:40:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMaDRZhxi5Cebc5mlEuOe3/85MlRxceoP0lDkQ228DPoI84XCMyJYNi9IHCV17xvr2XTixLw X-Received: by 10.159.216.145 with SMTP id s17mr7324253plp.297.1510537257372; Sun, 12 Nov 2017 17:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537257; cv=none; d=google.com; s=arc-20160816; b=s4tQSDNksTqCqvcm4njWiPkQ+Mz+Bj1aQtbIfGRsgJ0qJFpfrC2dETOsUSN1cyAijF BC9l9ooVPD8x/jwZxgg6bumfPjTU2UNlOAgKLpLQlioJvnF3gecF1z5JSRoAFHsCtbTN EHlmrhoGKVbGwFhNq9p1/cc1u9c68/n4z5cMhC1o6Q/4w3DWVrKNO+UXsESmH2Zj/2Rs pscdhZ9uZoSxVNTFxjxfXu5AdhvS4Yb57pNsu4PnXVstcnHVMOoLi694RdlnbEjo3+Ca Q55MJ1mSAgbe3gZWwOcGpJSDXjewec3ll26gMbWiCinOaT2ug7v766JPEl+3agzMVFKQ IxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=+86hg5n6eYh6d1kKcu1ugoxe4d85cwcT2XXAO98qVig=; b=XDZfHFEoJmYUpWQ1Cd9MFMLnuKpfOd3J18AWkUrx0ZRGRuB/fLksYjgmBTN+amv5HA mzVYJe+FJHX7MGtRPm5LQuZPw9r67/I82t7JXDp4/9XBBa/SkhsV3lB29KC5bS3S6XuM RcxF1s2gK49CROp+9/03AHWtA8Ap8yzrDhkAMDaXSRWoOthXMLh6lIpAHLf+a7xZZsQt L+YZnvT7ltIA0CCunZuWdWzle+nQncS1DEy2DGuHwc/cayTasmmjaYRz9k2EfqFQRwvn rDi9xPj6NT9WUSdpKVi1yQoMTJwvCbAM2NWvvLK44IqHGfn4yuci3QVG6Oq0QGHcaSwg rA/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si3628422pgo.118.2017.11.12.17.40.57; Sun, 12 Nov 2017 17:40:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977AbdKMBkz (ORCPT + 27 others); Sun, 12 Nov 2017 20:40:55 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10461 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbdKMBje (ORCPT ); Sun, 12 Nov 2017 20:39:34 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06512; Mon, 13 Nov 2017 09:39:24 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:06 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 3/7] perf tests: Set evlist of test__sw_clock_freq() to !overwrite Date: Mon, 13 Nov 2017 01:38:05 +0000 Message-ID: <20171113013809.212417-4-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5A08F7CD.001A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9b35943c3be125fe52ee344b579d6f99 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unsetting overwrite when calling perf_evlist__mmap is harmless. This commit passes false to it, makes following commits eliminate the overwrite argument easier. Signed-off-by: Wang Nan --- tools/perf/tests/sw-clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.1 diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index d88511f..c468e6c 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c @@ -77,7 +77,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) goto out_delete_evlist; } - err = perf_evlist__mmap(evlist, 128, true); + err = perf_evlist__mmap(evlist, 128, false); if (err < 0) { pr_debug("failed to mmap event: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); From patchwork Mon Nov 13 01:38:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118689 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1251645qgn; Sun, 12 Nov 2017 17:40:16 -0800 (PST) X-Google-Smtp-Source: AGs4zMbJLNGYaWkuuqvEoRek71tFjg0hz4yKRDdwOnfwKFcht+a9flJRbBIjf8PZ46bywjykJ2UH X-Received: by 10.98.219.134 with SMTP id f128mr7962593pfg.85.1510537216260; Sun, 12 Nov 2017 17:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537216; cv=none; d=google.com; s=arc-20160816; b=chHbcasaIvts09JRI255/4p7m3AIWNRvM3teAYwFaR1t15mHPDwix/hk1Vb0206Sfj WXpivA6r7Zm/+iTG5FCjrXYhutDwJG7UMjLUVuhaqvSEIXZsDalgSvxZkVjDefNNX/rZ dHjodDSyQrB11OvGjJBFY5JlCT2s2V6r4Tz0zZqY6K/xGdTiEeTuR2iebBSBWYT2awIm irWYxmL1P78/q3Pk/gspquZwRRtWiV1IPBue/XXDbzEocM0Me3oan0dYrhRN9pj0Id/j kvnu7oQtQ0TnoutUWakWHvVxuwOD2MoVngybFDcysaRQA2TyBr6tuso56r8LDEBjhbkL FOcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=fPighhHqeqfGVH8QGpLtSP8Ea2C26AgoI8IS1iwujEc=; b=GRCqwKdQZ8uZI6lthmqDn+RixUTw3Joq5P8+jd4YcWQGBetSLpU03ch1j6Qx6nbBMN dWshld7AeNHeEsefpgWNXsA2n6BerdcT+foEbAs8mjUkTwd5CON+kIRt6w3xi2zvC2Zy CkyveAZrVLgJPZ+M+WlNT19/Vyr+y2+AFeleQOjtwxIUHDwfrJdUW+488x/b3FeGBlCr 8UlVR14XKM6x8BndvDhXxdW6MUjGSqQ/GmG3EuenlRYPyhMF3sXfUfCvPVWop4iU+gEl d02b0mE0Kac1+BDnF9DRn+5xlDj7Ebp6EAXLmNw+nbq1OpHU+ELyKLCW+bj8wsIEuaZm TXMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si13416153pln.402.2017.11.12.17.40.16; Sun, 12 Nov 2017 17:40:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751668AbdKMBjh (ORCPT + 27 others); Sun, 12 Nov 2017 20:39:37 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10462 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbdKMBje (ORCPT ); Sun, 12 Nov 2017 20:39:34 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06520; Mon, 13 Nov 2017 09:39:25 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:07 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 4/7] perf tests: Set evlist of test__basic_mmap() to !overwrite Date: Mon, 13 Nov 2017 01:38:06 +0000 Message-ID: <20171113013809.212417-5-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5A08F7CE.0011, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a9451d5a7e61203513dc7e0109666185 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In this test, a large ring buffer is required so all events can feed into, so overwrite or not is meaningless. Change to !overwrite so following commits can remove this argument. Signed-off-by: Wang Nan --- tools/perf/tests/mmap-basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.1 diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index bc8a70e..667d696 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c @@ -93,7 +93,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse expected_nr_events[i] = 1 + rand() % 127; } - if (perf_evlist__mmap(evlist, 128, true) < 0) { + if (perf_evlist__mmap(evlist, 128, false) < 0) { pr_debug("failed to mmap events: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); goto out_delete_evlist; From patchwork Mon Nov 13 01:38:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118691 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1251753qgn; Sun, 12 Nov 2017 17:40:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ3YVy0ItsMvvCrxGlY7xV4RhDVLzo6Jol+tj/JNLaNgEZfyGxqSdel0yMgKdaVAtrEO4M4 X-Received: by 10.159.207.149 with SMTP id z21mr7315943plo.258.1510537228373; Sun, 12 Nov 2017 17:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537228; cv=none; d=google.com; s=arc-20160816; b=MW5UiVwrkBW12e2FPFRzbgZXk4lpnliD5zLjXEPZX13qKIGgXaEcBt4OfWmxWLKFNG aPC7yfG53dV+JNKtkxjYjMhkM9D2RR7cBGECkZ3Uvk8SFYpuUrpClhUxucc3S4TUEPbP nV83cLN3UJ4Qcrhz7AuqIq9YBuCa47rFiKWC5DkL5VIxYp5tMLYagFisBKe0KcKLBEz2 l0d2sgSZlazKNtZBEhIKyechWRTURr9dQonQmuzWKHBgkImmk8kQg/QIALM9IW2bcBmK J8WdfJ12FUkdy0pDFOtJOiepuutsNPIzP1XWkcUPAo5QuLai/bPqZD59n6q1X7zipuCe xUig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=fe2D8eyoeEVIysyYgR94FNQnBpbQTtMExiQUxvR1804=; b=aM9ca2jo3xRftNv7BSCUsyTGiRVEHMJS2RcU02kS7pXfSJnlJJq/xas1Urc+QiKXCt 98gWcR/sB33p64cBNd/aGBDGYE2qW8+TxuXhvjLbvmphLNzmtArVpDKc2VvGzyNiRGM/ b052ZDPHbhNaUYM/k3En1a4flF+Ri8Eh3QlXjBIYp/0vyhqDYOf9EdP6zxi8b9sJ+XUK siYfh/lurcv455dk3QHyX2M408y87S9meycdA18iuMJdaePIKKILNjZGPADv57Z3Rmjv QJmWP1ZhrVLh7+uK9Athv8CHqm0dHzizFq/fkpFHTyt8PCbxoOth9onkWJ34NPBev0OA xgfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si12812866plo.269.2017.11.12.17.40.28; Sun, 12 Nov 2017 17:40:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751921AbdKMBk0 (ORCPT + 27 others); Sun, 12 Nov 2017 20:40:26 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10523 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbdKMBjf (ORCPT ); Sun, 12 Nov 2017 20:39:35 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKV07224; Mon, 13 Nov 2017 09:39:26 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:07 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 5/7] perf tests: Set evlist of test__task_exit() to !overwrite Date: Mon, 13 Nov 2017 01:38:07 +0000 Message-ID: <20171113013809.212417-6-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5A08F7CE.0036, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b71ca9d0323d1f2c1bbe98da2c15238b Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changing ringbuffer to !overwrite in this task is harmless because this test uses a very low frequency (1) and using a very simple program (true). There should have only 3 events in the whole test. Overwriting is impossible to happen. Signed-off-by: Wang Nan --- tools/perf/tests/task-exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.1 diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index f0881d0..4fb6609 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -96,7 +96,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused goto out_delete_evlist; } - if (perf_evlist__mmap(evlist, 128, true) < 0) { + if (perf_evlist__mmap(evlist, 128, false) < 0) { pr_debug("failed to mmap events: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); goto out_delete_evlist; From patchwork Mon Nov 13 01:38:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118686 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1251274qgn; Sun, 12 Nov 2017 17:39:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMYXWFtcTWH6NgZMtLoh4sKHUlfMHB7q++mGvBbXO9Ghw2U+Dkqgo+dKUYdMgB3B7IQ8Iw8C X-Received: by 10.99.7.143 with SMTP id 137mr7009527pgh.158.1510537180628; Sun, 12 Nov 2017 17:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537180; cv=none; d=google.com; s=arc-20160816; b=k6OIjT9ccOe0OSC3/T1z4AhWBfeDu3R3fzIR6RZ3NA25DZT+mZStGrh3HahSsXVlPy 3hn543MkhbWv65kspCktttCZML167jR0R11+g3Pcj5C7eOhAkn/nq+YFsjlJNwk7jaI3 280RJrLgu8Mt7DzqSTGP4MJkFJOXlqwHQgCHnkCMOyhN+xOSjABYAFU4B86rz7Dxg4m7 ALANEZ9nsVO0i5j+yGsN3RNzS32V6oLp2LnknyxydY/SjGPv0y8y0SJXqv2BLB3ppvWT quJ3UJ2Lpkg0HYglaIgz3VOzFBlV/yOko8Bn4UKWT8iMmD0W+DdTmgqIl3fYuGBhoMVK GgCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=02jz+hwIbOd/2EmAksRWCi8Z+JC/pHJsAYEFLoVXz+c=; b=n5cWjBbNQ+Txt7sw3cU5zScjrh0OR4YSpMtEsbLhW+LKBZPNPh6C7mpSt7VImih3yW Ghi3ytvDWwy/oP7V/xTyWfCS0b1sEz6BZ5xBrmY25Mxf5kgXqr0jN69T3YVeV4Qnf9VE 3Trwbwh8yfHiOE44qrE41YYra6o9OzuMDckgBzwhtuLBQCGgqyzILpo1ekoBiRcG0yrt fuY1HuV6NEQIeqc0Uyhqj7nUk+nfwXIXsNYuU4sMDBHC9Yr6WghtcAk7kJ2Oz57npYvs gstmgxhzAHZ9QbfWR0sbEE4imJ0p9LRkfCf+YHJpa/9Qq37PjG1ZkMyXby6vtTCMg2+9 gx0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k91si13443922pld.453.2017.11.12.17.39.40; Sun, 12 Nov 2017 17:39:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751758AbdKMBjj (ORCPT + 27 others); Sun, 12 Nov 2017 20:39:39 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10465 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbdKMBjf (ORCPT ); Sun, 12 Nov 2017 20:39:35 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06514; Mon, 13 Nov 2017 09:39:25 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:08 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 6/7] perf tools: Remove 'overwrite' concept from code level Date: Mon, 13 Nov 2017 01:38:08 +0000 Message-ID: <20171113013809.212417-7-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5A08F7CD.0039, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3eb613878097b3980dcc843d51a9bc9e Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since all 'overwrite' usage are cleaned and no one really use a readonly main ringbuffer, remove 'overwrite' from function arguments and evlist. The concept of 'overwrite' and 'write_backward' are cleanner than before: 1. In code level, there's no 'overwrite' concept. Each evlist has two ringbuffer groups. One is read-write/forward, another is readonly/backward. Don't support read-write/backward and readonly/forward. 2. In user interface, we keep '--overwrite' and translate it into write_backward in each event. Signed-off-by: Wang Nan --- tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 +- tools/perf/builtin-kvm.c | 2 +- tools/perf/builtin-record.c | 4 ++-- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 2 +- tools/perf/tests/backward-ring-buffer.c | 2 +- tools/perf/tests/bpf.c | 2 +- tools/perf/tests/code-reading.c | 2 +- tools/perf/tests/keep-tracking.c | 2 +- tools/perf/tests/mmap-basic.c | 2 +- tools/perf/tests/openat-syscall-tp-fields.c | 2 +- tools/perf/tests/perf-record.c | 2 +- tools/perf/tests/sw-clock.c | 2 +- tools/perf/tests/switch-tracking.c | 2 +- tools/perf/tests/task-exit.c | 2 +- tools/perf/util/evlist.c | 14 ++++++-------- tools/perf/util/evlist.h | 6 ++---- tools/perf/util/mmap.c | 6 +++--- tools/perf/util/mmap.h | 2 +- tools/perf/util/python.c | 10 +++++----- 20 files changed, 33 insertions(+), 37 deletions(-) -- 2.10.1 diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 5dd7efb..c7ea843 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c @@ -83,7 +83,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe CHECK__(perf_evlist__open(evlist)); - CHECK__(perf_evlist__mmap(evlist, UINT_MAX, false)); + CHECK__(perf_evlist__mmap(evlist, UINT_MAX)); pc = evlist->mmap[0].base; ret = perf_read_tsc_conversion(pc, &tc); diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 0af4c09..e3e2a80 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -1043,7 +1043,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) goto out; } - if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages, false) < 0) { + if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages) < 0) { ui__error("Failed to mmap the events: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); perf_evlist__close(evlist); diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f4d9fc5..b3ef33f 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -300,7 +300,7 @@ static int record__mmap_evlist(struct record *rec, struct record_opts *opts = &rec->opts; char msg[512]; - if (perf_evlist__mmap_ex(evlist, opts->mmap_pages, false, + if (perf_evlist__mmap_ex(evlist, opts->mmap_pages, opts->auxtrace_mmap_pages, opts->auxtrace_snapshot_mode) < 0) { if (errno == EPERM) { @@ -481,7 +481,7 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli struct auxtrace_mmap *mm = &maps[i].auxtrace_mmap; if (maps[i].base) { - if (perf_mmap__push(&maps[i], evlist->overwrite, backward, rec, record__pushfn) != 0) { + if (perf_mmap__push(&maps[i], backward, rec, record__pushfn) != 0) { rc = -1; goto out; } diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 477a869..83d2ae2 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -902,7 +902,7 @@ static int perf_top__start_counters(struct perf_top *top) } } - if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) { + if (perf_evlist__mmap(evlist, opts->mmap_pages) < 0) { ui__error("Failed to mmap with %d (%s)\n", errno, str_error_r(errno, msg, sizeof(msg))); goto out_err; diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index c373f9a..c3f2f98 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2404,7 +2404,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) if (err < 0) goto out_error_apply_filters; - err = perf_evlist__mmap(evlist, trace->opts.mmap_pages, false); + err = perf_evlist__mmap(evlist, trace->opts.mmap_pages); if (err < 0) goto out_error_mmap; diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c index 992c917..bdebcf9 100644 --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c @@ -58,7 +58,7 @@ static int do_test(struct perf_evlist *evlist, int mmap_pages, int err; char sbuf[STRERR_BUFSIZE]; - err = perf_evlist__mmap(evlist, mmap_pages, false); + err = perf_evlist__mmap(evlist, mmap_pages); if (err < 0) { pr_debug("perf_evlist__mmap: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index 34c22cd..c433dd3 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c @@ -167,7 +167,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), goto out_delete_evlist; } - err = perf_evlist__mmap(evlist, opts.mmap_pages, false); + err = perf_evlist__mmap(evlist, opts.mmap_pages); if (err < 0) { pr_debug("perf_evlist__mmap: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 466a462..b6c813e 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -638,7 +638,7 @@ static int do_test_code_reading(bool try_kcore) break; } - ret = perf_evlist__mmap(evlist, UINT_MAX, false); + ret = perf_evlist__mmap(evlist, UINT_MAX); if (ret < 0) { pr_debug("perf_evlist__mmap failed\n"); goto out_put; diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index 7394286..b282916 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c @@ -94,7 +94,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un goto out_err; } - CHECK__(perf_evlist__mmap(evlist, UINT_MAX, false)); + CHECK__(perf_evlist__mmap(evlist, UINT_MAX)); /* * First, test that a 'comm' event can be found when the event is diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 667d696..f43d862 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c @@ -93,7 +93,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse expected_nr_events[i] = 1 + rand() % 127; } - if (perf_evlist__mmap(evlist, 128, false) < 0) { + if (perf_evlist__mmap(evlist, 128) < 0) { pr_debug("failed to mmap events: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); goto out_delete_evlist; diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index b6ee1c4..f68d818 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c @@ -63,7 +63,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest goto out_delete_evlist; } - err = perf_evlist__mmap(evlist, UINT_MAX, false); + err = perf_evlist__mmap(evlist, UINT_MAX); if (err < 0) { pr_debug("perf_evlist__mmap: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 19b6500..f9fbd8b 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c @@ -140,7 +140,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus * fds in the same CPU to be injected in the same mmap ring buffer * (using ioctl(PERF_EVENT_IOC_SET_OUTPUT)). */ - err = perf_evlist__mmap(evlist, opts.mmap_pages, false); + err = perf_evlist__mmap(evlist, opts.mmap_pages); if (err < 0) { pr_debug("perf_evlist__mmap: %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index c468e6c..fd01b24 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c @@ -77,7 +77,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) goto out_delete_evlist; } - err = perf_evlist__mmap(evlist, 128, false); + err = perf_evlist__mmap(evlist, 128); if (err < 0) { pr_debug("failed to mmap event: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 2acd785..9fee2a0 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -448,7 +448,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ goto out; } - err = perf_evlist__mmap(evlist, UINT_MAX, false); + err = perf_evlist__mmap(evlist, UINT_MAX); if (err) { pr_debug("perf_evlist__mmap failed!\n"); goto out_err; diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 4fb6609..4ba5a27 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -96,7 +96,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused goto out_delete_evlist; } - if (perf_evlist__mmap(evlist, 128, false) < 0) { + if (perf_evlist__mmap(evlist, 128) < 0) { pr_debug("failed to mmap events: %d (%s)\n", errno, str_error_r(errno, sbuf, sizeof(sbuf))); goto out_delete_evlist; diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 4c5daba..4948d3d 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -711,7 +711,7 @@ union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int * No need for read-write ring buffer: kernel stop outputting when * it hit md->prev (perf_mmap__consume()). */ - return perf_mmap__read_forward(md, evlist->overwrite); + return perf_mmap__read_forward(md, false); } union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx) @@ -738,7 +738,7 @@ void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx) void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx) { - perf_mmap__consume(&evlist->mmap[idx], evlist->overwrite); + perf_mmap__consume(&evlist->mmap[idx], false); } static void perf_evlist__munmap_nofree(struct perf_evlist *evlist) @@ -1058,14 +1058,14 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str, * Return: %0 on success, negative error code otherwise. */ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, - bool overwrite, unsigned int auxtrace_pages, + unsigned int auxtrace_pages, bool auxtrace_overwrite) { struct perf_evsel *evsel; const struct cpu_map *cpus = evlist->cpus; const struct thread_map *threads = evlist->threads; struct mmap_params mp = { - .prot = PROT_READ | (overwrite ? 0 : PROT_WRITE), + .prot = PROT_READ | PROT_WRITE, }; if (!evlist->mmap) @@ -1076,7 +1076,6 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, if (evlist->pollfd.entries == NULL && perf_evlist__alloc_pollfd(evlist) < 0) return -ENOMEM; - evlist->overwrite = overwrite; evlist->mmap_len = perf_evlist__mmap_size(pages); pr_debug("mmap size %zuB\n", evlist->mmap_len); mp.mask = evlist->mmap_len - page_size - 1; @@ -1097,10 +1096,9 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, return perf_evlist__mmap_per_cpu(evlist, &mp); } -int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, - bool overwrite) +int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages) { - return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); + return perf_evlist__mmap_ex(evlist, pages, 0, false); } int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 8c433e9..1dd3291 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -30,7 +30,6 @@ struct perf_evlist { int nr_entries; int nr_groups; int nr_mmaps; - bool overwrite; bool enabled; bool has_user_cpus; size_t mmap_len; @@ -168,10 +167,9 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, unsigned long perf_event_mlock_kb_in_pages(void); int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, - bool overwrite, unsigned int auxtrace_pages, + unsigned int auxtrace_pages, bool auxtrace_overwrite); -int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, - bool overwrite); +int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages); void perf_evlist__munmap(struct perf_evlist *evlist); size_t perf_evlist__mmap_size(unsigned long pages); diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 9fe5f9c..703ed41 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -299,7 +299,7 @@ static int rb_find_range(void *data, int mask, u64 head, u64 old, return backward_rb_find_range(data, mask, head, start, end); } -int perf_mmap__push(struct perf_mmap *md, bool overwrite, bool backward, +int perf_mmap__push(struct perf_mmap *md, bool backward, void *to, int push(void *to, void *buf, size_t size)) { u64 head = perf_mmap__read_head(md); @@ -321,7 +321,7 @@ int perf_mmap__push(struct perf_mmap *md, bool overwrite, bool backward, WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n"); md->prev = head; - perf_mmap__consume(md, overwrite || backward); + perf_mmap__consume(md, backward); return 0; } @@ -346,7 +346,7 @@ int perf_mmap__push(struct perf_mmap *md, bool overwrite, bool backward, } md->prev = head; - perf_mmap__consume(md, overwrite || backward); + perf_mmap__consume(md, backward); out: return rc; } diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index efd78b8..2c3d291 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -89,7 +89,7 @@ static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail) union perf_event *perf_mmap__read_forward(struct perf_mmap *map, bool check_messup); union perf_event *perf_mmap__read_backward(struct perf_mmap *map); -int perf_mmap__push(struct perf_mmap *md, bool overwrite, bool backward, +int perf_mmap__push(struct perf_mmap *md, bool backward, void *to, int push(void *to, void *buf, size_t size)); size_t perf_mmap__mmap_len(struct perf_mmap *map); diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index c129e99..ece33b4 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -856,14 +856,14 @@ static PyObject *pyrf_evlist__mmap(struct pyrf_evlist *pevlist, PyObject *args, PyObject *kwargs) { struct perf_evlist *evlist = &pevlist->evlist; - static char *kwlist[] = { "pages", "overwrite", NULL }; - int pages = 128, overwrite = false; + static char *kwlist[] = { "pages", NULL }; + int pages = 128; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii", kwlist, - &pages, &overwrite)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", kwlist, + &pages)) return NULL; - if (perf_evlist__mmap(evlist, pages, overwrite) < 0) { + if (perf_evlist__mmap(evlist, pages) < 0) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } From patchwork Mon Nov 13 01:38:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 118693 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1252248qgn; Sun, 12 Nov 2017 17:41:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMYU0WIgjqMewulStV3//xgSLIii3D3XrXyxc3P1Wa87hClUS697hHU3UoMZppqRLNmDSEgl X-Received: by 10.98.94.194 with SMTP id s185mr8187414pfb.56.1510537272491; Sun, 12 Nov 2017 17:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510537272; cv=none; d=google.com; s=arc-20160816; b=rJpIvLS/h0kaPA3FaQOTVkMqWZQRaAHxe/eSgwrEKfHnJ03AwQVPg7UDp1msyLEuGD fF1Y5XStJO5WnoPrOTEPFBAAf/7Xti1iMzmcH1odU3LQHkZTwDFo+E4osPwqvA+ddsIi 0q+ElKC70N8NVPIf8FZFJy2csmxgG2y+p15ZYTiTJEqIQTcFerOSDcKC+nZ/TvqufXUR KddJ74QAE2QibdescWJEUKHu9chgGCRmwbV3qU6I7RF1A3qKeZdl0srrhQ3pJwVc5eWR uRfC2TIrWD1s6888B2AeQmWaFby0wMoqaQlVyLGqYavPRResrWnD1IwEo3lOe5G8RofD 79Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=uVahC1ls+/p6YQNarNjT7hVupcTreIyFxmSIhcfRIJ8=; b=gAso6h4tordFNqFHtqVdKic4sGTg9KeC4Y5nNPkog7TRNF1NohpMKfG3S0ChrF896Y SISIcs+WNWsHeWnYoivyjLle5KX9efUiv0E+Wl+QsLBvFA+eDgaJnCEDJ9Gl5kfSsIsf kvvD6256q62uTYaZEslgY2OzfANEKoqGNRC8QPLqwGeF6ER6xatQCO0oIa/1bdu2qL8z 5Cb5bOfV50bWAid5ADbDb6GFtnzG5LCqDRoAmU9P9BHHip856tn/viZ4fW6wOtKoF4E0 ULFw1QD7HlaTVFbej4L4AliwpJGmDRfWwkCA6Qtdtq1rZS84wGwz50zbUyYNjut4p/Jt Pwqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si125611pgs.784.2017.11.12.17.41.12; Sun, 12 Nov 2017 17:41:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751762AbdKMBlK (ORCPT + 27 others); Sun, 12 Nov 2017 20:41:10 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10463 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbdKMBje (ORCPT ); Sun, 12 Nov 2017 20:39:34 -0500 Received: from 172.30.72.58 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKS06517; Mon, 13 Nov 2017 09:39:25 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 13 Nov 2017 09:39:08 +0800 From: Wang Nan To: , , , , CC: Wang Nan Subject: [PATCH 7/7] perf tools: Remove prot field in mmap param Date: Mon, 13 Nov 2017 01:38:09 +0000 Message-ID: <20171113013809.212417-8-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20171113013809.212417-1-wangnan0@huawei.com> References: <20171113013809.212417-1-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5A08F7CD.0040, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c66e60f551a72724509fcdddad8e6573 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After removing the concept of 'overwrite' in code level, now the prot is determinated by write_backward. There's no need to pass prot from perf_evlist__mmap_ex(). Signed-off-by: Wang Nan --- tools/perf/util/evlist.c | 17 ++++++----------- tools/perf/util/mmap.c | 4 ++-- tools/perf/util/mmap.h | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) -- 2.10.1 diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 4948d3d..0d713e0 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -799,28 +799,23 @@ perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused, } static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx, - struct mmap_params *_mp, int cpu_idx, + struct mmap_params *mp, int cpu_idx, int thread, int *_output, int *_output_backward) { struct perf_evsel *evsel; int revent; int evlist_cpu = cpu_map__cpu(evlist->cpus, cpu_idx); - struct mmap_params *mp; evlist__for_each_entry(evlist, evsel) { struct perf_mmap *maps = evlist->mmap; - struct mmap_params rdonly_mp; int *output = _output; int fd; int cpu; + int prot = PROT_READ; - mp = _mp; if (evsel->attr.write_backward) { output = _output_backward; maps = evlist->backward_mmap; - rdonly_mp = *_mp; - rdonly_mp.prot &= ~PROT_WRITE; - mp = &rdonly_mp; if (!maps) { maps = perf_evlist__alloc_mmap(evlist); @@ -830,6 +825,8 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx, if (evlist->bkw_mmap_state == BKW_MMAP_NOTREADY) perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING); } + } else { + prot |= PROT_WRITE; } if (evsel->system_wide && thread) @@ -844,7 +841,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx, if (*output == -1) { *output = fd; - if (perf_mmap__mmap(&maps[idx], mp, *output) < 0) + if (perf_mmap__mmap(&maps[idx], mp, prot, *output) < 0) return -1; } else { if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0) @@ -1064,9 +1061,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, struct perf_evsel *evsel; const struct cpu_map *cpus = evlist->cpus; const struct thread_map *threads = evlist->threads; - struct mmap_params mp = { - .prot = PROT_READ | PROT_WRITE, - }; + struct mmap_params mp; if (!evlist->mmap) evlist->mmap = perf_evlist__alloc_mmap(evlist); diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 703ed41..40e91a0 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -219,7 +219,7 @@ void perf_mmap__munmap(struct perf_mmap *map) auxtrace_mmap__munmap(&map->auxtrace_mmap); } -int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd) +int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int prot, int fd) { /* * The last one will be done at perf_evlist__mmap_consume(), so that we @@ -237,7 +237,7 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd) refcount_set(&map->refcnt, 2); map->prev = 0; map->mask = mp->mask; - map->base = mmap(NULL, perf_mmap__mmap_len(map), mp->prot, + map->base = mmap(NULL, perf_mmap__mmap_len(map), prot, MAP_SHARED, fd, 0); if (map->base == MAP_FAILED) { pr_debug2("failed to mmap perf event ring buffer, error %d\n", diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index 2c3d291..1f6fcc6 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -53,11 +53,11 @@ enum bkw_mmap_state { }; struct mmap_params { - int prot, mask; + int mask; struct auxtrace_mmap_params auxtrace_mp; }; -int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd); +int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int prot, int fd); void perf_mmap__munmap(struct perf_mmap *map); void perf_mmap__get(struct perf_mmap *map);