Setting custom field in struct thread from bhyverun code
Neel Natu
neelnatu at gmail.com
Fri Jun 5 18:51:53 UTC 2015
Hi Stefan,
On Fri, Jun 5, 2015 at 10:23 AM, Stefan Andritoiu
<stefan.andritoiu at gmail.com> wrote:
> I've added a new field to struct thread and want to set it's value
> when the VCPU thread is created. I need this new field in the ULE
> scheduler.
> My plan was this: in the fbsdrun_start_thread() function make a
> custom-ioctl call {ioctl(ctx->fd, VM_SET_CUSTOM, ..)} to set it. But I
> have no idea how to get the thread I need, to set it's value.
> How can I get the thread? Or is there a better way of setting, a
> VCPU-thread's field, at the moment the thread is created, to use it in
> the scheduler?
The thread context in which the ioctl is executed is passed as the
last argument to the ioctl handler.
For example: vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data,
int fflag, struct thread *td)
So, if you issue the ioctl() in vcpu context then 'td' points to the
vcpu thread.
best
Neel
> _______________________________________________
> freebsd-virtualization at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"
More information about the freebsd-virtualization
mailing list