From patchwork Wed Apr 12 08:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 82317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp174904vqo; Wed, 12 Apr 2023 02:05:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Zech9kOKr5XH5AeR/WWcuC44KvpHTGNWJMsboEMcmfLv37khtZUCSwLhk7/NPnUqncuUqF X-Received: by 2002:a17:906:4406:b0:933:4dc8:972d with SMTP id x6-20020a170906440600b009334dc8972dmr13203062ejo.20.1681290332816; Wed, 12 Apr 2023 02:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681290332; cv=none; d=google.com; s=arc-20160816; b=dyksBzRE1evrROAJoycOrDmTp/DkD4JCw67wwW975s76YUOTAw9T9/h3CZlTtPTCrR nDttYKOdgym60AYJ0zFKqsAx27K7UrwAkZGxXWbswwqIemOJ1F40TuvcRKZoorYKV/fY ghENpfHil2pThs0Jiw+XWeUC+aEh94KLRMHBnPSmsqlg4rJBxWs3Tx3aMtUCWwpaPqu4 087Co/v9/qBnorZiz7bA0z9EAU7/8RtnkvCcvbgVX3KOMuwhVXZzJO2PsXmac8E7vrLj L8dvlACbjSGu/H4yr38BIlZ30ffYYQs/+i6WNacCOqXuhzB9C9BTduNaD6Qmlxb/R08F VpJA== 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=AXVBsGP9dGtiGUR+ATnfelBRH8JclPevK3yLJBitAix+ClXcIaO6G3hxI9p0wVKfCS N+5hSVD7505L4XgLhmsPilc9otcLlQpV9L1dW1d2aKxOMG7dMIQXwQEG/0tQheYVN+Jr zLG6cg91EC9Q75nvgvcryY4qTUkXpG3dFMkZRzIjtVrl+rM8a2vMUaiCD9oRHdtYnc4o KaOYIhtzzkoJKrU1D9XGqDWPI8AhnXbkuEG9xU9fRm6Iowza3XDfI9rmQrpNdsmpO4Y6 z0ImgJLPwMvwbEbqPtwjAloxu7l7KJr0h72cYEE1+M8ZiD5wcpk5kz8zvzmxtao/cvbo eX2A== 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 nb34-20020a1709071ca200b0094a99b59877si1596056ejc.712.2023.04.12.02.05.08; Wed, 12 Apr 2023 02:05:32 -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 S230173AbjDLIb0 (ORCPT + 99 others); Wed, 12 Apr 2023 04:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjDLIag (ORCPT ); Wed, 12 Apr 2023 04:30:36 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6D2EE1FF3; Wed, 12 Apr 2023 01:30:32 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxEzQnbDZkmCEbAA--.42003S3; Wed, 12 Apr 2023 16:30:31 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxC74fbDZkdKwgAA--.35751S17; Wed, 12 Apr 2023 16:30:30 +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 v6 15/30] LoongArch: KVM: Implement vcpu status description Date: Wed, 12 Apr 2023 16:30:08 +0800 Message-Id: <20230412083023.1693910-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230412083023.1693910-1-zhaotianrui@loongson.cn> References: <20230412083023.1693910-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxC74fbDZkdKwgAA--.35751S17 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 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?1762960692390345279?= X-GMAIL-MSGID: =?utf-8?q?1762960692390345279?= 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) &&