From nobody Tue Feb 10 05:45:15 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1568198028; cv=none; d=zoho.com; s=zohoarc; b=grAuQDxZweAWAp2857BX6gzeoIcMFip3Xf4f8lFuCteP+mXh/5fK60mmFZ6rW7/quXUOxItZDbYv5STN8fl/tvzZaqjeg3GG96Q2p3AA0NoMFrt09xDQxrnuw2toojmHeIe2FC6ZAuQwY3LBiFeaa8IPlD9bBQkFiY/vRD+VvBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568198028; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=uBdzL211Ece7PgrTgXbxOBukDMkUw9sOYHPJ1fhOFbw=; b=ONQQJtj3r6pcZvgsXGuGxGJTl9n1U416i8qSsqMadxaT6wWuAt7MSvWF3obOGH12SPLjj84A1jnk2sWY0wzCoSPhHUTK9DVVkyAl4kdX1XQL0Uk/gl7Fsmf1e9sLqYtxDwdHO1y3rkgfKpxFk8HclwjQ7GYGMLGFsMtMRphWr+A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1568198028463981.4972899392666; Wed, 11 Sep 2019 03:33:48 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvT-00007Z-K9; Wed, 11 Sep 2019 10:32:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvS-00007G-AS for xen-devel@lists.xenproject.org; Wed, 11 Sep 2019 10:32:38 +0000 Received: from mail-lf1-x143.google.com (unknown [2a00:1450:4864:20::143]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 74df8a82-d47f-11e9-b299-bc764e2007e4; Wed, 11 Sep 2019 10:32:30 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id w67so16009003lff.4 for ; Wed, 11 Sep 2019 03:32:30 -0700 (PDT) Received: from aanisov-work.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id w27sm4585275ljd.55.2019.09.11.03.32.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 03:32:28 -0700 (PDT) X-Inumbo-ID: 74df8a82-d47f-11e9-b299-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aqXFQn3KxWtsIDGkNKwWIgnyKzS5VXO95uQ8ju2Spbk=; b=Q/90VE4ZsQYdXaQZj0SMpAOryuSI4oLF014698oCBwgip3cEhFWFwdgsHd2Z5hP2Af 5s0EbjXov/zOjTok7I7AMBfPe9OyiuNt+pWBnb9AXea0L92tiMW+nO9pNCcr4ZPtq2f+ Z0fdxxeLEWsPNvTQNe8xnMz1JMa/1UU+M0Lso3czkFew5EO1ajQr6RkH76tRjrnfaT+u AmW8SzEkCNyMZJtkPsJn4W4T0EUwILs+I6AeiOSzIY3DwX+npRDWD0q5/ZxcLDlMxRay 164vu7VAwvPEqImM+vus132RB7w4Fsjy+Te7LwOwWVCH+tDSM1FxoeNIKysP+WjNtic9 N7gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aqXFQn3KxWtsIDGkNKwWIgnyKzS5VXO95uQ8ju2Spbk=; b=j6c18ILiyX5zKU43/wSGRIKnQbjbzY+6nICPG+DmLvTbIxmocZ5Hp8xZhPp9nlUmWx Nf01AjSWNou7snkF3CJweKVqZhv++qSKxMKIiZMdchql75Ijw9SkiRcLLqJYda30J5bA gRzjR27AxYrqImu3PMmJrWKrNN1gYh0ouqaSOS3FEXrqMgr6e8y+Qj3kYqWQT8CELOwG kormlF5S1CjkW8TWjJmjFtJZdCo0qOJ9rhG/BNwP5eUtbOChRg0SzvPasIkOXF9WTrQY 0nf4ntuTmv75cEMTp97HvcjaD3mN9nvBfAoNFZPOUzQZmV+efSUnucMpUgZHGi+IarCm gl3A== X-Gm-Message-State: APjAAAUNWZSQaRkV/5HbhQ1aIZFWHIt2sqzpHomdzN47rMyDwsOwc2U9 J9Jjea0F6wrXwS5dx6WlCc2rlfPde38= X-Google-Smtp-Source: APXvYqxwhq4bqGgpmK+m18qIu6USIpEwLeSuAJRw7jtd6RNL/NRsYXdybm/xkxz6mT9NmS7BUwRXJA== X-Received: by 2002:a05:6512:6c:: with SMTP id i12mr23753466lfo.40.1568197948968; Wed, 11 Sep 2019 03:32:28 -0700 (PDT) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Wed, 11 Sep 2019 13:32:15 +0300 Message-Id: <1568197942-15374-3-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> References: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> Subject: [Xen-devel] [RFC 2/9] sysctl: extend XEN_SYSCTL_getcpuinfo interface X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Tim Deegan , Stefano Stabellini , Andrii Anisov , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Dario Faggioli , Julien Grall , Jan Beulich MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Andrii Anisov Extend XEN_SYSCTL_getcpuinfo interface with timing information provided by introduced time accounting infrastructure. Signed-off-by: Andrii Anisov --- xen/common/schedule.c | 33 ++++++++++++++++++++++++++++----- xen/common/sysctl.c | 4 ++++ xen/include/public/sysctl.h | 4 ++++ xen/include/xen/sched.h | 4 ++++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 6dd6603..2007034 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -208,13 +208,36 @@ void vcpu_runstate_get(struct vcpu *v, struct vcpu_ru= nstate_info *runstate) =20 uint64_t get_cpu_idle_time(unsigned int cpu) { - struct vcpu_runstate_info state =3D { 0 }; - struct vcpu *v =3D idle_vcpu[cpu]; + struct tacc *tacc =3D &per_cpu(tacc, cpu); =20 - if ( cpu_online(cpu) && v ) - vcpu_runstate_get(v, &state); + return tacc->state_time[TACC_IDLE]; +} + +uint64_t get_cpu_guest_time(unsigned int cpu) +{ + struct tacc *tacc =3D &per_cpu(tacc, cpu); + + return tacc->state_time[TACC_GUEST]; +} + +uint64_t get_cpu_hyp_time(unsigned int cpu) +{ + struct tacc *tacc =3D &per_cpu(tacc, cpu); + + return tacc->state_time[TACC_HYP]; +} + +uint64_t get_cpu_irq_time(unsigned int cpu) +{ + struct tacc *tacc =3D &per_cpu(tacc, cpu); + + return tacc->state_time[TACC_IRQ]; +} +uint64_t get_cpu_gsync_time(unsigned int cpu) +{ + struct tacc *tacc =3D &per_cpu(tacc, cpu); =20 - return state.time[RUNSTATE_running]; + return tacc->state_time[TACC_GSYNC]; } =20 /* diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 92b4ea0..b63083c 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -152,6 +152,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_= sysctl) for ( i =3D 0; i < nr_cpus; i++ ) { cpuinfo.idletime =3D get_cpu_idle_time(i); + cpuinfo.guesttime =3D get_cpu_guest_time(i); + cpuinfo.hyptime =3D get_cpu_hyp_time(i); + cpuinfo.gsynctime =3D get_cpu_gsync_time(i); + cpuinfo.irqtime =3D get_cpu_irq_time(i); =20 if ( copy_to_guest_offset(op->u.getcpuinfo.info, i, &cpuinfo, = 1) ) goto out; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 5401f9c..cdada1f 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -168,6 +168,10 @@ struct xen_sysctl_debug_keys { /* XEN_SYSCTL_getcpuinfo */ struct xen_sysctl_cpuinfo { uint64_aligned_t idletime; + uint64_aligned_t hyptime; + uint64_aligned_t guesttime; + uint64_aligned_t irqtime; + uint64_aligned_t gsynctime; }; typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 04a8724..8167608 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -876,6 +876,10 @@ void restore_vcpu_affinity(struct domain *d); =20 void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate= ); uint64_t get_cpu_idle_time(unsigned int cpu); +uint64_t get_cpu_hyp_time(unsigned int cpu); +uint64_t get_cpu_guest_time(unsigned int cpu); +uint64_t get_cpu_gsync_time(unsigned int cpu); +uint64_t get_cpu_irq_time(unsigned int cpu); =20 /* * Used by idle loop to decide whether there is work to do: --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel