Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp217261yba; Wed, 17 Apr 2019 23:22:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqymIGBgqSd90znqbvFIBboKx0fZGUhEPiIlpV36hIiMTpYqYg5Suzua9cu6IQc7Yw9LKZGA X-Received: by 2002:a17:902:9a89:: with SMTP id w9mr94629084plp.126.1555568572563; Wed, 17 Apr 2019 23:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555568572; cv=none; d=google.com; s=arc-20160816; b=GREEb94dy+elIP/QLW/Gy1qSfPvCoVJAgvboNPFb3y+vulJDXXbFpvZjm59ZAK28/J M+1AmmKWGNVCiVYoBmEtnwCNp3qLHaZEwh3A31sJEn7GdL+qx8W8G+yyNmYUen21NoX5 VuQNHvv1uuCoyo5npz5ZCaiaeVf1rYx8CqgGR1UkksvxaUHNdcFjOnVsR9joaLkuqBSD 6aa1u/qfF8sIMX3qbgdj+DHtE+0IsQvyoOXc07glYUBYb5dCyJb30P/zRUDqn8OIJR9X Zd82PaGFGWY6odNQ82hspbfq7ToHwTpi03I94rBkJaYH8G4JKFjRnDNlsD3NGLK2h3m+ nGoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=NP5MxU6HW4SxAWysbHzVcYfv8gpVF7pFc4ShdVn1Ths=; b=ABA4a7+bHipD7Pab4F78Z5onEv/g7O0P7HoLaVRy7GFMlDvGrSOZYeVb31y6Zhi8Bj nzrdwyhLPhUqTHKjlD6V4Vfncmx2TUlAuFDUlpBL/Y1l9Gdufn6MRhDrDEv/T4depyj/ 71AibQwEiqPfiAnOnD2LD1blqrVoY2nZGStjLXrB6CaIED5MriL0C7xZzXwM2A6Ab+/2 umo60v4yc85zQnkqApUW+JVWpX23YwcX/g6t28CJX3R/9DSMILXFmQNfA5jP/Rx82CYE 8X0tcF/sBFA+8nbKmcdbU97wRe7xak+/PWhMx26UOQdEs1jcPXuXHZA2YKb6iRMrUeRk ovWQ== 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 k4si1274104pll.170.2019.04.17.23.22.38; Wed, 17 Apr 2019 23:22:52 -0700 (PDT) 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 S2388076AbfDRGVb (ORCPT + 99 others); Thu, 18 Apr 2019 02:21:31 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:42840 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDRGVa (ORCPT ); Thu, 18 Apr 2019 02:21:30 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07713075|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.423763-0.027105-0.549132;FP=0|0|0|0|0|-1|-1|-1;HT=e01a16368;MF=han_mao@c-sky.com;NM=1;PH=DS;RN=3;RT=3;SR=0;TI=SMTPD_---.EMywanS_1555568487; Received: from localhost(mailfrom:han_mao@c-sky.com fp:SMTPD_---.EMywanS_1555568487) by smtp.aliyun-inc.com(10.147.42.241); Thu, 18 Apr 2019 14:21:27 +0800 From: Mao Han To: guoren@kernel.org Cc: linux-kernel@vger.kernel.org, Mao Han Subject: [PATCH 1/1] csky: add page fault perf event support Date: Thu, 18 Apr 2019 14:20:40 +0800 Message-Id: <46349332f41f16896afde240973764c385d78cd3.1555568371.git.han_mao@c-sky.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch add support for page fault count, major fault count and minorfault count. Without this patch page faults are not sampled for perf event. Performance counter stats for '/usr/lib/perf-test/callchain_test': 0 page-faults # 0.000 K/sec Signed-off-by: Mao Han --- arch/csky/mm/fault.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c index e1725f8..d07141d 100644 --- a/arch/csky/mm/fault.c +++ b/arch/csky/mm/fault.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -106,6 +107,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, return; } #endif + + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); /* * If we're in an interrupt or have no user * context, we must not take the fault.. @@ -153,10 +156,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, goto bad_area; BUG(); } - if (fault & VM_FAULT_MAJOR) + if (fault & VM_FAULT_MAJOR) { tsk->maj_flt++; - else + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, + address); + } else { tsk->min_flt++; + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, + address); + } up_read(&mm->mmap_sem); return; -- 2.7.4