slab: warn about duplicated KMC names when tracing

Instead of during creation.  The IOAT driver creates a KMC call
'completion_pool' for every device.  I'm not going to bother giving them
separate names.  The only thing we used duplicate names for was
debugging and slab_trace.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/drivers/dev/mem.c b/kern/drivers/dev/mem.c
index 5711c24..5379c50 100644
--- a/kern/drivers/dev/mem.c
+++ b/kern/drivers/dev/mem.c
@@ -424,7 +424,7 @@
 {
 	ERRSTACK(1);
 	struct sized_alloc *sza, *old_sza;
-	struct kmem_cache *kc;
+	struct kmem_cache *kc = NULL, *kc_i;
 
 	if (cb->nf < 2)
 		error(EFAIL, SLAB_TRACE_USAGE);
@@ -434,9 +434,16 @@
 		qunlock(&arenas_and_slabs_lock);
 		nexterror();
 	}
-	TAILQ_FOREACH(kc, &all_kmem_caches, all_kmc_link)
-		if (!strcmp(kc->name, cb->f[1]))
-			break;
+	TAILQ_FOREACH(kc_i, &all_kmem_caches, all_kmc_link) {
+		if (!strcmp(kc_i->name, cb->f[1])) {
+			if (kc) {
+				printk("[kernel] Multiple KC's named %s, tracing the first one\n",
+				       kc->name);
+				break;
+			}
+			kc = kc_i;
+		}
+	}
 	if (!kc)
 		error(ENOENT, "No such slab %s", cb->f[1]);
 	/* Note that the only time we have a real sza is when printing.
diff --git a/kern/src/slab.c b/kern/src/slab.c
index 0ebc730..eba20b5 100644
--- a/kern/src/slab.c
+++ b/kern/src/slab.c
@@ -104,11 +104,6 @@
 	struct kmem_cache *kc_i;
 
 	qlock(&arenas_and_slabs_lock);
-	TAILQ_FOREACH(kc_i, &all_kmem_caches, all_kmc_link) {
-		if (!strcmp(kc->name, kc_i->name))
-			warn("Creatgin KMC %s, but one with that name exists!",
-			     kc->name);
-	}
 	TAILQ_INSERT_TAIL(&all_kmem_caches, kc, all_kmc_link);
 	qunlock(&arenas_and_slabs_lock);
 }