From owner-freebsd-virtualization@FreeBSD.ORG Fri Jun 5 18:51:52 2015 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F12AB919 for ; Fri, 5 Jun 2015 18:51:52 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8914510A7 for ; Fri, 5 Jun 2015 18:51:52 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: by wibdq8 with SMTP id dq8so27955081wib.1 for ; Fri, 05 Jun 2015 11:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=B9Ryr/R765fpaOwQjBvTV9Cq/N0UYJDOSuD4snPaZqc=; b=uMJlbvndSc2lsHY5obY0/pwqhukYiR5FxShcZPpyyeea1WTYoRFIYfKwgIXxjfEe2K tMyYkfVpLYpeeemTo6vrMeXw9wDrjoRurLffQnh7fR5IdQ43HT6/8iXVv1y3+0FCG9Nq 7SudSBbLVHMpljGIEl1nIjG3CEXsikwo57EImQsjC/CclPLwJipOnMjj3+5zGmLc9Zf0 t0xnkR6rQMZD02Kx2oLbT0vqETFOy4uM0SIt8zs96+FuUt/TKVlXrqYH4kIkNezFoye0 a7EL9M5GU0yIiW9R9TPnRCEuEh4fSIxKwJUvnC8noP/o7+kWedP5abiZuo4vioxfGpoN pflQ== MIME-Version: 1.0 X-Received: by 10.194.62.201 with SMTP id a9mr8723224wjs.63.1433530311009; Fri, 05 Jun 2015 11:51:51 -0700 (PDT) Received: by 10.27.52.18 with HTTP; Fri, 5 Jun 2015 11:51:50 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Jun 2015 11:51:50 -0700 Message-ID: Subject: Re: Setting custom field in struct thread from bhyverun code From: Neel Natu To: Stefan Andritoiu Cc: "freebsd-virtualization@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2015 18:51:53 -0000 Hi Stefan, On Fri, Jun 5, 2015 at 10:23 AM, Stefan Andritoiu 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"