git: d1bdc2821fcd - main - Deprecate contigfree(9) in favour of free(9)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Jul 2024 10:46:06 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=d1bdc2821fcd416ab9b238580386eb605a6128d0
commit d1bdc2821fcd416ab9b238580386eb605a6128d0
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-07-23 19:21:17 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-07-26 10:45:01 +0000
Deprecate contigfree(9) in favour of free(9)
As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore. We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.
This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).
Sponsored by: The FreeBSD Foundation
Reviewed by: markj, kib
Tested by: pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
---
ObsoleteFiles.inc | 3 +++
share/man/man9/Makefile | 3 +--
share/man/man9/contigmalloc.9 | 31 +++++-----------------
sys/amd64/acpica/acpi_wakeup.c | 3 +--
sys/amd64/vmm/amd/svm.c | 4 +--
sys/arm64/arm64/busdma_bounce.c | 2 +-
sys/arm64/arm64/gicv3_its.c | 11 ++++----
sys/arm64/include/bus_dma.h | 2 +-
sys/arm64/iommu/smmu.c | 8 +++---
sys/arm64/iommu/smmuvar.h | 2 --
sys/compat/x86bios/x86bios.c | 6 ++---
sys/dev/agp/agp_i810.c | 2 +-
sys/dev/bwn/if_bwn.c | 12 ++-------
sys/dev/cxgbe/tom/t4_ddp.c | 6 ++---
sys/dev/dcons/dcons_os.c | 2 +-
sys/dev/hpt27xx/hpt27xx_osm_bsd.c | 10 +++----
sys/dev/hptmv/entry.c | 16 +++++------
sys/dev/hptnr/hptnr_osm_bsd.c | 10 +++----
sys/dev/hptrr/hptrr_osm_bsd.c | 10 +++----
sys/dev/hyperv/netvsc/if_hn.c | 7 +++--
sys/dev/hyperv/vmbus/vmbus.c | 14 +++++-----
sys/dev/hyperv/vmbus/vmbus_chan.c | 10 +++----
sys/dev/hyperv/vmbus/vmbus_chanvar.h | 1 -
sys/dev/hyperv/vmbus/vmbus_xact.c | 2 +-
sys/dev/ioat/ioat_test.c | 8 +-----
sys/dev/isci/isci.c | 2 +-
sys/dev/lge/if_lge.c | 7 +++--
sys/dev/netmap/if_ptnet.c | 2 +-
sys/dev/netmap/netmap_mem2.c | 9 +++----
sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 1 -
sys/dev/pst/pst-iop.c | 12 ++++-----
sys/dev/pst/pst-raid.c | 6 ++---
sys/dev/qat/qat/qat_ocf.c | 6 ++---
.../qat/qat_api/qat_utils/src/QatUtilsServices.c | 2 +-
sys/dev/virtio/gpu/virtio_gpu.c | 4 +--
sys/dev/virtio/virtqueue.c | 2 +-
sys/dev/vmware/vmci/vmci_kernel_if.c | 4 +--
sys/dev/xen/blkfront/blkfront.c | 8 ++----
sys/i386/acpica/acpi_wakeup.c | 3 +--
sys/kern/kern_malloc.c | 12 +++------
sys/powerpc/powernv/opal_nvram.c | 3 +--
sys/powerpc/powerpc/busdma_machdep.c | 2 +-
sys/riscv/include/bus_dma.h | 2 +-
sys/riscv/riscv/busdma_bounce.c | 2 +-
sys/sys/malloc.h | 3 ++-
sys/x86/include/bus_dma.h | 2 +-
sys/x86/isa/isa_dma.c | 8 +-----
sys/x86/x86/busdma_bounce.c | 2 +-
tools/test/stress2/misc/contigmalloc.sh | 10 +++----
tools/test/stress2/misc/contigmalloc2.sh | 11 +++-----
tools/test/stress2/misc/contigmalloc3.sh | 10 +++----
51 files changed, 123 insertions(+), 197 deletions(-)
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 02a34a2541eb..088dd23ebb4d 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20240726: deprecate contigfree(9)
+OLD_FILES+=usr/share/man/man9/contigfree.9.gz
+
# 20240721: retire vm_page_alloc_freelist
OLD_FILES+=usr/share/man/man9/vm_page_alloc_freelist.9.gz
OLD_FILES+=usr/share/man/man9/vm_page_alloc_freelist_domain.9.gz
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index f7c21ab541b6..0b315d64ed35 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -885,8 +885,7 @@ MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \
config_intrhook.9 config_intrhook_drain.9 \
config_intrhook.9 config_intrhook_establish.9 \
config_intrhook.9 config_intrhook_oneshot.9
-MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \
- contigmalloc.9 contigfree.9
+MLINKS+=contigmalloc.9 contigmalloc_domainset.9
MLINKS+=casuword.9 casueword.9 \
casuword.9 casueword32.9 \
casuword.9 casuword32.9
diff --git a/share/man/man9/contigmalloc.9 b/share/man/man9/contigmalloc.9
index 9e7086885870..edbcb1d60942 100644
--- a/share/man/man9/contigmalloc.9
+++ b/share/man/man9/contigmalloc.9
@@ -23,11 +23,11 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd July 22, 2024
+.Dd July 26, 2024
.Dt CONTIGMALLOC 9
.Os
.Sh NAME
-.Nm contigmalloc , contigfree
+.Nm contigmalloc
.Nd manage contiguous kernel physical memory
.Sh SYNOPSIS
.In sys/types.h
@@ -42,12 +42,6 @@
.Fa "unsigned long alignment"
.Fa "vm_paddr_t boundary"
.Fc
-.Ft void
-.Fo contigfree
-.Fa "void *addr"
-.Fa "unsigned long size"
-.Fa "struct malloc_type *type"
-.Fc
.In sys/param.h
.In sys/domainset.h
.Ft "void *"
@@ -109,17 +103,10 @@ Other flags (if present) are ignored.
.Pp
The
.Fn contigfree
-function deallocates memory allocated by a previous call to
-.Fn contigmalloc
-or
-.Fn contigmalloc_domainset .
-Its use is deprecated in favor of
-.Xr free 9
-which no longer requires the caller to know the
-.Fa size
-and also accepts
-.Dv NULL
-as an address.
+function is deprecated.
+Use
+.Xr free(9)
+instead.
.Sh IMPLEMENTATION NOTES
The
.Fn contigmalloc
@@ -130,12 +117,6 @@ However, unless
is specified, it may select a page for reclamation that must first be
written to backing storage, causing it to sleep.
.Pp
-The
-.Fn contigfree
-function does not accept
-.Dv NULL
-as an address input, unlike
-.Xr free 9 .
.Sh RETURN VALUES
The
.Fn contigmalloc
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c
index b6e6f99bc719..351cd16ff9ca 100644
--- a/sys/amd64/acpica/acpi_wakeup.c
+++ b/sys/amd64/acpica/acpi_wakeup.c
@@ -361,8 +361,7 @@ acpi_alloc_wakeup_handler(void **wakeaddr,
return;
freepages:
- if (*wakeaddr != NULL)
- contigfree(*wakeaddr, PAGE_SIZE, M_DEVBUF);
+ free(*wakeaddr, M_DEVBUF);
for (i = 0; i < ACPI_WAKEPT_PAGES; i++) {
if (wakept_m[i] != NULL)
vm_page_free(wakept_m[i]);
diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index f1106158e44e..b35cf53be080 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -2259,8 +2259,8 @@ svm_cleanup(void *vmi)
{
struct svm_softc *sc = vmi;
- contigfree(sc->iopm_bitmap, SVM_IO_BITMAP_SIZE, M_SVM);
- contigfree(sc->msr_bitmap, SVM_MSR_BITMAP_SIZE, M_SVM);
+ free(sc->iopm_bitmap, M_SVM);
+ free(sc->msr_bitmap, M_SVM);
free(sc, M_SVM);
}
diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
index 3836f8c74b45..da605d4e21f5 100644
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -605,7 +605,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
/*
* Free a piece of memory and it's allociated dmamap, that was allocated
- * via bus_dmamem_alloc. Make the same choice for free/contigfree.
+ * via bus_dmamem_alloc.
*/
static void
bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index 46695a415e86..d69f86023da6 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -158,7 +158,6 @@ struct its_dev {
struct lpi_chunk lpis;
/* Virtual address of ITT */
void *itt;
- size_t itt_size;
};
/*
@@ -1412,7 +1411,7 @@ its_device_get(device_t dev, device_t child, u_int nvecs)
struct gicv3_its_softc *sc;
struct its_dev *its_dev;
vmem_addr_t irq_base;
- size_t esize;
+ size_t esize, itt_size;
sc = device_get_softc(dev);
@@ -1450,8 +1449,8 @@ its_device_get(device_t dev, device_t child, u_int nvecs)
* Allocate ITT for this device.
* PA has to be 256 B aligned. At least two entries for device.
*/
- its_dev->itt_size = roundup2(MAX(nvecs, 2) * esize, 256);
- its_dev->itt = contigmalloc_domainset(its_dev->itt_size,
+ itt_size = roundup2(MAX(nvecs, 2) * esize, 256);
+ its_dev->itt = contigmalloc_domainset(itt_size,
M_GICV3_ITS, sc->sc_ds, M_NOWAIT | M_ZERO, 0,
LPI_INT_TRANS_TAB_MAX_ADDR, LPI_INT_TRANS_TAB_ALIGN, 0);
if (its_dev->itt == NULL) {
@@ -1462,7 +1461,7 @@ its_device_get(device_t dev, device_t child, u_int nvecs)
/* Make sure device sees zeroed ITT. */
if ((sc->sc_its_flags & ITS_FLAGS_CMDQ_FLUSH) != 0)
- cpu_dcache_wb_range(its_dev->itt, its_dev->itt_size);
+ cpu_dcache_wb_range(its_dev->itt, itt_size);
mtx_lock_spin(&sc->sc_its_dev_lock);
TAILQ_INSERT_TAIL(&sc->sc_its_dev_list, its_dev, entry);
@@ -1494,7 +1493,7 @@ its_device_release(device_t dev, struct its_dev *its_dev)
/* Free ITT */
KASSERT(its_dev->itt != NULL, ("Invalid ITT in valid ITS device"));
- contigfree(its_dev->itt, its_dev->itt_size, M_GICV3_ITS);
+ free(its_dev->itt, M_GICV3_ITS);
/* Free the IRQ allocation */
vmem_free(sc->sc_irq_alloc, its_dev->lpis.lpi_base,
diff --git a/sys/arm64/include/bus_dma.h b/sys/arm64/include/bus_dma.h
index fb494be0bdc4..d9c37eb2641b 100644
--- a/sys/arm64/include/bus_dma.h
+++ b/sys/arm64/include/bus_dma.h
@@ -62,7 +62,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
/*
* Free a piece of memory and it's allociated dmamap, that was allocated
- * via bus_dmamem_alloc. Make the same choice for free/contigfree.
+ * via bus_dmamem_alloc.
*/
static inline void
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 76a7d29dc2db..93b0cbb7c8e4 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -847,7 +847,6 @@ smmu_init_cd(struct smmu_softc *sc, struct smmu_domain *domain)
return (ENXIO);
}
- cd->size = size;
cd->paddr = vtophys(cd->vaddr);
ptr = cd->vaddr;
@@ -962,7 +961,7 @@ smmu_init_strtab_2lvl(struct smmu_softc *sc)
strtab->l1 = malloc(sz, M_SMMU, M_WAITOK | M_ZERO);
if (strtab->l1 == NULL) {
- contigfree(strtab->vaddr, l1size, M_SMMU);
+ free(strtab->vaddr, M_SMMU);
return (ENOMEM);
}
@@ -1014,7 +1013,6 @@ smmu_init_l1_entry(struct smmu_softc *sc, int sid)
size = 1 << (STRTAB_SPLIT + ilog2(STRTAB_STE_DWORDS) + 3);
l1_desc->span = STRTAB_SPLIT + 1;
- l1_desc->size = size;
l1_desc->va = contigmalloc(size, M_SMMU,
M_WAITOK | M_ZERO, /* flags */
0, /* low */
@@ -1057,7 +1055,7 @@ smmu_deinit_l1_entry(struct smmu_softc *sc, int sid)
*addr = 0;
l1_desc = &strtab->l1[sid >> STRTAB_SPLIT];
- contigfree(l1_desc->va, l1_desc->size, M_SMMU);
+ free(l1_desc->va, M_SMMU);
}
static int
@@ -1765,7 +1763,7 @@ smmu_domain_free(device_t dev, struct iommu_domain *iodom)
smmu_tlbi_asid(sc, domain->asid);
smmu_asid_free(sc, domain->asid);
- contigfree(cd->vaddr, cd->size, M_SMMU);
+ free(cd->vaddr, M_SMMU);
free(cd, M_SMMU);
free(domain, M_SMMU);
diff --git a/sys/arm64/iommu/smmuvar.h b/sys/arm64/iommu/smmuvar.h
index c32b17abc9bc..60fad8f87531 100644
--- a/sys/arm64/iommu/smmuvar.h
+++ b/sys/arm64/iommu/smmuvar.h
@@ -82,7 +82,6 @@ struct smmu_queue_local_copy {
struct smmu_cd {
vm_paddr_t paddr;
- vm_size_t size;
void *vaddr;
};
@@ -121,7 +120,6 @@ struct smmu_cmdq_entry {
struct l1_desc {
uint8_t span;
- size_t size;
void *va;
vm_paddr_t pa;
};
diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c
index 0eba97a59f5d..41b72080177c 100644
--- a/sys/compat/x86bios/x86bios.c
+++ b/sys/compat/x86bios/x86bios.c
@@ -162,7 +162,7 @@ x86bios_free(void *addr, size_t size)
x86bios_vmc.npages--;
}
mtx_unlock(&x86bios_lock);
- contigfree(addr, size, M_DEVBUF);
+ free(addr, M_DEVBUF);
}
void
@@ -564,7 +564,7 @@ x86bios_free(void *addr, size_t size)
bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE,
sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE));
mtx_unlock(&x86bios_lock);
- contigfree(addr, size, M_DEVBUF);
+ free(addr, M_DEVBUF);
}
void
@@ -669,7 +669,7 @@ x86bios_unmap_mem(void)
if (x86bios_rom != NULL)
pmap_unmapdev(x86bios_rom, X86BIOS_ROM_SIZE);
if (x86bios_seg != NULL) {
- contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
+ free(x86bios_seg, M_DEVBUF);
x86bios_seg = NULL;
}
}
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index b710a542a10f..b63c0aaf634a 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -1796,7 +1796,7 @@ agp_i810_free_memory(device_t dev, struct agp_memory *mem)
vm_page_unwire(m, PQ_INACTIVE);
VM_OBJECT_WUNLOCK(mem->am_obj);
} else {
- contigfree(sc->argb_cursor, mem->am_size, M_AGP);
+ free(sc->argb_cursor, M_AGP);
sc->argb_cursor = NULL;
}
}
diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c
index 742ed63a92aa..0f44c3c94672 100644
--- a/sys/dev/bwn/if_bwn.c
+++ b/sys/dev/bwn/if_bwn.c
@@ -2987,11 +2987,7 @@ bwn_dma_ringsetup(struct bwn_mac *mac, int controller_index,
return (dr);
fail2:
- if (dr->dr_txhdr_cache != NULL) {
- contigfree(dr->dr_txhdr_cache,
- (dr->dr_numslots / BWN_TX_SLOTS_PER_FRAME) *
- BWN_MAXTXHDRSIZE, M_DEVBUF);
- }
+ free(dr->dr_txhdr_cache, M_DEVBUF);
fail1:
free(dr->dr_meta, M_DEVBUF);
fail0:
@@ -3009,11 +3005,7 @@ bwn_dma_ringfree(struct bwn_dma_ring **dr)
bwn_dma_free_descbufs(*dr);
bwn_dma_free_ringmemory(*dr);
- if ((*dr)->dr_txhdr_cache != NULL) {
- contigfree((*dr)->dr_txhdr_cache,
- ((*dr)->dr_numslots / BWN_TX_SLOTS_PER_FRAME) *
- BWN_MAXTXHDRSIZE, M_DEVBUF);
- }
+ free((*dr)->dr_txhdr_cache, M_DEVBUF);
free((*dr)->dr_meta, M_DEVBUF);
free(*dr, M_DEVBUF);
diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c
index a08ddea00d05..529fc2a5b825 100644
--- a/sys/dev/cxgbe/tom/t4_ddp.c
+++ b/sys/dev/cxgbe/tom/t4_ddp.c
@@ -181,7 +181,7 @@ static void
free_ddp_rcv_buffer(struct toepcb *toep, struct ddp_rcv_buffer *drb)
{
t4_free_page_pods(&drb->prsv);
- contigfree(drb->buf, drb->len, M_CXGBE);
+ free(drb->buf, M_CXGBE);
free(drb, M_CXGBE);
counter_u64_add(toep->ofld_rxq->ddp_buffer_free, 1);
free_toepcb(toep);
@@ -242,7 +242,7 @@ alloc_ddp_rcv_buffer(struct toepcb *toep, int how)
error = t4_alloc_page_pods_for_rcvbuf(&td->pr, drb);
if (error != 0) {
- contigfree(drb->buf, drb->len, M_CXGBE);
+ free(drb->buf, M_CXGBE);
free(drb, M_CXGBE);
return (NULL);
}
@@ -250,7 +250,7 @@ alloc_ddp_rcv_buffer(struct toepcb *toep, int how)
error = t4_write_page_pods_for_rcvbuf(sc, toep->ctrlq, toep->tid, drb);
if (error != 0) {
t4_free_page_pods(&drb->prsv);
- contigfree(drb->buf, drb->len, M_CXGBE);
+ free(drb->buf, M_CXGBE);
free(drb, M_CXGBE);
return (NULL);
}
diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c
index 0d96ab51659b..4e34659fb3e8 100644
--- a/sys/dev/dcons/dcons_os.c
+++ b/sys/dev/dcons/dcons_os.c
@@ -442,7 +442,7 @@ dcons_modevent(module_t mode, int type, void *data)
dcons_detach(DCONS_GDB);
dg.buf->magic = 0;
- contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF);
+ free(dg.buf, M_DEVBUF);
}
/* Wait for tty deferred free callbacks to complete. */
diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
index 32d3e465c569..225c91b44f21 100644
--- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
+++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
@@ -146,9 +146,9 @@ static __inline void *__get_free_pages(int order)
M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
}
-static __inline void free_pages(void *p, int order)
+static __inline void free_pages(void *p)
{
- contigfree(p, PAGE_SIZE<<order, M_DEVBUF);
+ free(p, M_DEVBUF);
}
static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
@@ -230,7 +230,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
for (i=0; i<os_max_cache_pages; i++) {
p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus);
HPT_ASSERT(p);
- free_pages(p, 0);
+ free_pages(p);
}
for (f=vbus_ext->freelist_dma_head; f; f=f->next) {
@@ -244,7 +244,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
while ((p=freelist_get_dma(f, &bus))) {
if (order)
- free_pages(p, order);
+ free_pages(p);
else {
/* can't free immediately since other blocks in this page may still be in the list */
if (((HPT_UPTR)p & (PAGE_SIZE-1))==0)
@@ -254,7 +254,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
}
while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus)))
- free_pages(p, 0);
+ free_pages(p);
}
static int hpt_init_vbus(PVBUS_EXT vbus_ext)
diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c
index 4a014ce17f4e..5c4718bf582f 100644
--- a/sys/dev/hptmv/entry.c
+++ b/sys/dev/hptmv/entry.c
@@ -914,7 +914,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
{
MV_ERROR("RR18xx[%d]: Error in Request Quueues Alignment\n",
pAdapter->mvSataAdapter.adapterId);
- contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF);
+ free(pAdapter->requestsArrayBaseAddr, M_DEVBUF);
return -1;
}
/* response queues */
@@ -924,7 +924,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
{
MV_ERROR("RR18xx[%d]: Failed to allocate memory for EDMA response"
" queues\n", pAdapter->mvSataAdapter.adapterId);
- contigfree(pAdapter->requestsArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF);
+ free(pAdapter->requestsArrayBaseAddr, M_DEVBUF);
return -1;
}
pAdapter->responsesArrayBaseDmaAddr = fOsPhysicalAddress(pAdapter->responsesArrayBaseAddr);
@@ -941,8 +941,8 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
{
MV_ERROR("RR18xx[%d]: Error in Response Queues Alignment\n",
pAdapter->mvSataAdapter.adapterId);
- contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF);
- contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF);
+ free(pAdapter->requestsArrayBaseAddr, M_DEVBUF);
+ free(pAdapter->responsesArrayBaseAddr, M_DEVBUF);
return -1;
}
return 0;
@@ -951,8 +951,8 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
static void
hptmv_free_edma_queues(IAL_ADAPTER_T *pAdapter)
{
- contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF);
- contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF);
+ free(pAdapter->requestsArrayBaseAddr, M_DEVBUF);
+ free(pAdapter->responsesArrayBaseAddr, M_DEVBUF);
}
static PVOID
@@ -2950,13 +2950,13 @@ void
void
os_free_page(_VBUS_ARG void *p)
{
- contigfree(p, 0x1000, M_DEVBUF);
+ free(p, M_DEVBUF);
}
void
os_free_dma_page(_VBUS_ARG void *p)
{
- contigfree(p, 0x1000, M_DEVBUF);
+ free(p, M_DEVBUF);
}
void
diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c
index 00774bf9be4a..a8ac77c5ad5a 100644
--- a/sys/dev/hptnr/hptnr_osm_bsd.c
+++ b/sys/dev/hptnr/hptnr_osm_bsd.c
@@ -143,9 +143,9 @@ static __inline void *__get_free_pages(int order)
M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
}
-static __inline void free_pages(void *p, int order)
+static __inline void free_pages(void *p)
{
- contigfree(p, PAGE_SIZE<<order, M_DEVBUF);
+ free(p, M_DEVBUF);
}
static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
@@ -227,7 +227,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
for (i=0; i<os_max_cache_pages; i++) {
p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus);
HPT_ASSERT(p);
- free_pages(p, 0);
+ free_pages(p);
}
for (f=vbus_ext->freelist_dma_head; f; f=f->next) {
@@ -241,7 +241,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
while ((p=freelist_get_dma(f, &bus))) {
if (order)
- free_pages(p, order);
+ free_pages(p);
else {
/* can't free immediately since other blocks in this page may still be in the list */
if (((HPT_UPTR)p & (PAGE_SIZE-1))==0)
@@ -251,7 +251,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
}
while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus)))
- free_pages(p, 0);
+ free_pages(p);
}
static int hpt_init_vbus(PVBUS_EXT vbus_ext)
diff --git a/sys/dev/hptrr/hptrr_osm_bsd.c b/sys/dev/hptrr/hptrr_osm_bsd.c
index 4208dd620e37..68e9af3aff02 100644
--- a/sys/dev/hptrr/hptrr_osm_bsd.c
+++ b/sys/dev/hptrr/hptrr_osm_bsd.c
@@ -144,9 +144,9 @@ static __inline void *__get_free_pages(int order)
M_DEVBUF, M_WAITOK, BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
}
-static __inline void free_pages(void *p, int order)
+static __inline void free_pages(void *p)
{
- contigfree(p, PAGE_SIZE<<order, M_DEVBUF);
+ free(p, M_DEVBUF);
}
static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
@@ -228,7 +228,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
for (i=0; i<os_max_cache_pages; i++) {
p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus);
HPT_ASSERT(p);
- free_pages(p, 0);
+ free_pages(p);
}
for (f=vbus_ext->freelist_dma_head; f; f=f->next) {
@@ -242,7 +242,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
while ((p=freelist_get_dma(f, &bus))) {
if (order)
- free_pages(p, order);
+ free_pages(p);
else {
/* can't free immediately since other blocks in this page may still be in the list */
if (((HPT_UPTR)p & (PAGE_SIZE-1))==0)
@@ -252,7 +252,7 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
}
while ((p = dmapool_get_page((PVBUS)vbus_ext->vbus, &bus)))
- free_pages(p, 0);
+ free_pages(p);
}
static int hpt_init_vbus(PVBUS_EXT vbus_ext)
diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index 9f51f5b32199..5bdd804b06d5 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -5131,7 +5131,7 @@ hn_destroy_rx_data(struct hn_softc *sc)
if (sc->hn_rxbuf != NULL) {
if ((sc->hn_flags & HN_FLAG_RXBUF_REF) == 0)
- contigfree(sc->hn_rxbuf, HN_RXBUF_SIZE, M_DEVBUF);
+ free(sc->hn_rxbuf, M_DEVBUF);
else
device_printf(sc->hn_dev, "RXBUF is referenced\n");
sc->hn_rxbuf = NULL;
@@ -5146,8 +5146,7 @@ hn_destroy_rx_data(struct hn_softc *sc)
if (rxr->hn_br == NULL)
continue;
if ((rxr->hn_rx_flags & HN_RX_FLAG_BR_REF) == 0) {
- contigfree(rxr->hn_br, HN_TXBR_SIZE + HN_RXBR_SIZE,
- M_DEVBUF);
+ free(rxr->hn_br, M_DEVBUF);
} else {
device_printf(sc->hn_dev,
"%dth channel bufring is referenced", i);
@@ -5649,7 +5648,7 @@ hn_destroy_tx_data(struct hn_softc *sc)
if (sc->hn_chim != NULL) {
if ((sc->hn_flags & HN_FLAG_CHIM_REF) == 0) {
- contigfree(sc->hn_chim, HN_CHIM_SIZE, M_DEVBUF);
+ free(sc->hn_chim, M_DEVBUF);
} else {
device_printf(sc->hn_dev,
"chimney sending buffer is referenced");
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index 774ba6da46e7..5d0b23a09213 100644
--- a/sys/dev/hyperv/vmbus/vmbus.c
+++ b/sys/dev/hyperv/vmbus/vmbus.c
@@ -900,29 +900,27 @@ vmbus_dma_free(struct vmbus_softc *sc)
int cpu;
if (sc->vmbus_evtflags != NULL) {
- contigfree(sc->vmbus_evtflags, PAGE_SIZE, M_DEVBUF);
+ free(sc->vmbus_evtflags, M_DEVBUF);
sc->vmbus_evtflags = NULL;
sc->vmbus_rx_evtflags = NULL;
sc->vmbus_tx_evtflags = NULL;
}
if (sc->vmbus_mnf1 != NULL) {
- contigfree(sc->vmbus_mnf1, PAGE_SIZE, M_DEVBUF);
+ free(sc->vmbus_mnf1, M_DEVBUF);
sc->vmbus_mnf1 = NULL;
}
if (sc->vmbus_mnf2 != NULL) {
- contigfree(sc->vmbus_mnf2, sizeof(struct vmbus_mnf), M_DEVBUF);
+ free(sc->vmbus_mnf2, M_DEVBUF);
sc->vmbus_mnf2 = NULL;
}
CPU_FOREACH(cpu) {
if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) {
- contigfree(VMBUS_PCPU_GET(sc, message, cpu), PAGE_SIZE,
- M_DEVBUF);
+ free(VMBUS_PCPU_GET(sc, message, cpu), M_DEVBUF);
VMBUS_PCPU_GET(sc, message, cpu) = NULL;
}
if (VMBUS_PCPU_GET(sc, event_flags, cpu) != NULL) {
- contigfree(VMBUS_PCPU_GET(sc, event_flags, cpu),
- PAGE_SIZE, M_DEVBUF);
+ free(VMBUS_PCPU_GET(sc, event_flags, cpu), M_DEVBUF);
VMBUS_PCPU_GET(sc, event_flags, cpu) = NULL;
}
}
@@ -1424,7 +1422,7 @@ vmbus_free_cpu_mem(struct vmbus_softc *sc)
void **hv_cpu_mem;
hv_cpu_mem = VMBUS_PCPU_PTR(sc, cpu_mem, cpu);
if(*hv_cpu_mem != NULL) {
- contigfree(*hv_cpu_mem, PAGE_SIZE, M_DEVBUF);
+ free(*hv_cpu_mem, M_DEVBUF);
*hv_cpu_mem = NULL;
}
}
diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c
index 0922470d4672..5ce6e545158c 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chan.c
+++ b/sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -341,8 +341,7 @@ vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size,
* Allocate the TX+RX bufrings.
*/
KASSERT(chan->ch_bufring == NULL, ("bufrings are allocated"));
- chan->ch_bufring_size = txbr_size + rxbr_size;
- chan->ch_bufring = contigmalloc(chan->ch_bufring_size, M_DEVBUF,
+ chan->ch_bufring = contigmalloc(txbr_size + rxbr_size, M_DEVBUF,
M_WAITOK | M_ZERO, 0ul, ~0ul, PAGE_SIZE, 0);
if (chan->ch_bufring == NULL) {
vmbus_chan_printf(chan, "bufring allocation failed\n");
@@ -368,8 +367,7 @@ vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size,
"leak %d bytes memory\n", chan->ch_id,
txbr_size + rxbr_size);
} else {
- contigfree(chan->ch_bufring, chan->ch_bufring_size,
- M_DEVBUF);
+ free(chan->ch_bufring, M_DEVBUF);
}
chan->ch_bufring = NULL;
}
@@ -939,7 +937,7 @@ disconnect:
* Destroy the TX+RX bufrings.
*/
if (chan->ch_bufring != NULL) {
- contigfree(chan->ch_bufring, chan->ch_bufring_size, M_DEVBUF);
+ free(chan->ch_bufring, M_DEVBUF);
chan->ch_bufring = NULL;
}
return (error);
@@ -1679,7 +1677,7 @@ vmbus_chan_free(struct vmbus_channel *chan)
KASSERT(chan->ch_poll_intvl == 0, ("chan%u: polling is activated",
chan->ch_id));
- contigfree(chan->ch_monprm, sizeof(struct hyperv_mon_param), M_DEVBUF);
+ free(chan->ch_monprm, M_DEVBUF);
mtx_destroy(&chan->ch_subchan_lock);
sx_destroy(&chan->ch_orphan_lock);
vmbus_rxbr_deinit(&chan->ch_rxbr);
diff --git a/sys/dev/hyperv/vmbus/vmbus_chanvar.h b/sys/dev/hyperv/vmbus/vmbus_chanvar.h
index e88ada2dd274..c02ec24c70a1 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chanvar.h
+++ b/sys/dev/hyperv/vmbus/vmbus_chanvar.h
@@ -123,7 +123,6 @@ struct vmbus_channel {
struct vmbus_channel *ch_prichan; /* owner primary chan */
void *ch_bufring; /* TX+RX bufrings */
- size_t ch_bufring_size;
uint32_t ch_bufring_gpadl;
struct task ch_attach_task; /* run in ch_mgmt_tq */
diff --git a/sys/dev/hyperv/vmbus/vmbus_xact.c b/sys/dev/hyperv/vmbus/vmbus_xact.c
index f5f766f2c2fc..eb221ef92b2c 100644
--- a/sys/dev/hyperv/vmbus/vmbus_xact.c
+++ b/sys/dev/hyperv/vmbus/vmbus_xact.c
@@ -104,7 +104,7 @@ static void
vmbus_xact_free(struct vmbus_xact *xact)
{
- contigfree(xact->x_req, xact->x_ctx->xc_req_size, M_DEVBUF);
+ free(xact->x_req, M_DEVBUF);
free(xact->x_resp0, M_DEVBUF);
if (xact->x_priv != NULL)
free(xact->x_priv, M_DEVBUF);
diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c
index 9c081e0fb0b9..6ff3494a76da 100644
--- a/sys/dev/ioat/ioat_test.c
+++ b/sys/dev/ioat/ioat_test.c
@@ -82,17 +82,11 @@ static void _ioat_test_log(int verbosity, const char *fmt, ...);
static void
ioat_test_transaction_destroy(struct test_transaction *tx)
{
- struct ioat_test *test;
int i;
- test = tx->test;
-
for (i = 0; i < IOAT_MAX_BUFS; i++) {
if (tx->buf[i] != NULL) {
- if (test->testkind == IOAT_TEST_DMA_8K)
- free(tx->buf[i], M_IOAT_TEST);
- else
- contigfree(tx->buf[i], tx->length, M_IOAT_TEST);
+ free(tx->buf[i], M_IOAT_TEST);
tx->buf[i] = NULL;
}
}
diff --git a/sys/dev/isci/isci.c b/sys/dev/isci/isci.c
index 2b5d4301f6b2..1dede4e45b4c 100644
--- a/sys/dev/isci/isci.c
+++ b/sys/dev/isci/isci.c
@@ -235,7 +235,7 @@ isci_detach(device_t device)
sci_pool_get(controller->unmap_buffer_pool, unmap_buffer);
if (unmap_buffer == NULL)
break;
- contigfree(unmap_buffer, PAGE_SIZE, M_ISCI);
+ free(unmap_buffer, M_ISCI);
}
}
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index dfcaa01d366b..7542b17e19eb 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -555,8 +555,7 @@ lge_attach(device_t dev)
fail:
lge_free_jumbo_mem(sc);
if (sc->lge_ldata)
- contigfree(sc->lge_ldata,
- sizeof(struct lge_list_data), M_DEVBUF);
+ free(sc->lge_ldata, M_DEVBUF);
if (ifp)
if_free(ifp);
if (sc->lge_irq)
@@ -590,7 +589,7 @@ lge_detach(device_t dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->lge_irq);
bus_release_resource(dev, LGE_RES, LGE_RID, sc->lge_res);
- contigfree(sc->lge_ldata, sizeof(struct lge_list_data), M_DEVBUF);
+ free(sc->lge_ldata, M_DEVBUF);
if_free(ifp);
lge_free_jumbo_mem(sc);
mtx_destroy(&sc->lge_mtx);
@@ -784,7 +783,7 @@ lge_free_jumbo_mem(struct lge_softc *sc)
free(entry, M_DEVBUF);
}
- contigfree(sc->lge_cdata.lge_jumbo_buf, LGE_JMEM, M_DEVBUF);
+ free(sc->lge_cdata.lge_jumbo_buf, M_DEVBUF);
return;
}
diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c
index cea62517b2e6..bf14bfdb73ea 100644
--- a/sys/dev/netmap/if_ptnet.c
+++ b/sys/dev/netmap/if_ptnet.c
@@ -540,7 +540,7 @@ ptnet_detach(device_t dev)
ptnet_irqs_fini(sc);
if (sc->csb_gh) {
- contigfree(sc->csb_gh, 2*PAGE_SIZE, M_DEVBUF);
+ free(sc->csb_gh, M_DEVBUF);
sc->csb_gh = NULL;
sc->csb_hg = NULL;
}
diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c
index 23954b377f9b..473b252e7329 100644
--- a/sys/dev/netmap/netmap_mem2.c
+++ b/sys/dev/netmap/netmap_mem2.c
@@ -1284,7 +1284,7 @@ netmap_reset_obj_allocator(struct netmap_obj_pool *p)
* in the lut.
*/
for (i = 0; i < p->objtotal; i += p->_clustentries) {
- contigfree(p->lut[i].vaddr, p->_clustsize, M_NETMAP);
+ free(p->lut[i].vaddr, M_NETMAP);
}
nm_free_lut(p->lut, p->objtotal);
}
@@ -1402,7 +1402,6 @@ static int
netmap_finalize_obj_allocator(struct netmap_obj_pool *p)
{
int i; /* must be signed */
- size_t n;
if (p->lut) {
/* if the lut is already there we assume that also all the
@@ -1430,7 +1429,6 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool *p)
* Allocate clusters, init pointers
*/
- n = p->_clustsize;
for (i = 0; i < (int)p->objtotal;) {
int lim = i + p->_clustentries;
char *clust;
@@ -1442,7 +1440,7 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool *p)
* can live with standard malloc, because the hardware will not
* access the pages directly.
*/
- clust = contigmalloc(n, M_NETMAP, M_NOWAIT | M_ZERO,
+ clust = contigmalloc(p->_clustsize, M_NETMAP, M_NOWAIT | M_ZERO,
(size_t)0, -1UL, PAGE_SIZE, 0);
if (clust == NULL) {
/*
@@ -1456,8 +1454,7 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool *p)
lim = i / 2;
for (i--; i >= lim; i--) {
if (i % p->_clustentries == 0 && p->lut[i].vaddr)
- contigfree(p->lut[i].vaddr,
- n, M_NETMAP);
+ free(p->lut[i].vaddr, M_NETMAP);
p->lut[i].vaddr = NULL;
}
out:
diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
index c24d03a178ee..c8c9eb8c8dd8 100644
--- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
+++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
@@ -6478,7 +6478,6 @@ int agtiapi_ReleaseHBA( device_t dev )
pCard->pPortalData = NULL;
AGTIAPI_PRINTK("agtiapi_ReleaseHBA: PortalData released\n");
}
- //calls contigfree() or free()
agtiapi_MemFree(pCardInfo);
AGTIAPI_PRINTK("agtiapi_ReleaseHBA: low level resource released\n");
diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c
index 03eca4d96286..353d41808800 100644
--- a/sys/dev/pst/pst-iop.c
+++ b/sys/dev/pst/pst-iop.c
@@ -136,7 +136,7 @@ iop_attach(void *arg)
ident->vendor, ident->product);
printf("pstiop: description=<%.16s> revision=<%.8s>\n",
ident->description, ident->revision);
- contigfree(reply, PAGE_SIZE, M_PSTIOP);
+ free(reply, M_PSTIOP);
}
#endif
@@ -317,18 +317,18 @@ iop_get_lct(struct iop_softc *sc)
msg->sgl.phys_addr[0] = vtophys(reply);
if (iop_queue_wait_msg(sc, mfa, (struct i2o_basic_message *)msg)) {
- contigfree(reply, ALLOCSIZE, M_PSTIOP);
+ free(reply, M_PSTIOP);
return 0;
}
if (!(sc->lct = malloc(reply->table_size * sizeof(struct i2o_lct_entry),
M_PSTIOP, M_NOWAIT | M_ZERO))) {
- contigfree(reply, ALLOCSIZE, M_PSTIOP);
+ free(reply, M_PSTIOP);
return 0;
}
bcopy(&reply->entry[0], sc->lct,
reply->table_size * sizeof(struct i2o_lct_entry));
sc->lct_count = reply->table_size;
- contigfree(reply, ALLOCSIZE, M_PSTIOP);
+ free(reply, M_PSTIOP);
return 1;
}
@@ -374,10 +374,10 @@ iop_get_util_params(struct iop_softc *sc, int target, int operation, int group)
if (iop_queue_wait_msg(sc, mfa, (struct i2o_basic_message *)msg) ||
reply->error_info_size) {
- contigfree(reply, PAGE_SIZE, M_PSTIOP);
+ free(reply, M_PSTIOP);
reply = NULL;
}
- contigfree(param, PAGE_SIZE, M_PSTIOP);
+ free(param, M_PSTIOP);
return reply;
}
*** 416 LINES SKIPPED ***