From patchwork Mon Apr 17 09:59:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 84118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2002649vqo; Mon, 17 Apr 2023 03:03:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aUEcaP969ozHEOL8grgUePgPq4hxpqyw3/Gui30AKS9npjheLNmy9U3vTmhTiLEshwL1JW X-Received: by 2002:a17:90a:f417:b0:247:6619:61de with SMTP id ch23-20020a17090af41700b00247661961demr6666629pjb.46.1681725785464; Mon, 17 Apr 2023 03:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681725785; cv=none; d=google.com; s=arc-20160816; b=Xfysoj3ie2pqaNzy0oVGHvCbAn6Al9KiYy5bDul3jPaaKUq9LZ2YEPOaaLGDjmPnbb qQzKaZpwRqX+VUfiDBUohE9W0U+LPzNPhp6vncm7mIrnE2nHw97NEXtGsMtjt6rCxrvS RgeNhe1cTiog+fVxufgj62vgionjHPy0zuGQaKSlFixxDLgivjXCgWsH4dWwx5N5tofU uMevlEZd4MKxTRl46f5bz8Kae+LE4+9gcZlSCoNIdwZ5rFK5wtLIlgnkikj1VDxpv6EI RR9P+1HH+hve1Kirw1TOPkRL55L18/nn3K7x2zqCZHxSePUbZF3wmz8D48SOCKHE9ysC N+qQ== 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=BE7FaryA8Rz4PCjV/VyN+79Ihx+pc2FpvMWjzmaJCJ9YM9YrUG6CaV+cKWrh8u8STL HHUGf4IGQVkXfMkT5hxwWo7/lWEuIdYV2zgmUD4gvsfx1hUOveEpQ7zD56vR9a30efND +qqUfHYwvdUtOt8N/eelO5tR95COSDOQOFIegldKv/XudnxnudSxfPzomp5ahBWHMQxh UxiVZh7eeuyMMrzDOVLb7lRsUyitpFVQfooyjn1kKo1PZzbFoQ4ophBmAd4PZOov+FQ5 bksdTg8DnAy1vLKxVdczipTMNrd8/njboEHVpO1DskGKTFeKZ5SfHluZCz5aAqvnA8EH vbdA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r19-20020a17090aa09300b00230ca3efcf3si10742018pjp.158.2023.04.17.03.02.53; Mon, 17 Apr 2023 03:03:05 -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 S230397AbjDQKCU (ORCPT + 99 others); Mon, 17 Apr 2023 06:02:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbjDQKBZ (ORCPT ); Mon, 17 Apr 2023 06:01:25 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1BC11FF6; Mon, 17 Apr 2023 03:00:46 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxJDSbGD1kZ+YdAA--.47190S3; Mon, 17 Apr 2023 17:59:55 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57yWGD1kua0qAA--.48254S17; Mon, 17 Apr 2023 17:59:54 +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:59:35 +0800 Message-Id: <20230417095950.875228-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230417095950.875228-1-zhaotianrui@loongson.cn> References: <20230417095950.875228-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx57yWGD1kua0qAA--.48254S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrWfXw17tr1kuFyfAF47urg_yoW8Gr1UpF nrC3WFgr4rWwnxWw1fJ39xXw47XrZ5WF1fWr9Fq34akFnrKrn5XFW0kFWDGFyvy3sYyr1S qayrtwnrua90yw7anT9S1TB71UUUU8JqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bcAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7 CjxVAFwI0_GcCE3s1ln4kS14v26r4a6rW5M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF 6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6x8ErcxFaVAv8V WrMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVW8ZVWr XwCF04k20xvY0x0EwIxGrwCF04k20xvE74AGY7Cv6cx26rWl4I8I3I0E4IkC6x0Yz7v_Jr 0_Gr1l4IxYO2xFxVAFwI0_GFv_Wrylx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_tr0E3s1lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owCI42IY6xAIw20E Y4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr1j6F4UJwCI42IY6I8E87Iv6xkF7I 0E14v26F4UJVW0obIYCTnIWIevJa73UjIFyTuYvjxU42YLDUUUU 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763417297283934038?= X-GMAIL-MSGID: =?utf-8?q?1763417297283934038?= 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) &&