From: Alexey Budankov <alexey.budankov@linux.intel.com>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Andi Kleen <ak@linux.intel.com>, Kan Liang <kan.liang@intel.com>,
Dmitri Prokhorov <Dmitry.Prohorov@intel.com>,
Valery Cherepennikov <valery.cherepennikov@intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephane Eranian <eranian@google.com>,
David Carrillo-Cisneros <davidcc@google.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 1/3] perf/core: use rb trees for pinned/flexible groups
Date: Wed, 30 Aug 2017 14:16:09 +0300 [thread overview]
Message-ID: <210d2c4d-c3c0-d748-c954-3364785583db@linux.intel.com> (raw)
In-Reply-To: <fa962d7c-2a6d-bb33-50b0-9d8f0057e8ab@linux.intel.com>
On 30.08.2017 11:30, Alexey Budankov wrote:
> On 29.08.2017 16:51, Alexander Shishkin wrote:
>> Alexey Budankov <alexey.budankov@linux.intel.com> writes:
>>
>>> Now I figured that not all indexed events are always located under
>>> the root with the same cpu, and it depends on the order of insertion
>>> e.g. with insertion order 01,02,03,14,15,16 we get this:
>>>
>>> 02
>>> / \
>>> 01 14
>>> / \
>>> 03 15
>>> \
>>> 16
>>>
>>> and it is unclear how to iterate cpu==0 part of tree in this case.
>>
>> Using this example, rb_next() should take you through the nodes in this
>> order (assuming you start with 01): 01, 02, 03, 14, etc. So you iterate
>> while event->cpu==cpu using rb_next() and you should be fine.
>
> Well, indeed we get the most left leaf (03) in rb_next() for the case above.
>
>>
>>> Iterating cpu specific subtree like this:
>>>
>>> #define for_each_group_event(event, group, cpu, pmu, field) \
>>> for (event = rb_entry_safe(group_first(group, cpu, pmu), \
>>> typeof(*event), field); \
>>> event && event->cpu == cpu && event->pmu == pmu; \
>>> event = rb_entry_safe(rb_next(&event->field), \
>>> typeof(*event), field))
>>
>> Afaict, this assumes that you are also ordering on event->pmu, which
>> should be reflected in your _less function. And also assuming that
>> group_first() is doing the right thing. Can we see the code?
>
> I didn't do ordering by PMU for this patch set. Yet more I implemented
> groups_first() like this:
>
> static struct perf_event *
> perf_event_groups_first(struct perf_event_groups *groups, int cpu)
> {
> struct perf_event *node_event = NULL;
> struct rb_node *node = NULL;
>
> node = groups->tree.rb_node;
>
> while (node) {
> node_event = container_of(node,
> struct perf_event, group_node);
>
> if (cpu < node_event->cpu) {
> node = node->rb_left;
> } else if (cpu > node_event->cpu) {
> node = node->rb_right;
> } else {
> node = node->rb_left;
> }
> }
>
> return node_event;
> }
>
> and it doesn't work as expected for case above with cpu == 1.
>
> I corrected the code above to this:
>
> static struct perf_event *
> perf_event_groups_first(struct perf_event_groups *groups, int cpu)
> {
> struct perf_event *node_event = NULL, *match = NULL;
> struct rb_node *node = NULL;
>
> node = groups->tree.rb_node;
>
> while (node) {
> node_event = container_of(node,
> struct perf_event, group_node);
>
> if (cpu < node_event->cpu) {
> node = node->rb_left;
> } else if (cpu > node_event->cpu) {
> node = node->rb_right;
> } else {
> match = node_event;
> node = node->rb_left;
> }
> }
>
> return match;
> }
>
> but now struggling with silent oopses which I guess are not
> related to multiplexing at all.
Added logging into the code and now see this in dmesg output:
[ 175.743879] BUG: unable to handle kernel paging request at 00007fe2a90d1a54
[ 175.743899] IP: __task_pid_nr_ns+0x3b/0x90
[ 175.743903] PGD 2f317ca067
[ 175.743906] P4D 2f317ca067
[ 175.743910] PUD 0
[ 175.743926] Oops: 0000 [#1] SMP
[ 175.743931] Modules linked in: fuse xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables nfsv3 rpcsec_gss_krb5 nfsv4 cmac arc4 md4 nls_utf8 cifs nfs ccm dns_resolver fscache rpcrdma ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp coretemp hfi1 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel intel_cstate rdmavt joydev ipmi_ssif intel_uncore ib_core ipmi_si ipmi_devintf intel_rapl_perf iTCO_wdt iTCO_vendor_support pcspkr tpm_tis tpm_tis_core
[ 175.744088] mei_me tpm i2c_i801 ipmi_msghandler lpc_ich mei shpchp wmi acpi_power_meter acpi_pad nfsd auth_rpcgss nfs_acl lockd grace sunrpc mgag200 drm_kms_helper ttm drm igb crc32c_intel ptp pps_core dca i2c_algo_bit
[ 175.744156] CPU: 12 PID: 8272 Comm: perf Not tainted 4.13.0-rc4-v7.3.3+ #13
[ 175.744160] Hardware name: Intel Corporation S7200AP/S7200AP, BIOS S72C610.86B.01.01.0190.080520162104 08/05/2016
[ 175.744165] task: ffff90c47d4d0000 task.stack: ffffae42d8fb0000
[ 175.744177] RIP: 0010:__task_pid_nr_ns+0x3b/0x90
[ 175.744181] RSP: 0018:ffff90c4bbd05ae0 EFLAGS: 00010046
[ 175.744190] RAX: 0000000000000000 RBX: ffff90c47d4d0000 RCX: 00007fe2a90d1a50
[ 175.744204] RDX: ffffffffbee4ed20 RSI: 0000000000000000 RDI: ffff90c47d4d0000
[ 175.744209] RBP: ffff90c4bbd05ae0 R08: 0000000000281a93 R09: 0000000000000000
[ 175.744213] R10: 0000000000000005 R11: 0000000000000000 R12: ffff90c46d25d800
[ 175.744218] R13: ffff90c4bbd05c40 R14: ffff90c47d4d0000 R15: ffff90c46d25d800
[ 175.744224] FS: 0000000000000000(0000) GS:ffff90c4bbd00000(0000) knlGS:0000000000000000
[ 175.744228] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 175.744232] CR2: 00007fe2a90d1a54 CR3: 0000002f33bd2000 CR4: 00000000001406e0
[ 175.744236] Call Trace:
[ 175.744243] <NMI>
[ 175.744259] perf_event_pid_type+0x27/0x40
[ 175.744272] __perf_event_header__init_id+0xb5/0xd0
[ 175.744284] perf_prepare_sample+0x54/0x360
[ 175.744293] perf_event_output_forward+0x2f/0x80
[ 175.744304] ? sched_clock+0xb/0x10
[ 175.744315] ? sched_clock_cpu+0x11/0xb0
[ 175.744334] __perf_event_overflow+0x54/0xe0
[ 175.744346] perf_event_overflow+0x14/0x20
[ 175.744356] intel_pmu_handle_irq+0x203/0x4b0
[ 175.744379] perf_event_nmi_handler+0x2d/0x50
[ 175.744391] nmi_handle+0x61/0x110
[ 175.744402] default_do_nmi+0x44/0x110
[ 175.744411] do_nmi+0x113/0x190
[ 175.744421] end_repeat_nmi+0x1a/0x1e
[ 175.744432] RIP: 0010:native_write_msr+0x6/0x30
[ 175.744437] RSP: 0018:ffffae42d8fb3c18 EFLAGS: 00000002
[ 175.744452] RAX: 0000000000000003 RBX: ffff90c4bbd0a360 RCX: 000000000000038f
[ 175.744457] RDX: 0000000000000007 RSI: 0000000000000003 RDI: 000000000000038f
[ 175.744461] RBP: ffffae42d8fb3c30 R08: 0000000000281a93 R09: 0000000000000000
[ 175.744464] R10: 0000000000000005 R11: 0000000000000000 R12: 0000000000000000
[ 175.744468] R13: ffff90c4bbd0a360 R14: ffff90c4bbd0a584 R15: 0000000000000001
[ 175.744485] ? native_write_msr+0x6/0x30
[ 175.744495] ? native_write_msr+0x6/0x30
[ 175.744504] </NMI>
[ 175.744514] ? __intel_pmu_enable_all.isra.13+0x4f/0x80
[ 175.744524] intel_pmu_enable_all+0x10/0x20
[ 175.744534] x86_pmu_enable+0x263/0x2f0
[ 175.744545] perf_pmu_enable+0x22/0x30
[ 175.744554] ctx_resched+0x74/0xb0
[ 175.744568] perf_event_exec+0x17e/0x1e0
[ 175.744584] setup_new_exec+0x72/0x180
[ 175.744595] load_elf_binary+0x39f/0x15ea
[ 175.744610] ? get_user_pages_remote+0x83/0x1f0
[ 175.744620] ? __check_object_size+0x164/0x1a0
[ 175.744632] ? __check_object_size+0x164/0x1a0
[ 175.744642] ? _copy_from_user+0x33/0x70
[ 175.744654] search_binary_handler+0x9e/0x1e0
[ 175.744664] do_execveat_common.isra.31+0x53d/0x700
[ 175.744677] SyS_execve+0x3a/0x50
[ 175.744691] do_syscall_64+0x67/0x150
[ 175.744702] entry_SYSCALL64_slow_path+0x25/0x25
[ 175.744709] RIP: 0033:0x7fe2a6cb77a7
[ 175.744713] RSP: 002b:00007ffc554690b8 EFLAGS: 00000202 ORIG_RAX: 000000000000003b
[ 175.744721] RAX: ffffffffffffffda RBX: 00007ffc5546b900 RCX: 00007fe2a6cb77a7
[ 175.744725] RDX: 000000000151dd70 RSI: 00007ffc5546b900 RDI: 00007ffc5546d59e
[ 175.744735] RBP: 00007ffc55469140 R08: 00007ffc554690a0 R09: 00007ffc55468f50
[ 175.744740] R10: 00007ffc55468ed0 R11: 0000000000000202 R12: 000000000151dd70
[ 175.744748] R13: 000000000082e740 R14: 0000000000000000 R15: 00007ffc5546d59e
[ 175.744757] Code: bf 78 09 00 00 00 74 46 85 f6 75 35 89 f6 48 8d 04 76 48 8d 84 c7 70 09 00 00 48 8b 48 08 48 85 c9 74 2b 8b b2 30 08 00 00 31 c0 <3b> 71 04 77 0f 48 c1 e6 05 48 8d 4c 31 30 48 3b 51 08 74 0b 5d
[ 175.744910] RIP: __task_pid_nr_ns+0x3b/0x90 RSP: ffff90c4bbd05ae0
[ 175.744914] CR2: 00007fe2a90d1a54
>
> Please look at v8 for a while. It addresses your comments for v7.
>
>>
>> Regards,
>> --
>> Alex
>>
>
> Thanks,
> Alexey
>
next prev parent reply other threads:[~2017-08-30 11:16 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 8:11 [PATCH v6 0/3] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Alexey Budankov
2017-08-02 8:13 ` [PATCH v6 1/3] perf/core: use rb trees for pinned/flexible groups Alexey Budankov
2017-08-03 13:00 ` Peter Zijlstra
2017-08-03 20:30 ` Alexey Budankov
2017-08-04 14:36 ` Peter Zijlstra
2017-08-07 7:17 ` Alexey Budankov
2017-08-07 8:39 ` Peter Zijlstra
2017-08-07 9:13 ` Peter Zijlstra
2017-08-07 15:32 ` Alexey Budankov
2017-08-07 15:55 ` Peter Zijlstra
2017-08-07 16:27 ` Alexey Budankov
2017-08-07 16:57 ` Peter Zijlstra
2017-08-07 17:39 ` Andi Kleen
2017-08-07 18:12 ` Peter Zijlstra
2017-08-07 18:13 ` Alexey Budankov
2017-08-15 17:28 ` Alexey Budankov
2017-08-23 13:39 ` Alexander Shishkin
2017-08-23 14:18 ` Alexey Budankov
2017-08-29 13:51 ` Alexander Shishkin
2017-08-30 8:30 ` Alexey Budankov
2017-08-30 10:18 ` Alexander Shishkin
2017-08-30 10:30 ` Alexey Budankov
2017-08-30 11:13 ` Alexander Shishkin
2017-08-30 11:16 ` Alexey Budankov [this message]
2017-08-31 10:12 ` Alexey Budankov
2017-08-31 10:12 ` Alexey Budankov
2017-08-04 14:53 ` Peter Zijlstra
2017-08-07 15:22 ` Alexey Budankov
2017-08-02 8:15 ` [PATCH v6 2/3]: perf/core: use context tstamp_data for skipped events on mux interrupt Alexey Budankov
2017-08-03 13:04 ` Peter Zijlstra
2017-08-03 14:00 ` Peter Zijlstra
2017-08-03 15:58 ` Alexey Budankov
2017-08-04 12:36 ` Peter Zijlstra
2017-08-03 15:00 ` Peter Zijlstra
2017-08-03 18:47 ` Alexey Budankov
2017-08-04 12:35 ` Peter Zijlstra
2017-08-04 12:51 ` Peter Zijlstra
2017-08-04 14:25 ` Alexey Budankov
2017-08-04 14:23 ` Alexey Budankov
2017-08-10 15:57 ` Alexey Budankov
2017-08-22 20:47 ` Peter Zijlstra
2017-08-23 8:54 ` Alexey Budankov
2017-08-31 17:18 ` [RFC][PATCH] perf: Rewrite enabled/running timekeeping Peter Zijlstra
2017-08-31 19:51 ` Stephane Eranian
2017-09-05 7:51 ` Stephane Eranian
2017-09-05 9:44 ` Peter Zijlstra
2017-09-01 10:45 ` Alexey Budankov
2017-09-01 12:31 ` Peter Zijlstra
2017-09-01 11:17 ` Alexey Budankov
2017-09-01 12:42 ` Peter Zijlstra
2017-09-01 21:03 ` Vince Weaver
2017-09-04 10:46 ` Alexey Budankov
2017-09-04 12:08 ` Peter Zijlstra
2017-09-04 14:56 ` Alexey Budankov
2017-09-04 15:41 ` Peter Zijlstra
2017-09-04 15:58 ` Peter Zijlstra
2017-09-05 10:17 ` Alexey Budankov
2017-09-05 11:19 ` Peter Zijlstra
2017-09-11 6:55 ` Alexey Budankov
2017-09-05 12:06 ` Alexey Budankov
2017-09-05 12:59 ` Peter Zijlstra
2017-09-05 16:03 ` Peter Zijlstra
2017-09-06 13:48 ` Alexey Budankov
2017-09-08 8:47 ` Alexey Budankov
2018-03-12 17:43 ` [tip:perf/core] perf/cor: Use RB trees for pinned/flexible groups tip-bot for Alexey Budankov
2017-08-02 8:16 ` [PATCH v6 3/3]: perf/core: add mux switch to skip to the current CPU's events list on mux interrupt Alexey Budankov
2017-08-18 5:17 ` [PATCH v7 0/2] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Alexey Budankov
2017-08-18 5:21 ` [PATCH v7 1/2] perf/core: use rb trees for pinned/flexible groups Alexey Budankov
2017-08-23 11:17 ` Alexander Shishkin
2017-08-23 17:23 ` Alexey Budankov
2017-08-18 5:22 ` [PATCH v7 2/2] perf/core: add mux switch to skip to the current CPU's events list on mux interrupt Alexey Budankov
2017-08-23 11:54 ` Alexander Shishkin
2017-08-23 18:12 ` Alexey Budankov
2017-08-22 20:21 ` [PATCH v7 0/2] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Peter Zijlstra
2017-08-23 8:54 ` Alexey Budankov
2017-08-31 10:12 ` Alexey Budankov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=210d2c4d-c3c0-d748-c954-3364785583db@linux.intel.com \
--to=alexey.budankov@linux.intel.com \
--cc=Dmitry.Prohorov@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=davidcc@google.com \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=valery.cherepennikov@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome