xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: sainath grandhi <saiallforums@gmail.com>
To: xen-devel@lists.xen.org
Subject: Help with reading from hvc console device on a PV guest
Date: Thu, 23 Jul 2015 10:14:57 -0700	[thread overview]
Message-ID: <CABqzqi4FEud7Ub=H4mrSS8hgftFTYeZ2JP2Ei_av5UMgtHENfw@mail.gmail.com> (raw)

Hello,

    Please let me know if you have some information about issue below.

    I created a channel device for PV guest using

channel= ["connection=pty, name=xen.channel.0,
path=/var/lib/xen/ctl-socket","connection=socket, name=xen.channel.1,
path=/var/lib/xen/ctl-socket-data"]

   Xen toolstack uses qemu backend for additional consoles other than console 0.

/usr/local/lib/xen/bin/qemu-system-i386 -xen-domid 505 -chardev
socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-505,server,nowait
-no-shutdown -mon chardev=libxl-cmd,mode=control -chardev
socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-505,server,nowait
-mon chardev=libxenstat-cmd,mode=control -chardev
pty,id=libxl-channel0 -chardev
socket,id=libxl-channel1,path=/var/lib/xen/ctl-socket-data,server,nowait
-nodefaults -xen-attach -name ubuntupvhchannel -vnc none -display none
-nographic -machine xenpv -m 2048

   I see additional console devices in the guest under /dev/hvc1 and /dev/hvc2.

  I write to the other end of the channel i.e. from dom0,   but when I
read the console device /dev/hvc1 or /dev/hvc2, using cat or an
application using read(), I do not get the data out. But I could print
out the data using printk (the string I passed from dom0) inside the
hvc driver code where it reads from backend.

  Looks like I am missing something in the userspace creation of
device node or some flag for opening device file in the read system
call of my application. Any suggestions?

Application I wrote to read from console device:

  memset(buf, 0, sizeof(buf));

  fd=open("/dev/xenconsole/xen.channel.1", O_RDWR|O_NONBLOCK);

  if(fd < 0)

      printf("could not open dev hvc2\n");

  size = read(fd, (void *)buf, sizeof(buf));

  printf("size read %d\n",size);

Thanks

             reply	other threads:[~2015-07-23 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 17:14 sainath grandhi [this message]
2015-07-24  7:54 ` Help with reading from hvc console device on a PV guest Wei Liu
2015-07-24 17:05   ` sainath grandhi
2015-07-28  9:06     ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABqzqi4FEud7Ub=H4mrSS8hgftFTYeZ2JP2Ei_av5UMgtHENfw@mail.gmail.com' \
    --to=saiallforums@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).