Re: svn commit: r292469 - in head/sys: dev/drm2/ttm mips/include mips/mips vm

2015-12-25 Thread Justin Hibbits

On Dec 22, 2015, at 6:47 PM, NGie Cooper wrote:




On Dec 22, 2015, at 13:51, Ed Maste  wrote:

On 19 December 2015 at 13:42, Alan Cox  wrote:

Author: alc
Date: Sat Dec 19 18:42:50 2015
New Revision: 292469
URL: https://svnweb.freebsd.org/changeset/base/292469

Log:
Introduce a new mechanism for relocating virtual pages to a new  
physical

address and use this mechanism when:


Universe build is failing on powerpc.powerpc with:

cc1: warnings being treated as errors
/scratch/tmp/emaste/freebsd/sys/vm/vm_page.c: In function  
'vm_page_reclaim_run':
/scratch/tmp/emaste/freebsd/sys/vm/vm_page.c:2449: warning:  
comparison

is always true due to limited range of data type
*** [vm_page.o] Error code 1


+1

It’s only with the MPC85XX kernel, which I believe is 32-bit powerpc.

Thanks!
-NGie


This is fixed by r292680.

- Justin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292469 - in head/sys: dev/drm2/ttm mips/include mips/mips vm

2015-12-22 Thread Justin Hibbits
On Dec 22, 2015 18:48, "NGie Cooper"  wrote:
>
>
> > On Dec 22, 2015, at 13:51, Ed Maste  wrote:
> >
> > On 19 December 2015 at 13:42, Alan Cox  wrote:
> >> Author: alc
> >> Date: Sat Dec 19 18:42:50 2015
> >> New Revision: 292469
> >> URL: https://svnweb.freebsd.org/changeset/base/292469
> >>
> >> Log:
> >>  Introduce a new mechanism for relocating virtual pages to a new
physical
> >>  address and use this mechanism when:
> >
> > Universe build is failing on powerpc.powerpc with:
> >
> > cc1: warnings being treated as errors
> > /scratch/tmp/emaste/freebsd/sys/vm/vm_page.c: In function
'vm_page_reclaim_run':
> > /scratch/tmp/emaste/freebsd/sys/vm/vm_page.c:2449: warning: comparison
> > is always true due to limited range of data type
> > *** [vm_page.o] Error code 1
>
> +1
>
> It’s only with the MPC85XX kernel, which I believe is 32-bit powerpc.
>
> Thanks!
> -NGie

Correct, this is due to the fact that on this target vm_paddr_t is 64-bit,
and trunc_page() macro casts through unsigned long (32 bits). I have a
patch that removes all casts for vm macros in PowerPC (PowerPC is the only
target that casts for these macros still), in code review right now (only
been lightly tested).

- Justin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r292469 - in head/sys: dev/drm2/ttm mips/include mips/mips vm

2015-12-22 Thread Ed Maste
On 19 December 2015 at 13:42, Alan Cox  wrote:
> Author: alc
> Date: Sat Dec 19 18:42:50 2015
> New Revision: 292469
> URL: https://svnweb.freebsd.org/changeset/base/292469
>
> Log:
>   Introduce a new mechanism for relocating virtual pages to a new physical
>   address and use this mechanism when:

Universe build is failing on powerpc.powerpc with:

cc1: warnings being treated as errors
/scratch/tmp/emaste/freebsd/sys/vm/vm_page.c: In function 'vm_page_reclaim_run':
/scratch/tmp/emaste/freebsd/sys/vm/vm_page.c:2449: warning: comparison
is always true due to limited range of data type
*** [vm_page.o] Error code 1
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r292469 - in head/sys: dev/drm2/ttm mips/include mips/mips vm

2015-12-22 Thread NGie Cooper

> On Dec 22, 2015, at 13:51, Ed Maste  wrote:
> 
> On 19 December 2015 at 13:42, Alan Cox  wrote:
>> Author: alc
>> Date: Sat Dec 19 18:42:50 2015
>> New Revision: 292469
>> URL: https://svnweb.freebsd.org/changeset/base/292469
>> 
>> Log:
>>  Introduce a new mechanism for relocating virtual pages to a new physical
>>  address and use this mechanism when:
> 
> Universe build is failing on powerpc.powerpc with:
> 
> cc1: warnings being treated as errors
> /scratch/tmp/emaste/freebsd/sys/vm/vm_page.c: In function 
> 'vm_page_reclaim_run':
> /scratch/tmp/emaste/freebsd/sys/vm/vm_page.c:2449: warning: comparison
> is always true due to limited range of data type
> *** [vm_page.o] Error code 1

+1

It’s only with the MPC85XX kernel, which I believe is 32-bit powerpc.

Thanks!
-NGie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r292469 - in head/sys: dev/drm2/ttm mips/include mips/mips vm

