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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED,USER_IN_DEF_DKIM_WL autolearn=no 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 A6F53C48BE5 for ; Thu, 17 Jun 2021 15:20:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91C92613F9 for ; Thu, 17 Jun 2021 15:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233130AbhFQPWv (ORCPT ); Thu, 17 Jun 2021 11:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbhFQPWu (ORCPT ); Thu, 17 Jun 2021 11:22:50 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1C9C061767 for ; Thu, 17 Jun 2021 08:20:41 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id f30so11197222lfj.1 for ; Thu, 17 Jun 2021 08:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5nxSzCxRIGKeYpvFJwHnokf+lsLXzTQKnVZehNuKBfY=; b=v73zJk16lVzUG7QbbkRkacwK3TUPJGuBDYnlw6a7OPjaXiFoy/Tg1SF7o+pP2VkjgQ GCw+WkjfIQ3l6iS90jFkDddYRWl54Fy+YMR/OLBaPnT1q7EH0oEDgCPwHFRf8oPp7gGh W7Ec4TAFYCyuNTidERQalF9VJ9rhnKCIZeBncU5P/7WoHZpOenVDVwlRJezyVC2NtJ6Y vboZ+Jh+7e1OhUpnKBfhBMPZL2co2cGDoDioEPRVmBRw4+jEILLh2FWrKa/OxCOxZ34S /rw7UTqce3bTc65+uzu2YO9pLXUzTgYikYTMftRKjr074dSbh8dedXtXArBgTf7VXUpm YOvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5nxSzCxRIGKeYpvFJwHnokf+lsLXzTQKnVZehNuKBfY=; b=ZMlMLuecDX1xshr437BjVgcOGu/lr30TzH9Qu2T7AqUQw0ze/ZMNkb+FY8WhgvwFWS 8H5zrNym6dbMasVCBQEexlEe5xqAuGCxAlDTDwRzMLirvksZKXmPBFQYK7a5DHu1234o I8xNOwr5Ko+0Ao5trNBlez1QnaGf3CR7ZON6E1vC6Y+3QuJhvGf8PsYt7foaMI0ogqSD ohjUk4fy/jHwH0ivRSOuwScmSJRIGXWFkS3KZd7YfqeugpXAjXOTE/7Brme+vAYo2APF OZRETZzyoyfa2Wlez4+RH8Zr63SoGCi14WHAtrTm4t35xF/hxuRjmHwCKzejhKxqaKw6 pBAw== X-Gm-Message-State: AOAM532CE6TuC4JPPfKKvnjIg8b4faGvovK8wrMorXVVG7DUx9FovYvQ nkCgasjjwFzUISiimsUmgvhTrTyyJUgZKj8JGjhniQ== X-Google-Smtp-Source: ABdhPJxKKizWi/fGNn+9wpt69Ewj2CzuOybJdiyg4e/t3EuxZUFb779j6T3WEp//mVN3Ae7BamP0hcGF5jtDYBl/+0Y= X-Received: by 2002:a05:6512:3ea:: with SMTP id n10mr4392667lfq.178.1623943239558; Thu, 17 Jun 2021 08:20:39 -0700 (PDT) MIME-Version: 1.0 References: <20210617044146.2667540-1-jingzhangos@google.com> <20210617044146.2667540-4-jingzhangos@google.com> In-Reply-To: From: Jing Zhang Date: Thu, 17 Jun 2021 10:20:27 -0500 Message-ID: Subject: Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface To: Greg KH Cc: KVM , KVMARM , LinuxMIPS , KVMPPC , LinuxS390 , Linuxkselftest , Paolo Bonzini , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Will Deacon , Huacai Chen , Aleksandar Markovic , Thomas Bogendoerfer , Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Peter Shier , Oliver Upton , David Rientjes , Emanuele Giuseppe Esposito , David Matlack , Ricardo Koller , Krish Sadhukhan , Fuad Tabba Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Greg, On Thu, Jun 17, 2021 at 12:56 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:44AM +0000, Jing Zhang wrote: > > + struct kvm_stats_desc { > > + __u32 flags; > > + __s16 exponent; > > + __u16 size; > > + __u32 offset; > > + __u32 unused; > > + char name[0]; > > + }; > > > > > +The ``unused`` fields are reserved for future support for other types of > > +statistics data, like log/linear histogram. > > you HAVE to set unused to 0 for now, otherwise userspace does not know > it is unused, right? And then, really it is "used", so why not just say > that now? It's tricky, but you have to get this right now otherwise you > can never use it in the future. > Sure, will do that. > > +The ``name`` field points to the name string of the statistics data. The name > > It is not a pointer, it is the data itself. > Will fix it. > > +string starts at the end of ``struct kvm_stats_desc``. > > +The maximum length (including trailing '\0') is indicated by ``name_size`` > > +in ``struct kvm_stats_header``. > > I thought we were replacing [0] arrays with [], are you sure you should > be declaring this as [0]? Same for all structures in this document (and > code). > The reason to declare it as [0] is to have the flexibility to change the maximum length of KVM stats name. For now, the max len is defined as 48, which can be read from the header. Then the userspace can get the length of descriptor by adding sizeof(struct_kvm_stats_desc) + 48. Whenever the max len is changed in KVM, the userspace would not have to update code to reflect that. However, if we are OK to restrict the maximum KVM stats' length to 48 (or any other number), we can just declear it with [] instead of [0]. > thanks, > > greg k-h Thanks, Jing