RAID1 Disk Setup and Asynchronous Reads#223
Conversation
initialize disk selection policy when starting RAID.
implementation
setting the RAID1 module's thread to use realtime scheduler
arthurp
left a comment
There was a problem hiding this comment.
Mostly nits that should be trivial to fix.
The complex bit is creating and configuring the block devices. See comments below.
| -drive if=none,format=raw,id=r0,file=./test/build/raid1_0.img \ | ||
| -drive if=none,format=raw,id=r1,file=./test/build/raid1_1.img \ | ||
| -drive if=none,format=raw,id=r0,file=/dev/nvme0n1p1 \ | ||
| -drive if=none,format=raw,id=r1,file=/dev/nvme1n1p1 \ | ||
| -drive if=none,format=raw,id=r2,file=/dev/nvme2n1p1 \ |
There was a problem hiding this comment.
I'm not sure how to handle this given the discussion of multiple configurations above. Do you know off hand when this file is actually used? I think, most of the time, it's actually ignored. If we can understand when this file is actually used we can potentially remove the raid devices entirely and just document that raid isn't configured in the specific configuration.
There was a problem hiding this comment.
The configurations here is configuring QEMU if emulating Asterinas on RISC-V. Just deleting them doesn't affect the CI/CD or development for us (we are defaulting to x86_64). But if there are RISC-V emulation in CI/CD it may fail.
There was a problem hiding this comment.
OK. If the makefile creates image files by default, it's probably best to just point this at those files.
ioeddk
left a comment
There was a problem hiding this comment.
Addressed minor changes. Will change qemu_args.sh and optimize snafu error handling ASAP.
| -drive if=none,format=raw,id=r0,file=./test/build/raid1_0.img \ | ||
| -drive if=none,format=raw,id=r1,file=./test/build/raid1_1.img \ | ||
| -drive if=none,format=raw,id=r0,file=/dev/nvme0n1p1 \ | ||
| -drive if=none,format=raw,id=r1,file=/dev/nvme1n1p1 \ | ||
| -drive if=none,format=raw,id=r2,file=/dev/nvme2n1p1 \ |
There was a problem hiding this comment.
The configurations here is configuring QEMU if emulating Asterinas on RISC-V. Just deleting them doesn't affect the CI/CD or development for us (we are defaulting to x86_64). But if there are RISC-V emulation in CI/CD it may fail.
…g on GH runners, rather than physical partitions
IRQ for OQueue strong observe and converting data writeout on the fly into flush all on inactive.
508dd72 to
6819de0
Compare
arthurp
left a comment
There was a problem hiding this comment.
Sorry to nit pick so much. But there are just a lot of things that feel like they haven't been checked or that I think we have discussed before but you haven't addressed. Please read the entire diff yourself again with all previous comments in mind. Let's chat a little about this when we meet today.
Since we have reached a point where nothing is a major issue I can't fix in an already planned next PR, go ahead and do your full pass and then merge.
| # Configure RAID drive sources. Set RAID_DEVICES to a comma-separated list of | ||
| # exactly three existing block devices (e.g. | ||
| # RAID_DEVICES=/dev/nvme0n1p1,/dev/nvme1n1p1,/dev/nvme2n1p1) to pass them directly to the guest. | ||
| # If unset or any device path is invalid, 1GB ext2 image files are used instead. |
There was a problem hiding this comment.
NIT: In general, I want something to fail if there is invalid data (as opposed to missing), not use a default. This is because the user probably meant to specify something, but did it wrong. If they wanted the default, they wouldn't have specified anything at all. This is something AI does wrong constantly, I don't know if you used it here, but it's worth noting.
| cp "$RAID_DEV_0" "$RAID_IMG" | ||
| fi | ||
| done | ||
| RAID_CACHE="writeback" |
There was a problem hiding this comment.
Why is the cache mode different? I'm not saying it's wrong, I'm just curious.
| SSH_RAND_PORT=${SSH_PORT:-22} | ||
| SSH_RAND_PORT=${SSH_PORT:-61541} |
| #[derive(Clone)] | ||
| #[derive(Clone, Copy, Default, BinarySerde)] | ||
| #[repr(C)] | ||
| pub struct BlockDeviceCompletionStats { | ||
| /// The latency of the I/O request (time from submission to completion). | ||
| pub latency: Duration, | ||
| /// The latency of the I/O request in microseconds. | ||
| pub latency_us: u64, | ||
| /// The number of outstanding requests at completion time. | ||
| pub outstanding_requests: usize, | ||
| pub outstanding_requests: u64, | ||
| /// The index of the device that produced this stat. | ||
| pub device_index: u64, |
There was a problem hiding this comment.
NIT: Aren't we dropping these changes? Once I move to CBOR, Duration works and the derive is different. It doesn't really matter I guess, but I'm going to immediately undo these changes. I thought we discussed this, but maybe I'm wrong, or maybe I said not to worry about it. Sorry, if those are the case.
| // Disable IRQs while holding the OQueue's SpinLock inside | ||
| // try_strong_observe to prevent deadlock with the IRQ handler | ||
| // that produces to the same OQueue (bio completion stats). | ||
| let _irq_guard = ostd::trap::irq::disable_local(); | ||
| o.try_strong_observe() |
| /// Dispatches a request by type. The RAID-1 device accepts the same BIOs as | ||
| /// any `BlockDevice` and applies RAID semantics underneath. | ||
| fn process_request(&self, request: BioRequest) { | ||
| // log::info!("Raid1Device process request, type: {:?}", request.type_()); |
| /// Handles the irq issued from the device | ||
| fn handle_irq(&self) { | ||
| info!("Virtio block device handle irq"); | ||
| // info!("Virtio block device handle irq"); |
| // single disk benchmark | ||
| // let nvme_device_name = "raid0"; | ||
| // if let Ok(block_device_nvme) = start_block_device(nvme_device_name) { | ||
| // let nvme_fs = Ext2::open(block_device_nvme).unwrap(); | ||
| // let target_path = FsPath::try_from("/raid1").unwrap(); | ||
| // self::rootfs::mount_fs_at(nvme_fs, &target_path).unwrap(); | ||
| // info!("[kernel] Mounted NVMe fs at {:?} ", target_path); | ||
| // } else { | ||
| // error!("[kernel] Failed to start NVMe block device '{}'", nvme_device_name); | ||
| // } | ||
| // return; | ||
|
|
|
All issues addressed. |
As one of the intermediate PR of #170, merging the following commits:
VirtIOmodule to the new OQueue.