From nobody Sun Feb 8 14:53:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487862168280280.26156532114453; Thu, 23 Feb 2017 07:02:48 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NEx0rQ015651; Thu, 23 Feb 2017 09:59:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NEuwB6028138 for ; Thu, 23 Feb 2017 09:56:58 -0500 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NEuwkg005344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 23 Feb 2017 09:56:58 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CC45C04BD4F for ; Thu, 23 Feb 2017 14:56:57 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1NEskBE036468 for ; Thu, 23 Feb 2017 09:56:55 -0500 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0b-001b2d01.pphosted.com with ESMTP id 28sw9b4yua-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Feb 2017 09:56:55 -0500 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Feb 2017 00:56:52 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Feb 2017 00:56:50 +1000 Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id F11DA2BB0057; Fri, 24 Feb 2017 01:56:49 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1NEufLI35979506; Fri, 24 Feb 2017 01:56:49 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1NEuHUH027760; Fri, 24 Feb 2017 01:56:17 +1100 Received: from localhost.in.ibm.com ([9.124.35.101]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1NEu19C027181; Fri, 24 Feb 2017 01:56:16 +1100 From: Nitesh Konkar To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 20:25:36 +0530 In-Reply-To: <1487861739-24929-1-git-send-email-niteshkonkar.libvirt@gmail.com> References: <1487861739-24929-1-git-send-email-niteshkonkar.libvirt@gmail.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022314-0040-0000-0000-000002F327C1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022314-0041-0000-0000-00000C4C79CF Message-Id: <1487861739-24929-8-git-send-email-niteshkonkar.libvirt@gmail.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-23_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=15 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702230140 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 23 Feb 2017 14:56:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 23 Feb 2017 14:56:57 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'niteshkonkar.libvirt@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.06 * (BAYES_50, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_SOFTFAIL) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com Cc: Nitesh Konkar , Nitesh Konkar Subject: [libvirt] [PATCH v2 07/10] perf: add page_faults_maj software perf event support X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch adds support and documentation for the page_faults_maj perf event. Signed-off-by: Nitesh Konkar --- docs/formatdomain.html.in | 9 +++++++++ docs/schemas/domaincommon.rng | 1 + include/libvirt/libvirt-domain.h | 10 ++++++++++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 1 + src/util/virperf.c | 5 ++++- src/util/virperf.h | 1 + tests/genericxml2xmlindata/generic-perf.xml | 1 + tools/virsh.pod | 3 +++ 9 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0d2834b..3d94441 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1942,6 +1942,7 @@ <event name=3D'context_switches' enabled=3D'no'/> <event name=3D'cpu_migrations' enabled=3D'no'/> <event name=3D'page_faults_min' enabled=3D'no'/> + <event name=3D'page_faults_maj' enabled=3D'no'/> </perf> ... @@ -2062,6 +2063,14 @@ applications running on the platform perf.page_faults_min + + page_faults_maj + the count of major page faults, that is, where the + page was not present in the page cache, and + therefore had to be fetched from storage, by + applications running on the platform + perf.page_faults_maj + =20

Devices

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b8914d5..82327c6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -439,6 +439,7 @@ context_switches cpu_migrations page_faults_min + page_faults_maj diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index b7e6c71..f6e5c5a 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2250,6 +2250,16 @@ void virDomainStatsRecordListFree(virDomainStatsReco= rdPtr *stats); */ # define VIR_PERF_PARAM_PAGE_FAULTS_MIN "page_faults_min" =20 +/** + * VIR_PERF_PARAM_PAGE_FAULTS_MAJ: + * + * Macro for typed parameter name that represents page_faults_maj + * perf event which can be used to measure the count of major page + * faults by applications running on the platform. It corresponds + * to the "perf.page_faults_maj" field in the *Stats APIs. + */ +# define VIR_PERF_PARAM_PAGE_FAULTS_MAJ "page_faults_maj" + int virDomainGetPerfEvents(virDomainPtr dom, virTypedParameterPtr *params, int *nparams, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 2e95532..21f91de 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11266,6 +11266,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "perf.page_faults_min" - The count of minor page faults as unsigned * long long. It is produced by the * page_faults_min perf event. + * "perf.page_faults_maj" - The count of major page faults as unsigned + * long long. It is produced by the + * page_faults_maj perf event. * * Note that entire stats groups or individual stat fields may be missing = from * the output in case they are not supported by the given hypervisor, are = not diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8523e1f..5448119 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9575,6 +9575,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_PERF_PARAM_CONTEXT_SWITCHES, VIR_TYPED_= PARAM_BOOLEAN, VIR_PERF_PARAM_CPU_MIGRATIONS, VIR_TYPED_PA= RAM_BOOLEAN, VIR_PERF_PARAM_PAGE_FAULTS_MIN, VIR_TYPED_P= ARAM_BOOLEAN, + VIR_PERF_PARAM_PAGE_FAULTS_MAJ, VIR_TYPED_P= ARAM_BOOLEAN, NULL) < 0) return -1; =20 diff --git a/src/util/virperf.c b/src/util/virperf.c index 9e41df9..b3dd5c7 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -46,7 +46,7 @@ VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST, "stalled_cycles_backend", "ref_cpu_cycles", "cpu_clock", "task_clock", "page_faults", "context_switches", "cpu_migrations", - "page_faults_min"); + "page_faults_min", "page_faults_maj"); =20 struct virPerfEvent { int type; @@ -133,6 +133,9 @@ static struct virPerfEventAttr attrs[] =3D { {.type =3D VIR_PERF_EVENT_PAGE_FAULTS_MIN, .attrType =3D PERF_TYPE_SOFTWARE, .attrConfig =3D PERF_COUNT_SW_PAGE_FAULTS_MIN}, + {.type =3D VIR_PERF_EVENT_PAGE_FAULTS_MAJ, + .attrType =3D PERF_TYPE_SOFTWARE, + .attrConfig =3D PERF_COUNT_SW_PAGE_FAULTS_MAJ}, }; typedef struct virPerfEventAttr *virPerfEventAttrPtr; =20 diff --git a/src/util/virperf.h b/src/util/virperf.h index aa90273..49d4ba7 100644 --- a/src/util/virperf.h +++ b/src/util/virperf.h @@ -53,6 +53,7 @@ typedef enum { VIR_PERF_EVENT_CONTEXT_SWITCHES, /* Count of context switches */ VIR_PERF_EVENT_CPU_MIGRATIONS, /* Count of cpu migrations */ VIR_PERF_EVENT_PAGE_FAULTS_MIN, /* Count of minor page faults */ + VIR_PERF_EVENT_PAGE_FAULTS_MAJ, /* Count of major page faults */ =20 VIR_PERF_EVENT_LAST } virPerfEventType; diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml= 2xmlindata/generic-perf.xml index 62ad973..a5b6dfb 100644 --- a/tests/genericxml2xmlindata/generic-perf.xml +++ b/tests/genericxml2xmlindata/generic-perf.xml @@ -32,6 +32,7 @@ + diff --git a/tools/virsh.pod b/tools/virsh.pod index 6194aaf..18282f8 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -970,6 +970,7 @@ I<--perf> returns the statistics of all enabled perf ev= ents: "perf.context_switches" - the count of context switches. "perf.cpu_migrations" - the count of cpu migrations "perf.page_faults_min" - the count of minor page faults + "perf.page_faults_maj" - the count of major page faults =20 See the B command for more details about each event. =20 @@ -2351,6 +2352,8 @@ B applications running on the platform page_faults_min - Provides the count minor page faults by applications running on the platform + page_faults_maj - Provides the count major page faults + by applications running on the platform =20 B: The statistics can be retrieved using the B command usi= ng the I<--perf> flag. --=20 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list