xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Matias Ezequiel Vara Larsen <matiasevara@gmail.com>
Cc: xen-devel@lists.xenproject.org,
	"Matias Ezequiel Vara Larsen" <matias.vara@vates.fr>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Dario Faggioli" <dfaggioli@suse.com>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: Re: API/ABIs: Re: [RFC PATCH v2 0/2] Add a new acquire resource to query vcpu statistics
Date: Wed, 8 Mar 2023 15:16:05 +0100	[thread overview]
Message-ID: <d0354bab-3022-6048-8d58-45f63aaf26be@suse.com> (raw)
In-Reply-To: <20230308115410.GA1108824@horizon>

On 08.03.2023 12:54, Matias Ezequiel Vara Larsen wrote:
> On Tue, Mar 07, 2023 at 11:12:00AM +0100, Jan Beulich wrote:
>> On 06.03.2023 15:23, Matias Ezequiel Vara Larsen wrote:
>>> - Xen shall use the "stats_active" field to indicate what it is producing. In
>>>   this field, reserved bits shall be 0. This shall allow us to agree on the
>>> layout even when producer and consumer are compiled with different headers.
>>
>> I wonder how well such a bitfield is going to scale. It provides for
>> only 32 (maybe 64) counters. Of course this may seem a lot right now,
>> but you never know how quickly something like this can grow. Plus
>> with ...
>>
> 
> Would it make sense to define it like this?:
> 
> struct vcpu_shmem_stats {
> #define STATS_A (1u << 0)
> ...
> #define VCPU_STATS_MAGIC 0xaabbccdd
>      uint32_t magic;
>      uint32_t offset;  // roundup(sizeof(vcpu_shmem_stats) + sizeof(uint32_t) * nr_stats, cacheline_size)
>      uint32_t size;    // sizeof(vcpu_stats)
>      uint32_t stride;  // roundup(sizeof(vcpu_stats), cacheline_size)
>      uint32_t nr_stats; // size of stats_active in uint32_t
>      uint32_t stats_active[XEN_FLEX_ARRAY_DIM];
>      ...
> };

Possibly, but this would make it harder to use the interface. An alternative
might be to specify that an actual stats value set to ~0 marks an inactive
element. Since these are 64-bit counters, with today's and tomorrow's
computers we won't be at risk of a counter reaching a value of 2^^64-1, I
guess. And even if there was one where such a risk could not be excluded
(e.g. because of using pretty large increments), one would merely need to
make sure to saturate at 2^^64-2. Plus at such a point one would need to
consider anyway to switch to 128-bit fields, as neither saturated nor
wrapped values are of much use to consumers.

>>> - In the vcpu_stats structure, new fields can only ever be appended.
>>
>> ... this rule the only ambiguity that could arise to consumers when
>> no active flags existed would be that they can't tell "event never
>> occurred" from "hypervisor doesn't know about this anymore".
> 
> Do you mean how the consumer can figure out if either 1) Xen does not know yet
> about some flag or 2) the flag has been deprecated? I think 2) is the case that
> Andrew mention in which the magic number could be used as an ABI version to
> break backwards compatibility.

No, an inactive field wouldn't break the ABI. An ABI change would be if
such an inactive field was actually removed from the array. Or if e.g.,
as per above, we needed to switch to 128-bit counters.

Jan


  reply	other threads:[~2023-03-08 14:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 12:39 [RFC PATCH v2 0/2] Add a new acquire resource to query vcpu statistics Matias Ezequiel Vara Larsen
2022-10-07 12:39 ` [RFC PATCH v2 1/2] xen/memory : Add a stats_table resource type Matias Ezequiel Vara Larsen
2022-12-13 17:02   ` Jan Beulich
2023-02-16 14:48     ` Matias Ezequiel Vara Larsen
2023-02-16 15:10       ` Jan Beulich
2022-12-14  7:29   ` Jan Beulich
2022-12-14  7:56     ` Jan Beulich
2023-02-17  8:50       ` Matias Ezequiel Vara Larsen
2023-02-17  8:57         ` Jan Beulich
2023-02-17  9:29           ` Matias Ezequiel Vara Larsen
2023-02-17 14:10             ` Jan Beulich
2023-02-23 12:16               ` Matias Ezequiel Vara Larsen
2023-02-23 12:42                 ` Jan Beulich
2023-03-07 14:44                   ` Matias Ezequiel Vara Larsen
2023-03-07 16:55                     ` Jan Beulich
2023-03-09  9:22                       ` Matias Ezequiel Vara Larsen
2023-02-16 15:07     ` Matias Ezequiel Vara Larsen
2023-02-16 15:15       ` Jan Beulich
2023-02-20 16:51         ` Matias Ezequiel Vara Larsen
2023-02-21  8:48           ` Jan Beulich
2022-10-07 12:39 ` [RFC PATCH v2 2/2] tools/misc: Add xen-vcpus-stats tool Matias Ezequiel Vara Larsen
2023-02-23 16:01   ` Andrew Cooper
2023-02-23 20:31     ` Julien Grall
2023-03-17 11:01       ` Matias Ezequiel Vara Larsen
2023-03-29 21:29         ` Julien Grall
2023-02-24 15:31     ` Matias Ezequiel Vara Larsen
2023-02-23 19:56 ` API/ABIs: Re: [RFC PATCH v2 0/2] Add a new acquire resource to query vcpu statistics Andrew Cooper
2023-03-06 14:23   ` Matias Ezequiel Vara Larsen
2023-03-07 10:12     ` Jan Beulich
2023-03-08 11:54       ` Matias Ezequiel Vara Larsen
2023-03-08 14:16         ` Jan Beulich [this message]
2023-03-09 10:38           ` Matias Ezequiel Vara Larsen
2023-03-09 11:50             ` Jan Beulich
2023-03-10 10:58               ` Matias Ezequiel Vara Larsen
2023-03-10 11:34                 ` Jan Beulich
2023-03-14 10:28                   ` Matias Ezequiel Vara Larsen
2023-03-14 10:34                     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0354bab-3022-6048-8d58-45f63aaf26be@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien@xen.org \
    --cc=matias.vara@vates.fr \
    --cc=matiasevara@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).