Subject: Re: uvm_map_findspace alignment fallback
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 03/25/2004 00:06:38
On Thu, Mar 25, 2004 at 11:01:24AM +0900, YAMAMOTO Takashi wrote:
> > > Index: uvm_bio.c
> > > ===================================================================
> > > --- uvm_bio.c	(revision 641)
> > > +++ uvm_bio.c	(working copy)
> > > @@ -208,7 +208,11 @@ ubc_init(void)
> > >  		    ubc_nwins << ubc_winshift, &ubc_object.uobj, 0, (vsize_t)va,
> > >  		    UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
> > >  				UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0) {
> > > -		panic("ubc_init: failed to map ubc_object");
> > > +		if (uvm_map(kernel_map, (vaddr_t *)&ubc_object.kva,
> > > +		    ubc_nwins << ubc_winshift, &ubc_object.uobj, 0, 0,
> > > +		    UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
> > > +				UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0)
> > > +			panic("ubc_init: failed to map ubc_object");
> > >  	}
> > >  	UVMHIST_INIT(ubchist, 300);
> > >  }
> > 
> > va was set explicitly to 1. Why this change is needed?
> 
> it might not be 1, if you have PMAP_PREFER.

Yeah, right. Somehow I overlooked that.
I thought of PMAP_PREFER as a way to color physical/virtual mapping
to avoid virtual address aliasing in VIPT caches, I don't know
why and what it does in ubc_init, especially in a role of alignment
requirement for uvm_map. 

Anyway, back to your patch to ubc_init, I wouldn't commit this
because it's a step in opposite direction to uvm_map. You make alignment
requirement strict there and then relax it back in ubc_init. 

	Andrey