tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tracking P->V for unmanaged device pages



On 26 Mar 2015, at 13:13, Taylor R Campbell <campbell+netbsd-tech-kern%mumble.net@localhost> wrote:

> Various DRM graphics drivers, including Intel, Radeon, and Nouveau,
> sometimes need to unmap all virtual mappings of certain physical
> pages for which there is no struct vm_page.  The issue is explained in
> detail here:
> 
> https://mail-index.netbsd.org/tech-kern/2014/07/23/msg017392.html
> 
> It's not desirable to simply add struct vm_pages on a freelist that
> uvm_pagealloc ignores, because struct vm_page is large (120 bytes on
> amd64, for example), most of it is unnecessary for P->V tracking, and
> the physical regions that need P->V tracking are large (hundreds of
> megabytes, or gigabytes).
> 
> The attached patch implements the following extension to pmap(9) on
> x86 and uses it in DRM[*].  The implementation uses a linear list of
> pv-tracked ranges, since it is expected to be short (one to three
> elements).  The list is managed with pserialize(9) so it adds no
> locking overhead to existing pmap operations that need to look up
> entries in it.

If you plan to use pserialize here it is time to change
pserialize_perform() to not kpause() every xc_broadcast.

Currently pserialize_perform() takes at least two ticks to complete.

It should be modified as:

	i = 0;
	do {
		mutex_spin_exit(&psz_lock);
		xc = xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
		xc_wait(xc);
		if (i++ > 1)
			kpause("psrlz", false, 1, NULL);
		mutex_spin_enter(&psz_lock);
	} while (!kcpuset_iszero(psz->psz_target));

to become faster in the usual "two activity switches" case.

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)



Home | Main Index | Thread Index | Old Index