All of lore.kernel.org
 help / color / mirror / Atom feed
* How console data travel in Xen?
@ 2005-06-30  9:06 NAHieu
  0 siblings, 0 replies; 7+ messages in thread
From: NAHieu @ 2005-06-30  9:06 UTC (permalink / raw)
  To: xen-devel

Hello,

I am trying to investigate in detail how console data go thru the Xen
system. Suppose that I am running a domainU, when I type at the
domainU console (I connect to the console with xencons or ssh), how
data (from keyboard in this case) travel from low level (hardware) to
Xen, then to dom0, then to domU?

I am not afraid of reading and hacking the source to understand this,
but I dont know where to start in the jungle of code. (Which files
should I pay attention to?)

Looks like xen/drivers/char/console.c is not related to this problem?

All the helps are highly appreciated ;-)

Thank you a lot,
Hieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* How console data travel in Xen?
@ 2005-06-30 15:41 NAHieu
  2005-06-30 16:08 ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: NAHieu @ 2005-06-30 15:41 UTC (permalink / raw)
  To: xen-devel

Hello,

I am trying to investigate in detail how console data go thru the Xen
system. Suppose that I am running a domainU, when I type at the
domainU console (I connect to the console with xencons or ssh), how
data (from keyboard in this case) travel from low level (hardware) to
Xen, then to dom0, then to domU?

I am not afraid of reading and hacking the source to understand this,
but I dont know where to start in the jungle of code. (Which files
should I pay attention to?)

Looks like xen/drivers/char/console.c is not related to this problem?

All the helps are highly appreciated ;-)

Thank you a lot,
Hieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: How console data travel in Xen?
@ 2005-06-30 15:52 Li, Xin B
  0 siblings, 0 replies; 7+ messages in thread
From: Li, Xin B @ 2005-06-30 15:52 UTC (permalink / raw)
  To: NAHieu, xen-devel

NAHieu wrote:
> Hello,
> 
> I am trying to investigate in detail how console data go
> thru the Xen system. Suppose that I am running a domainU,
> when I type at the domainU console (I connect to the
> console with xencons or ssh), how data (from keyboard in
> this case) travel from low level (hardware) to Xen, then
> to dom0, then to domU? 
> 
> I am not afraid of reading and hacking the source to
> understand this, but I dont know where to start in the
> jungle of code. (Which files should I pay attention to?)
> 
> Looks like xen/drivers/char/console.c is not related to
> this problem? 

Xcs.c should help!

> 
> All the helps are highly appreciated ;-)
> 
> Thank you a lot,
> Hieu
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How console data travel in Xen?
  2005-06-30 15:41 NAHieu
@ 2005-06-30 16:08 ` Anthony Liguori
  2005-06-30 17:28   ` NAHieu
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2005-06-30 16:08 UTC (permalink / raw)
  To: NAHieu; +Cc: xen-devel

NAHieu wrote:

>Hello,
>
>I am trying to investigate in detail how console data go thru the Xen
>system. Suppose that I am running a domainU, when I type at the
>domainU console (I connect to the console with xencons or ssh), how
>data (from keyboard in this case) travel from low level (hardware) to
>Xen, then to dom0, then to domU?
>  
>
There exists a well-known event channel and shared memory page between 
each dom0 and domU which the control tools are responsible for setting 
up (in Xend, that's xcs--in VM-Tools, that's xenctld).  The shared 
memory page is defined by the shared_info_frame which is queriable as 
part of getdomaininfo().  The event channel is chosen by the control 
tools and is almost always 1.

The event channel and shared memory page make up the control channel.  
The shared memory page is used as a ring queue for messages (see 
/usr/include/xen/io/domain_controller.h) and the event channel is a 
notification message to say when a new message has arrived.

