New x86 rootnex code and dtrace

In snv_24, there was some significant changes to the DDI DMA routines in the x86 rootnex.

For driver writers, there's some additional visibility to what's going on with the DDI DMA interfaces via dtrace. The following is a hacked up dtrace script to get an idea of what you can see. I need to clean it up and explain what your seeing more, but for now, I'll just put it out there.

#!/usr/sbin/dtrace -Fs

sdt:rootnex:\*:rootnex-bind-prealloc
{
	@prealloc_cookies[arg0] = count();
}

sdt:rootnex:\*:rootnex-bind-alloc
{
	@ba[arg0] = count();
}

sdt:rootnex:\*:rootnex-alloc-handle
{
	@lq[probefunc] = lquantize(arg0, 0, 16384, 128);
}

sdt:rootnex:\*:rootnex-bind-fast
{
	@lq[probefunc] = lquantize(arg1, 0, 16384, 128);
	@bf[arg0] = quantize(arg2);
}

sdt:rootnex:\*:rootnex-bind-slow
{
	@lq[probefunc] = lquantize(arg1, 0, 16384, 128);
	@bs[arg0] = quantize(arg2);
}

sdt:rootnex:\*:rootnex-bind-sp-alloc
{
	@bw[arg0] = count();
}

sdt:rootnex:\*:rootnex-sync-dev
{
	@sd[arg0] = sum(arg1);
}

sdt:rootnex:\*:rootnex-sync-cpu
{
	@sc[arg0] = sum(arg1);
}

sdt:rootnex:\*:rootnex-alloc-copybuf
{
	@copybuf_alloc[arg0] = sum(arg1);
}

sdt:rootnex:\*:rootnex-sgllen-window
{
	@sgllen_window[arg0] = count();
}

sdt:rootnex:\*:rootnex-copybuf-window
{
	@copybuf_window[arg0] = count();
}

sdt:rootnex:\*:rootnex-maxxfer-window
{
	@maxxfer_window[arg0] = count();
}

fbt:unix:i_ddi_mem_alloc:entry
{
	@mem_alloc[arg0] = sum(arg2);
	@c[probefunc] = count();
}

fbt:genunix:ddi_dma_alloc_handle:entry
{
	@c[probefunc] = count();
}

fbt:genunix:ddi_dma_addr_bind_handle:entry
{
	@c[probefunc] = count();
}

fbt:genunix:ddi_dma_buf_bind_handle:entry
{
	@c[probefunc] = count();
}

fbt:genunix:ddi_dma_mem_alloc:entry
{
	@c[probefunc] = count();
}

END
{
	printf("\\n\\n");

	printf("\\nDMA Function Count\\n");
	printf("    %-26s\\tCNT\\n", "FUNCTION");
	printa("    %-26s\\t%@u\\n", @c);

	printf("\\nalloc: bytes allocated in dma alloc\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @mem_alloc);

	printf("\\nbind: used pre-alloced sgl storage (fast)\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @prealloc_cookies);

	printf("\\nbind: had to alloc memory to store sgl (slow)\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @ba);

	printf("\\nbind: had to alloc memory for window/copybuf state (slow)\\n");	
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @bw);

	printf("\\nbind: bytes allocated for copybuf\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @copybuf_alloc);

	printf("\\nbind: sgllen windows\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @sgllen_window);

	printf("\\nbind: copybuf windows\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @copybuf_window);

	printf("\\nbind: maxxfer windows\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @maxxfer_window);

	printf("\\nbind: took fastpath\\n");
	printa("    DIP = 0x%p\\tvalue=bindsize%@u\\n", @bf);

	printf("\\nbind: took slowpath\\n");
	printa("    DIP = 0x%p\\tvalue=bindsize%@u\\n", @bs);

	printf("\\nalloc/bind: outstanding handles and binds\\n");
	printa("    %s\\t%@u\\n", @lq);

	printf("\\nsync: bytes copied for sync dev\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @sd);

	printf("\\nsync: bytes copied for sync cpu\\n");
	printf("    %-18s\\tCNT\\n", "DIP");
	printa("    0x%p\\t%@u\\n", @sc);
}
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

mrj

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today