Bug 212515

Summary: vncfb does not run on IA64
Product: [Fedora] Fedora Reporter: Atsushi SAKAI <sakaia>
Component: xenAssignee: Markus Armbruster <armbru>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: bstein, katzj, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Fixed In Version: xen-3.0.3-9.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-01 09:45:01 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 216169    

Description Atsushi SAKAI 2006-10-27 01:16:27 EDT
Description of problem:
vncfb does not run on IA64

Version-Release number of selected component (if applicable):

How reproducible:
Just create domU with vnc=1

Steps to Reproduce:
Actual results:
we can see the vnc view(for example from virt-manager)

Expected results:

Additional info:
Comment 1 Daniel Berrange 2006-10-27 13:11:30 EDT
I have reproduced this issue successfully. The xen-vncfb daemon which exposes
the console via VNC is going defunct, and in xend-debug.log  is dumping 'Could
not connect to domain (Invalid argument)'. 

This message is comming from:

$ grep --before 1 'Could not connect' tools/xenfb/*.c
vncfb.c-        if (!xenfb_attach_dom(xenfb, domid)) {
vncfb.c:                fprintf(stderr, "Could not connect to domain (%s)\n",

So, need to investigate which the xenfb_attach_dom() function is failing on ia64.
Comment 2 Daniel Berrange 2006-10-27 14:35:46 EDT
It appears to be failing to map the virtual framebuffer into process:

#0  xc_map_foreign_range (xc_handle=8, dom=3, size=<value optimized out>,
prot=3, mfn=669) at xc_linux.c:105
#1  0x40000000000060f0 in xenfb_attach_dom (xenfb_pub=0x600000000005c050,
domid=3) at xenfb.c:237
#2  0x40000000000042e0 in main (argc=8, argv=0x60000ffffe77b928) at vncfb.c:208
#3  0x200000000016f040 in __libc_start_main () from /lib/libc.so.6.1
#4  0x4000000000003bc0 in _start ()

Is where it dies, doing an ioctl:

102         if ( ioctl(xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 )

(gdb) print ioctlx
$19 = {num = 1, dom = 3, entry = 0x60000ffffe77a858}
(gdb) print entry
$10 = {va = 2305843009229422592, mfn = 669, npages = 1}

The error is set to -EINVAL.
Comment 3 Isaku Yamahata 2006-10-29 20:38:17 EST
On xenLinux/IA64, pfn_to_mfn() == __pa() so that the front end sends invalid
value as vnc/page-ref, vkbd/page-ref.
Thus ioctlx.mfn is invalid and ioctl() call failed.
To get real mfn, pfn_to_mfn_for_dma() (or its variants) must be used.
Here is the patch for it.
Atsushi verified this patch so that the ioctl() call successes.

diff -X /home/yamahata/dontdiff -urp xen-3.0.3-rc3/linux-2.6-xen-sparse/drivers/
xen/xenfb/xenfb.c xen-3.0.3-rc3-new/linux-2.6-xen-sparse/drivers/xen/xenfb/
--- xen-3.0.3-rc3/linux-2.6-xen-sparse/drivers/xen/xenfb/xenfb.c        2006-10-
30 10:20:34.000000000 +0900
+++ xen-3.0.3-rc3-new/linux-2.6-xen-sparse/drivers/xen/xenfb/xenfb.c    2006-10-
25 18:03:56.000000000 +0900
@@ -510,7 +510,7 @@ static int __init xenfb_probe(void)
        if (ret)
                goto error_unreg;
        ret = xenbus_printf(xbt, "vfb", "page-ref", "%lu",
-                           virt_to_mfn(info->page));
+                           virt_to_bus(info->page) >> PAGE_SHIFT);
        // FIXME grant tables?
        if (ret)
                goto error_xenbus;
diff -X /home/yamahata/dontdiff -urp xen-3.0.3-rc3/linux-2.6-xen-sparse/drivers/
xen/xenkbd/xenkbd.c xen-3.0.3-rc3-new/linux-2.6-xen-sparse/drivers/xen/xenkbd/
--- xen-3.0.3-rc3/linux-2.6-xen-sparse/drivers/xen/xenkbd/xenkbd.c      2006-10-
30 10:20:34.000000000 +0900
+++ xen-3.0.3-rc3-new/linux-2.6-xen-sparse/drivers/xen/xenkbd/xenkbd.c  2006-10-
25 18:05:02.000000000 +0900
@@ -130,7 +130,7 @@ int __init xenkbd_init(void)
        if (ret)
                goto error_unreg;
        ret = xenbus_printf(xbt, "vkbd", "page-ref", "%lu",
-                           virt_to_mfn(dev->info));
+                           virt_to_bus(dev->info) >> PAGE_SHIFT);
        if (ret)
                goto error_xenbus;
        ret = xenbus_printf(xbt, "vkbd", "event-channel", "%u",