Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4288383rdb; Thu, 14 Sep 2023 19:03:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtlc+KrfNgHnUjMyudagaOlgjnU5FnDff05w0Omkby/eClX11mrIPxVCgzfIVwHqjrHWAR X-Received: by 2002:a17:90a:6c02:b0:269:6c5:11a7 with SMTP id x2-20020a17090a6c0200b0026906c511a7mr231429pjj.17.1694743409087; Thu, 14 Sep 2023 19:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694743409; cv=none; d=google.com; s=arc-20160816; b=ukFQQnrRGRc3wBBzlrxcpJQ1N2vl5MrMUtM5XafO53ZIM6m0WDNSg0DoOS+9zvTFFA JUHATjehiKbEx9Q+6zeCGr0nhHI4fUA54GwtYPxNEX4kSaQXR5DLJ7xiSgNip5rmmvM2 W9zjLXAw8oyFObVcDWw4BXm75GLebNmvuHZI6sOdkBF48u/VLZUVYD+YvQIF29bIPsjz LOCASFZmiuPNfbfac35k8hkAna1a03r8eFz6oqV7RDqset9J9XFL18i/xalwaM9kJlch qrJNlf+vF7FMjsfy+npv+cmrURLfC3LYL9nXeCb7iBZ3tu/Eq4Sm7dJBvpNt1VRtOgxa fthw== 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=4x9fB0LqhJ5bESeebL43eSzMxsBggRdSxQXe6ro6UJo=; fh=ejoaVAUUbBXsA/6jM/beuI9xCYtV2osdR9SpI7hjY84=; b=PP4tcTHjDpsI8bOi7M2an6tSMdbJu3hLDFQdslZwPMeBRoMpkmGm8GlnzFD3VDOfhe KG2yNXNbNN6h2GbWaCJGdFLB8zYWsmx7ERNSyLWvMT/34XZJUMSq/UrSJnnVPM+iPMUH HzBBuQ6R95CgdLhoDtASrapkNQkJz5tYulB5vClNIaVFDQ98KmOK71Ycxn+dmP7/kh4y h+1l/o+pF8AyX1gvRSNivohv2yGF5lAyjNmOOa8nrogSzpXATjXN94utLE823G3GIoJ0 uOgRvKWQdfNOr2F81J+zXqkIBnyNG9zzPWactXRhJaBEO1SvJ72jTk2FF2hUP2WfBxLJ j2VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id lp1-20020a17090b4a8100b0026923261e44si5116552pjb.42.2023.09.14.19.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 19:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3A39282F4E36; Thu, 14 Sep 2023 18:50:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231382AbjIOBue (ORCPT + 99 others); Thu, 14 Sep 2023 21:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbjIOBu3 (ORCPT ); Thu, 14 Sep 2023 21:50:29 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A722B2716; Thu, 14 Sep 2023 18:50:05 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Bxd+hHuANlAf8nAA--.40979S3; Fri, 15 Sep 2023 09:49:59 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axndw9uANl+ioGAA--.11927S17; Fri, 15 Sep 2023 09:49:58 +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 v21 15/29] LoongArch: KVM: Implement vcpu status description Date: Fri, 15 Sep 2023 09:49:35 +0800 Message-Id: <20230915014949.1222777-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230915014949.1222777-1-zhaotianrui@loongson.cn> References: <20230915014949.1222777-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Axndw9uANl+ioGAA--.11927S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 18:50:37 -0700 (PDT) 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 7162e6ddb7..9cca9f4a0c 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.39.1