Skip to content
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

[virtio-queue] add events/metrics support #105

Open
lauralt opened this issue Oct 22, 2021 · 3 comments
Open

[virtio-queue] add events/metrics support #105

lauralt opened this issue Oct 22, 2021 · 3 comments
Assignees

Comments

@lauralt
Copy link
Contributor

lauralt commented Oct 22, 2021

In case of a queue misconfiguration, we log an error by using the log crate. We can get rid of this dependency by defining a QueueEvents trait and let the backend decide how they want to handle different events, an example here for the serial console. Another option would be to return errors instead of logging an error. Related to: #94.

@uran0sH
Copy link
Contributor

uran0sH commented May 5, 2022

I will add trait QueueEvents in virtio-queue, like below:

/// Define a QueueEvents trait and let the backend decide how they want to handle different events
pub trait QueueEvents {
   // some methods
   ....
}

And the device in the devices crate will implement this trait.

@lauralt
Copy link
Contributor Author

lauralt commented May 6, 2022

@uran0sH I assigned you to the issue. Thanks!

@uran0sH
Copy link
Contributor

uran0sH commented May 7, 2022

I try to add QueueEvents to QueueState as its field, like below. And I find some problems.

pub struct QueueState<EV: QueueEvents> {
    ...
    /// Queue Events
    pub queue_evts: EV,
}

pub struct Queue<M: GuestAddressSpace, EV: 'static + QueueEvents, S: QueueStateT<EV> = QueueState<EV>> {
    /// Guest memory object associated with the queue.
    pub mem: M,
    /// Virtio queue state.
    pub state: S,
    _marker: PhantomData<EV>,
}
  1. if we add queue_evts to QueueState , we need modify new method of QueueStateT, like fn new(max_size: u16, queue_evts: EV) -> Self
  2. And it will also affect virtio-queue-ser
impl From<&QueueStateSer> for QueueState {
    fn from(state: &QueueStateSer) -> Self {
        QueueState {
            queue_evts: ?
        }
    }
}

What value should we assign to queue_evts?
3. the struct implementing QueueState must be static, since pub trait QueueStateT<EV: 'static + QueueEvents>: for<'a> QueueStateGuard<'a, EV>. I can't find other methods to solve this. Maybe you have other methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants