summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorarao <none@none>2005-08-03 20:03:27 -0700
committerarao <none@none>2005-08-03 20:03:27 -0700
commitea841a36325080fa70fe84dbaff3b3e8c8ce458e (patch)
tree3ce0d36e2847eda64955271339fdc3a9fc6e9bfd /usr/src
parent3ee8f2953edde3e116dbfeb31193566a7a6d2914 (diff)
downloadillumos-joyent-ea841a36325080fa70fe84dbaff3b3e8c8ce458e.tar.gz
6291901 minor memory leak and misc fixes in vnex_add_intr and qcn_remove_intr
6303260 md size changes causes Solaris to panic. can't boot the system
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/sun4v/io/qcn.c5
-rw-r--r--usr/src/uts/sun4v/io/vnex.c1
-rw-r--r--usr/src/uts/sun4v/os/mach_cpu_states.c2
-rw-r--r--usr/src/uts/sun4v/os/mach_descrip.c8
-rw-r--r--usr/src/uts/sun4v/sys/machsystm.h1
-rw-r--r--usr/src/uts/sun4v/vm/mach_vm_dep.c22
6 files changed, 33 insertions, 6 deletions
diff --git a/usr/src/uts/sun4v/io/qcn.c b/usr/src/uts/sun4v/io/qcn.c
index 3071edc673..50853cc010 100644
--- a/usr/src/uts/sun4v/io/qcn.c
+++ b/usr/src/uts/sun4v/io/qcn.c
@@ -288,6 +288,7 @@ qcn_remove_intrs(void)
(void) ddi_intr_remove_handler(qcn_state->qcn_htable[x]);
(void) ddi_intr_free(qcn_state->qcn_htable[x]);
}
+ kmem_free(qcn_state->qcn_htable, qcn_state->qcn_intr_size);
}
static void
@@ -366,6 +367,8 @@ qcn_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
if (ddi_intr_get_softint_pri(qcn_state->qcn_softint_hdl,
&soft_prip) != DDI_SUCCESS) {
cmn_err(CE_WARN, "qcn_attach: softint_pri failed\n");
+ (void) ddi_intr_remove_softint(
+ qcn_state->qcn_softint_hdl);
qcn_remove_intrs();
return (DDI_FAILURE);
}
@@ -844,7 +847,7 @@ qcn_trigger_softint(void)
mutex_exit(&qcn_state->qcn_softlock);
(void) ddi_intr_trigger_softint(
qcn_state->qcn_softint_hdl, NULL);
- } else
+ } else
mutex_exit(&qcn_state->qcn_softlock);
}
}
diff --git a/usr/src/uts/sun4v/io/vnex.c b/usr/src/uts/sun4v/io/vnex.c
index f716af4286..b30c5878ed 100644
--- a/usr/src/uts/sun4v/io/vnex.c
+++ b/usr/src/uts/sun4v/io/vnex.c
@@ -398,6 +398,7 @@ vnex_add_intr(dev_info_t *dip, dev_info_t *rdip,
*/
cfg = SUN4V_REG_SPEC2CFG_HDL(reg_p->physaddr);
+ kmem_free(reg_p, reglen);
ino = hdlp->ih_vector;
/*
diff --git a/usr/src/uts/sun4v/os/mach_cpu_states.c b/usr/src/uts/sun4v/os/mach_cpu_states.c
index c6a25f70b9..b3ad91c277 100644
--- a/usr/src/uts/sun4v/os/mach_cpu_states.c
+++ b/usr/src/uts/sun4v/os/mach_cpu_states.c
@@ -485,7 +485,7 @@ mach_dump_buffer_init(void)
if (hvdump_buf_sz > HVDUMP_SIZE_MAX)
hvdump_buf_sz = HVDUMP_SIZE_MAX;
- hvdump_buf_va = contig_mem_alloc(hvdump_buf_sz);
+ hvdump_buf_va = contig_mem_alloc_align(hvdump_buf_sz, PAGESIZE);
if (hvdump_buf_va == NULL)
return;
diff --git a/usr/src/uts/sun4v/os/mach_descrip.c b/usr/src/uts/sun4v/os/mach_descrip.c
index 90ee1f8712..d603a1c06e 100644
--- a/usr/src/uts/sun4v/os/mach_descrip.c
+++ b/usr/src/uts/sun4v/os/mach_descrip.c
@@ -94,10 +94,14 @@ mach_descrip_init(void)
(void) hv_mach_desc((uint64_t)0, &md_size);
MDP(("MD: buffer size is %d\n", md_size));
- /* Round allocated space to nearest page */
+ /*
+ * Align allocated space to nearest page contig_mem_alloc_align
+ * requires a Power of 2 alignment
+ */
machine_descrip.space = P2ROUNDUP(md_size, PAGESIZE);
MDP(("MD: allocated space is %d\n", machine_descrip.space));
- machine_descrip.va = contig_mem_alloc(machine_descrip.space);
+ machine_descrip.va = contig_mem_alloc_align(machine_descrip.space,
+ PAGESIZE);
if (machine_descrip.va == NULL)
cmn_err(CE_PANIC, "Allocation for machine description failed");
diff --git a/usr/src/uts/sun4v/sys/machsystm.h b/usr/src/uts/sun4v/sys/machsystm.h
index 8a571731a4..8db9dca1ff 100644
--- a/usr/src/uts/sun4v/sys/machsystm.h
+++ b/usr/src/uts/sun4v/sys/machsystm.h
@@ -256,6 +256,7 @@ extern uint32_t cbe_level14_inum;
* contiguous memory
*/
extern void *contig_mem_alloc(size_t);
+extern void *contig_mem_alloc_align(size_t, size_t);
extern void contig_mem_free(void *, size_t);
/*
diff --git a/usr/src/uts/sun4v/vm/mach_vm_dep.c b/usr/src/uts/sun4v/vm/mach_vm_dep.c
index f9f96c3d2c..d8eecb834c 100644
--- a/usr/src/uts/sun4v/vm/mach_vm_dep.c
+++ b/usr/src/uts/sun4v/vm/mach_vm_dep.c
@@ -515,13 +515,31 @@ contig_vmem_xalloc_aligned_wrapper(vmem_t *vmp, size_t size, int vmflag)
return (vmem_xalloc(vmp, size, size, 0, 0, NULL, NULL, vmflag));
}
+/*
+ * conting_mem_alloc_align allocates real contiguous memory with the specified
+ * alignment upto contig_mem_slab_size. The alignment must be a power of 2.
+ */
void *
-contig_mem_alloc(size_t size)
+contig_mem_alloc_align(size_t size, size_t align)
{
- return (vmem_xalloc(contig_mem_arena, size, size, 0, 0,
+ if ((align & (align - 1)) != 0)
+ return (NULL);
+
+ return (vmem_xalloc(contig_mem_arena, size, align, 0, 0,
NULL, NULL, VM_NOSLEEP));
}
+/*
+ * Allocates size aligned contiguous memory upto contig_mem_slab_size.
+ * Size must be a power of 2.
+ */
+void *
+contig_mem_alloc(size_t size)
+{
+ ASSERT((size & (size - 1)) == 0);
+ return (contig_mem_alloc_align(size, size));
+}
+
void
contig_mem_free(void *vaddr, size_t size)
{