From: Sander Eikelenboom Subject: Re: xen-swiotlb Date: Sun, 19 Sep 2010 15:14:12 +0200 Message-ID: <966488858.20100919151412@eikelenboom.it> References: <1045449371.20100815232839@eikelenboom.it> <20100816144353.GB29351@phenom.dumpdata.com> <1077869382.20100816213227@eikelenboom.it> <20100826214321.GA17372@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20100826214321.GA17372@phenom.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: Konrad Rzeszutek Wilk Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Hi Konrad, It seems i have a working setup now, passing through a xhci controller to a= guest, and keep grabbing video, it has ran for 2 days now. But i have changed a lot of parameters, so I will try to find out which one= seems to be the problem, or that everything is miraculously fixed :-) (it's on other hardware (intel platform) now, as the only VM, newer dom0 ke= rnel, newer domU kernel, no swiotlb=3Dforce anymore, the boot option pasi s= uggested, no irq balance etc.) Will post again when i know something more ! -- Sander Thursday, August 26, 2010, 11:43:21 PM, you wrote: >> > Looking at the output, the physical addresses that DMA-ed are: >>=20 >> > 0x1f2962dc0 >> > 0x1f24f2e68 >>=20 >> > and they look to be called quite often. In fact, there looks to be a >> > loop that does something like this: >>=20 >> > again: >> > p =3D kmalloc(..) >>=20 >> > dma =3D pci_map_single(p) >> > pci_dma_mapping_error(dma); >> > /* get some data.. */ >> > /* parse the: (pipe 0x80000280): IN: c0 00 00 00 0c 00 01 00 */ >> > pci_unmap_sg(dma); >> > goto again; >>=20 >> > As the virtual address sent to pci_map_single looks to be sequentially >> > increasing. > I am not sure what virtual address I was thinking off. Looking again > at the dmesg output it looks actually correct. SWIOTLB is giving out > chunks, increasing its own index, and then unmaping those pages right > away. > This stack-trace in the middle of the log: > =20 > Aug 15 23:14:02 security kernel: [ 103.646497] em28xx #0 em28xx_isoc_cop= y :Video frame 1, length=3D960, odd > Aug 15 23:14:02 security kernel: [ 103.650177] xhci_hcd 0000:08:00.0: Mi= ss service interval error, set skip flag > Aug 15 23:14:02 security kernel: [ 103.651371] em28xx #0 em28xx_irq_call= back :urb completition error -18. > Aug 15 23:14:02 security kernel: [ 103.651406] em28xx #0 print_err_statu= s :URB status -18 [Unknown]. > Aug 15 23:14:02 security kernel: [ 103.651432] em28xx #0 em28xx_isoc_cop= y :Video frame 2, length=3D2888, even > Aug 15 23:14:02 security kernel: [ 103.651454] em28xx #0 get_next_buf :N= o active queue to serve > Aug 15 23:14:02 security kernel: [ 103.651477] em28xx #0 print_err_statu= s :URB packet 63, status -18 [Unknown]. > Aug 15 23:14:02 security kernel: [ 103.653143] motion: page allocation f= ailure. order:1, mode:0x20 > Aug 15 23:14:02 security kernel: [ 103.653177] Pid: 1418, comm: motion N= ot tainted 2.6.352.6.36pre+pci-front-xhci-20100813-xhcidebug+ #14 > Aug 15 23:14:02 security kernel: [ 103.653205] Call Trace: > Aug 15 23:14:02 security kernel: [ 103.653219] [] __alloc_pages_nodemask+0x667/0x6c7 > Aug 15 23:14:02 security kernel: [ 103.653272] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:02 security kernel: [ 103.653300] [] cac= he_alloc_refill+0x3b3/0x851 > Aug 15 23:14:02 security kernel: [ 103.653326] [] ? x= en_force_evtchn_callback+0xd/0xf > Aug 15 23:14:02 security kernel: [ 103.653352] [] ? c= heck_events+0x12/0x20 > Aug 15 23:14:02 security kernel: [ 103.653375] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:02 security kernel: [ 103.653401] [] ? c= reate_object+0x2e/0x2a1 > Aug 15 23:14:02 security kernel: [ 103.653425] [] kme= m_cache_alloc+0xf7/0x1c4 > Aug 15 23:14:02 security kernel: [ 103.653451] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:02 security kernel: [ 103.653475] [] cre= ate_object+0x2e/0x2a1 > Aug 15 23:14:02 security kernel: [ 103.653499] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:02 security kernel: [ 103.653523] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:02 security kernel: [ 103.653548] [] ? c= ache_alloc_debugcheck_after+0x1bf/0x239 > Aug 15 23:14:02 security kernel: [ 103.653575] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:02 security kernel: [ 103.653602] [] kme= mleak_alloc+0x21/0x3e > Aug 15 23:14:02 security kernel: [ 103.653625] [] kme= m_cache_alloc+0x197/0x1c4 > Aug 15 23:14:02 security kernel: [ 103.653649] [] xhc= i_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:02 security kernel: [ 103.653675] [] usb= _hcd_submit_urb+0xb1f/0xbf5 > Aug 15 23:14:02 security kernel: [ 103.653701] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:02 security kernel: [ 103.653726] [] ? x= en_force_evtchn_callback+0xd/0xf > Aug 15 23:14:02 security kernel: [ 103.653751] [] ? c= heck_events+0x12/0x20 > Aug 15 23:14:02 security kernel: [ 103.653777] [] ? v= t_console_print+0x43/0x346 > Aug 15 23:14:02 security kernel: [ 103.653802] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:02 security kernel: [ 103.653830] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:02 security kernel: [ 103.653857] [] ? l= ock_release+0x1e0/0x1ed > Aug 15 23:14:03 security kernel: [ 103.653882] [] usb= _submit_urb+0x249/0x260 > Aug 15 23:14:03 security kernel: [ 103.653919] [] em2= 8xx_irq_callback+0xc9/0xfd [em28xx] > Aug 15 23:14:03 security kernel: [ 103.653946] [] usb= _hcd_giveback_urb+0x84/0xb8 > Aug 15 23:14:03 security kernel: [ 103.653972] [] xhc= i_handle_event+0xced/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.653998] [] xhc= i_handle_event+0xd8b/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.654024] [] xhc= i_handle_event+0xd8b/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.654050] [] xhc= i_irq+0x11d/0x1af > Aug 15 23:14:03 security kernel: [ 103.654074] [] xhc= i_msi_irq+0x1b/0x1d > Aug 15 23:14:03 security kernel: [ 103.654103] [] han= dle_IRQ_event+0x20/0xc7 > Aug 15 23:14:03 security kernel: [ 103.654128] [] han= dle_level_irq+0x98/0xf3 > Aug 15 23:14:03 security kernel: [ 103.654151] [] __x= en_evtchn_do_upcall+0xe1/0x183 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xen= _evtchn_do_upcall+0x2a/0x3c > Aug 15 23:14:03 security kernel: [ 103.654151] [] xen= _do_hypervisor_callback+0x1e/0x30 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? hypercall_page+0x2eb/0x1006 > Aug 15 23:14:03 security kernel: [ 103.654151] Mem-Info: > Aug 15 23:14:03 security kernel: [ 103.654151] DMA per-cpu: > Aug 15 23:14:03 security kernel: [ 103.654151] CPU 0: hi: 0, btch:= 1 usd: 0 > Aug 15 23:14:03 security kernel: [ 103.654151] DMA32 per-cpu: > Aug 15 23:14:03 security kernel: [ 103.654151] CPU 0: hi: 186, btch:= 31 usd: 168 > Aug 15 23:14:03 security kernel: [ 103.654151] active_anon:4503 inactive= _anon:4767 isolated_anon:0 > Aug 15 23:14:03 security kernel: [ 103.654151] active_file:4071 inactiv= e_file:9087 isolated_file:0 > Aug 15 23:14:03 security kernel: [ 103.654151] unevictable:0 dirty:1081= writeback:0 unstable:0 > Aug 15 23:14:03 security kernel: [ 103.654151] free:1584 slab_reclaimab= le:5991 slab_unreclaimable:153956 > Aug 15 23:14:03 security kernel: [ 103.654151] mapped:3401 shmem:48 pag= etables:1452 bounce:0 > Aug 15 23:14:03 security kernel: [ 103.654151] DMA free:3992kB min:60kB = low:72kB high:88kB active_anon:84kB inactive_anon:436kB active_file:24kB in= active_file:148kB unevictable:0kB isolated(anon):0kB isolated(file):0kB pre= sent:15712kB mlocked:0kB dirty:20kB writeback:0kB mapped:16kB shmem:0kB sla= b_reclaimable:264kB slab_unreclaimable:8932kB kernel_stack:0kB pagetables:3= 84kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclai= mable? no > Aug 15 23:14:03 security kernel: [ 103.654151] lowmem_reserve[]: 0 994 9= 94 994 > Aug 15 23:14:03 security kernel: [ 103.654151] DMA32 free:2344kB min:400= 0kB low:5000kB high:6000kB active_anon:17928kB inactive_anon:18632kB active= _file:16260kB inactive_file:36200kB unevictable:0kB isolated(anon):0kB isol= ated(file):0kB present:1018080kB mlocked:0kB dirty:4304kB writeback:0kB map= ped:13588kB shmem:192kB slab_reclaimable:23700kB slab_unreclaimable:606892k= B kernel_stack:720kB pagetables:5424kB unstable:0kB bounce:0kB writeback_tm= p:0kB pages_scanned:0 all_unreclaimable? no > Aug 15 23:14:03 security kernel: [ 103.654151] lowmem_reserve[]: 0 0 0 0 > Aug 15 23:14:03 security kernel: [ 103.654151] DMA: 88*4kB 1*8kB 1*16kB = 1*32kB 0*64kB 0*128kB 0*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB =3D 3992kB > Aug 15 23:14:03 security kernel: [ 103.654151] DMA32: 406*4kB 0*8kB 1*16= kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB =3D 234= 4kB > Aug 15 23:14:03 security kernel: [ 103.654151] 13236 total pagecache pag= es > Aug 15 23:14:03 security kernel: [ 103.654151] 21 pages in swap cache > Aug 15 23:14:03 security kernel: [ 103.654151] Swap cache stats: add 32,= delete 11, find 27/27 > Aug 15 23:14:03 security kernel: [ 103.654151] Free swap =3D 524200kB > Aug 15 23:14:03 security kernel: [ 103.654151] Total swap =3D 524284kB > Aug 15 23:14:03 security kernel: [ 103.654151] 262128 pages RAM > Aug 15 23:14:03 security kernel: [ 103.654151] 73203 pages reserved > Aug 15 23:14:03 security kernel: [ 103.654151] 21103 pages shared > Aug 15 23:14:03 security kernel: [ 103.654151] 105944 pages non-shared > Aug 15 23:14:03 security kernel: [ 103.654151] kmemleak: Cannot allocate= a kmemleak_object structure > Aug 15 23:14:03 security kernel: [ 103.654151] Pid: 1418, comm: motion N= ot tainted 2.6.352.6.36pre+pci-front-xhci-20100813-xhcidebug+ #14 > Aug 15 23:14:03 security kernel: [ 103.654151] Call Trace: > Aug 15 23:14:03 security kernel: [ 103.654151] [] create_object+0x49/0x2a1 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? c= ache_alloc_debugcheck_after+0x1bf/0x239 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= hci_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:03 security kernel: [ 103.654151] [] kme= mleak_alloc+0x21/0x3e > Aug 15 23:14:03 security kernel: [ 103.654151] [] kme= m_cache_alloc+0x197/0x1c4 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_urb_enqueue+0x14c/0x3f5 > Aug 15 23:14:03 security kernel: [ 103.654151] [] usb= _hcd_submit_urb+0xb1f/0xbf5 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= en_force_evtchn_callback+0xd/0xf > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? c= heck_events+0x12/0x20 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? v= t_console_print+0x43/0x346 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? x= en_restore_fl_direct_end+0x0/0x1 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? l= ock_release+0x1e0/0x1ed > Aug 15 23:14:03 security kernel: [ 103.654151] [] usb= _submit_urb+0x249/0x260 > Aug 15 23:14:03 security kernel: [ 103.654151] [] em2= 8xx_irq_callback+0xc9/0xfd [em28xx] > Aug 15 23:14:03 security kernel: [ 103.654151] [] usb= _hcd_giveback_urb+0x84/0xb8 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_handle_event+0xced/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_handle_event+0xd8b/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_handle_event+0xd8b/0xdf7 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_irq+0x11d/0x1af > Aug 15 23:14:03 security kernel: [ 103.654151] [] xhc= i_msi_irq+0x1b/0x1d > Aug 15 23:14:03 security kernel: [ 103.654151] [] han= dle_IRQ_event+0x20/0xc7 > Aug 15 23:14:03 security kernel: [ 103.654151] [] han= dle_level_irq+0x98/0xf3 > Aug 15 23:14:03 security kernel: [ 103.654151] [] __x= en_evtchn_do_upcall+0xe1/0x183 > Aug 15 23:14:03 security kernel: [ 103.654151] [] xen= _evtchn_do_upcall+0x2a/0x3c > Aug 15 23:14:03 security kernel: [ 103.654151] [] xen= _do_hypervisor_callback+0x1e/0x30 > Aug 15 23:14:03 security kernel: [ 103.654151] [] ? hypercall_page+0x2eb/0x1006 > Aug 15 23:14:03 security kernel: [ 103.654151] kmemleak: Kernel memory l= eak detector disabled > Aug 15 23:14:03 security kernel: [ 103.654151] xhci_hcd 0000:08:00.0: Fo= und td. Clear skip flag. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 0, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 1, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 2, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 3, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 4, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 5, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 6, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.654151] em28xx #0 print_err_statu= s :URB packet 7, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.659299] xhci_hcd 0000:08:00.0: Mi= ss service interval error, set skip flag > Aug 15 23:14:03 security kernel: [ 103.659307] xhci_hcd 0000:08:00.0: Fo= und td. Clear skip flag. > Aug 15 23:14:03 security kernel: [ 103.661748] kmemleak: Automatic memor= y scanning thread ended > Aug 15 23:14:03 security kernel: [ 103.755620] em28xx #0 print_err_statu= s :URB packet 6, status -18 [Unknown]. > Aug 15 23:14:03 security kernel: [ 103.755630] em28xx #0 print_err_statu= s :URB packet 7, status -18 [Unknown]. > The first fault is kmemleaker not being able to allocate its structure, > and then it throws an error too. > Then the em28xx gets horribly confused that it could not send an URB > anymore and from there one things get worst. > There is something causing this memory problem,and I think we can narrow > it down if you output the kmemleaker output. You might have to > unload/reload the em28xx driver to get an idea of where the leak is. >> So what i have as domU kernel is: >> - from Linus tree 2.6.36-pre with latest commit 8357422d4bf33bc2c35884d4= 016c3fc9efbbc1d2 >> - pulled your devel/xen-pcifront-0.5 tree, and fixed the merge conflicts= due to the pv on hvm patches, in the same way Jeremy did for his 2.6.36 br= anch. >> Conflicts: >> drivers/xen/events.c >> include/xen/events.h >>=20 >> - Added a patch for xhci isoc that fixes another bug. (attached 0001-xHC= I-update-ring-dequeue-pointer-when-process-missed.patch) >> - Added a patch that shows extra debug info for xhci from the author of = the xhci-isoc pathes (attached isoc_length5.patch) >>=20 >> - Changed some debug lines from dbg to warn level, (just enabling xhci-d= ebug in kernel config floods the logs too fast, so i just enabled them in x= hci-mem.c) >> (Attached a patch with all my changes to xhci*, including the 2 patche= s above applied.) >>=20 >> - Added some printk's to swiotlb-xen.c to see which functions were used,= and let some of them print the address as well, in the hope i could find s= ome debug info there.(attached) > So the other thing I realized is that xhci can actually do 64bit > transfers. Try booting without the 'swiotlb=3Dforce' (but still have > iommu=3Dsoft). >>=20 >> Apart from fixing the xhci in the end, is there a way to prevent xen fro= m freezing altogether without leaving a trace ? > I am still puzzled as why Xen hypervisor would freeze. It _should_ work > just fine. >> Even an Oops is much easier to debug than a freeze. Due to the nature of= DMA that could perhaps be difficult, although there is an DMA API ... >>=20 >> Had a fruitful LinuxCon ? > Quite so! >>=20 >> -- >> Sander --=20 Best regards, Sander mailto:linux@eikelenboom.it