Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2396889rwd; Sun, 21 May 2023 20:26:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66Uy208l0P0qzJnNwdxBhLVH1G0nqOplv0ykmOzTHBZahh5u/6/PgmrUHcrwx6SK4wlzEE X-Received: by 2002:a17:902:ba8c:b0:1ae:6290:26d with SMTP id k12-20020a170902ba8c00b001ae6290026dmr9883690pls.7.1684725970462; Sun, 21 May 2023 20:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684725970; cv=none; d=google.com; s=arc-20160816; b=ZK/lOMFwmcsDArHzon99hvVNpaqrDSu3X9vWLxXSN1/dX9jhv2TzU5uPp6/xGKDW9p ScVkv3M7lpTWowZCowwTJMCUHVo8p64JacNUjD/I8VvxFRCP60EUiPccMQ24132TlBpA rlHqr2id8O2lOM63kMDnM9+eN6v2QVKIkBSiu4teG+5z5vF7AtXjWTUxqpGY1HOH+YhQ hNpoQIl6uYdCJidWifFZ0MdVGmg3my88acVEgnMd6cQhRjbG37bHnufuK3l/7MERGtKs iSON+s8V3Q6kqry+Ta3hXQBqjtiMhgIdL3NMGufKZSs3bH6mDyGaMCvzCb7EimY6aNnN cNPw== 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=nzyy1KkrkQNw/jBMcD8fbA8WpjmdVpfxzrELmrq+6vM=; b=vWhq81XlNGDf8GIRZIwX6NgnRD8vJCNoa25c/QSbG3maKdHrJ371j0G4X9eCb6EXol xBsEBnKtYMfLxV5z5GQ3KyV1v4BhTzqLVoOA50sDIGrpCuu+RH47wEVLyEhzgMf5/FK0 Xs8NmKqwDKWlAfXQ5fxSPs+4RZUxr2vHMR11cugYaHWfoDehDyVtiOkfELTsKTpzbkvI uViEDCmi+jhht+XhBJm7u28TM+0LqrBNulbEhtg+Ijg9wmWR6EpQukKSDfJXOW3/kA55 uccx7rRpSbSJeTCaXANsyzAwPbKD6e4N2bEMeqJcwskQoRv0lyBhJAnBYL7hQddo4zES QHVA== 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 d12-20020a170903230c00b001a63e4ff6fbsi4318464plh.178.2023.05.21.20.25.58; Sun, 21 May 2023 20:26:10 -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 S231801AbjEVDNk (ORCPT + 99 others); Sun, 21 May 2023 23:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbjEVDM0 (ORCPT ); Sun, 21 May 2023 23:12:26 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4178BE0; Sun, 21 May 2023 20:12:23 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxyOmX3WpkaMsKAA--.18765S3; Mon, 22 May 2023 11:12:23 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxMMiR3WpkJIFuAA--.54000S17; Mon, 22 May 2023 11:12:22 +0800 (CST) From: Tianrui Zhao To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton , maobibo@loongson.cn, Xi Ruoyao , zhaotianrui@loongson.cn Subject: [PATCH v11 15/31] LoongArch: KVM: Implement vcpu status description Date: Mon, 22 May 2023 11:12:01 +0800 Message-Id: <20230522031217.956464-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230522031217.956464-1-zhaotianrui@loongson.cn> References: <20230522031217.956464-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxMMiR3WpkJIFuAA--.54000S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7uw4kGry8Kw4DWrW7KFyrXrb_yoW8Gr1UpF nruas0gr4rWwnxWw1fJ39xXw43XrZ5WF1fWr92qryYkFnrtrn5XFW0krWDGFyvy34Fyr1S qayrtwnxua90yaUanT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bxxFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aV CY1x0267AKxVW8Jr0_Cr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487 Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VCjz48v1s IEY20_WwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_ JF0_Jw1l42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxFaVAv8VWrMxC20s026xCaFVCjc4 AY6r1j6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCj r7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6x IIjxv20xvE14v26w1j6s0DMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8Jr0_Cr1UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvj4RKpBTUUUUU X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 a48f4b17ddc5..28319500c091 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -12,6 +12,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.39.1