Skip to contentSkip to conversation

xenblk: Add O_DIRECT and O_SYNC support.

PATCH Keir Fraser 2 participants 5 messages Nov 5, 2008 – Nov 6, 2008 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Jens Axboe

If you only complete the request once you get a completion in, then there's no issue. I thought it did queuing, serves me well for not actually having the code handy to look at... There's still some merit to Joe's patch, he should have split #2 into two pieces - some of it is actually a real bug fix (you must not do bio_alloc() without having submitted the previous bio you allocated, and you should use a private bioset if you stack). This much is at least visible from just looking at the patch!

blkfront can queue multiple requests to blkback, each of which is a scatter-gather list. Each request is turned into one or more bios by blkback, and each is individually submit_bio()ed. When ->bi_end_io(0) is called for all bios corresponding to a request, only then is a response queued for collection by blkfront.

I wasn't aware of limitations on number of times you can call bio_alloc(). Perhaps we should arrange to submit_bio() more eagerly, rather than batching up (we plug the queue previously, so there's no need to batch up submit_bio() calls for scheduling purposes). Would that be better than a bioset, or is a bioset easier do you think?

Quoted 1 line

Does blkback propagate unplug events downwards?

Not sure what that means. blkback does its own limited queue plugging to try to develop usefully schedulable batches of I/O. There's no concept of plugging across the blkfront/blkback interface.

-- Keir

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 8 lines · Jens Axboe
Quoted 5 lines
Quoted 1 line

Does blkback propagate unplug events downwards?

Not sure what that means. blkback does its own limited queue plugging to try to develop usefully schedulable batches of I/O. There's no concept of plugging across the blkfront/blkback interface.

So once you leave your queuing loop, you unplug the below device? Or just point me at the source...

The tree's at http://xenbits.xensource.com/linux-2.6.18-xen.hg

You can clone it or browse it there.

The medium- to long-term issue is just to make sure that Jeremy's port of blkback into upstream Linux (which he's probably working on at the moment) doesn't perpetuate the bio violations. But I guess we should fix 2.6.18 too since others base their own Xen patchsets on it still (e.g., for dom0 support).

Thanks,
Keir

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 22 lines · Jens Axboe
Quoted 13 lines · Keir Fraser
Quoted 8 lines · Jens Axboe
Quoted 5 lines
Quoted 1 line

Does blkback propagate unplug events downwards?

Not sure what that means. blkback does its own limited queue plugging to try to develop usefully schedulable batches of I/O. There's no concept of plugging across the blkfront/blkback interface.

So once you leave your queuing loop, you unplug the below device? Or just point me at the source...

The tree's at http://xenbits.xensource.com/linux-2.6.18-xen.hg

Quoted 7 lines

You can clone it or browse it there.

The medium- to long-term issue is just to make sure that Jeremy's port of blkback into upstream Linux (which he's probably working on at the moment) doesn't perpetuate the bio violations. But I guess we should fix 2.6.18 too since others base their own Xen patchsets on it still (e.g., for dom0 support).

Quoted 4 lines

Ah thanks! Perhaps we can talk Joe into snipping the bio_alloc() changes out of his patch #2 - Joe, just the bio_alloc() and submit_bio() stuff, you don't have to include the bio_set changes.

Thanks, will get rid of it.

Joe

#6 lore raw
In reply to a message not in the archive
Quoted 9 lines · Jens Axboe
Quoted 5 lines

The medium- to long-term issue is just to make sure that Jeremy's port of blkback into upstream Linux (which he's probably working on at the moment) doesn't perpetuate the bio violations. But I guess we should fix 2.6.18 too since others base their own Xen patchsets on it still (e.g., for dom0 support).

Ah thanks! Perhaps we can talk Joe into snipping the bio_alloc() changes out of his patch #2 - Joe, just the bio_alloc() and submit_bio() stuff, you don't have to include the bio_set changes.

But Joe's patch still queues up bios into an array, the same as ever?

-- Keir

#7 lore raw
In reply to a message not in the archive
Quoted 15 lines

You don't need a bio_set if you are not queuing beneath someone else. But you do need to take care not to call bio_alloc() again without having submitted the previous allocation, that is a violation of the bio mempool and can lead to deadlocks. I think the batching you do looks pointless (again, only looking at the patch), you should submit each bio as soon as it is built instead of stashing it in an array for later submission. That also gets rid of your bio mempool violation.

Quoted 5 lines
Quoted 1 line

Does blkback propagate unplug events downwards?

Not sure what that means. blkback does its own limited queue plugging to try to develop usefully schedulable batches of I/O. There's no concept of plugging across the blkfront/blkback interface.

Quoted 5 lines

So once you leave your queuing loop, you unplug the below device? Or just point me at the source...

From source code when got all requests from ring buffer, it have have

unpluged request_queue, when unplug_fn() called, maybe some requests in request_queue waiting for commit to device.

I have suspected the data lost for device's cache, but when set the bio rw to WRITE_SYNC, data could almost sync to disk at once.

Thanks,
Joe