Skip to contentSkip to conversation

virtio-balloon: Avoid using the word 'report' when referring to free page hinting

PATCH Superseded Alexander Duyck 2 participants 3 messages Apr 15, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-balloon: Avoid using the word 'report' when referring to free page hinting

From: Alexander Duyck <[email protected]>

It can be confusing to have multiple features within the same driver that are using the same verbage. As such this patch is creating a union of free_page_report_cmd_id with free_page_hint_cmd_id so that we can clean-up the userspace code a bit in terms of readability while maintaining the functionality of legacy code.

---
 drivers/virtio/virtio_balloon.c     |    2 +-
 include/uapi/linux/virtio_balloon.h |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/virtio/virtio_balloon.c +1 -1
index 0ef16566c3f3..95d9c2f0a7be 100644
@@ -580,7 +580,7 @@ static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
 	if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
 			       &vb->config_read_bitmap))
 		virtio_cread(vb->vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id,
+			     free_page_hint_cmd_id,
 			     &vb->cmd_id_received_cache);
 
 	return vb->cmd_id_received_cache;
include/uapi/linux/virtio_balloon.h +9 -2
index 19974392d324..dc3e656470dd 100644
@@ -48,8 +48,15 @@ struct virtio_balloon_config {
 	__u32 num_pages;
 	/* Number of pages we've actually got in balloon. */
 	__u32 actual;
-	/* Free page report command id, readonly by guest */
-	__u32 free_page_report_cmd_id;
+	/*
+	 * Free page hint command id, readonly by guest.
+	 * Was previously named free_page_report_cmd_id so we
+	 * need to carry that name for legacy support.
+	 */
+	union {
+		__u32 free_page_hint_cmd_id;
+		__u32 free_page_report_cmd_id;	/* deprecated */
+	};
 	/* Stores PAGE_POISON if page poisoning is in use */
 	__u32 poison_val;
 };
#1 lore raw
Quoted 40 lines · Alexander Duyck

From: Alexander Duyck <[email protected]>

It can be confusing to have multiple features within the same driver that are using the same verbage. As such this patch is creating a union of free_page_report_cmd_id with free_page_hint_cmd_id so that we can clean-up the userspace code a bit in terms of readability while maintaining the functionality of legacy code.

---
 drivers/virtio/virtio_balloon.c     |    2 +-
 include/uapi/linux/virtio_balloon.h |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/virtio/virtio_balloon.c +1 -1
index 0ef16566c3f3..95d9c2f0a7be 100644
@@ -580,7 +580,7 @@ static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
 	if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
 			       &vb->config_read_bitmap))
 		virtio_cread(vb->vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id,
+			     free_page_hint_cmd_id,
 			     &vb->cmd_id_received_cache);
 
 	return vb->cmd_id_received_cache;
include/uapi/linux/virtio_balloon.h +2 -2
index 19974392d324..dc3e656470dd 100644
@@ -48,8 +48,15 @@ struct virtio_balloon_config {
 	__u32 num_pages;
 	/* Number of pages we've actually got in balloon. */
 	__u32 actual;
-	/* Free page report command id, readonly by guest */
-	__u32 free_page_report_cmd_id;
+	/*
+	 * Free page hint command id, readonly by guest.

include/uapi/linux/virtio_balloon.h struct virtio_balloon_config { · line 62

Quoted 10 lines
include/uapi/linux/virtio_balloon.h +7 -0
+	 * Was previously named free_page_report_cmd_id so we
+	 * need to carry that name for legacy support.
+	 */
+	union {
+		__u32 free_page_hint_cmd_id;
+		__u32 free_page_report_cmd_id;	/* deprecated */
+	};
 	/* Stores PAGE_POISON if page poisoning is in use */
 	__u32 poison_val;
 };

Can we also change the comment of

#define VIRTIO_BALLOON_F_FREE_PAGE_HINT /* VQ to report free pages */

?

Thanks!

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 7 lines · David Hildenbrand

Can we also change the comment of

#define VIRTIO_BALLOON_F_FREE_PAGE_HINT /* VQ to report free pages */

?

Thanks!

No problem. I will update and submit a v2.

Thanks.

- Alex