On Sat, Sep 30, 2017 at 12:05:52PM +0800, Wei Wang wrote:
+static int send_balloon_page_sg(struct virtio_balloon *vb,
+ struct virtqueue *vq,
+ void *addr,
+ uint32_t size,
+ bool batch)
+{
+ int err;
+
+ err = add_one_sg(vq, addr, size);
+
+ /* If batchng is requested, we batch till the vq is full */
typo
+ if (!batch || !vq->num_free)
+ kick_and_wait(vq, vb->acked);
+
+ return err;
+}
If add_one_sg fails, kick_and_wait will hang forever.
The reason this might work in because
1. with 1 sg there are no memory allocations 2. if adding fails on vq full, then
something
is in queue and will wake up kick_and_wait.
So in short this is expected to never fail.
How about a BUG_ON here then?
And make it void, and add a comment with above explanation.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 56:37:06 |
Calls: | 6,652 |
Calls today: | 4 |
Files: | 12,200 |
Messages: | 5,330,879 |