From patchwork Tue Mar 21 03:56:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 72664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1576495wrt; Mon, 20 Mar 2023 21:10:07 -0700 (PDT) X-Google-Smtp-Source: AK7set8FM8+LUIXQsImJxyAKGn3QGARbmphqfpa+7jntKgeXgcdSko7E0eRv1AREp2OnrsLZpv4k X-Received: by 2002:a17:902:d505:b0:1a1:e39c:d4d1 with SMTP id b5-20020a170902d50500b001a1e39cd4d1mr738186plg.67.1679371806866; Mon, 20 Mar 2023 21:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679371806; cv=none; d=google.com; s=arc-20160816; b=sRX50F1oplFU1z2ShypMSJCCFmvrVAhZIqDBauD4Tfc/csmDd3ehuV037gnQv+qKFX 6+S7/9p/+gE/kH45HElXRoBOjfDGZBT6n0SDR8D+71U6JQQyG7cHY1tHMPG0VLPp8IOj XOznabwdyw7LdQRnFlGUSSAju3lx4Ozye8/x44XEbEvACw7/Q8nzRW8LGJLtlmNK1k5y n4WQUWNUIjWmZa7WuIYujamRP9GAEOz1La7VMckKfVaEIt+/vnay8LbWc0l4ZWzIUamO XNnxvsqI8Qe1lcuOzy0m3/so5UgQzJQwHD/bi1Jsl7EZcAo9AtTz2MFIkbbRVKJvyzXg 5zFw== 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=AA7k2H160dyCJOOTIXJafK3AGYd5clnF/9Vhza6Xez8=; b=tCAnxCeNUsTpEjArgDhvaTZPqlE1TEcUMBvIZo10nkgE8qcheEZcs2+4tL0WPjZAYB Ne5byjNxn34UyuTGNnzOeoKAgU3OQFRYC69fpJdyiFmC+AB1nwzTzoBgfHdHYHxH4tPV /OqEFLi6I9ZKkd6b8mdo0xT2c0QDQ3VJ5pvA7CWtjAqJ0Ur9ATLYlMlA2iXvoS0Ig+d6 M0zWuWCh8kAUbi4R1R3pK6Xj7RUVHqkPAr/Xd4eALMHzpBQEhiwO0Hl22vtDxAZIeb1+ 0ifpZDqX5bOGakdvkTKHRyMz6jlo30rF8+UxJJgNiAzHj5VXoTDCp+coTBelwD2uSLdJ Hw7g== 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 t12-20020a170902b20c00b00189c05664e8si11887715plr.563.2023.03.20.21.09.52; Mon, 20 Mar 2023 21:10:06 -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 S230103AbjCUD6E (ORCPT + 99 others); Mon, 20 Mar 2023 23:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjCUD5E (ORCPT ); Mon, 20 Mar 2023 23:57:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A2BBA2E0F9; Mon, 20 Mar 2023 20:57:02 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8BxYU8NKxlkgDYPAA--.22483S3; Tue, 21 Mar 2023 11:57:01 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxD78EKxlkQB4IAA--.33942S17; Tue, 21 Mar 2023 11:57:01 +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 Subject: [PATCH v4 15/29] LoongArch: KVM: Implement vcpu status description Date: Tue, 21 Mar 2023 11:56:37 +0800 Message-Id: <20230321035651.598505-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230321035651.598505-1-zhaotianrui@loongson.cn> References: <20230321035651.598505-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxD78EKxlkQB4IAA--.33942S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrWfXw17tr1kuFy3WFy8Zrb_yoW8Jw4rpF nrCa4Ygr4rWwn3Ww1fJ398Xw47XrWkWF1fWr9Fq34akFsrtrn5XFW8KFWDGFyvy34Fyr1S qayrt3Zrua90yw7anT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj 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.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?1760948971839173419?= X-GMAIL-MSGID: =?utf-8?q?1760948971839173419?= 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 319129de4..3382bb0cd 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);