One of the message types is CMSG_CONSOLE.  It has one message subtype 
CMSG_CONSOLE_DATA.  Console data (input and output) is passed in 60 byte 
chunks using this message type between dom0 and domU.  This is handled 
at drivers/xen/console/console.c in domU (in the kernel tree) and in 
tools/xcs/*.c in dom0 (or xenctld/console.c in VM-Tools).  In VM-Tools, 
the console messages are just put into a queue until a file (usually a 
pty) is associated with the device in which case everything is 
dumped/read from the file.

The Xend/xcs architecture is a bit more complex.  xcs forwards all 
messages over two sockets to Xend.  Xend then dispatches these messages 
internally.  The messages are then read/written to a socket.  The stuff 
that's unique to the console is mostly handled in 
tools/python/xen/xend/server/console.py

Hope this helps.

Regards,

Anthony Liguori

>I am not afraid of reading and hacking the source to understand this,
>but I dont know where to start in the jungle of code. (Which files
>should I pay attention to?)
>
>Looks like xen/drivers/char/console.c is not related to this problem?
>
>All the helps are highly appreciated ;-)
>
>Thank you a lot,
>Hieu
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>
>  
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How console data travel in Xen?
  2005-06-30 16:08 ` Anthony Liguori
@ 2005-06-30 17:28   ` NAHieu
  2005-06-30 18:16     ` Anthony Liguori
  0 siblings, 1 reply; 7+ messages in thread
From: NAHieu @ 2005-06-30 17:28 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: xen-devel

On 7/1/05, Anthony Liguori <aliguori@us.ibm.com> wrote:
> NAHieu wrote:
> 
> >Hello,
> >
> >I am trying to investigate in detail how console data go thru the Xen
> >system. Suppose that I am running a domainU, when I type at the
> >domainU console (I connect to the console with xencons or ssh), how
> >data (from keyboard in this case) travel from low level (hardware) to
> >Xen, then to dom0, then to domU?
> >
> >
> There exists a well-known event channel and shared memory page between
> each dom0 and domU which the control tools are responsible for setting
> up (in Xend, that's xcs--in VM-Tools, that's xenctld).  The shared
> memory page is defined by the shared_info_frame which is queriable as
> part of getdomaininfo().  The event channel is chosen by the control
> tools and is almost always 1.
> 
> The event channel and shared memory page make up the control channel.
> The shared memory page is used as a ring queue for messages (see
> /usr/include/xen/io/domain_controller.h) and the event channel is a
> notification message to say when a new message has arrived.
> 
> One of the message types is CMSG_CONSOLE.  It has one message subtype
> CMSG_CONSOLE_DATA.  Console data (input and output) is passed in 60 byte
> chunks using this message type between dom0 and domU.  This is handled
> at drivers/xen/console/console.c in domU (in the kernel tree) and in
> tools/xcs/*.c in dom0 (or xenctld/console.c in VM-Tools).  In VM-Tools,
> the console messages are just put into a queue until a file (usually a
> pty) is associated with the device in which case everything is
> dumped/read from the file.
> 
> The Xend/xcs architecture is a bit more complex.  xcs forwards all
> messages over two sockets to Xend.  Xend then dispatches these messages
> internally.  The messages are then read/written to a socket.  The stuff
> that's unique to the console is mostly handled in
> tools/python/xen/xend/server/console.py

Anthony, thank you for a great detail explaination. These information
is really helpful to me.

But still few questions stand: how do console data go from HW to Xen,
then to dom0? (the above explaination is only about sessions between
dom0 and domU)

Thank you a lot,
Hieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How console data travel in Xen?
  2005-06-30 17:28   ` NAHieu
@ 2005-06-30 18:16     ` Anthony Liguori
       [not found]       ` <5d7aca95050630113550c453b0@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2005-06-30 18:16 UTC (permalink / raw)
  To: NAHieu; +Cc: xen-devel

NAHieu wrote:

>Anthony, thank you for a great detail explaination. These information
>is really helpful to me.
>  
>
no problem :-)

>But still few questions stand: how do console data go from HW to Xen,
>then to dom0? (the above explaination is only about sessions between
>dom0 and domU)
>  
>
Ok, so let's say you enter some keyboard data.  Those keyboard actions 
are going to go to dom0.  If you're typing at a console it's getting 
intercepted by some program that's push that keyboard data to Xend let's 
say.  Xend takes that data and splits it up into CMSG_CONSOLE messages 
which it then passes through the previously described mechanism to domU.

Then domU sees that data as input on a virtual serial device (the domU 
kernel's been hacked to use the serial device by default instead of the 
typical virtual terminals).  Then when domU decides it wants to display 
that data back to the user, it sends it back to dom0 again through the 
previously described channel.

Xend ends up getting those messages and assembles it into a string which 
it then displays back on the console.

This is probably a bit clearer if you look at the VM-Tools source tree.  
Everything is pretty much confined to tools/vm-console.c and 
xenctld/console.c.  Xend does pretty much the same thing but there's a 
bit more indirection involved.

Regards,

Anthony Liguori

>Thank you a lot,
>Hieu
>
>  
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How console data travel in Xen?
       [not found]       ` <5d7aca95050630113550c453b0@mail.gmail.com>
@ 2005-06-30 18:39         ` Anthony Liguori
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony Liguori @ 2005-06-30 18:39 UTC (permalink / raw)
  To: NAHieu, xen-devel

NAHieu wrote:

>Oops, probably you missed my point: I want to know how the data go
>from low level (HW) to Xen (hypervisor), then to dom0.
>  
>
I was avoiding answering this because I'm sure that someone who's much 
smarter than me is going to jump in and correct me on this :-)

dom0 takes the keyboard interrupts just like it normally would.  I 
believe (and I may be wrong here) that in x86 the IDT is setup such that 
keyboard interrupts go directly to the dom0 kernel (since it's in ring 1).

I would imagine that in x86-64 that those interrupts have to be 
reflected back down to the guest OS.  This is almost pure speculation 
though so hopefully someone else will jump in and correct me.

>I guess it works this way: dom0 has privileged right to access to HW,
>so it can take keyboard code directly (I guess it goes thru Xen, but
>dont know exactly how?). Then from dom to domU, it works like you
>explained. Is that correct?
>
>Many thanks, Anthony.
>Hieu.
>
>  
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-30 18:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-30  9:06 How console data travel in Xen? NAHieu
  -- strict thread matches above, loose matches on Subject: below --
2005-06-30 15:41 NAHieu
2005-06-30 16:08 ` Anthony Liguori
2005-06-30 17:28   ` NAHieu
2005-06-30 18:16     ` Anthony Liguori
     [not found]       ` <5d7aca95050630113550c453b0@mail.gmail.com>
2005-06-30 18:39         ` Anthony Liguori
2005-06-30 15:52 Li, Xin B

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.