From patchwork Fri Sep 15 01:49:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhaotianrui X-Patchwork-Id: 139986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp744672vqi; Thu, 14 Sep 2023 18:54:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4h6AUC/7OmLrXqE0uG9GzvG03WQUpNYelWnIqqBiIeReP40wzlnjB+JwasRWOiSm5lebK X-Received: by 2002:a05:6870:7022:b0:1d5:a3b5:d89c with SMTP id u34-20020a056870702200b001d5a3b5d89cmr419575oae.3.1694742875387; Thu, 14 Sep 2023 18:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694742875; cv=none; d=google.com; s=arc-20160816; b=F758ql7bTblO6jq620EvHPKcsf5f5wGrzjqqQ0WLBJBVRRa1P3ppuqYspM8LBZ8pyU RtfTW+CUZZA5BmhlBgcBK06m1GKtzMrB6QTrsJaaHaM+yr4qM+BupFYbCb7tehCjJlzK agUSz743LpaURnzisJfanGVjPQcLqInOfqquRnRbJKIcibaTvfJVwHOalREElJ/cegga bQP4bMeqItrLg5oiefHxBQv7pRbdQGAxCXvWl1FYXg5bPdAkHIHkNaRQdDUZm3mT7BPq JgyZYaWwxj6SJtTNBBV7+kIXqTjjikM+s09MqdwJhHm8NLPG98X1mzYcD2cUF8X59jkU Evmg== 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=4x9fB0LqhJ5bESeebL43eSzMxsBggRdSxQXe6ro6UJo=; fh=ejoaVAUUbBXsA/6jM/beuI9xCYtV2osdR9SpI7hjY84=; b=PP4tcTHjDpsI8bOi7M2an6tSMdbJu3hLDFQdslZwPMeBRoMpkmGm8GlnzFD3VDOfhe KG2yNXNbNN6h2GbWaCJGdFLB8zYWsmx7ERNSyLWvMT/34XZJUMSq/UrSJnnVPM+iPMUH HzBBuQ6R95CgdLhoDtASrapkNQkJz5tYulB5vClNIaVFDQ98KmOK71Ycxn+dmP7/kh4y h+1l/o+pF8AyX1gvRSNivohv2yGF5lAyjNmOOa8nrogSzpXATjXN94utLE823G3GIoJ0 uOgRvKWQdfNOr2F81J+zXqkIBnyNG9zzPWactXRhJaBEO1SvJ72jTk2FF2hUP2WfBxLJ j2VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id k24-20020a63ff18000000b00563f8ccc097si2229040pgi.780.2023.09.14.18.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 18:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E06EF84DC457; Thu, 14 Sep 2023 18:50:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231503AbjIOBue (ORCPT + 33 others); Thu, 14 Sep 2023 21:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbjIOBu3 (ORCPT ); Thu, 14 Sep 2023 21:50:29 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A722B2716; Thu, 14 Sep 2023 18:50:05 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Bxd+hHuANlAf8nAA--.40979S3; Fri, 15 Sep 2023 09:49:59 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axndw9uANl+ioGAA--.11927S17; Fri, 15 Sep 2023 09:49:58 +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 Subject: [PATCH v21 15/29] LoongArch: KVM: Implement vcpu status description Date: Fri, 15 Sep 2023 09:49:35 +0800 Message-Id: <20230915014949.1222777-16-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230915014949.1222777-1-zhaotianrui@loongson.cn> References: <20230915014949.1222777-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Axndw9uANl+ioGAA--.11927S17 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 18:50:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777066705356025210 X-GMAIL-MSGID: 1777066705356025210 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 7162e6ddb7..9cca9f4a0c 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) &&