From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6770C48BDF for ; Mon, 14 Jun 2021 02:54:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0D116134F for ; Mon, 14 Jun 2021 02:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232336AbhFNC4Q (ORCPT ); Sun, 13 Jun 2021 22:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbhFNC4P (ORCPT ); Sun, 13 Jun 2021 22:56:15 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4F6C0613A3 for ; Sun, 13 Jun 2021 19:54:01 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id h20-20020ac87d540000b0290249d0777b80so6587756qtb.13 for ; Sun, 13 Jun 2021 19:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EFssac9rz7i/Qr9EpSWwLvB4XY7qiCj+W7+6Jhxuqag=; b=LYERAZ7y42UfbmbPlfdmiRT+5SUAlpPUpcnKAJ06pnxNMruCW5nQs9eoLdhY4QqimU Bw60ALBxFeHcd/4Y9jIRzBOR9/jMvrFmonm5knRkEcDKOB3k8Nb4pdzKFF+bTNo8qSkm LW4hKTBMV2DNjCzUzntynYfjW6IAKSv/c/Xb2y6CY8rqY5Rw4e+W4wgtv7ZA858F3JCH Zl4LhituKwhgS7GcTCyVhu28y+SbW3QLn/N4f5Iatuc8SttyxjK8JXA4Tnh9QopWwUl4 oZCcRWH9m6pqfBku+n2hHpfC7LViqfP68y/Fz+T5Qfck+/1uBFBrVHOLCvaP8cjdEJAO vTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EFssac9rz7i/Qr9EpSWwLvB4XY7qiCj+W7+6Jhxuqag=; b=DFQWAbC6J1o7br1dAUCo9w60TA6S0MWyNKOtYdKrOs1aGp/sAk0D0Hiev0fbwPCkc3 8g7FrjIraOoFshHkK4qHVNuuZenerolsHyePLfv1GqqT3WAYtMn6r39Rx0gfq7NnW8v4 Jp86b6txqGJXpouFnWO20omTcmbsiq3Olmks9g3YkJepwmfZcMnzzR37ono5k0UgDD9W 8pU+NWjUTwYzPrsaP7zK4uRyvLmC8wU9ZKpIfQCZ9pnFskytHc/AIT+dIS11Q+pQ44Te 9VFgCilfyTi1a+5Kej4KOftnj6GtPs+B8k4TjPpty4vrHRyP+22f2fZzLYePKb3HIMIX 3Qgw== X-Gm-Message-State: AOAM532CyunA8yk/RFwwjuN8bst6vWMo22YHmWO95/rmq24cX/WmECU6 idbaio5UfHIxiroK4BvaOpZW1HFuRQ73eF2cCA== X-Google-Smtp-Source: ABdhPJx06RmEFcd18ZQJLMbPbZxx739B0LLW3SWUDB8V4bqvcXAZJX+M+bK78AWrb7OsWvWt/mmcsnPMfO++tuNCdA== X-Received: from jgzg.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:1acf]) (user=jingzhangos job=sendgmr) by 2002:a05:6214:20c4:: with SMTP id 4mr8552573qve.1.1623639240966; Sun, 13 Jun 2021 19:54:00 -0700 (PDT) Date: Mon, 14 Jun 2021 02:53:50 +0000 In-Reply-To: <20210614025351.365284-1-jingzhangos@google.com> Message-Id: <20210614025351.365284-4-jingzhangos@google.com> Mime-Version: 1.0 References: <20210614025351.365284-1-jingzhangos@google.com> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog Subject: [PATCH 3/4] KVM: stats: Update documentation supporting stats mode and offset From: Jing Zhang To: KVM , KVMARM , LinuxMIPS , KVMPPC , LinuxS390 , Paolo Bonzini , Fuad Tabba Cc: Jing Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org Update documentation to reflect that stats descriptor supports new flags for read/write mode and an offset field is added in stats descriptor. Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index d1ad30212726..67979700a90e 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -5160,12 +5160,19 @@ below code block:: #define KVM_STATS_BASE_POW2 (0x1 << KVM_STATS_BASE_SHIFT) #define KVM_STATS_BASE_MAX KVM_STATS_BASE_POW2 + #define KVM_STATS_MODE_SHIFT 12 + #define KVM_STATS_MODE_MASK (0xF << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_RW (0x0 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_READ (0x1 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_WRITE (0x2 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_MAX KVM_STATS_MODE_WRITE + struct kvm_stats_desc { __u32 flags; __s16 exponent; __u16 size; - __u32 unused1; - __u32 unused2; + __u32 offset; + __u32 unused; char name[0]; }; @@ -5212,23 +5219,35 @@ Bits 4-7 of ``flags`` encode the unit: value is 200, ``exponent`` is 4, we can get the number of CPU clock cycles by ``value * pow(10, exponent) = 200 * pow(10, 4) = 2000000``. -Bits 7-11 of ``flags`` encode the base: +Bits 8-11 of ``flags`` encode the base: * ``KVM_STATS_BASE_POW10`` The scale is based on power of 10. It is used for measurement of time and CPU clock cycles. * ``KVM_STATS_BASE_POW2`` The scale is based on power of 2. It is used for measurement of memory size. +Bits 12-15 of ``flags`` encode the mode: + * ``KVM_STATS_MODE_RW`` + The corresponding statistics supports both read and write (clear). + * ``KVM_STATS_MODE_READ`` + The corresponding statistics supports read only. + * ``KVM_STATS_MODE_WRITE`` + The corresponding statistics supports write only. (Not used for now, added + for completeness) + The ``exponent`` field is the scale of corresponding statistics data. For example, if the unit is ``KVM_STATS_UNIT_BYTES``, the base is ``KVM_STATS_BASE_POW2``, the ``exponent`` is 10, then we know that the real unit of the statistics data is KBytes a.k.a pow(2, 10) = 1024 bytes. -The ``size`` field is the number of values of this statistics data. It is in the -unit of ``unsigned long`` for VM or ``__u64`` for VCPU. +The ``size`` field is the number of values (u64) of this statistics data. Its +value is usually 1 for most of simple statistics. + +The ``offset`` field is the offset from the start of Data Block to the start of +the corresponding statistics data. -The ``unused1`` and ``unused2`` fields are reserved for future -support for other types of statistics data, like log/linear histogram. +The ``unused`` fields are reserved for future support for other types of +statistics data, like log/linear histogram. The ``name`` field points to the name string of the statistics data. The name string starts at the end of ``struct kvm_stats_desc``. -- 2.32.0.272.g935e593368-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F39B1C49361 for ; Mon, 14 Jun 2021 02:54:11 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 95F19613AB for ; Mon, 14 Jun 2021 02:54:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95F19613AB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4ACF0406AD; Sun, 13 Jun 2021 22:54:11 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qgCfjiF4Sh3G; Sun, 13 Jun 2021 22:54:10 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A26F84A1AF; Sun, 13 Jun 2021 22:54:05 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 057A149F6C for ; Sun, 13 Jun 2021 22:54:04 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BUu-QHSh85c4 for ; Sun, 13 Jun 2021 22:54:01 -0400 (EDT) Received: from mail-qv1-f74.google.com (mail-qv1-f74.google.com [209.85.219.74]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 67A2740630 for ; Sun, 13 Jun 2021 22:54:01 -0400 (EDT) Received: by mail-qv1-f74.google.com with SMTP id 10-20020a0562140d4ab0290247bb35d2c3so4239192qvr.22 for ; Sun, 13 Jun 2021 19:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EFssac9rz7i/Qr9EpSWwLvB4XY7qiCj+W7+6Jhxuqag=; b=LYERAZ7y42UfbmbPlfdmiRT+5SUAlpPUpcnKAJ06pnxNMruCW5nQs9eoLdhY4QqimU Bw60ALBxFeHcd/4Y9jIRzBOR9/jMvrFmonm5knRkEcDKOB3k8Nb4pdzKFF+bTNo8qSkm LW4hKTBMV2DNjCzUzntynYfjW6IAKSv/c/Xb2y6CY8rqY5Rw4e+W4wgtv7ZA858F3JCH Zl4LhituKwhgS7GcTCyVhu28y+SbW3QLn/N4f5Iatuc8SttyxjK8JXA4Tnh9QopWwUl4 oZCcRWH9m6pqfBku+n2hHpfC7LViqfP68y/Fz+T5Qfck+/1uBFBrVHOLCvaP8cjdEJAO vTUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EFssac9rz7i/Qr9EpSWwLvB4XY7qiCj+W7+6Jhxuqag=; b=sa38G1l/qFZaMGVoSiM0B7noUGCOI+DX+5LxHFCLZb9S9S/kPP+nS8OOTfKW3Qc/cE f5vD6oGfMd3cqRL3SjkApVamPnRvX/Hnv+cyNxbyf9rADmKapbUvynpBwYz8Q3Lg5sJ6 dDbH4HjG2OHXW6ysDHca099fnmAaKnN8gg+SGn4dTan2OQgkWDtfwl+TjIN1U3TKO+LB pqTSb11S+FsX/zG+0fY/6pfvhXDt959HXGC0/Ym2RIX7V6NrQgthhU2v2OHwQuLI/xkL RK9PigReXHYgdTKuouNi1ydjElSshrj/mBE5/v+14d8mdMcLBrE+NE/N4uYwoYqX9cCj MPgQ== X-Gm-Message-State: AOAM530oO2J6yrbI+pD2RL13m+qwNS/tX+mRsiLseGgxZ+enmEex5FmB q/90EluP7GJdqdkLoyzNzycXZNL3pnPUUwSmsA== X-Google-Smtp-Source: ABdhPJx06RmEFcd18ZQJLMbPbZxx739B0LLW3SWUDB8V4bqvcXAZJX+M+bK78AWrb7OsWvWt/mmcsnPMfO++tuNCdA== X-Received: from jgzg.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:1acf]) (user=jingzhangos job=sendgmr) by 2002:a05:6214:20c4:: with SMTP id 4mr8552573qve.1.1623639240966; Sun, 13 Jun 2021 19:54:00 -0700 (PDT) Date: Mon, 14 Jun 2021 02:53:50 +0000 In-Reply-To: <20210614025351.365284-1-jingzhangos@google.com> Message-Id: <20210614025351.365284-4-jingzhangos@google.com> Mime-Version: 1.0 References: <20210614025351.365284-1-jingzhangos@google.com> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog Subject: [PATCH 3/4] KVM: stats: Update documentation supporting stats mode and offset From: Jing Zhang To: KVM , KVMARM , LinuxMIPS , KVMPPC , LinuxS390 , Paolo Bonzini , Fuad Tabba X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Update documentation to reflect that stats descriptor supports new flags for read/write mode and an offset field is added in stats descriptor. Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index d1ad30212726..67979700a90e 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -5160,12 +5160,19 @@ below code block:: #define KVM_STATS_BASE_POW2 (0x1 << KVM_STATS_BASE_SHIFT) #define KVM_STATS_BASE_MAX KVM_STATS_BASE_POW2 + #define KVM_STATS_MODE_SHIFT 12 + #define KVM_STATS_MODE_MASK (0xF << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_RW (0x0 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_READ (0x1 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_WRITE (0x2 << KVM_STATS_MODE_SHIFT) + #define KVM_STATS_MODE_MAX KVM_STATS_MODE_WRITE + struct kvm_stats_desc { __u32 flags; __s16 exponent; __u16 size; - __u32 unused1; - __u32 unused2; + __u32 offset; + __u32 unused; char name[0]; }; @@ -5212,23 +5219,35 @@ Bits 4-7 of ``flags`` encode the unit: value is 200, ``exponent`` is 4, we can get the number of CPU clock cycles by ``value * pow(10, exponent) = 200 * pow(10, 4) = 2000000``. -Bits 7-11 of ``flags`` encode the base: +Bits 8-11 of ``flags`` encode the base: * ``KVM_STATS_BASE_POW10`` The scale is based on power of 10. It is used for measurement of time and CPU clock cycles. * ``KVM_STATS_BASE_POW2`` The scale is based on power of 2. It is used for measurement of memory size. +Bits 12-15 of ``flags`` encode the mode: + * ``KVM_STATS_MODE_RW`` + The corresponding statistics supports both read and write (clear). + * ``KVM_STATS_MODE_READ`` + The corresponding statistics supports read only. + * ``KVM_STATS_MODE_WRITE`` + The corresponding statistics supports write only. (Not used for now, added + for completeness) + The ``exponent`` field is the scale of corresponding statistics data. For example, if the unit is ``KVM_STATS_UNIT_BYTES``, the base is ``KVM_STATS_BASE_POW2``, the ``exponent`` is 10, then we know that the real unit of the statistics data is KBytes a.k.a pow(2, 10) = 1024 bytes. -The ``size`` field is the number of values of this statistics data. It is in the -unit of ``unsigned long`` for VM or ``__u64`` for VCPU. +The ``size`` field is the number of values (u64) of this statistics data. Its +value is usually 1 for most of simple statistics. + +The ``offset`` field is the offset from the start of Data Block to the start of +the corresponding statistics data. -The ``unused1`` and ``unused2`` fields are reserved for future -support for other types of statistics data, like log/linear histogram. +The ``unused`` fields are reserved for future support for other types of +statistics data, like log/linear histogram. The ``name`` field points to the name string of the statistics data. The name string starts at the end of ``struct kvm_stats_desc``. -- 2.32.0.272.g935e593368-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm