Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3356219pxx; Mon, 2 Nov 2020 06:54:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbC77bK3Dk+WBeBDkJuVPX/eh5P33GKUko3fmWgLTLG4yyXzxpY8ts8wY1sQP75vRXAMIi X-Received: by 2002:a50:ab07:: with SMTP id s7mr16731674edc.287.1604328861380; Mon, 02 Nov 2020 06:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604328861; cv=none; d=google.com; s=arc-20160816; b=B+x+eK6WmppTHjqM/8lc9THdAxwMYUHHKOeXqH+cD83NeOOaj9pCu0EvH+VyNGRi4v Mqr23XkxllPGNP6d1r3CIDHg69sNiDP5IfQ2MzcU1fb1380a6RczvIjaddDnOZHLaW6E dq1KA7elGvBeCQMOx9SSyM7+QutiCbqpnq6MyxZPEM204MSFOAcqbtoVqlfw58DukDnh RAzRtezwOZ5OPbkJi7F4lL9GZwlGXKUmPDkYlH0crUYcdNbjOj3oRKsnipOZmNWgaA+8 8SzZTq64z5ca4L4fc52u1J8EHsWM5o54YwglRLw2rj8lbB5btFLWuCg6IR9UGIEIrm8i mIHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=aUzlgHjCNYZph1yS+8m6KnYKTiNBZbplUqx6FtBjVjU=; b=ufljE/dPumS5p5mnko+0eLpnKi1jkAIjQ9r6YJgI7RMIL2+h5NDy4Q9IPFD1mdc5Sc f5mo+JwBjL/EOslzxA6e/+ecGnj3kp0OBue/G9O64f9gZntXBA6P6fmCmn5tj9QK5S7L MrJK9B/0WfzDxU9OXNFvb0Izwky6tSuAy7+D7gVV3GIfPRczuTA2dWDUraPMZRxAhUrK LFILydBRvwtapeLToWXXGxJa+UZ8RBlveV9hLsClsUUalxQCn5S4JW9xogPv4NNXHYwN Rkwsiy6x6S6oqbwbiR/UeUmCVPbgyirVr+vZ/2oH4KpmN4LowN8bdZ7Qq86sKFPGRS12 GiAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=csJWRdD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb27si10411587ejc.536.2020.11.02.06.53.58; Mon, 02 Nov 2020 06:54:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=csJWRdD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725980AbgKBOwa (ORCPT + 99 others); Mon, 2 Nov 2020 09:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbgKBOwa (ORCPT ); Mon, 2 Nov 2020 09:52:30 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D513C0617A6 for ; Mon, 2 Nov 2020 06:52:30 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id k9so9270355pgt.9 for ; Mon, 02 Nov 2020 06:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aUzlgHjCNYZph1yS+8m6KnYKTiNBZbplUqx6FtBjVjU=; b=csJWRdD1sbeRdikJMiHryEWVPv6Whuanfrwn7ExUkEHpr0dCZi27D5+8t1PzBIU0MF 8StlO2+KZkzv01moaLPdt5lH54JxQ681jE3ValKU4UwYFI0hnd/NBRVmLdYzRYTouce2 /RQIRDTal4ad93/5LbSqG5dsgxg4ke3B71zcsJqxHso8QxZZb+xMjzGLjU3yNlbpQF2p l/gb4RHMhDr9gWYiadwmAEv543hcSaDoU1nm7BsMY5RuC09+Li8bGmWVPWEKMqmo4EuZ MimrM8dc+K6FPORO1OaebsVObfXWbw/tGB5YKFBi0tSqYMJ27rWKQB8dFgJISRJC11PI dMdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=aUzlgHjCNYZph1yS+8m6KnYKTiNBZbplUqx6FtBjVjU=; b=E5oghObYiNrb21LCUqQibwkpmdqsStLGC2zSZmfguGXQUPM2k4frXxrfQmU9o15aRL N5YjCrDd1nOxbPOlW5RFjP4Q920DNrQoJDAH81HVoLdFh4nu9ibDsi9m+V+29lAYrpCn su7IvA+WhzhGXmMgV1UEhMu84LjsDedGO47GkIIYuTWVGQm+1z58qs2o+DS09KF8JGsq p/HkKLujfjBwYBrR3heOH8q9rsWkt693Mx2iM3Rw2EulCdZnfZ/didicaX9SbyYfvr0j jHoG6Tk+K3lmJDqftrTQ/NiDlYSbHQyp8WvsweY2N2rXsQQMQqKCC9iejfQ0lGljljlo Sm0g== X-Gm-Message-State: AOAM531a2fcxvTiXXXxuQFHycRV7aeTnQ9lRbmGh5XRjaKQH/0EGS74A G0s2mV4rFl4RlZ0O4TOyyCU= X-Received: by 2002:a17:90a:1903:: with SMTP id 3mr18247773pjg.74.1604328749885; Mon, 02 Nov 2020 06:52:29 -0800 (PST) Received: from balhae.roam.corp.google.com ([101.235.31.111]) by smtp.gmail.com with ESMTPSA id y4sm13513091pjc.53.2020.11.02.06.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 06:52:29 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Peter Zijlstra , Ingo Molnar Cc: Arnaldo Carvalho de Melo , Jiri Olsa , LKML , Stephane Eranian , Andi Kleen , Ian Rogers , Kan Liang , Gabriel Marin Subject: [RFC 0/2] perf/core: Invoke pmu::sched_task callback for cpu events Date: Mon, 2 Nov 2020 23:52:19 +0900 Message-Id: <20201102145221.309001-1-namhyung@kernel.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, It was reported that system-wide events with precise_ip set have a lot of unknown symbols on Intel machines. Depending on the system load I can see more than 30% of total symbols are not resolved (actually don't have DSO mappings). I found that it's only large PEBS is enabled - using call-graph or the frequency mode will disable it and have valid results. I've verified it by checking intel_pmu_pebs_sched_task() is called like below: # perf probe -a intel_pmu_pebs_sched_task # perf stat -a -e probe:intel_pmu_pebs_sched_task \ > perf record -a -e cycles:ppp -c 100001 sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 2.625 MB perf.data (10345 samples) ] Performance counter stats for 'system wide': 0 probe:intel_pmu_pebs_sched_task 2.157533991 seconds time elapsed Looking at the code, I found out that the pmu::sched_task callback was changed recently that it's called only for task events. So cpu events with large PEBS didn't flush the buffer and they are attributed to unrelated tasks later resulted in unresolved symbols. This patch reverts it and keeps the optimization for task events. While at it, I also found the context switch callback was not enabled for cpu events from the beginning. So I've added it too. With this applied, I can see the above callbacks are hit as expected and perf report has valid symbols. Thanks Namhyung Namhyung Kim (2): perf/core: Enable sched_task callbacks if PMU has it perf/core: Invoke pmu::sched_task callback for per-cpu events include/linux/perf_event.h | 1 + kernel/events/core.c | 42 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) -- 2.29.1.341.ge80a0c044ae-goog