Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2012 19:20:36 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r232066 - in stable/9: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/amd64/amd64 sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/sys sys/vm
Message-ID:  <201202231920.q1NJKa13019550@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Thu Feb 23 19:20:36 2012
New Revision: 232066
URL: http://svn.freebsd.org/changeset/base/232066

Log:
  MFC r230623
  
   exclude kmem_alloc'ed ARC data buffers from kernel minidumps on amd64
   excluding other allocations including UMA now entails the addition of
   a single flag to kmem_alloc or uma zone create
  
  Reviewed by:	alc,avg

Modified:
  stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  stable/9/sys/amd64/amd64/minidump_machdep.c
  stable/9/sys/amd64/amd64/uma_machdep.c
  stable/9/sys/cddl/compat/opensolaris/sys/kmem.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/9/sys/sys/malloc.h
  stable/9/sys/vm/uma.h
  stable/9/sys/vm/uma_core.c
  stable/9/sys/vm/vm_kern.c
  stable/9/sys/vm/vm_page.c
  stable/9/sys/vm/vm_page.h

Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Thu Feb 23 19:20:36 2012	(r232066)
@@ -329,6 +329,7 @@ extern void cv_broadcast(kcondvar_t *cv)
 #define	KM_SLEEP		UMEM_NOFAIL
 #define	KM_PUSHPAGE		KM_SLEEP
 #define	KM_NOSLEEP		UMEM_DEFAULT
+#define	KM_NODEBUG		0
 #define	KMC_NODEBUG		UMC_NODEBUG
 #define	KMC_NOTOUCH		0	/* not needed for userland caches */
 #define	kmem_alloc(_s, _f)	umem_alloc(_s, _f)

Modified: stable/9/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/minidump_machdep.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/amd64/amd64/minidump_machdep.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/watchdog.h>
 #endif
 #include <vm/vm.h>
+#include <vm/vm_page.h>
 #include <vm/pmap.h>
 #include <machine/atomic.h>
 #include <machine/elf.h>
@@ -75,8 +76,11 @@ CTASSERT(sizeof(*vm_page_dump) == 8);
 static int
 is_dumpable(vm_paddr_t pa)
 {
+	vm_page_t m;
 	int i;
 
+	if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL)
+		return ((m->flags & PG_NODUMP) == 0);
 	for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
 		if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
 			return (1);

Modified: stable/9/sys/amd64/amd64/uma_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/uma_machdep.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/amd64/amd64/uma_machdep.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -66,7 +66,8 @@ uma_small_alloc(uma_zone_t zone, int byt
 			break;
 	}
 	pa = m->phys_addr;
-	dump_add_page(pa);
+	if ((wait & M_NODUMP) == 0)
+		dump_add_page(pa);
 	va = (void *)PHYS_TO_DMAP(pa);
 	if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
 		pagezero(va);

Modified: stable/9/sys/cddl/compat/opensolaris/sys/kmem.h
==============================================================================
--- stable/9/sys/cddl/compat/opensolaris/sys/kmem.h	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/cddl/compat/opensolaris/sys/kmem.h	Thu Feb 23 19:20:36 2012	(r232066)
@@ -45,8 +45,10 @@ MALLOC_DECLARE(M_SOLARIS);
 #define	KM_SLEEP		M_WAITOK
 #define	KM_PUSHPAGE		M_WAITOK
 #define	KM_NOSLEEP		M_NOWAIT
-#define	KMC_NODEBUG		0
+#define	KM_ZERO			M_ZERO
+#define	KM_NODEBUG		M_NODUMP
 #define	KMC_NOTOUCH		0
+#define	KMC_NODEBUG		UMA_ZONE_NODUMP
 
 typedef struct kmem_cache {
 	char		kc_name[32];

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -121,7 +121,7 @@ zio_init(void)
 		size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
 		size_t p2 = size;
 		size_t align = 0;
-		size_t cflags = (size > zio_buf_debug_limit) ? KMC_NODEBUG : 0;
+		size_t cflags = (size > zio_buf_debug_limit) ? (KMC_NODEBUG|KMC_NOTOUCH) : 0;
 
 		while (p2 & (p2 - 1))
 			p2 &= p2 - 1;
@@ -242,7 +242,7 @@ zio_data_buf_alloc(size_t size)
 	if (zio_use_uma)
 		return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE));
 	else
-		return (kmem_alloc(size, KM_SLEEP));
+		return (kmem_alloc(size, KM_SLEEP | KM_NODEBUG));
 }
 
 void

Modified: stable/9/sys/sys/malloc.h
==============================================================================
--- stable/9/sys/sys/malloc.h	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/sys/malloc.h	Thu Feb 23 19:20:36 2012	(r232066)
@@ -50,6 +50,7 @@
 #define	M_ZERO		0x0100		/* bzero the allocation */
 #define	M_NOVM		0x0200		/* don't ask VM for pages */
 #define	M_USE_RESERVE	0x0400		/* can alloc out of reserve memory */
+#define	M_NODUMP	0x0800		/* don't dump pages in this allocation */
 
 #define	M_MAGIC		877983977	/* time when first defined :-) */
 

Modified: stable/9/sys/vm/uma.h
==============================================================================
--- stable/9/sys/vm/uma.h	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/vm/uma.h	Thu Feb 23 19:20:36 2012	(r232066)
@@ -248,6 +248,10 @@ int uma_zsecond_add(uma_zone_t zone, uma
 					 * backend pages and can fail early.
 					 */
 #define	UMA_ZONE_VTOSLAB	0x2000	/* Zone uses vtoslab for lookup. */
+#define	UMA_ZONE_NODUMP		0x4000	/*
+					 * Zone's pages will not be included in
+					 * mini-dumps.
+					 */
 
 /*
  * These flags are shared between the keg and zone.  In zones wishing to add

Modified: stable/9/sys/vm/uma_core.c
==============================================================================
--- stable/9/sys/vm/uma_core.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/vm/uma_core.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -840,6 +840,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t
 	else
 		wait &= ~M_ZERO;
 
+	if (keg->uk_flags & UMA_ZONE_NODUMP)
+		wait |= M_NODUMP;
+
 	/* zone is passed for legacy reasons. */
 	mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait);
 	if (mem == NULL) {

Modified: stable/9/sys/vm/vm_kern.c
==============================================================================
--- stable/9/sys/vm/vm_kern.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/vm/vm_kern.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -382,6 +382,8 @@ kmem_back(vm_map_t map, vm_offset_t addr
 
 	if (flags & M_ZERO)
 		pflags |= VM_ALLOC_ZERO;
+	if (flags & M_NODUMP)
+		pflags |= VM_ALLOC_NODUMP;
 
 	VM_OBJECT_LOCK(kmem_object);
 	for (i = 0; i < size; i += PAGE_SIZE) {

Modified: stable/9/sys/vm/vm_page.c
==============================================================================
--- stable/9/sys/vm/vm_page.c	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/vm/vm_page.c	Thu Feb 23 19:20:36 2012	(r232066)
@@ -1424,6 +1424,8 @@ vm_page_alloc(vm_object_t object, vm_pin
 	 * must be cleared before the free page queues lock is released.
 	 */
 	flags = 0;
+	if (req & VM_ALLOC_NODUMP)
+		flags |= PG_NODUMP;
 	if (m->flags & PG_ZERO) {
 		vm_page_zero_count--;
 		if (req & VM_ALLOC_ZERO)

Modified: stable/9/sys/vm/vm_page.h
==============================================================================
--- stable/9/sys/vm/vm_page.h	Thu Feb 23 19:16:05 2012	(r232065)
+++ stable/9/sys/vm/vm_page.h	Thu Feb 23 19:20:36 2012	(r232066)
@@ -263,6 +263,7 @@ extern struct vpglocks pa_lock[];
 #define	PG_MARKER	0x10		/* special queue marker page */
 #define	PG_SLAB		0x20		/* object pointer is actually a slab */
 #define	PG_WINATCFLS	0x40		/* flush dirty page on inactive q */
+#define	PG_NODUMP	0x80		/* don't include this page in the dump */
 
 /*
  * Misc constants.
@@ -350,6 +351,7 @@ extern struct vpglocks vm_page_queue_loc
 #define	VM_ALLOC_IFCACHED	0x0400	/* Fail if the page is not cached */
 #define	VM_ALLOC_IFNOTCACHED	0x0800	/* Fail if the page is cached */
 #define	VM_ALLOC_IGN_SBUSY	0x1000	/* vm_page_grab() only */
+#define	VM_ALLOC_NODUMP		0x2000	/* don't include in dump */
 
 #define	VM_ALLOC_COUNT_SHIFT	16
 #define	VM_ALLOC_COUNT(count)	((count) << VM_ALLOC_COUNT_SHIFT)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202231920.q1NJKa13019550>