Re: [PATCH v4 9/9] virtio-balloon: add workingset reporting
From: Daniel Verkamp
Date: Wed Nov 27 2024 - 18:21:40 EST
On Tue, Nov 26, 2024 at 7:00 PM Yuanchu Xie <yuanchu@xxxxxxxxxx> wrote:
[...]
> diff --git a/include/linux/workingset_report.h b/include/linux/workingset_report.h
> index f6bbde2a04c3..1074b89035e9 100644
> --- a/include/linux/workingset_report.h
> +++ b/include/linux/workingset_report.h
[...]
> diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
> index ee35a372805d..668eaa39c85b 100644
> --- a/include/uapi/linux/virtio_balloon.h
> +++ b/include/uapi/linux/virtio_balloon.h
> @@ -25,6 +25,7 @@
> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE. */
> +#include "linux/workingset_report.h"
> #include <linux/types.h>
> #include <linux/virtio_types.h>
> #include <linux/virtio_ids.h>
This seems to be including a non-uapi header
(include/linux/workingset_report.h) from a uapi header
(include/uapi/linux/virtio_balloon.h), which won't compile outside the
kernel. Does anything in the uapi actually need declarations from
workingset_report.h?
> @@ -37,6 +38,7 @@
> #define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3 /* VQ to report free pages */
> #define VIRTIO_BALLOON_F_PAGE_POISON 4 /* Guest is using page poisoning */
> #define VIRTIO_BALLOON_F_REPORTING 5 /* Page reporting virtqueue */
> +#define VIRTIO_BALLOON_F_WS_REPORTING 6 /* Working Set Size reporting */
>
> /* Size of a PFN in the balloon interface. */
> #define VIRTIO_BALLOON_PFN_SHIFT 12
> @@ -128,4 +130,32 @@ struct virtio_balloon_stat {
> __virtio64 val;
> } __attribute__((packed));
>
> +/* Operations from the device */
> +#define VIRTIO_BALLOON_WS_OP_REQUEST 1
> +#define VIRTIO_BALLOON_WS_OP_CONFIG 2
> +
> +struct virtio_balloon_working_set_notify {
> + /* REQUEST or CONFIG */
> + __le16 op;
> + __le16 node_id;
> + /* the following fields valid iff op=CONFIG */
> + __le32 report_threshold;
> + __le32 refresh_interval;
> + __le32 idle_age[WORKINGSET_REPORT_MAX_NR_BINS];
> +};
> +
> +struct virtio_balloon_working_set_report_bin {
> + __le64 idle_age;
> + /* bytes in this bucket for anon and file */
> + __le64 anon_bytes;
> + __le64 file_bytes;
> +};
> +
> +struct virtio_balloon_working_set_report {
> + __le32 error;
> + __le32 node_id;
> + struct virtio_balloon_working_set_report_bin
> + bins[WORKINGSET_REPORT_MAX_NR_BINS];
> +};
> +
> #endif /* _LINUX_VIRTIO_BALLOON_H */
Have the spec changes been discussed in the virtio TC?
Thanks,
-- Daniel