From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v6] Userspace grant communication Date: Tue, 8 Feb 2011 16:49:58 -0500 Message-ID: <20110208214958.GA8176@dumpdata.com> References: <1296753544-13323-1-git-send-email-dgdegra@tycho.nsa.gov> <20110207231416.GA12956@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20110207231416.GA12956@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel De Graaf Cc: jeremy@goop.org, xen-devel@lists.xensource.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, Feb 07, 2011 at 06:14:16PM -0500, Konrad Rzeszutek Wilk wrote: > On Thu, Feb 03, 2011 at 12:18:58PM -0500, Daniel De Graaf wrote: > > Changes since v5: > > - Added a tested xen version to workaround in #4 > > - Cleaned up variable names & structures > > - Clarified some of the cleanup in gntalloc > > - Removed copyright statement from public-domain files > > > > [PATCH 1/6] xen-gntdev: Change page limit to be global instead of per-open > > [PATCH 2/6] xen-gntdev: Use find_vma rather than iterating our vma list manually > > [PATCH 3/6] xen-gntdev: Add reference counting to maps > > [PATCH 4/6] xen-gntdev: Support mapping in HVM domains > > [PATCH 5/6] xen-gntalloc: Userspace grant allocation driver > > [PATCH 6/6] xen/gntalloc,gntdev: Add unmap notify ioctl > > > > Test/Demo code (also updated): > > I played with this (two PV domains) and I got two failures: With your latest patch the issue described earlier disappear, but if I try to map an non-existed page (say I am confused) I get this: diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 75f8037..2dd2efa 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#undef DEBUG +#define DEBUG 1 #include #include @@ -304,12 +304,16 @@ static int unmap_grant_pages(struct grant_map *map, int offset, int pages) pr_debug("map %d+%d [%d+%d]\n", map->index, map->count, offset, pages); err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset, pages); - if (err) + if (err) { + printk(KERN_WARNING "grant unmapping hypercall failed: %d\n", err); return err; - + } for (i = 0; i < pages; i++) { - if (map->unmap_ops[offset+i].status) + if (map->unmap_ops[offset+i].status) { + printk(KERN_WARNING "%lx is still active: %d\n", + offset+i, map->unmap_ops[offset+i].status); err = -EINVAL; + } map->unmap_ops[offset+i].handle = 0; } return err; (it differs from #master with this patch): > map 1 9 [ 234.522158] priv ffff88001afac420, add 1 [ 234.522742] gntdev_print_maps: maps list (priv ffff88001afac420) [ 234.523061] index 0, count 1 [new] [ 234.523892] map 0+1 at 7fdee5890000 (pgoff 0) [ 234.524464] map 0+1 Could not map grant 1.9: Invalid argument (map failed) > map 1 8 [ 236.313135] priv ffff88001afac420, add 1 [ 236.313739] gntdev_print_maps: maps list (priv ffff88001afac420) [ 236.314062] index 0, count 1 [ 236.314062] index 1, count 1 [new] [ 236.315521] map 1+1 at 7fdee588f000 (pgoff 1) [ 236.316120] map 1+1 Mapped grant 1.8 as 4096=0x7fdee588f000 > map 1 10 [ 242.833149] priv ffff88001afac420, add 1 [ 242.833813] gntdev_print_maps: maps list (priv ffff88001afac420) [ 242.834063] index 0, count 1 [ 242.834063] index 1, count 1 [ 242.834063] index 2, count 1 [new] [ 242.836265] map 2+1 at 7fdee588e000 (pgoff 2) [ 242.836866] map 2+1 Could not map grant 1.10: Invalid argument (map failed) > map 3 10 [ 247.224151] priv ffff88001afac420, add 1 [ 247.224808] gntdev_print_maps: maps list (priv ffff88001afac420) [ 247.225062] index 0, count 1 [ 247.225062] index 1, count 1 [ 247.225062] index 2, count 1 [ 247.225062] index 3, count 1 [new][ 247.227637] map 3+1 at 7fdee588d000 (pgoff 3) [ 247.228180] map 3+1 Could not map grant 3.10: Invalid argument (map failed) > unmap 140366365671424 Unmapped page at 0x7fa9975d4000 > show 00(140595310424064,4096): id 99c6b8b4567 n=11000000 b=adjakasdaadaskda END > ^C[ 252.265142] map 0+1 (7fdee588f000 7fdee5890000) [ 252.265724] map 0+1 [0+1] [ 252.296327] 0 is still active: -1 [ 252.296834] ------------[ cut here ]------------ [ 252.297310] WARNING: at /home/konrad/ssd/linux/drivers/xen/gntdev.c:396 mn_release+0x6e/0x90() [ 252.297310] Modules linked in: xen_evtchn fbcon tileblit font bitblit softcursor ttm drm_kms_helper xen_blkfront xen_netfront xen_fbfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_kbdfront xenfs [last unloaded: dump_dma] [ 252.297310] Pid: 2313, comm: test_gnt Tainted: G W 2.6.38-rc4-xtt-00169-gb68565e-dirty #3 [ 252.297310] Call Trace: [ 252.297310] [] ? warn_slowpath_common+0x80/0x98 [ 252.297310] [] ? warn_slowpath_null+0x15/0x17 [ 252.297310] [] ? mn_release+0x6e/0x90 [ 252.297310] [] ? __mmu_notifier_release+0x51/0x85 [ 252.297310] [] ? exit_mmap+0x27/0x101 [ 252.297310] [] ? mmput+0x30/0xd7 [ 252.297310] [] ? exit_mm+0x129/0x136 [ 252.297310] [] ? do_exit+0x208/0x7aa [ 252.297310] [] ? xen_force_evtchn_callback+0xd/0xf [ 252.297310] [] ? check_events+0x12/0x20 [ 252.297310] [] ? put_ldisc+0xac/0xb1 [ 252.297310] [] ? tty_ldisc_deref+0x9/0xb [ 252.297310] [] ? tty_read+0x8c/0xc8 [ 252.297310] [] ? do_notify_resume+0x27/0x5f [ 252.297310] [] ? int_signal+0x12/0x17 [ 252.297310] ---[ end trace e3791f053b755549 ]--- [ 252.297310] map 1+1 (7fdee588f000 7fdee5890000) [ 252.297310] map 1+1 [0+1] [ 252.315756] map 2+1 (7fdee588d000 7fdee588e000) [ 252.316341] map 2+1 [0+1] [ 252.346990] 0 is still active: -4 [ 252.347569] ------------[ cut here ]------------ [ 252.347976] WARNING: at /home/konrad/ssd/linux/drivers/xen/gntdev.c:396 mn_release+0x6e/0x90() [ 252.347976] Modules linked in: xen_evtchn fbcon tileblit font bitblit softcursor ttm drm_kms_helper xen_blkfront xen_netfront xen_fbfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_kbdfront xenfs [last unloaded: dump_dma] [ 252.347976] Pid: 2313, comm: test_gnt Tainted: G W 2.6.38-rc4-xtt-00169-gb68565e-dirty #3 [ 252.347976] Call Trace: [ 252.347976] [] ? warn_slowpath_common+0x80/0x98 [ 252.347976] [] ? warn_slowpath_null+0x15/0x17 [ 252.347976] [] ? mn_release+0x6e/0x90 [ 252.347976] [] ? __mmu_notifier_release+0x51/0x85 [ 252.347976] [] ? exit_mmap+0x27/0x101 [ 252.347976] [] ? mmput+0x30/0xd7 [ 252.347976] [] ? exit_mm+0x129/0x136 [ 252.347976] [] ? do_exit+0x208/0x7aa [ 252.347976] [] ? xen_force_evtchn_callback+0xd/0xf [ 252.347976] [] ? check_events+0x12/0x20 [ 252.347976] [] ? do_raw_spin_lock+0x6b/0x120 [ 252.347976] [] ? do_group_exit+0x72/0x9a [ 252.347976] [] ? get_signal_to_deliver+0x360/0x37f [ 252.347976] [] ? n_tty_read+0x6d5/0x7ad [ 252.347976] [] ? do_signal+0x6d/0x68b [ 252.347976] [] ? __wake_up+0x3f/0x48 [ 252.347976] [] ? put_ldisc+0xac/0xb1 [ 252.347976] [] ? tty_ldisc_deref+0x9/0xb [ 252.347976] [] ? tty_read+0x8c/0xc8 [ 252.347976] [] ? do_notify_resume+0x27/0x5f [ 252.347976] [] ? int_signal+0x12/0x17 [ 252.347976] map 3+1 (7fdee588d000 7fdee588e000) [ 252.347976] map 3+1 [0+1] [ 252.396334] 0 is still active: -4 [ 252.396925] ------------[ cut here ]------------ [ 252.397301] WARNING: at /home/konrad/ssd/linux/drivers/xen/gntdev.c:396 mn_release+0x6e/0x90() [ 252.397301] Modules linked in: xen_evtchn fbcon tileblit font bitblit softcursor ttm drm_kms_helper xen_blkfront xen_netfront xen_fbfront fb_sys_fops sysimgblt sysfillrect syscopyarea xen_kbdfront xenfs [last unloaded: dump_dma] [ 252.397301] Pid: 2313, comm: test_gnt Tainted: G W 2.6.38-rc4-xtt-00169-gb68565e-dirty #3 [ 252.397301] Call Trace: [ 252.397301] [] ? warn_slowpath_common+0x80/0x98 [ 252.397301] [] ? warn_slowpath_null+0x15/0x17 [ 252.397301] [] ? mn_release+0x6e/0x90 [ 252.397301] [] ? __mmu_notifier_release+0x51/0x85 [ 252.397301] [] ? exit_mmap+0x27/0x101 [ 252.397301] [] ? mmput+0x30/0xd7 [ 252.397301] [] ? exit_mm+0x129/0x136 [ 252.397301] [] ? do_exit+0x208/0x7aa [ 252.397301] [] ? xen_force_evtchn_callback+0xd/0xf [ 252.397301] [] ? check_events+0x12/0x20 [ 252.397301] [] ? do_raw_spin_lock+0x6b/0x120 [ 252.397301] [] ? do_group_exit+0x72/0x9a [ 252.397301] [] ? get_signal_to_deliver+0x360/0x37f [ 252.397301] [] ? n_tty_read+0x6d5/0x7ad [ 252.397301] [] ? do_signal+0x6d/0x68b [ 252.397301] [] ? __wake_up+0x3f/0x48 [ 252.397301] [] ? put_ldisc+0xac/0xb1 [ 252.397301] [] ? tty_ldisc_deref+0x9/0xb [ 252.397301] [] ? tty_read+0x8c/0xc8 [ 252.397301] [] ? do_notify_resume+0x27/0x5f [ 252.397301] [] ? int_signal+0x12/0x17 [ 252.397301] ---[ end trace e3791f053b75554b ]--- [ 252.414807] close ffff88001e35ea10 [ 252.415439] priv ffff88001afac420