From patchwork Tue Feb 28 07:00:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 62311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2868464wrd; Mon, 27 Feb 2023 23:30:28 -0800 (PST) X-Google-Smtp-Source: AK7set8Sw2HVg3nuqxE7gO+UnKmTJ+0F8luS7k71vShVBm+nOFEEi6yTZnYKXXpPyIqYozOyETuc X-Received: by 2002:a17:907:8690:b0:8e7:7da:421b with SMTP id qa16-20020a170907869000b008e707da421bmr2469670ejc.6.1677569428469; Mon, 27 Feb 2023 23:30:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677569428; cv=none; d=google.com; s=arc-20160816; b=MCXjfYzyGVr4ypDMSmNryH1g1k2yxnjDLCD6rHrJaJWiyqUipFmijFyl/inGsUrc9H zE73fQxYJQgCcLW4VQntfrD4XPdO+ghAqdMk0BDdNBFxURayFyLXzYmzI4BQlUcuLFQ+ 5MmHznv+p4bPYMHvik7TUrOOLNTu6Rsie2aBHme9qRHflSF6om7xk5vQHNDLSB8x0ms7 R14EkeDbrqtqrI1jlZTG1QvdD6rznlMalh9x8usutT5UsbA+82C552D0wkTR5clcf6Tu ID77oIoWQP1i2t3XMx76epvtq35o9lsaMFd0ULRTIevizHYjiKYcfvHcSda6WDWtfSq1 4DTA== 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=5fMIyb8WvWviHMUoZu0AxkLdKrn81GKTAle1FCiSCZU=; b=kYgANSiLA+Ioxfe6Tug/O8h99aRW5fXPEKD7jCRTvwOQUo4x9jNeMt5JXLoRhHGhUo r4q3St8K+mk0P0XGjP64Z+tIlKbJbPRFcbhe9qK9MT03XopwJ+eQJUVDw7zcH3linEGq 2e07lkDLUInN0gUH1XZ0QnHaYVseu9PxBYbpjpYhCUT1wJzS0kBYcPsXkwUon36f8AlE Ik111IuRLirJZsKM+wqj1pFdHODCw+kpmYS1DN/4rbhjjndiSu1girnDYS7O6oRCj0CC Wo7Zwm1ip91pslnHxVYB6GTCm0k62Gg4X6jjFtzHh2K91Nb6wfePnnYAkat87JnpnJ3c PpSw== 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 sd25-20020a170906ce3900b008b3b05ca5e1si10224639ejb.375.2023.02.27.23.30.06; Mon, 27 Feb 2023 23:30:28 -0800 (PST) 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 S230334AbjB1HKs (ORCPT + 99 others); Tue, 28 Feb 2023 02:10:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjB1HKq (ORCPT ); Tue, 28 Feb 2023 02:10:46 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B276F265B1; Mon, 27 Feb 2023 23:10:13 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Axbdqupv1jtWAGAA--.6430S3; Tue, 28 Feb 2023 15:01:02 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bxc+Wppv1jPG9AAA--.15462S17; Tue, 28 Feb 2023 15:01: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 v3 15/29] LoongArch: KVM: Implement vcpu status description Date: Tue, 28 Feb 2023 15:00:42 +0800 Message-Id: <20230228070057.3687180-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230228070057.3687180-1-zhaotianrui@loongson.cn> References: <20230228070057.3687180-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bxc+Wppv1jPG9AAA--.15462S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxJrWfXw17tr1kurWfJFyfCrg_yoW8Jw4kpF nrCa4Fgr4rWwn3Ww1fJ39xJw42qrWkWF1fWr9Fq34akFnxtrn5XFW0krWDGFykA34Fyr1S qayrtwnrua90yw7anT9S1TB71UUUUjJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bx8Fc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4 AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF 7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aV CY1x0267AKxVWxJr0_GcWln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l 57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6x8ErcxFaV Av8VWrMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWU AVWUtwCF04k20xvY0x0EwIxGrwCF04k20xvE74AGY7Cv6cx26rWl4I8I3I0E4IkC6x0Yz7 v_Jr0_Gr1l4IxYO2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_tr0E3s1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcVCF 04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4UJVWxJr1lIxAIcVC2z280aV CY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0zR9iSdUUUUU= X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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?1759059040739676004?= X-GMAIL-MSGID: =?utf-8?q?1759059040739676004?= 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 14c89208936f..bf66ac6b4472 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);