Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1698214rwo; Wed, 2 Aug 2023 20:14:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlHBSMxMn95kGD6kECAWcFylwjSaTWchdeoWKXvm1d+y1otxY0tJxhWJlY7sNCpPIAurGSV1 X-Received: by 2002:a05:6830:1d98:b0:6b8:8c15:5249 with SMTP id y24-20020a0568301d9800b006b88c155249mr19237370oti.24.1691032459118; Wed, 02 Aug 2023 20:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691032459; cv=none; d=google.com; s=arc-20160816; b=uY/d0Tj3TZw9zZ58shmnO6wG0tKqUHTOh9AyjXYbsD23T7kdVVJ8IJyor1jm6GV0Ao sDVlA8ueHRiIq9wuXWndPyg8STWWi7u++FzaLy1EFBOvS8Gc7kX9GSAZCVnxZSgLMWx+ BYfWd4n0zpIXgxMaJwbUiYPeM+7so4oJ2QehCZt70siDLcGpaAj/Dzp+EKkBPX3EDN1G WCQDW1RRtQGbJxTAQxnZP/x6YIllSTuu8i6AB9KqwW69OWnp5knLQPfpe43tqNllGis/ rdRXYEdS+/AlAIlQHH14ghESCB4jEE29pGjzxn3LRYZ4YTzGQiCCv89TKUNANlMeXYp7 6skA== 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=fvvMXPp4SKpRXIY59WG2g+JxC1XAUWws7WbO+/Y/VA4=; fh=vBXozhnPXwSB3DJhjnKWz3f6luaN/KxHDpM6/QeZg4o=; b=I+AVjyssRszcpiJwZWXvg3U2r9mNYduZtoPBa2iJKTJs475lY9J47BdRx96W1E/zbg sBRx9qKqIWFfea/goykdemPaVHiN8m0hc+pvglO0vKmxBesSU54HiryqPGAkkwiZwbQ9 +eRGbNbV+OcUrKTO8JJsKYMajYQDmBXqv1n35aCUXsVKcdbOSmOcQ93LBwItip8l0h5Z 7vaMFJLKxMaf125v1+3Agi2sYkRy1IUJmfXDXHSuTM0lr5KxWNkOt7PRc1COCVrG8U6Q E+EuKR1OAclZqZgXFNCDjNA28gy29LIAP1n7ZY57YDEwZGfdywfRpYtbgyhvI6CqBhlg 7zjA== 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 j32-20020a635520000000b0055c4c9cc005si11754003pgb.499.2023.08.02.20.14.07; Wed, 02 Aug 2023 20:14:19 -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 S231520AbjHCCYN (ORCPT + 99 others); Wed, 2 Aug 2023 22:24:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbjHCCWy (ORCPT ); Wed, 2 Aug 2023 22:22:54 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0EDC3ABC; Wed, 2 Aug 2023 19:22:07 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8BxIvBND8tkVWkPAA--.35244S3; Thu, 03 Aug 2023 10:22:05 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cx_c4yD8tk8oNGAA--.51268S17; Thu, 03 Aug 2023 10:22:01 +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 v18 15/30] LoongArch: KVM: Implement vcpu status description Date: Thu, 3 Aug 2023 10:21:23 +0800 Message-Id: <20230803022138.2736430-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230803022138.2736430-1-zhaotianrui@loongson.cn> References: <20230803022138.2736430-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Cx_c4yD8tk8oNGAA--.51268S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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. Reviewed-by: Bibo Mao 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 8ce84ae6b841..4e1ff58cc61b 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