Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbdI3DTv (ORCPT ); Fri, 29 Sep 2017 23:19:51 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:36225 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673AbdI3DTt (ORCPT ); Fri, 29 Sep 2017 23:19:49 -0400 X-Google-Smtp-Source: AOwi7QC3LSo8dEaL9eLIodFm8g7BoQFTzyI9cIppXeGLp4CdUUvd9hHR5F9/sd+1x/Qu9G65n6x4xiGCsXReGSDlpJM= MIME-Version: 1.0 From: Luming Yu Date: Sat, 30 Sep 2017 11:19:48 +0800 Message-ID: Subject: [PATCH v1 0/9] early pt: intel processor trace early support To: LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3000 Lines: 66 we can use intel processor trace facility since cpu power on so we can try this patch to do early code analysis at basic block level. The basic usage is as below: #./sptdump #./sptdecode --pt ptout.0 -e ../linux-test/vmlinux | less .... [+ 10] ext4_getblk+159 -> __getblk_gfp [+ 13] __getblk_gfp+30 -> __find_get_block [+ 112] __find_get_block+167 -> mark_page_accessed [+ 2] __getblk_gfp+38 -> _cond_resched [+ 7] _cond_resched+16 -> rcu_all_qs [+ 35] htree_dirblock_to_tree+324 -> __ext4_check_dir_entry [+ 8] htree_dirblock_to_tree+352 -> ext4fs_dirhash [+ 53] ext4fs_dirhash+196 -> str2hashbuf_signed [+ 18] htree_dirblock_to_tree+233 -> ext4_htree_store_dirent [+ 18] ext4_htree_store_dirent+52 -> __kmalloc [+ 10] __kmalloc+27 -> kmalloc_slab [+ 9] __kmalloc+248 -> _cond_resched [+ 7] _cond_resched+16 -> rcu_all_qs [+ 39] __kmalloc+303 -> __memset [+ 4] __kmalloc+231 -> memcg_kmem_put_cache [+ 17] ext4_htree_store_dirent+114 -> __memcpy [+ 14] ext4_htree_store_dirent+214 -> rb_insert_color [+ 26] htree_dirblock_to_tree+324 -> __ext4_check_dir_entry [+ 8] htree_dirblock_to_tree+352 -> ext4fs_dirhash [+ 53] ext4fs_dirhash+196 -> str2hashbuf_signed [+ 18] htree_dirblock_to_tree+233 -> ext4_htree_store_dirent [+ 18] ext4_htree_store_dirent+52 -> __kmalloc [+ 10] __kmalloc+27 -> kmalloc_slab [+ 9] __kmalloc+248 -> _cond_resched .... The patch borrows some idea/code and tools from Andi Kleen's simple-pt project. Luming Yu(9): Basic support for early intel processor trace features with zero deps boot option early_pt to enable early pt boot option early_pt_buf_len for early pt buffer size setup early pt basic addr pair filter support (addr0 && addr1) early pt basic addr pair filter support (addr0 && addr1) early pt enable mtc freq packet enable early pt psb packet early pt enable cyc packet start early intel processor trace in early boot arch/x86/events/Kconfig | 6 + arch/x86/events/intel/Makefile | 1 + arch/x86/events/intel/early_pt.c | 443 +++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/smpboot.c | 2 + init/main.c | 2 + kernel/trace/Kconfig | 2 +- 6 files changed, 455 insertions(+), 1 deletion(-) create mode 100644 arch/x86/events/intel/early_pt.c -- 2.7.5