From patchwork Tue Mar 28 12:31:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 76061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2188517vqo; Tue, 28 Mar 2023 05:49:29 -0700 (PDT) X-Google-Smtp-Source: AKy350aVJ0ONedw1LObjdB+EJ+UB3VtKsY6aNs8HAVPxiD9NH9NbKcsZWkWzVyLoCqwXF3ztNZ21 X-Received: by 2002:aa7:d784:0:b0:500:50f6:dd30 with SMTP id s4-20020aa7d784000000b0050050f6dd30mr15845396edq.15.1680007768745; Tue, 28 Mar 2023 05:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680007768; cv=none; d=google.com; s=arc-20160816; b=xWPhmvVaRhhbCalwy67KqVco7+iS9pHhdOsFi/kBqDb0iplU849SrzEzRyIq2sOq6i GfR05zgnHo8eRBmmiHD5RE/Pdh+ou1VSGqzBVdA66YMdaCuEpGLELjchaZJr7kCk4G1i b2Jcm00aWjOknOExjPB4veviECrujBuHlIQbSz9cCChjHYkiXMtFSIhJ4WiPAfxf3Ba2 YIpJFbXffWIXy6qdsJSJCYsloFr0ehVJ31Er59Agvd1SkpKvzzzDnuQlk8ghVkgdpP4j CO6g8+lqtWCamty4kQEv2lvSo6sTZcU4HYqtFWxbQ/00qcFkLQC4ZjOgtlF0nMDm61th H+Jw== 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=y/oGVovxHEqXHiT6+jtvlxENmDMFvXZ2OfTmnJOUyoCZC9/tCb/BnvB1NEL7HYQoIy KbKyYq3VlRkdD8u72ydBRrtPGHWQLjFWbSKAsLZnhod5zlP7dPBnW7CJsAdlcP/UY8Xo A2iFaUmlx+qVJN0zhIhQCmvJ0Sf40g8DxtmVsHt3Mp57k/o9tXfitVFaKWtPsslZfzWj C2po8C2ZVhHmd7z6v2jOnTuqHbzPT+plpLend2dlZlCgrF4kiRufHqU+ZeNk82791t1F +VenI+GvizfuKPbXkSbZkJBXt+gcLkCDnFoHiA35KFoCLUemT1AwL35+PH8npYmT5gGc 8vaw== 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 n1-20020aa7c441000000b00501e4be89e6si18480410edr.280.2023.03.28.05.49.04; Tue, 28 Mar 2023 05:49:28 -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 S232453AbjC1Mpb (ORCPT + 99 others); Tue, 28 Mar 2023 08:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbjC1Mp3 (ORCPT ); Tue, 28 Mar 2023 08:45:29 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77A0B8A66; Tue, 28 Mar 2023 05:45:06 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxEzQb3iJkMxkTAA--.29270S3; Tue, 28 Mar 2023 20:31:23 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxPL4X3iJku2cPAA--.12046S17; Tue, 28 Mar 2023 20:31:23 +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: [PING PATCH v4 15/29] LoongArch: KVM: Implement vcpu status description Date: Tue, 28 Mar 2023 20:31:05 +0800 Message-Id: <20230328123119.3649361-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230328123119.3649361-1-zhaotianrui@loongson.cn> References: <20230328123119.3649361-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxPL4X3iJku2cPAA--.12046S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrWfXw17tr1kuFy3WFy8Zrb_yoW8Jw4rpF nrCa4Ygr4rWwn3Ww1fJ398Xw47XrWkWF1fWr9Fq34akFsrtrn5XFW8KFWDGFyvy34Fyr1S qayrt3Zrua90yw7anT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj 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=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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?1761615826417210629?= X-GMAIL-MSGID: =?utf-8?q?1761615826417210629?= 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);