* [PATCH] virtio_balloon: add array of stat names
@ 2018-04-13 13:44 Michael S. Tsirkin
2018-04-13 18:53 ` Jonathan Helman
[not found] ` <8ac55da5-3c2b-a546-7597-ec6c82ff9590@oracle.com>
0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2018-04-13 13:44 UTC (permalink / raw)
To: linux-kernel; +Cc: virtualization
Jason Wang points out that it's vary hard for users to build an array of
stat names. The naive thing is to use VIRTIO_BALLOON_S_NR but that
breaks if we add more stats.
Let's add an array of reasonably readable names.
Fixes: 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jonathan Helman <jonathan.helman@oracle.com>,
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/uapi/linux/virtio_balloon.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
index 9e02137..1477c17 100644
--- a/include/uapi/linux/virtio_balloon.h
+++ b/include/uapi/linux/virtio_balloon.h
@@ -64,6 +64,21 @@ struct virtio_balloon_config {
#define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
#define VIRTIO_BALLOON_S_NR 10
+#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
+ VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
+ VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
+ VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
+ VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
+ VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
+ VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
+ VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
+ VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
+ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
+ VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \
+}
+
+#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
+
/*
* Memory statistics structure.
* Driver fills an array of these structures and passes to device.
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_balloon: add array of stat names
2018-04-13 13:44 [PATCH] virtio_balloon: add array of stat names Michael S. Tsirkin
@ 2018-04-13 18:53 ` Jonathan Helman
[not found] ` <8ac55da5-3c2b-a546-7597-ec6c82ff9590@oracle.com>
1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Helman @ 2018-04-13 18:53 UTC (permalink / raw)
To: Michael S. Tsirkin, linux-kernel; +Cc: virtualization
On 04/13/2018 06:44 AM, Michael S. Tsirkin wrote:
> Jason Wang points out that it's vary hard for users to build an array of
s/vary/very
> stat names. The naive thing is to use VIRTIO_BALLOON_S_NR but that
> breaks if we add more stats.
>
> Let's add an array of reasonably readable names.
Thanks for doing this, this is goodness. Clients of this interface will
now only require a modification to their internal copy of the header
file (if they have one), rather than updating their string array as well.
>
> Fixes: 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
I think this is a tad bit confusing since the only way you'd know why
this patch "fixes" 6c64fe7f2 is by reading the LKML archives and finding
Jason's comment.
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Jonathan Helman <jonathan.helman@oracle.com>, > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Jonathan Helman <jonathan.helman@oracle.com>
> ---
> include/uapi/linux/virtio_balloon.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
> index 9e02137..1477c17 100644
> --- a/include/uapi/linux/virtio_balloon.h
> +++ b/include/uapi/linux/virtio_balloon.h
> @@ -64,6 +64,21 @@ struct virtio_balloon_config {
> #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
> #define VIRTIO_BALLOON_S_NR 10
>
> +#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
> + VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
> + VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
> + VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
> + VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
> + VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
> + VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
> + VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
> + VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
> + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
> + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ > +}
> +
> +#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
> +
> /*
> * Memory statistics structure.
> * Driver fills an array of these structures and passes to device.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_balloon: add array of stat names
[not found] ` <8ac55da5-3c2b-a546-7597-ec6c82ff9590@oracle.com>
@ 2018-04-13 22:07 ` Michael S. Tsirkin
2018-04-13 23:43 ` Jonathan Helman
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2018-04-13 22:07 UTC (permalink / raw)
To: Jonathan Helman; +Cc: linux-kernel, virtualization
On Fri, Apr 13, 2018 at 11:53:31AM -0700, Jonathan Helman wrote:
>
>
> On 04/13/2018 06:44 AM, Michael S. Tsirkin wrote:
> > Jason Wang points out that it's vary hard for users to build an array of
>
> s/vary/very
>
> > stat names. The naive thing is to use VIRTIO_BALLOON_S_NR but that
> > breaks if we add more stats.
> >
> > Let's add an array of reasonably readable names.
>
> Thanks for doing this, this is goodness. Clients of this interface will now
> only require a modification to their internal copy of the header file (if
> they have one), rather than updating their string array as well.
>
> >
> > Fixes: 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
>
> I think this is a tad bit confusing since the only way you'd know why this
> patch "fixes" 6c64fe7f2 is by reading the LKML archives and finding Jason's
> comment.
So
... add more stats as recently by commit 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Jonathan Helman <jonathan.helman@oracle.com>, > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> Reviewed-by: Jonathan Helman <jonathan.helman@oracle.com>
>
> > ---
> > include/uapi/linux/virtio_balloon.h | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
> > diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
> > index 9e02137..1477c17 100644
> > --- a/include/uapi/linux/virtio_balloon.h
> > +++ b/include/uapi/linux/virtio_balloon.h
> > @@ -64,6 +64,21 @@ struct virtio_balloon_config {
> > #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
> > #define VIRTIO_BALLOON_S_NR 10
> > +#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
> > + VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
> > + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ > +}
> > +
> > +#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
> > +
> > /*
> > * Memory statistics structure.
> > * Driver fills an array of these structures and passes to device.
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_balloon: add array of stat names
2018-04-13 22:07 ` Michael S. Tsirkin
@ 2018-04-13 23:43 ` Jonathan Helman
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Helman @ 2018-04-13 23:43 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: linux-kernel, virtualization
On 04/13/2018 03:07 PM, Michael S. Tsirkin wrote:
> On Fri, Apr 13, 2018 at 11:53:31AM -0700, Jonathan Helman wrote:
>>
>>
>> On 04/13/2018 06:44 AM, Michael S. Tsirkin wrote:
>>> Jason Wang points out that it's vary hard for users to build an array of
>>
>> s/vary/very
>>
>>> stat names. The naive thing is to use VIRTIO_BALLOON_S_NR but that
>>> breaks if we add more stats.
>>>
>>> Let's add an array of reasonably readable names.
>>
>> Thanks for doing this, this is goodness. Clients of this interface will now
>> only require a modification to their internal copy of the header file (if
>> they have one), rather than updating their string array as well.
>>
>>>
>>> Fixes: 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
>>
>> I think this is a tad bit confusing since the only way you'd know why this
>> patch "fixes" 6c64fe7f2 is by reading the LKML archives and finding Jason's
>> comment.
>
> So
>
> ... add more stats as recently by commit 6c64fe7f2 ("virtio_balloon: export hugetlb page allocation counts")
>
>
Sure. Thanks.
Jon
>
>
>>> Cc: Jason Wang <jasowang@redhat.com>
>>> Cc: Jonathan Helman <jonathan.helman@oracle.com>, > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>
>> Reviewed-by: Jonathan Helman <jonathan.helman@oracle.com>
>>
>>> ---
>>> include/uapi/linux/virtio_balloon.h | 15 +++++++++++++++
>>> 1 file changed, 15 insertions(+)
>>>
>>> diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
>>> index 9e02137..1477c17 100644
>>> --- a/include/uapi/linux/virtio_balloon.h
>>> +++ b/include/uapi/linux/virtio_balloon.h
>>> @@ -64,6 +64,21 @@ struct virtio_balloon_config {
>>> #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */
>>> #define VIRTIO_BALLOON_S_NR 10
>>> +#define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \
>>> + VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ > +}
>>> +
>>> +#define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("")
>>> +
>>> /*
>>> * Memory statistics structure.
>>> * Driver fills an array of these structures and passes to device.
>>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-13 23:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-13 13:44 [PATCH] virtio_balloon: add array of stat names Michael S. Tsirkin
2018-04-13 18:53 ` Jonathan Helman
[not found] ` <8ac55da5-3c2b-a546-7597-ec6c82ff9590@oracle.com>
2018-04-13 22:07 ` Michael S. Tsirkin
2018-04-13 23:43 ` Jonathan Helman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox