Re: svn commit: r326347 - in head/sys: kern sys vm

2017-12-10 Thread Cy Schubert
In message , Andriy Gapon 
wri
tes:
> On 29/11/2017 01:40, Jeff Roberson wrote:
> >   Eliminate kmem_arena and kmem_object in preparation for further NUMA comm
> its.
> >   
> >   The arena argument to kmem_*() is now only used in an assert.  A follow-u
> p
> >   commit will remove the argument altogether before we freeze the API for t
> he
> >   next release.
> >   
> >   This replaces the hard limit on kmem size with a soft limit imposed by UM
> A.  When
> >   the soft limit is exceeded we periodically wakeup the UMA reclaim thread 
> to
> >   attempt to shrink KVA.  On 32bit architectures this should behave much mo
> re
> >   gracefully as we exhaust KVA.  On 64bit the limits are likely never hit.
> >   
> >   Reviewed by:  markj, kib (some objections)
> >   Discussed with:   alc
> >   Tested by:pho
> >   Sponsored by: Netflix / Dell EMC Isilon
> >   Differential Revision:https://reviews.freebsd.org/D13187
>
>
> Given this bug report https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=22408
> 0#c3
> can we revert this commit until its impact on ZFS is examined (and fixed)?
>
> Unfortunately, there is no public comment from you at all.
> Not even "yes, I am aware, will be looking into it".

Until we can address the ARC breakage, can we revert this, please?


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


Re: svn commit: r326347 - in head/sys: kern sys vm

2017-12-07 Thread Andriy Gapon
On 29/11/2017 01:40, Jeff Roberson wrote:
>   Eliminate kmem_arena and kmem_object in preparation for further NUMA 
> commits.
>   
>   The arena argument to kmem_*() is now only used in an assert.  A follow-up
>   commit will remove the argument altogether before we freeze the API for the
>   next release.
>   
>   This replaces the hard limit on kmem size with a soft limit imposed by UMA. 
>  When
>   the soft limit is exceeded we periodically wakeup the UMA reclaim thread to
>   attempt to shrink KVA.  On 32bit architectures this should behave much more
>   gracefully as we exhaust KVA.  On 64bit the limits are likely never hit.
>   
>   Reviewed by:markj, kib (some objections)
>   Discussed with: alc
>   Tested by:  pho
>   Sponsored by:   Netflix / Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D13187


Given this bug report 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224080#c3
can we revert this commit until its impact on ZFS is examined (and fixed)?

Unfortunately, there is no public comment from you at all.
Not even "yes, I am aware, will be looking into it".

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


Re: svn commit: r326347 - in head/sys: kern sys vm

2017-12-04 Thread Emmanuel Vadot
On Tue, 28 Nov 2017 23:40:55 + (UTC)
Jeff Roberson  wrote:

> Author: jeff

 Hi Jeff,

> Date: Tue Nov 28 23:40:54 2017
> New Revision: 326347
> URL: https://svnweb.freebsd.org/changeset/base/326347
> 
> Log:
>   Eliminate kmem_arena and kmem_object in preparation for further NUMA 
> commits.
>   
>   The arena argument to kmem_*() is now only used in an assert.  A follow-up
>   commit will remove the argument altogether before we freeze the API for the
>   next release.
>   
>   This replaces the hard limit on kmem size with a soft limit imposed by UMA. 
>  When
>   the soft limit is exceeded we periodically wakeup the UMA reclaim thread to
>   attempt to shrink KVA.  On 32bit architectures this should behave much more
>   gracefully as we exhaust KVA.  On 64bit the limits are likely never hit.
>   
>   Reviewed by:markj, kib (some objections)
>   Discussed with: alc
>   Tested by:  pho
>   Sponsored by:   Netflix / Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D13187
> 
> Modified:
>   head/sys/kern/kern_malloc.c
>   head/sys/kern/subr_vmem.c
>   head/sys/sys/vmem.h
>   head/sys/vm/memguard.c
>   head/sys/vm/uma.h
>   head/sys/vm/uma_core.c
>   head/sys/vm/uma_int.h
>   head/sys/vm/vm_kern.c
>   head/sys/vm/vm_map.c
>   head/sys/vm/vm_object.c
>   head/sys/vm/vm_object.h

 This seems to break USB (EHCI and OHCI) on Pine64 (arm64)

 The board just hang when plugin usb device, setting
hw.usb.ehci.debug=3 this is what I have when plugging an usb stick :

ehci_root_intr: port 1 changed
ehci_set_hw_power: 
ehci_roothub_exec: type=0xa3 request=0x00 wLen=0x0004 wValue=0x
wIndex=0x0001 ehci_roothub_exec: type=0x23 request=0x01 wLen=0x
wValue=0x0010 wIndex=0x0001 ehci_roothub_exec: type=0xa3 request=0x00
wLen=0x0004 wValue=0x wIndex=0x0001 ehci_roothub_exec: type=0x23
request=0x01 wLen=0x wValue=0x0014 wIndex=0x0001 ehci_roothub_exec:
type=0x23 request=0x03 wLen=0x wValue=0x0004 wIndex=0x0001
ehci_roothub_exec: ehci after reset, status=0x1005
ehci_roothub_exec: ehci port 1 reset, status = 0x1005
ehci_roothub_exec: type=0xa3 request=0x00 wLen=0x0004 wValue=0x
wIndex=0x0001 ehci_roothub_exec: type=0x23 request=0x01 wLen=0x
wValue=0x0014 wIndex=0x0001 ehci_roothub_exec: type=0xa3 request=0x00
wLen=0x0004 wValue=0x wIndex=0x0001 ehci_ep_init:
endpoint=0xfd4f10f8, addr=0, endpt=0, mode=0 (1)

 If you have any idea on how to debug/resolve this,

 Cheers,

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


svn commit: r326347 - in head/sys: kern sys vm

2017-11-28 Thread Jeff Roberson
Author: jeff
Date: Tue Nov 28 23:40:54 2017
New Revision: 326347
URL: https://svnweb.freebsd.org/changeset/base/326347

Log:
  Eliminate kmem_arena and kmem_object in preparation for further NUMA commits.
  
  The arena argument to kmem_*() is now only used in an assert.  A follow-up
  commit will remove the argument altogether before we freeze the API for the
  next release.
  
  This replaces the hard limit on kmem size with a soft limit imposed by UMA.  
When
  the soft limit is exceeded we periodically wakeup the UMA reclaim thread to
  attempt to shrink KVA.  On 32bit architectures this should behave much more
  gracefully as we exhaust KVA.  On 64bit the limits are likely never hit.
  
  Reviewed by:  markj, kib (some objections)
  Discussed with:   alc
  Tested by:pho
  Sponsored by: Netflix / Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D13187

Modified:
  head/sys/kern/kern_malloc.c
  head/sys/kern/subr_vmem.c
  head/sys/sys/vmem.h
  head/sys/vm/memguard.c
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Tue Nov 28 23:18:35 2017(r326346)
+++ head/sys/kern/kern_malloc.c Tue Nov 28 23:40:54 2017(r326347)
@@ -239,16 +239,22 @@ sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS)
 {
u_long size;
 
-   size = vmem_size(kmem_arena, VMEM_ALLOC);
+   size = uma_size();
return (sysctl_handle_long(oidp, , 0, req));
 }
 
 static int
 sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS)
 {
-   u_long size;
+   u_long size, limit;
 
-   size = vmem_size(kmem_arena, VMEM_FREE);
+   /* The sysctl is unsigned, implement as a saturation value. */
+   size = uma_size();
+   limit = uma_limit();
+   if (size > limit)
+   size = 0;
+   else
+   size = limit - size;
return (sysctl_handle_long(oidp, , 0, req));
 }
 
@@ -669,19 +675,6 @@ reallocf(void *addr, unsigned long size, struct malloc
return (mem);
 }
 
-/*
- * Wake the uma reclamation pagedaemon thread when we exhaust KVA.  It
- * will call the lowmem handler and uma_reclaim() callbacks in a
- * context that is safe.
- */
-static void
-kmem_reclaim(vmem_t *vm, int flags)
-{
-
-   uma_reclaim_wakeup();
-   pagedaemon_wakeup();
-}
-
 #ifndef __sparc64__
 CTASSERT(VM_KMEM_SIZE_SCALE >= 1);
 #endif
@@ -759,9 +752,7 @@ kmeminit(void)
 #else
tmp = vm_kmem_size;
 #endif
-   vmem_init(kmem_arena, "kmem arena", kva_alloc(tmp), tmp, PAGE_SIZE,
-   0, 0);
-   vmem_set_reclaim(kmem_arena, kmem_reclaim);
+   uma_set_limit(tmp);
 
 #ifdef DEBUG_MEMGUARD
/*
@@ -769,7 +760,7 @@ kmeminit(void)
 * replacement allocator used for detecting tamper-after-free
 * scenarios as they occur.  It is only used for debugging.
 */
-   memguard_init(kmem_arena);
+   memguard_init(kernel_arena);
 #endif
 }
 

Modified: head/sys/kern/subr_vmem.c
==
--- head/sys/kern/subr_vmem.c   Tue Nov 28 23:18:35 2017(r326346)
+++ head/sys/kern/subr_vmem.c   Tue Nov 28 23:40:54 2017(r326347)
@@ -137,6 +137,7 @@ struct vmem {
int vm_nbusytag;
vmem_size_t vm_inuse;
vmem_size_t vm_size;
+   vmem_size_t vm_limit;
 
/* Used on import. */
vmem_import_t   *vm_importfn;
@@ -228,11 +229,11 @@ static uma_zone_t vmem_bt_zone;
 
 /* boot time arena storage. */
 static struct vmem kernel_arena_storage;
-static struct vmem kmem_arena_storage;
 static struct vmem buffer_arena_storage;
 static struct vmem transient_arena_storage;
+/* kernel and kmem arenas are aliased for backwards KPI compat. */
 vmem_t *kernel_arena = _arena_storage;
-vmem_t *kmem_arena = _arena_storage;
+vmem_t *kmem_arena = _arena_storage;
 vmem_t *buffer_arena = _arena_storage;
 vmem_t *transient_arena = _arena_storage;
 
@@ -254,11 +255,11 @@ bt_fill(vmem_t *vm, int flags)
VMEM_ASSERT_LOCKED(vm);
 
/*
-* Only allow the kmem arena to dip into reserve tags.  It is the
+* Only allow the kernel arena to dip into reserve tags.  It is the
 * vmem where new tags come from.
 */
flags &= BT_FLAGS;
-   if (vm != kmem_arena)
+   if (vm != kernel_arena)
flags &= ~M_USE_RESERVE;
 
/*
@@ -615,22 +616,22 @@ vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, uint8_
 {
vmem_addr_t addr;
 
-   *pflag = UMA_SLAB_KMEM;
+   *pflag = UMA_SLAB_KERNEL;
 
/*
 * Single thread boundary tag allocation so that the address space
 * and memory are added in one atomic operation.
 */