On Thu, Apr 13, 2017 at 05:35:08PM +0800, Wei Wang wrote:
Add a new vq, miscq, to handle miscellaneous requests between the deviceimplements
and the driver.
This patch implemnts the VIRTIO_BALLOON_MISCQ_INQUIRE_UNUSED_PAGES
request sent from the device.Commands are sent from host and handled on guest.
In fact how is this so different from stats?
How about reusing the stats vq then? You can use one buffer
for stats and one buffer for commands.
+ miscq_out_hdr->flags = 0;And where is miscq_out_hdr used? I see no add_outbuf anywhere.
+
+ for_each_populated_zone(zone) {
+ for (order = MAX_ORDER - 1; order > 0; order--) {
+ for (migratetype = 0; migratetype < MIGRATE_TYPES;
+ migratetype++) {
+ do {
+ ret = inquire_unused_page_block(zone,
+ order, migratetype, &page);
+ if (!ret) {
+ pfn = (u64)page_to_pfn(page);
+ add_one_chunk(vb, vq,
+ PAGE_CHUNK_TYPE_UNUSED,
+ pfn,
+ (u64)(1 << order));
+ }
+ } while (!ret);
+ }
+ }
+ }
+ miscq_out_hdr->flags |= VIRTIO_BALLOON_MISCQ_F_COMPLETE;
Things like this should be passed through function parameters
and not stuffed into device structure, fields should be
initialized before use and not where we happen to
have the data handy.
It intends to be a bit number. Bit 0 of flags to indicate the completion
Also, _F_ is normally a bit number, you use it as a value here.