2015-12-19 Thread Alan Cox
Author: alc
Date: Sat Dec 19 18:42:50 2015
New Revision: 292469
URL: https://svnweb.freebsd.org/changeset/base/292469

Log:
  Introduce a new mechanism for relocating virtual pages to a new physical
  address and use this mechanism when:
  
  1. kmem_alloc_{attr,contig}() can't find suitable free pages in the physical
 memory allocator's free page lists.  This replaces the long-standing
 approach of scanning the inactive and inactive queues, converting clean
 pages into PG_CACHED pages and laundering dirty pages.  In contrast, the
 new mechanism does not use PG_CACHED pages nor does it trigger a large
 number of I/O operations.
  
  2. on 32-bit MIPS processors, uma_small_alloc() and the pmap can't find
 free pages in the physical memory allocator's free page lists that are
 covered by the direct map.  Tested by: adrian
  
  3. ttm_bo_global_init() and ttm_vm_page_alloc_dma32() can't find suitable
 free pages in the physical memory allocator's free page lists.
  
  In the coming months, I expect that this new mechanism will be applied in
  other places.  For example, balloon drivers should use relocation to
  minimize fragmentation of the guest physical address space.
  
  Make vm_phys_alloc_contig() a little smarter (and more efficient in some
  cases).  Specifically, use vm_phys_segs[] earlier to avoid scanning free
  page lists that can't possibly contain suitable pages.
  
  Reviewed by:  kib, markj
  Glanced at:   jhb
  Discussed with:   jeff
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D

Modified:
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_page_alloc.c
  head/sys/mips/include/pmap.h
  head/sys/mips/mips/pmap.c
  head/sys/mips/mips/uma_machdep.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pageout.h
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h
  head/sys/vm/vm_reserv.c
  head/sys/vm/vm_reserv.h

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==
--- head/sys/dev/drm2/ttm/ttm_bo.c  Sat Dec 19 13:19:39 2015
(r292468)
+++ head/sys/dev/drm2/ttm/ttm_bo.c  Sat Dec 19 18:42:50 2015
(r292469)
@@ -1488,21 +1488,21 @@ int ttm_bo_global_init(struct drm_global
struct ttm_bo_global_ref *bo_ref =
container_of(ref, struct ttm_bo_global_ref, ref);
struct ttm_bo_global *glob = ref->object;
-   int ret;
+   int req, ret;
int tries;
 
sx_init(>device_list_mutex, "ttmdlm");
mtx_init(>lru_lock, "ttmlru", NULL, MTX_DEF);
glob->mem_glob = bo_ref->mem_glob;
+   req = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ;
tries = 0;
 retry:
-   glob->dummy_read_page = vm_page_alloc_contig(NULL, 0,
-   VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ,
+   glob->dummy_read_page = vm_page_alloc_contig(NULL, 0, req,
1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE);
 
if (unlikely(glob->dummy_read_page == NULL)) {
-   if (tries < 1) {
-   vm_pageout_grow_cache(tries, 0, VM_MAX_ADDRESS);
+   if (tries < 1 && vm_page_reclaim_contig(req, 1,
+   0, VM_MAX_ADDRESS, PAGE_SIZE, 0)) {
tries++;
goto retry;
}

Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c
==
--- head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sat Dec 19 13:19:39 2015
(r292468)
+++ head/sys/dev/drm2/ttm/ttm_page_alloc.c  Sat Dec 19 18:42:50 2015
(r292469)
@@ -166,13 +166,9 @@ ttm_vm_page_alloc_dma32(int req, vm_mema
PAGE_SIZE, 0, memattr);
if (p != NULL || tries > 2)
return (p);
-
-   /*
-* Before growing the cache see if this is just a normal
-* memory shortage.
-*/
-   VM_WAIT;
-   vm_pageout_grow_cache(tries, 0, 0x);
+   if (!vm_page_reclaim_contig(req, 1, 0, 0x,
+   PAGE_SIZE, 0))
+   VM_WAIT;
}
 }
 

Modified: head/sys/mips/include/pmap.h
==
--- head/sys/mips/include/pmap.hSat Dec 19 13:19:39 2015
(r292468)
+++ head/sys/mips/include/pmap.hSat Dec 19 18:42:50 2015
(r292469)
@@ -178,7 +178,6 @@ void *pmap_kenter_temporary(vm_paddr_t p
 void pmap_kenter_temporary_free(vm_paddr_t pa);
 void pmap_flush_pvcache(vm_page_t m);
 int pmap_emulate_modified(pmap_t pmap, vm_offset_t va);
-void pmap_grow_direct_page_cache(void);
 void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
 
 #endif /* _KERNEL */

Modified: head/sys/mips/mips/pmap.c