-
Notifications
You must be signed in to change notification settings - Fork 36
Description of block&net_queue-handler.md #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amar512-prog
wants to merge
1
commit into
codenet:main
Choose a base branch
from
amar512-prog:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Description of queue-handler | ||
codenet marked this conversation as resolved.
Show resolved
Hide resolved
codenet marked this conversation as resolved.
Show resolved
Hide resolved
codenet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Brief about Virtio: | ||
| It is virtualized driver for network and disk device. It improves the performance of guests by lowering guest I/O latency and | ||
| raising throughput to levels that are almost comparable to those of bare metal in KVM. | ||
|
|
||
| ### About virtio block queue-handler: | ||
| - The virtio-block device presents a block device to the virtual machine. | ||
| - This object is used to filter the events with given condition of a block device, in case of exceptional events we need to remove the event from the QueueHandler. | ||
| - It has two components: | ||
| - inner - an Inorder Queue handler object which is used to handle requests. | ||
| - ioeventfd - a file descriptor with an underlying count within the kernel. | ||
| ```rs | ||
| pub(crate) struct QueueHandler<M: GuestAddressSpace> { | ||
| pub inner: InOrderQueueHandler<M, SingleFdSignalQueue>, | ||
| pub ioeventfd: EventFd, | ||
| } | ||
| ``` | ||
|
|
||
| - In this process of its implementation, we match the condition of events and remove the unmatched ones from the EventOps of EventManager as follows: | ||
| - filtering the events: | ||
| 1. events.event\_set() == EventSet::IN | ||
| 2. events.data() == IOEVENT_DATA | ||
| 3. self.ioeventfd.read().is\_err() | ||
| 4. inorderhander process\_queue() is giving error | ||
| - Then, we remove the other event. | ||
| - In this init of its implementation, we initializing op as EventOps by adding event of a file descriptor, associated data and EVENTSET::IN | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. initializing -> initialize |
||
| ```rs | ||
| impl<M: GuestAddressSpace> MutEventSubscriber for QueueHandler<M> { | ||
| fn process(&mut self, events: Events, ops: &mut EventOps) { | ||
| ... | ||
| } | ||
| fn init(&mut self, ops: &mut EventOps) { | ||
| ... | ||
| } | ||
| ``` | ||
| ### About virtio net queue-handler: | ||
| - The virtio-net device use to access network adapters to the virtual machine. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is used |
||
| -  | ||
|
|
||
| - This object is used to filter the events with given condition of a network adapter, in case of exceptional events we need to remove the event from the QueueHandler. | ||
| - It has three components: | ||
| - inner - an Inorder Queue handler object which is used to handle requests. | ||
| - rx_ioevent - a file descriptor with an underlying count within the kernel. | ||
| - tx_ioevent - a file descriptor with an underlying count within the kernel. | ||
| ```rs | ||
| pub struct QueueHandler<M: GuestAddressSpace> { | ||
| pub inner: SimpleHandler<M, SingleFdSignalQueue>, | ||
| pub rx_ioevent: EventFd, | ||
| pub tx_ioevent: EventFd, | ||
| } | ||
| ``` | ||
|
|
||
| - In this handle_error of its implementation, we remove all events in ops of EventOps. | ||
|
|
||
| ```rs | ||
| impl<M: GuestAddressSpace> QueueHandler<M> { | ||
| fn handle_error<S: AsRef<str>>(&self, s: S, ops: &mut EventOps) { | ||
| ... | ||
| } | ||
| } | ||
| ``` | ||
| - In this process of each of MutEventSubscriber of its implementation, we match the condition of events and remove the unmatched ones from the EventOps of EventManager as follows: | ||
| - filtering the events: | ||
| 1. events.event\_set() == EventSet::IN | ||
| 2. no error in inorder handler processing request respectively: | ||
| - process tap: inorder queue.process_tap() | ||
| - process rx: inorder queue.process_rxq() | ||
| - process tx: inorder queue.process_txq() | ||
| 3. no error in respective event read: | ||
| - rx: rx_ioevent.read() | ||
| - tx: tx_ioevent.read() | ||
| - forward for exceptional events to call handle_error to remove them. | ||
| - In this init of its implementation, we initializing op as EventOps by adding event of a file descriptor(tap of inorder handler, rx_ioevent, tx_ioevent), associated data (TAPFD_DATA, RX_IOEVENT_DATA, TX_IOEVENT_DATA) and EVENTSET::IN (in case of tap process EDGE_TRIGGERED is also included) | ||
| ```rs | ||
| impl<M: GuestAddressSpace> MutEventSubscriber for QueueHandler<M> { | ||
| fn process(&mut self, events: Events, ops: &mut EventOps) { | ||
| ... | ||
| } | ||
| fn init(&mut self, ops: &mut EventOps) { | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.