All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH V2 0/1] virtio-balloon: fix internal stat name array to match Linux kernel
  2018-05-09 19:53 ` [virtio-dev] " Thomas Tai
  (?)
@ 2018-05-09 19:23 ` no-reply
  -1 siblings, 0 replies; 11+ messages in thread
From: no-reply @ 2018-05-09 19:23 UTC (permalink / raw)
  To: thomas.tai; +Cc: famz, mst, virtio-dev, jasowang, rob.gardner, qemu-devel

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1525895585-79023-1-git-send-email-thomas.tai@oracle.com
Subject: [Qemu-devel] [PATCH V2 0/1] virtio-balloon: fix internal stat name array to match Linux kernel

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1525895585-79023-1-git-send-email-thomas.tai@oracle.com -> patchew/1525895585-79023-1-git-send-email-thomas.tai@oracle.com
 t [tag update]            patchew/20180509182002.8044-1-mreitz@redhat.com -> patchew/20180509182002.8044-1-mreitz@redhat.com
Switched to a new branch 'test'
6a374a628a virtio-balloon: fix internal stat name array to match Linux kernel

=== OUTPUT BEGIN ===
Checking PATCH 1/1: virtio-balloon: fix internal stat name array to match Linux kernel...
ERROR: code indent should never use tabs
#56: FILE: hw/virtio/virtio-balloon.c:47:
+^IVIRTIO_BALLOON_S_NAMES_WITH_PREFIX("stat-");$

total: 1 errors, 0 warnings, 52 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH V2 0/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-09 19:53 ` Thomas Tai
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-09 19:53 UTC (permalink / raw)
  To: mst; +Cc: jasowang, virtio-dev, qemu-devel, rob.gardner, thomas.tai

Hi Michael,
As you have suggested I have imported the kernel header
file and use the new macro to create the string array.
Would you kindly review the patch for me? Please feel
free to comment.

Thank you,
Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [virtio-dev] [PATCH V2 0/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-09 19:53 ` Thomas Tai
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-09 19:53 UTC (permalink / raw)
  To: mst; +Cc: jasowang, virtio-dev, qemu-devel, rob.gardner, thomas.tai

Hi Michael,
As you have suggested I have imported the kernel header
file and use the new macro to create the string array.
Would you kindly review the patch for me? Please feel
free to comment.

Thank you,
Thomas



---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
  2018-05-09 19:53 ` [virtio-dev] " Thomas Tai
@ 2018-05-09 19:53   ` Thomas Tai
  -1 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-09 19:53 UTC (permalink / raw)
  To: mst; +Cc: jasowang, virtio-dev, qemu-devel, rob.gardner, thomas.tai

The Linux kernel commit b40000325044 ("virtio_balloon: add array
of stat names") defines an array of stat name strings for consumers
of the virtio interface to use via the virtio_balloon.h header
file, rather than requiring each consumer to define its own. But at
present, the stat names defined in this array by the Linux kernel
do not match up with those defined internally by QEMU.

This patch fixes this inconsistency by importing the header file
from linux and use the new macro to construct the balloon_stat_names
array.

Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Cc: Rob Gardner <rob.gardner@oracle.com>
---
 docs/virtio-balloon-stats.txt                   |  2 ++
 hw/virtio/virtio-balloon.c                      | 13 ++-----------
 include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
index 7a66d25..7c69fdb 100644
--- a/docs/virtio-balloon-stats.txt
+++ b/docs/virtio-balloon-stats.txt
@@ -34,6 +34,8 @@ which will return a dictionary containing:
       - stat-total-memory
       - stat-available-memory
       - stat-disk-caches
+      - stat-hugetlb-allocations
+      - stat-hugetlb-failures
 
   o A key named last-update, which contains the last stats update
     timestamp in seconds. Since this timestamp is generated by the host,
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index f456cea..646f2e0 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -43,17 +43,8 @@ static void balloon_page(void *addr, int deflate)
     }
 }
 
