[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] Fwd: Mouse Click and Context Switch Question

  • To: "Sujata Doshi" <sujatadoshi@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
  • Date: Fri, 13 Oct 2006 18:43:47 +0200
  • Delivery-date: Fri, 13 Oct 2006 09:44:30 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acbu5JugbOWjm4XiTBuFBcyYXKT1cAAAMoSA
  • Thread-topic: [Xen-devel] Fwd: Mouse Click and Context Switch Question


> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Sujata Doshi
> Sent: 13 October 2006 17:28
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-devel] Fwd: Mouse Click and Context Switch Question
> Hi
> I wasn't sure if the email below went through , since I was not
> subscribed to the list. Would appreciate your response.
> Thanks
> Sujata
> ---------- Forwarded message ----------
> From: Sujata Doshi <sujatadoshi@xxxxxxxxx>
> Date: Oct 13, 2006 10:37 AM
> Subject: Mouse Click and Context Switch Question
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Hello
> I am starting a research project which involves using Xen. Basically
> we would like to monitor the input to an application running in the
> guest OS . Specifically, we need to be able to figure out when an
> input was made via a mouse click and what the coordinates of the mouse
> pointer were on that click. If I understand correctly, on a mouse
> click, an interrupt occurs which gets handled by the Xen VMM --- is
> there a way of figuring out at the Xen VMM level what the coordinates
> of the click are when this interrupt occurs ?

You understand correctly on the principle of interrupts, but the actual
mouse-movements are tracked in the mouse-handling code inside Linux
Dom0, not in the VMM, as the VMM doesn't actually know (or care)
anything about the mouse as a device, just about forwarding the
interrupt to the rightfull owner. 

If you know what application you want to track, and you're able to hack
some code, I'd suggest that you go modify the X-windows code (such as
XFree86) to track where the mouse-clicks are forwarded to the
application. Since X-windows knows which application it forwards what
information to, it's the "perfect" place to do this [from my
understanding of the subject - I could of course be missing some
important factor that isn't apparent from the above brief description]. 

> I understand this would also involve figuring out when a context
> switch occurs to that particular application so that we can grab the
> right mouse click. Is there an easy way to figure this context switch
> out ?

The VMM scheduler is not per process but per virtual machine, so the
application level would have to be understood by the operating system
running on top of Xen, as Xen doesn't actually know what application (if
any) is running at any given time, only the Linux kernel (typial case)
that is running on top of Xen will know this. 
> I would appreciate if you could guide me with the above queries and
> also which files in the Xen source I should be looking at to achieve
> this task.

I could theoretically help you with any Xen-files, but I don't think
that's the right approach in the first place - you want to be working
further up in the architecture to have access to the "current

[Note: this is assuming that we're talking about para-virtualized
clients. In the case of a full-virtualized guest [HVM, VT/AMD-V], such
as a Windows guest, there is a possibility that you could follow the
mouse within the qemu-dm [the device model that generates the virtual
mouse], and use that information to record where the mouse moves to.
However, it's still impossible to understand which application is
running at that particular point in time - again, you need to have OS to
help you with that].

> Thank you very much for your help
> Sujata
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.