A friend of mine is trying to use two full HD cams on a OpenBSD laptop
to record his band sessions from two different angles. He can start
the first cam fine with 1920x1080, but if he tries to start the second
cam with 1920x1080 he runs out of USB memory.
That made me look in to the USB memory allocation, and it's a bit
sub-optimal currently. We have three memory pools for USB:
M_USB USB general.
M_USBDEV USB device driver.
M_USBHC USB host controller.
A lot of USB devices drivers still use M_DEVBUF for their memory
allocations, including uvideo(4). I think we should use M_USBDEV
instead for USB device drivers, and M_USBHC for USB HC drivers.
Therefore, USB memory allocation ends up in M_DEVBUF often, while
M_USBDEV is not very much utilized. The attached diff is changing the
USB device drivers to use M_USBDEV instead of M_DEVBUF, and the USB HC
drivers to use M_USBHC instead of M_DEVBUF. Exception for the USB
device drivers are the free(9) calls if loadfirmware(9) is used.
Following an example on a xhci(4) host as of today.
Memory allocation after boot:
kern.malloc.kmemstat.devbuf: memuse = 11749K
kern.malloc.kmemstat.USB: memuse = 44K
kern.malloc.kmemstat.USB_device: memuse = 4K
kern.malloc.kmemstat.USB_HC: memuse = 0K
Memory allocation after uvideo(4) device attaches:
kern.malloc.kmemstat.devbuf: memuse = 15942K
kern.malloc.kmemstat.USB: memuse = 53K
kern.malloc.kmemstat.USB_device: memuse = 4K
kern.malloc.kmemstat.USB_HC: memuse = 0K
Memory allocation after uvideo(4) device is in use:
kern.malloc.kmemstat.devbuf: memuse = 52394K <---
kern.malloc.kmemstat.USB: memuse = 57K
kern.malloc.kmemstat.USB_device: memuse = 4K
kern.malloc.kmemstat.USB_HC: memuse = 0K
Following the same procedure with the diff applied.
Memory allocation after boot:
kern.malloc.kmemstat.devbuf: memuse = 11770K
kern.malloc.kmemstat.USB: memuse = 44K
kern.malloc.kmemstat.USB_device: memuse = 4K
kern.malloc.kmemstat.USB_HC: memuse = 1K
Memory allocation after uvideo(4) device attaches:
kern.malloc.kmemstat.devbuf: memuse = 15962K
kern.malloc.kmemstat.USB: memuse = 53K
kern.malloc.kmemstat.USB_device: memuse = 5K
kern.malloc.kmemstat.USB_HC: memuse = 1K
Memory allocation after uvideo(4) device is in use:
kern.malloc.kmemstat.devbuf: memuse = 15962K
kern.malloc.kmemstat.USB: memuse = 57K
kern.malloc.kmemstat.USB_device: memuse = 36457K <---
kern.malloc.kmemstat.USB_HC: memuse = 1K
With this I can run two full HD cams on the same host since the M_USBDEV
memory pool has usually more capacity than M_DEVBUF. Tested on a
xhci(4) and ehci(4) host.
Comments? OKs?
Cheers,
Marcus
Index: sys/dev/usb/ehci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.215
diff -u -p -u -p -r1.215 ehci.c
--- sys/dev/usb/ehci.c 26 Oct 2021 16:29:49 -0000 1.215
+++ sys/dev/usb/ehci.c 21 Nov 2021 10:51:38 -0000
@@ -331,7 +331,7 @@ ehci_init(struct ehci_softc *sc)
return (err);
if (ehcixfer == NULL) {
- ehcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ ehcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (ehcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
Index: sys/dev/usb/if_athn_usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_athn_usb.c,v
retrieving revision 1.62
diff -u -p -u -p -r1.62 if_athn_usb.c
--- sys/dev/usb/if_athn_usb.c 31 Oct 2021 12:24:02 -0000 1.62
+++ sys/dev/usb/if_athn_usb.c 21 Nov 2021 10:51:38 -0000
@@ -1178,7 +1178,7 @@ athn_usb_node_alloc(struct ieee80211com
{
struct athn_node *an;
- an = malloc(sizeof(struct athn_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ an = malloc(sizeof(struct athn_node), M_USBDEV, M_NOWAIT | M_ZERO);
return (struct ieee80211_node *)an;
}
Index: sys/dev/usb/if_otus.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_otus.c,v
retrieving revision 1.69
diff -u -p -u -p -r1.69 if_otus.c
--- sys/dev/usb/if_otus.c 25 Feb 2021 02:48:20 -0000 1.69
+++ sys/dev/usb/if_otus.c 21 Nov 2021 10:51:39 -0000
@@ -884,7 +884,7 @@ otus_write_barrier(struct otus_softc *sc
struct ieee80211_node *
otus_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct otus_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct otus_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
Index: sys/dev/usb/if_run.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_run.c,v
retrieving revision 1.134
diff -u -p -u -p -r1.134 if_run.c
--- sys/dev/usb/if_run.c 1 Nov 2021 12:08:46 -0000 1.134
+++ sys/dev/usb/if_run.c 21 Nov 2021 10:51:39 -0000
@@ -1664,7 +1664,7 @@ run_read_eeprom(struct run_softc *sc)
struct ieee80211_node *
run_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct run_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct run_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
Index: sys/dev/usb/if_wi_usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_wi_usb.c,v
retrieving revision 1.74
diff -u -p -u -p -r1.74 if_wi_usb.c
--- sys/dev/usb/if_wi_usb.c 9 Aug 2021 07:21:48 -0000 1.74
+++ sys/dev/usb/if_wi_usb.c 21 Nov 2021 10:51:39 -0000
@@ -409,7 +409,7 @@ wi_usb_detach(struct device *self, int f
while (sc->wi_usb_nummem) {
sc->wi_usb_nummem--;
- free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF,
+ free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV,
sc->wi_usb_txmemsize[sc->wi_usb_nummem]);
sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL;
sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0;
@@ -539,7 +539,7 @@ wi_cmd_usb(struct wi_softc *wsc, int cmd
/* free alloc_nicmem regions */
while (sc->wi_usb_nummem) {
sc->wi_usb_nummem--;
- free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF,
+ free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV,
sc->wi_usb_txmemsize[sc->wi_usb_nummem]);
sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL;
sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0;
@@ -921,7 +921,7 @@ wi_alloc_nicmem_usb(struct wi_softc *wsc
return ENOMEM;
}
- sc->wi_usb_txmem[nmem] = malloc(len, M_DEVBUF, M_WAITOK | M_CANFAIL);
+ sc->wi_usb_txmem[nmem] = malloc(len, M_USBDEV, M_WAITOK | M_CANFAIL);
if (sc->wi_usb_txmem[nmem] == NULL) {
sc->wi_usb_nummem--;
return ENOMEM;
@@ -1748,7 +1748,7 @@ wi_usb_thread(void *arg)
struct wi_usb_thread_info *wi_thread_info;
int s;
- wi_thread_info = malloc(sizeof(*wi_thread_info), M_DEVBUF, M_WAITOK);
+ wi_thread_info = malloc(sizeof(*wi_thread_info), M_USBDEV, M_WAITOK);
/*
* is there a remote possibility that the device could
Index: sys/dev/usb/if_zyd.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_zyd.c,v
retrieving revision 1.125
diff -u -p -u -p -r1.125 if_zyd.c
--- sys/dev/usb/if_zyd.c 31 Jul 2020 10:49:33 -0000 1.125
+++ sys/dev/usb/if_zyd.c 21 Nov 2021 10:51:39 -0000
@@ -633,7 +633,7 @@ zyd_free_rx_list(struct zyd_softc *sc)
struct ieee80211_node *
zyd_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct zyd_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct zyd_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
Index: sys/dev/usb/ohci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ohci.c,v
retrieving revision 1.162
diff -u -p -u -p -r1.162 ohci.c
--- sys/dev/usb/ohci.c 26 Oct 2021 16:29:49 -0000 1.162
+++ sys/dev/usb/ohci.c 21 Nov 2021 10:51:40 -0000
@@ -720,7 +720,7 @@ ohci_init(struct ohci_softc *sc)
LIST_INIT(&sc->sc_hash_itds[i]);
if (ohcixfer == NULL) {
- ohcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ ohcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (ohcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
Index: sys/dev/usb/uaudio.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
retrieving revision 1.161
diff -u -p -u -p -r1.161 uaudio.c
--- sys/dev/usb/uaudio.c 18 May 2021 10:02:00 -0000 1.161
+++ sys/dev/usb/uaudio.c 21 Nov 2021 10:51:40 -0000
@@ -719,7 +719,7 @@ uaudio_mkname(struct uaudio_softc *sc, c
while (1) {
if (n == NULL) {
n = malloc(sizeof(struct uaudio_name),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
n->templ = templ;
n->unit = 0;
n->next = sc->names;
@@ -799,7 +799,7 @@ uaudio_ranges_add(struct uaudio_ranges *
/* XXX: use 'res' here */
r->nval += max - min + 1;
- e = malloc(sizeof(struct uaudio_ranges_el), M_DEVBUF, M_WAITOK);
+ e = malloc(sizeof(struct uaudio_ranges_el), M_USBDEV, M_WAITOK);
e->min = min;
e->max = max;
e->res = res;
@@ -817,7 +817,7 @@ uaudio_ranges_clear(struct uaudio_ranges
while ((e = r->el) != NULL) {
r->el = e->next;
- free(e, M_DEVBUF, sizeof(struct uaudio_ranges_el));
+ free(e, M_USBDEV, sizeof(struct uaudio_ranges_el));
}
r->nval = 0;
}
@@ -975,7 +975,7 @@ uaudio_req_ranges(struct uaudio_softc *s
if (sizeof(req_buf) >= req_size)
req = req_buf;
else
- req = malloc(req_size, M_DEVBUF, M_WAITOK);
+ req = malloc(req_size, M_USBDEV, M_WAITOK);
p.rptr = p.wptr = req;
if (!uaudio_req(sc, UT_READ_CLASS_INTERFACE,
@@ -1003,7 +1003,7 @@ uaudio_req_ranges(struct uaudio_softc *s
}
if (req != req_buf)
- free(req, M_DEVBUF, req_size);
+ free(req, M_USBDEV, req_size);
return 1;
}
@@ -1126,7 +1126,7 @@ uaudio_feature_addent(struct uaudio_soft
return;
}
- m = malloc(sizeof(struct uaudio_mixent), M_DEVBUF, M_WAITOK);
+ m = malloc(sizeof(struct uaudio_mixent), M_USBDEV, M_WAITOK);
m->chan = chan;
m->fname = features[uac_type].name;
m->type = features[uac_type].mix_type;
@@ -1140,13 +1140,13 @@ uaudio_feature_addent(struct uaudio_soft
&m->ranges)) {
printf("%s: failed to get ranges for %s control\n",
DEVNAME(sc), m->fname);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
if (m->ranges.el == NULL) {
printf("%s: skipped %s control with empty range\n",
DEVNAME(sc), m->fname);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
#ifdef UAUDIO_DEBUG
@@ -1166,7 +1166,7 @@ uaudio_feature_addent(struct uaudio_soft
if (cmp == 0) {
DPRINTF("%02u: %s.%s: duplicate feature for chan %d\n",
u->id, u->name, m->fname, m->chan);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
if (cmp > 0)
@@ -1290,7 +1290,7 @@ uaudio_process_unit(struct uaudio_softc
*/
u = uaudio_unit_byid(sc, id);
if (u == NULL) {
- u = malloc(sizeof(struct uaudio_unit), M_DEVBUF, M_WAITOK);
+ u = malloc(sizeof(struct uaudio_unit), M_USBDEV, M_WAITOK);
u->id = id;
u->type = subtype;
u->term = 0;
@@ -2556,7 +2556,7 @@ uaudio_process_as(struct uaudio_softc *s
unsigned int type, subtype;
int ispcm = 0;
- a = malloc(sizeof(struct uaudio_alt), M_DEVBUF, M_WAITOK);
+ a = malloc(sizeof(struct uaudio_alt), M_USBDEV, M_WAITOK);
a->mode = 0;
a->nch = 0;
a->v1_rates = 0;
@@ -2592,7 +2592,7 @@ uaudio_process_as(struct uaudio_softc *s
}
if (!ispcm) {
DPRINTF("%s: non-pcm iface\n", __func__);
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 1;
}
}
@@ -2616,7 +2616,7 @@ uaudio_process_as(struct uaudio_softc *s
if (a->mode == 0) {
printf("%s: no data endpoints found\n", DEVNAME(sc));
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 1;
}
@@ -2644,7 +2644,7 @@ uaudio_process_as(struct uaudio_softc *s
*pa = a;
return 1;
failed:
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 0;
}
@@ -2683,7 +2683,7 @@ uaudio_fixup_params(struct uaudio_softc
break;
}
p = malloc(sizeof(struct uaudio_params),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
p->palt = ap;
p->ralt = ar;
p->v1_rates = rates;
@@ -2700,7 +2700,7 @@ uaudio_fixup_params(struct uaudio_softc
if (sc->params_list == NULL) {
for (a = sc->alts; a != NULL; a = a->next) {
p = malloc(sizeof(struct uaudio_params),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
if (a->mode == AUMODE_PLAY) {
p->palt = a;
p->ralt = NULL;
@@ -2791,7 +2791,7 @@ uaudio_xfer_alloc(struct uaudio_softc *s
return ENOMEM;
xfer->sizes = mallocarray(count,
- sizeof(xfer->sizes[0]), M_DEVBUF, M_WAITOK);
+ sizeof(xfer->sizes[0]), M_USBDEV, M_WAITOK);
if (xfer->sizes == NULL)
return ENOMEM;
@@ -2811,7 +2811,7 @@ uaudio_xfer_free(struct uaudio_softc *sc
xfer->usb_xfer = NULL;
}
if (xfer->sizes != NULL) {
- free(xfer->sizes, M_DEVBUF,
+ free(xfer->sizes, M_USBDEV,
sizeof(xfer->sizes[0]) * count);
xfer->sizes = NULL;
}
@@ -3861,12 +3861,12 @@ uaudio_detach(struct device *self, int f
while ((alt = sc->alts) != NULL) {
sc->alts = alt->next;
- free(alt, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(alt, M_USBDEV, sizeof(struct uaudio_alt));
}
while ((params = sc->params_list) != NULL) {
sc->params_list = params->next;
- free(params, M_DEVBUF, sizeof(struct uaudio_params));
+ free(params, M_USBDEV, sizeof(struct uaudio_params));
}
while ((unit = sc->unit_list) != NULL) {
@@ -3874,15 +3874,15 @@ uaudio_detach(struct device *self, int f
while ((mixent = unit->mixent_list) != NULL) {
unit->mixent_list = mixent->next;
uaudio_ranges_clear(&mixent->ranges);
- free(mixent, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(mixent, M_USBDEV, sizeof(struct uaudio_mixent));
}
uaudio_ranges_clear(&unit->rates);
- free(unit, M_DEVBUF, sizeof(struct uaudio_unit));
+ free(unit, M_USBDEV, sizeof(struct uaudio_unit));
}
while ((name = sc->names)) {
sc->names = name->next;
- free(name, M_DEVBUF, sizeof(struct uaudio_name));
+ free(name, M_USBDEV, sizeof(struct uaudio_name));
}
return rv;
Index: sys/dev/usb/udl.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/udl.c,v
retrieving revision 1.95
diff -u -p -u -p -r1.95 udl.c
--- sys/dev/usb/udl.c 27 Oct 2021 09:09:55 -0000 1.95
+++ sys/dev/usb/udl.c 21 Nov 2021 10:51:40 -0000
@@ -640,7 +640,7 @@ udl_alloc_screen(void *v, const struct w
/* allocate character backing store */
sc->sc_cbs = mallocarray(sc->sc_ri.ri_rows, sc->sc_ri.ri_cols *
- sizeof(*sc->sc_cbs), M_DEVBUF, M_NOWAIT|M_ZERO);
+ sizeof(*sc->sc_cbs), M_USBDEV, M_NOWAIT|M_ZERO);
if (sc->sc_cbs == NULL) {
printf("%s: can't allocate mem for character backing store!\n",
DN(sc));
@@ -669,7 +669,7 @@ udl_free_screen(void *v, void *cookie)
/* free character backing store */
if (sc->sc_cbs != NULL)
- free(sc->sc_cbs, M_DEVBUF, sc->sc_cbslen);
+ free(sc->sc_cbs, M_USBDEV, sc->sc_cbslen);
sc->sc_nscreens--;
}
@@ -1418,7 +1418,7 @@ void
udl_free_huffman(struct udl_softc *sc)
{
if (sc->sc_huffman != NULL) {
- free(sc->sc_huffman, M_DEVBUF, sc->sc_huffman_size);
+ free(sc->sc_huffman, M_USBDEV, sc->sc_huffman_size);
sc->sc_huffman = NULL;
sc->sc_huffman_size = 0;
DPRINTF(1, "%s: huffman table freed\n", DN(sc));
@@ -1434,7 +1434,7 @@ udl_fbmem_alloc(struct udl_softc *sc)
size = round_page(size);
if (sc->sc_fbmem == NULL) {
- sc->sc_fbmem = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO);
+ sc->sc_fbmem = malloc(size, M_USBDEV, M_NOWAIT|M_ZERO);
if (sc->sc_fbmem == NULL)
return (-1);
}
@@ -1446,7 +1446,7 @@ void
udl_fbmem_free(struct udl_softc *sc)
{
if (sc->sc_fbmem != NULL) {
- free(sc->sc_fbmem, M_DEVBUF, sc->sc_fbmemsize);
+ free(sc->sc_fbmem, M_USBDEV, sc->sc_fbmemsize);
sc->sc_fbmem = NULL;
sc->sc_fbmemsize = 0;
}
@@ -1500,7 +1500,7 @@ udl_cmd_alloc_buf(struct udl_softc *sc)
{
struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
- cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_DEVBUF, M_NOWAIT|M_ZERO);
+ cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_USBDEV, M_NOWAIT|M_ZERO);
if (cb->buf == NULL) {
printf("%s: %s: can't allocate buffer!\n",
DN(sc), FUNC);
@@ -1518,7 +1518,7 @@ udl_cmd_free_buf(struct udl_softc *sc)
struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
if (cb->buf != NULL) {
- free(cb->buf, M_DEVBUF, UDL_CMD_MAX_XFER_SIZE);
+ free(cb->buf, M_USBDEV, UDL_CMD_MAX_XFER_SIZE);
cb->buf = NULL;
}
cb->off = 0;
Index: sys/dev/usb/uhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhci.c,v
retrieving revision 1.153
diff -u -p -u -p -r1.153 uhci.c
--- sys/dev/usb/uhci.c 26 Oct 2021 16:29:49 -0000 1.153
+++ sys/dev/usb/uhci.c 21 Nov 2021 10:51:40 -0000
@@ -363,7 +363,7 @@ uhci_init(struct uhci_softc *sc)
uhci_reset(sc);
if (uhcixfer == NULL) {
- uhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ uhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (uhcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
Index: sys/dev/usb/umass_scsi.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/umass_scsi.c,v
retrieving revision 1.61
diff -u -p -u -p -r1.61 umass_scsi.c
--- sys/dev/usb/umass_scsi.c 22 Sep 2020 19:32:53 -0000 1.61
+++ sys/dev/usb/umass_scsi.c 21 Nov 2021 10:51:40 -0000
@@ -84,7 +84,7 @@ umass_scsi_attach(struct umass_softc *sc
struct umass_scsi_softc *scbus;
u_int16_t flags = 0;
- scbus = malloc(sizeof(*scbus), M_DEVBUF, M_WAITOK | M_ZERO);
+ scbus = malloc(sizeof(*scbus), M_USBDEV, M_WAITOK | M_ZERO);
sc->bus = scbus;
@@ -136,7 +136,7 @@ umass_scsi_detach(struct umass_softc *sc
if (scbus != NULL) {
if (scbus->sc_child != NULL)
rv = config_detach(scbus->sc_child, flags);
- free(scbus, M_DEVBUF, sizeof(*scbus));
+ free(scbus, M_USBDEV, sizeof(*scbus));
sc->bus = NULL;
}
Index: sys/dev/usb/utvfu.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/utvfu.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 utvfu.c
--- sys/dev/usb/utvfu.c 31 Jul 2020 10:49:33 -0000 1.11
+++ sys/dev/usb/utvfu.c 21 Nov 2021 10:51:40 -0000
@@ -1507,7 +1507,7 @@ utvfu_vs_alloc_frame(struct utvfu_softc
struct utvfu_frame_buf *fb = &sc->sc_fb;
fb->size = sc->sc_max_frame_sz;
- fb->buf = malloc(fb->size, M_DEVBUF, M_NOWAIT);
+ fb->buf = malloc(fb->size, M_USBDEV, M_NOWAIT);
if (fb->buf == NULL) {
printf("%s: can't allocate frame buffer!\n", DEVNAME(sc));
return (ENOMEM);
@@ -1529,12 +1529,12 @@ utvfu_vs_free_frame(struct utvfu_softc *
struct utvfu_frame_buf *fb = &sc->sc_fb;
if (fb->buf != NULL) {
- free(fb->buf, M_DEVBUF, fb->size);
+ free(fb->buf, M_USBDEV, fb->size);
fb->buf = NULL;
}
if (sc->sc_mmap_buffer != NULL) {
- free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_bufsz);
+ free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_bufsz);
sc->sc_mmap_buffer = NULL;
memset(sc->sc_mmap, 0, sizeof(sc->sc_mmap));
}
@@ -1659,7 +1659,7 @@ utvfu_reqbufs(void *v, struct v4l2_reque
return (ENOMEM);
sc->sc_mmap_bufsz *= sc->sc_mmap_count;
sc->sc_mmap_bufsz = round_page(sc->sc_mmap_bufsz); /* page align */
- sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_DEVBUF, M_NOWAIT);
+ sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_USBDEV, M_NOWAIT);
if (sc->sc_mmap_buffer == NULL) {
printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc));
return (ENOMEM);
Index: sys/dev/usb/uvideo.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uvideo.c,v
retrieving revision 1.213
diff -u -p -u -p -r1.213 uvideo.c
--- sys/dev/usb/uvideo.c 31 May 2021 21:06:48 -0000 1.213
+++ sys/dev/usb/uvideo.c 21 Nov 2021 10:51:40 -0000
@@ -1773,7 +1773,7 @@ uvideo_vs_alloc_frame(struct uvideo_soft
return (USBD_NOMEM);
}
- fb->buf = malloc(fb->buf_size, M_DEVBUF, M_NOWAIT);
+ fb->buf = malloc(fb->buf_size, M_USBDEV, M_NOWAIT);
if (fb->buf == NULL) {
printf("%s: can't allocate frame buffer!\n", DEVNAME(sc));
return (USBD_NOMEM);
@@ -1797,12 +1797,12 @@ uvideo_vs_free_frame(struct uvideo_softc
struct uvideo_frame_buffer *fb = &sc->sc_frame_buffer;
if (fb->buf != NULL) {
- free(fb->buf, M_DEVBUF, fb->buf_size);
+ free(fb->buf, M_USBDEV, fb->buf_size);
fb->buf = NULL;
}
if (sc->sc_mmap_buffer != NULL) {
- free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_buffer_size);
+ free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_buffer_size);
sc->sc_mmap_buffer = NULL;
sc->sc_mmap_buffer_size = 0;
}
@@ -3309,7 +3309,7 @@ uvideo_reqbufs(void *v, struct v4l2_requ
}
buf_size_total = sc->sc_mmap_count * buf_size;
buf_size_total = round_page(buf_size_total); /* page align buffer */
- sc->sc_mmap_buffer = malloc(buf_size_total, M_DEVBUF, M_NOWAIT);
+ sc->sc_mmap_buffer = malloc(buf_size_total, M_USBDEV, M_NOWAIT);
if (sc->sc_mmap_buffer == NULL) {
printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc));
sc->sc_mmap_count = 0;
Index: sys/dev/usb/xhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/xhci.c,v
retrieving revision 1.122
diff -u -p -u -p -r1.122 xhci.c
--- sys/dev/usb/xhci.c 26 Oct 2021 16:29:49 -0000 1.122
+++ sys/dev/usb/xhci.c 21 Nov 2021 10:51:40 -0000
@@ -317,7 +317,7 @@ xhci_init(struct xhci_softc *sc)
return (error);
if (xhcixfer == NULL) {
- xhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ xhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (xhcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
DEVNAME(sc));