-static const char *balloon_stat_names[] = {
-   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
-   [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
-   [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
-   [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
-   [VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
-   [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
-   [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
-   [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
-   [VIRTIO_BALLOON_S_NR] = NULL
-};
+static const char *balloon_stat_names[VIRTIO_BALLOON_S_NR] = \
+	VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("stat-");
 
 /*
  * reset_stats - Mark all items in the stats array as unset
diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h
index 7b0a41b..4dbb7dc 100644
--- a/include/standard-headers/linux/virtio_balloon.h
+++ b/include/standard-headers/linux/virtio_balloon.h
@@ -53,7 +53,24 @@ struct virtio_balloon_config {
 #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
 #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */
 #define VIRTIO_BALLOON_S_CACHES   7   /* Disk caches */
-#define VIRTIO_BALLOON_S_NR       8
+#define VIRTIO_BALLOON_S_HTLB_PGALLOC  8  /* Hugetlb page allocations */
+#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.
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-09 19:53   ` Thomas Tai
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-09 19:53 UTC (permalink / raw)
  To: mst; +Cc: jasowang, virtio-dev, qemu-devel, rob.gardner, thomas.tai

The Linux kernel commit b40000325044 ("virtio_balloon: add array
of stat names") defines an array of stat name strings for consumers
of the virtio interface to use via the virtio_balloon.h header
file, rather than requiring each consumer to define its own. But at
present, the stat names defined in this array by the Linux kernel
do not match up with those defined internally by QEMU.

This patch fixes this inconsistency by importing the header file
from linux and use the new macro to construct the balloon_stat_names
array.

Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Cc: Rob Gardner <rob.gardner@oracle.com>
---
 docs/virtio-balloon-stats.txt                   |  2 ++
 hw/virtio/virtio-balloon.c                      | 13 ++-----------
 include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
index 7a66d25..7c69fdb 100644
--- a/docs/virtio-balloon-stats.txt
+++ b/docs/virtio-balloon-stats.txt
@@ -34,6 +34,8 @@ which will return a dictionary containing:
       - stat-total-memory
       - stat-available-memory
       - stat-disk-caches
+      - stat-hugetlb-allocations
+      - stat-hugetlb-failures
 
   o A key named last-update, which contains the last stats update
     timestamp in seconds. Since this timestamp is generated by the host,
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index f456cea..646f2e0 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -43,17 +43,8 @@ static void balloon_page(void *addr, int deflate)
     }
 }
 
-static const char *balloon_stat_names[] = {
-   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
-   [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
-   [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
-   [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
-   [VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
-   [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
-   [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
-   [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
-   [VIRTIO_BALLOON_S_NR] = NULL
-};
+static const char *balloon_stat_names[VIRTIO_BALLOON_S_NR] = \
+	VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("stat-");
 
 /*
  * reset_stats - Mark all items in the stats array as unset
diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h
index 7b0a41b..4dbb7dc 100644
--- a/include/standard-headers/linux/virtio_balloon.h
+++ b/include/standard-headers/linux/virtio_balloon.h
@@ -53,7 +53,24 @@ struct virtio_balloon_config {
 #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
 #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */
 #define VIRTIO_BALLOON_S_CACHES   7   /* Disk caches */
-#define VIRTIO_BALLOON_S_NR       8
+#define VIRTIO_BALLOON_S_HTLB_PGALLOC  8  /* Hugetlb page allocations */
+#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.
-- 
1.8.3.1


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
  2018-05-09 19:53   ` [virtio-dev] " Thomas Tai
@ 2018-05-10  8:18     ` Stefan Hajnoczi
  -1 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  8:18 UTC (permalink / raw)
  To: Thomas Tai; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner

[-- Attachment #1: Type: text/plain, Size: 4388 bytes --]

On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
> The Linux kernel commit b40000325044 ("virtio_balloon: add array
> of stat names") defines an array of stat name strings for consumers
> of the virtio interface to use via the virtio_balloon.h header
> file, rather than requiring each consumer to define its own. But at
> present, the stat names defined in this array by the Linux kernel
> do not match up with those defined internally by QEMU.
> 
> This patch fixes this inconsistency by importing the header file
> from linux and use the new macro to construct the balloon_stat_names
> array.
> 
> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
> Cc: Rob Gardner <rob.gardner@oracle.com>
> ---
>  docs/virtio-balloon-stats.txt                   |  2 ++
>  hw/virtio/virtio-balloon.c                      | 13 ++-----------
>  include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>  3 files changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
> index 7a66d25..7c69fdb 100644
> --- a/docs/virtio-balloon-stats.txt
> +++ b/docs/virtio-balloon-stats.txt
> @@ -34,6 +34,8 @@ which will return a dictionary containing:
>        - stat-total-memory
>        - stat-available-memory
>        - stat-disk-caches
> +      - stat-hugetlb-allocations
> +      - stat-hugetlb-failures
>  
>    o A key named last-update, which contains the last stats update
>      timestamp in seconds. Since this timestamp is generated by the host,
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index f456cea..646f2e0 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -43,17 +43,8 @@ static void balloon_page(void *addr, int deflate)
>      }
>  }
>  
> -static const char *balloon_stat_names[] = {
> -   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
> -   [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
> -   [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
> -   [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
> -   [VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
> -   [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
> -   [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
> -   [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
> -   [VIRTIO_BALLOON_S_NR] = NULL
> -};
> +static const char *balloon_stat_names[VIRTIO_BALLOON_S_NR] = \
> +	VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("stat-");
>  
>  /*
>   * reset_stats - Mark all items in the stats array as unset
> diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h
> index 7b0a41b..4dbb7dc 100644
> --- a/include/standard-headers/linux/virtio_balloon.h
> +++ b/include/standard-headers/linux/virtio_balloon.h
> @@ -53,7 +53,24 @@ struct virtio_balloon_config {
>  #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
>  #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */
>  #define VIRTIO_BALLOON_S_CACHES   7   /* Disk caches */
> -#define VIRTIO_BALLOON_S_NR       8
> +#define VIRTIO_BALLOON_S_HTLB_PGALLOC  8  /* Hugetlb page allocations */
> +#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.
> -- 
> 1.8.3.1
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-10  8:18     ` Stefan Hajnoczi
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  8:18 UTC (permalink / raw)
  To: Thomas Tai; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner

[-- Attachment #1: Type: text/plain, Size: 4388 bytes --]

On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
> The Linux kernel commit b40000325044 ("virtio_balloon: add array
> of stat names") defines an array of stat name strings for consumers
> of the virtio interface to use via the virtio_balloon.h header
> file, rather than requiring each consumer to define its own. But at
> present, the stat names defined in this array by the Linux kernel
> do not match up with those defined internally by QEMU.
> 
> This patch fixes this inconsistency by importing the header file
> from linux and use the new macro to construct the balloon_stat_names
> array.
> 
> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
> Cc: Rob Gardner <rob.gardner@oracle.com>
> ---
>  docs/virtio-balloon-stats.txt                   |  2 ++
>  hw/virtio/virtio-balloon.c                      | 13 ++-----------
>  include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>  3 files changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt
> index 7a66d25..7c69fdb 100644
> --- a/docs/virtio-balloon-stats.txt
> +++ b/docs/virtio-balloon-stats.txt
> @@ -34,6 +34,8 @@ which will return a dictionary containing:
>        - stat-total-memory
>        - stat-available-memory
>        - stat-disk-caches
> +      - stat-hugetlb-allocations
> +      - stat-hugetlb-failures
>  
>    o A key named last-update, which contains the last stats update
>      timestamp in seconds. Since this timestamp is generated by the host,
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index f456cea..646f2e0 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -43,17 +43,8 @@ static void balloon_page(void *addr, int deflate)
>      }
>  }
>  
> -static const char *balloon_stat_names[] = {
> -   [VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
> -   [VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
> -   [VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
> -   [VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
> -   [VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
> -   [VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
> -   [VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
> -   [VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
> -   [VIRTIO_BALLOON_S_NR] = NULL
> -};
> +static const char *balloon_stat_names[VIRTIO_BALLOON_S_NR] = \
> +	VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("stat-");
>  
>  /*
>   * reset_stats - Mark all items in the stats array as unset
> diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h
> index 7b0a41b..4dbb7dc 100644
> --- a/include/standard-headers/linux/virtio_balloon.h
> +++ b/include/standard-headers/linux/virtio_balloon.h
> @@ -53,7 +53,24 @@ struct virtio_balloon_config {
>  #define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
>  #define VIRTIO_BALLOON_S_AVAIL    6   /* Available memory as in /proc */
>  #define VIRTIO_BALLOON_S_CACHES   7   /* Disk caches */
> -#define VIRTIO_BALLOON_S_NR       8
> +#define VIRTIO_BALLOON_S_HTLB_PGALLOC  8  /* Hugetlb page allocations */
> +#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.
> -- 
> 1.8.3.1
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
  2018-05-09 19:53   ` [virtio-dev] " Thomas Tai
@ 2018-05-10  8:18     ` Stefan Hajnoczi
  -1 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  8:18 UTC (permalink / raw)
  To: Thomas Tai; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
> The Linux kernel commit b40000325044 ("virtio_balloon: add array
> of stat names") defines an array of stat name strings for consumers
> of the virtio interface to use via the virtio_balloon.h header
> file, rather than requiring each consumer to define its own. But at
> present, the stat names defined in this array by the Linux kernel
> do not match up with those defined internally by QEMU.
> 
> This patch fixes this inconsistency by importing the header file
> from linux and use the new macro to construct the balloon_stat_names
> array.
> 
> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
> Cc: Rob Gardner <rob.gardner@oracle.com>
> ---
>  docs/virtio-balloon-stats.txt                   |  2 ++
>  hw/virtio/virtio-balloon.c                      | 13 ++-----------
>  include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>  3 files changed, 22 insertions(+), 12 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-10  8:18     ` Stefan Hajnoczi
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  8:18 UTC (permalink / raw)
  To: Thomas Tai; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner

[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]

On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
> The Linux kernel commit b40000325044 ("virtio_balloon: add array
> of stat names") defines an array of stat name strings for consumers
> of the virtio interface to use via the virtio_balloon.h header
> file, rather than requiring each consumer to define its own. But at
> present, the stat names defined in this array by the Linux kernel
> do not match up with those defined internally by QEMU.
> 
> This patch fixes this inconsistency by importing the header file
> from linux and use the new macro to construct the balloon_stat_names
> array.
> 
> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
> Cc: Rob Gardner <rob.gardner@oracle.com>
> ---
>  docs/virtio-balloon-stats.txt                   |  2 ++
>  hw/virtio/virtio-balloon.c                      | 13 ++-----------
>  include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>  3 files changed, 22 insertions(+), 12 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
  2018-05-10  8:18     ` Stefan Hajnoczi
@ 2018-05-10 12:56       ` Thomas Tai
  -1 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-10 12:56 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner



On 2018-05-10 04:18 AM, Stefan Hajnoczi wrote:
> On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
>> The Linux kernel commit b40000325044 ("virtio_balloon: add array
>> of stat names") defines an array of stat name strings for consumers
>> of the virtio interface to use via the virtio_balloon.h header
>> file, rather than requiring each consumer to define its own. But at
>> present, the stat names defined in this array by the Linux kernel
>> do not match up with those defined internally by QEMU.
>>
>> This patch fixes this inconsistency by importing the header file
>> from linux and use the new macro to construct the balloon_stat_names
>> array.
>>
>> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
>> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
>> Cc: Rob Gardner <rob.gardner@oracle.com>
>> ---
>>   docs/virtio-balloon-stats.txt                   |  2 ++
>>   hw/virtio/virtio-balloon.c                      | 13 ++-----------
>>   include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>>   3 files changed, 22 insertions(+), 12 deletions(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 

Thank you Stefan.

-Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [virtio-dev] [PATCH V2 1/1] virtio-balloon: fix internal stat name array to match Linux kernel
@ 2018-05-10 12:56       ` Thomas Tai
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Tai @ 2018-05-10 12:56 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: mst, jasowang, virtio-dev, qemu-devel, rob.gardner



On 2018-05-10 04:18 AM, Stefan Hajnoczi wrote:
> On Wed, May 09, 2018 at 03:53:05PM -0400, Thomas Tai wrote:
>> The Linux kernel commit b40000325044 ("virtio_balloon: add array
>> of stat names") defines an array of stat name strings for consumers
>> of the virtio interface to use via the virtio_balloon.h header
>> file, rather than requiring each consumer to define its own. But at
>> present, the stat names defined in this array by the Linux kernel
>> do not match up with those defined internally by QEMU.
>>
>> This patch fixes this inconsistency by importing the header file
>> from linux and use the new macro to construct the balloon_stat_names
>> array.
>>
>> Signed-off-by: Jonathan Helman <jonathan.helman@oracle.com>
>> Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
>> Cc: Rob Gardner <rob.gardner@oracle.com>
>> ---
>>   docs/virtio-balloon-stats.txt                   |  2 ++
>>   hw/virtio/virtio-balloon.c                      | 13 ++-----------
>>   include/standard-headers/linux/virtio_balloon.h | 19 ++++++++++++++++++-
>>   3 files changed, 22 insertions(+), 12 deletions(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 

Thank you Stefan.

-Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-05-10 12:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 19:53 [Qemu-devel] [PATCH V2 0/1] virtio-balloon: fix internal stat name array to match Linux kernel Thomas Tai
2018-05-09 19:53 ` [virtio-dev] " Thomas Tai
2018-05-09 19:23 ` [Qemu-devel] " no-reply
2018-05-09 19:53 ` [Qemu-devel] [PATCH V2 1/1] " Thomas Tai
2018-05-09 19:53   ` [virtio-dev] " Thomas Tai
2018-05-10  8:18   ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10  8:18     ` Stefan Hajnoczi
2018-05-10  8:18   ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10  8:18     ` Stefan Hajnoczi
2018-05-10 12:56     ` [Qemu-devel] " Thomas Tai
2018-05-10 12:56       ` Thomas Tai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.