Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15844682rwd; Mon, 26 Jun 2023 02:02:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LOsLbnJmBVMPR3mf37PUxw6drxOQdHNjCjcnuCoam9RaUNm7Whbh2ftmWUJ1BaIKZtmf9 X-Received: by 2002:a17:907:7f1c:b0:96a:2dd7:2ee0 with SMTP id qf28-20020a1709077f1c00b0096a2dd72ee0mr33458709ejc.5.1687770155275; Mon, 26 Jun 2023 02:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687770155; cv=none; d=google.com; s=arc-20160816; b=hO2Rz+jHmdARljyKqzngj9Y8qI+CuFs5DDy06hLrVESfWWOd89OhFRu09ryfGsY9IL QVUqm7dzQJKE8ifJijZ4+YIvfVfRq3+jtA3SMUhKrtbbxaoMqPPksmXTz5NvZbKozdrv f824XMD2+xPXC4ZErwtdKpoVwMcr2RYNgTRYNBuYUG1vv1+Lk+AoMrPo6tHCt5sypebH 3mt4iju3ztErzM8Wr4RRByRglGjMLbb73DURcEIR8CveDl9yx+0neEycqflpileLX4kC +R8wRUUgz+mPlH+HWnkSyu0WKXejHQKTiCXoCcqg+QClwM7B7RN87IrPdD0mYsRgudSp xUGg== 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=hNX0bsBQSk1hIyX2jOClTW9jwnaDKQghYtlHEFOzjB4=; fh=FJJE1KfQOXNgUCxk/Gxke8tBG9gBLo3aFI+sNzAMBeU=; b=WB0VkvD3ALPlxYodClgiEXwH4ob3m9HneVSTjQTabsRJyM9DrId4olHWnqdg0CMPgy z4BwpF9NPmOoM5PVAAZEjBdDE1TGwFiew4yr6xypR36fvI2R7AmM35xexAUykUfYPkbU PkxEvCpKzw8CDtq+Kkjpl8Ch+/ctHVInat00b3q4ND+5zEELDcRCieOUQrSGkfoeb9En LTqjxLloz8mtCQmrtN7e9hA/14LP669ILiUEMtNS0BXLPbwi5YgRzd8s5/Oy+tK76ezZ u4ns2xp7MAlWPz4mxZpjUi5GSj7hkw7Md+Z+tNdBCIW1uM1gbqpoBPYbyWVM/1jP+LfC xTNg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z23-20020a1709064e1700b0098b0feb8935si2635972eju.1035.2023.06.26.02.02.06; Mon, 26 Jun 2023 02:02:35 -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 S229521AbjFZItP (ORCPT + 99 others); Mon, 26 Jun 2023 04:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjFZIs1 (ORCPT ); Mon, 26 Jun 2023 04:48:27 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96FF2E7B; Mon, 26 Jun 2023 01:48:07 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8CxZPDAUJlkyDQCAA--.3353S3; Mon, 26 Jun 2023 16:48:00 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bxxsy5UJlk4hQJAA--.19269S17; Mon, 26 Jun 2023 16:47:59 +0800 (CST) From: Tianrui Zhao To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton , maobibo@loongson.cn, Xi Ruoyao , zhaotianrui@loongson.cn, tangyouling@loongson.cn Subject: [PATCH v15 15/30] LoongArch: KVM: Implement vcpu status description Date: Mon, 26 Jun 2023 16:47:37 +0800 Message-Id: <20230626084752.1138621-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230626084752.1138621-1-zhaotianrui@loongson.cn> References: <20230626084752.1138621-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Bxxsy5UJlk4hQJAA--.19269S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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 Implement LoongArch vcpu status description such as idle exits counter, signal exits counter, cpucfg exits counter, etc. Reviewed-by: Bibo Mao 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 012b0738a06d..2a8d9a76b134 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -12,6 +12,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) && -- 2.39.1