Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3737497rwe; Mon, 17 Apr 2023 02:49:55 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNrE0OI+yK9BhFWGDu59uyFSWBrv4CjGe1jxRv5ksCWMJhp7IsIVToLxDmiIz/KPsqs5bL X-Received: by 2002:a17:903:2289:b0:19c:e842:a9e0 with SMTP id b9-20020a170903228900b0019ce842a9e0mr13657060plh.16.1681724995395; Mon, 17 Apr 2023 02:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681724995; cv=none; d=google.com; s=arc-20160816; b=kn28207yVl5X8Rw3ZmHVMheIQDev4XFzbj93X4buRjMrxkgpVJbHqok56GCn3IOR+f 5otzudnnlmTv9jwUUvQd6KuNY4CIYAr4vzm7uAbSTpXEQekUj5s+CH/MUHEG84G/T59R dgjvua6GS4XYJOcZsbI/EL5gweNBnB+GWQXC4XJlB9Y+cI2tPDttv9heim8zZCe6fnjE FjmbxlCPXao8ihQyPjfenWgTvU9x/eyN9tL/yjzQCA0aEbPeert8LGrKt4oIkV8Ht4TH Zz4LlF99XeW+yv/Ji2dUyBDkeUub+n5OX1d9XkBcI+sp0VPRbOeSIMtv76mCdAN2u4Ez ZwTw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VX0IQ0Y/vjdrOOt+940kw6nzpRjcrJkHGUBKmJvNGaU=; b=0Zurms0uPqgYVkRHddp51SUWnU9dES/s26QeiD6kyZyJruUB4vv6vDuqb3aS9JPhsl lMIxCg+49I89EcHxmzJOcdLISO8GSx7p50IRd5IEzI6KeFUtF+eh/lFthfBucJozmJgZ 390fmpg0pbnORdKoyFO4BS71fY9mcS8khzn5U+XrSveDpKR5nQeSNxpdpc5ZSUw5Jdx6 pym7JIMLxGuVRobtodYw6xoLf5Z9ougV/3ZqgX/KXRVGfTSLK6i45b18RI3HNsvwuQdY gSzNj9MbZ+eSR39uJUuI2jSbVqTPSlG6gott+cP4hxQhcCOs9cuBoPvvtEMC+t4RIimk iCUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a170902c40600b001a6d08ead4dsi3406721plk.641.2023.04.17.02.49.41; Mon, 17 Apr 2023 02:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbjDQJsb (ORCPT + 99 others); Mon, 17 Apr 2023 05:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbjDQJr7 (ORCPT ); Mon, 17 Apr 2023 05:47:59 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A52E13C0E; Mon, 17 Apr 2023 02:47:22 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8CxidmQFT1kgeMdAA--.34945S3; Mon, 17 Apr 2023 17:46:56 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxtryKFT1kyagqAA--.47974S17; Mon, 17 Apr 2023 17:46:55 +0800 (CST) From: Tianrui Zhao To: Paolo Bonzini Cc: Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton , maobibo@loongson.cn, Xi Ruoyao , zhaotianrui@loongson.cn Subject: [PATCH v7 15/30] LoongArch: KVM: Implement vcpu status description Date: Mon, 17 Apr 2023 17:46:34 +0800 Message-Id: <20230417094649.874671-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230417094649.874671-1-zhaotianrui@loongson.cn> References: <20230417094649.874671-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8CxtryKFT1kyagqAA--.47974S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrWfXw17tr1kuFyfAF47urg_yoW8Gr1UpF nrC3WFgr4rWwnxWw1fJ39xXw47XrZ5WF1fWr9Fq34akFnrKrn5XFW0kFWDGFyvy3sYyr1S qayrtwnrua90yw7anT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b4AFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6x kF7I0E14v26F4UJVW0owAaw2AFwI0_JF0_Jw1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAq jxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E74AGY7Cv6c x26rWlOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I0En4kS14v26r12 6r1DMxAIw28IcxkI7VAKI48JMxAIw28IcVCjz48v1sIEY20_WwCFx2IqxVCFs4IE7xkEbV WUJVW8JwCFI7km07C267AKxVWUAVWUtwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWDJVCq3wCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwCI42IY6xAI w20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr1j6F4UJwCI42IY6I8E87Iv6x kF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7xRiTKZJUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement loongarch vcpu status description such as idle exits counter, signal exits counter, cpucfg exits counter, etc. Signed-off-by: Tianrui Zhao --- arch/loongarch/kvm/vcpu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index bac4ce2ec1eb..735fa3b0ab43 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -13,6 +13,23 @@ #define CREATE_TRACE_POINTS #include "trace.h" +const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { + KVM_GENERIC_VCPU_STATS(), + STATS_DESC_COUNTER(VCPU, idle_exits), + STATS_DESC_COUNTER(VCPU, signal_exits), + STATS_DESC_COUNTER(VCPU, int_exits), + STATS_DESC_COUNTER(VCPU, cpucfg_exits), +}; + +const struct kvm_stats_header kvm_vcpu_stats_header = { + .name_size = KVM_STATS_NAME_SIZE, + .num_desc = ARRAY_SIZE(kvm_vcpu_stats_desc), + .id_offset = sizeof(struct kvm_stats_header), + .desc_offset = sizeof(struct kvm_stats_header) + KVM_STATS_NAME_SIZE, + .data_offset = sizeof(struct kvm_stats_header) + KVM_STATS_NAME_SIZE + + sizeof(kvm_vcpu_stats_desc), +}; + int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) { return !!(vcpu->arch.irq_pending) && -- 2.31.1