Date: Fri, 5 Jun 2015 11:51:50 -0700 From: Neel Natu <neelnatu@gmail.com> To: Stefan Andritoiu <stefan.andritoiu@gmail.com> Cc: "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org> Subject: Re: Setting custom field in struct thread from bhyverun code Message-ID: <CAFgRE9EAmL5FYcge6UhaYjFxLY8RoM5eyci-pmLDAOGwQdTV9Q@mail.gmail.com> In-Reply-To: <CAO3d8=bpczvx26xSiteb7xPCTjt04ogBYObGCMsewNUi=U5z8w@mail.gmail.com> References: <CAO3d8=bpczvx26xSiteb7xPCTjt04ogBYObGCMsewNUi=U5z8w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Stefan,
On Fri, Jun 5, 2015 at 10:23 AM, Stefan Andritoiu
<stefan.andritoiu@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFgRE9EAmL5FYcge6UhaYjFxLY8RoM5eyci-pmLDAOGwQdTV9Q>
