diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2023-03-25 11:00:35 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2023-03-25 11:00:35 +0000 |
| commit | 3b24ded3e5eb3d219347bd767ea02146d27eb7b5 (patch) | |
| tree | fd23d072cdcc0edeb600cb9bb9580e5b9bbe0bd7 /sys/dev | |
| parent | ab3b267a18f9ac8039aa1d569a6f54f404f23358 (diff) | |
Fix 32bit overflow when calculating balloon size.
Don't make uvm_pglistalloc wait, it will wait forever. Instead rely on
the retries by this driver. This also allows to cancel the request.
Increase inflate speed by factor 10 (same as deflate).
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/viomb.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/viomb.c b/sys/dev/pci/viomb.c index 0eaeb5b9ca1..a6cf1da0dda 100644 --- a/sys/dev/pci/viomb.c +++ b/sys/dev/pci/viomb.c @@ -1,4 +1,4 @@ -/* $NetBSD: viomb.c,v 1.15 2023/03/23 03:55:11 yamaguchi Exp $ */ +/* $NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.15 2023/03/23 03:55:11 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -286,8 +286,8 @@ inflate(struct viomb_softc *sc) nhpages = nvpages * VIRTIO_PAGE_SIZE / PAGE_SIZE; b = &sc->sc_req; - if (uvm_pglistalloc(nhpages*PAGE_SIZE, 0, UINT32_MAX*PAGE_SIZE, - 0, 0, &b->bl_pglist, nhpages, 1)) { + if (uvm_pglistalloc(nhpages*PAGE_SIZE, 0, UINT32_MAX*(paddr_t)PAGE_SIZE, + 0, 0, &b->bl_pglist, nhpages, 0)) { printf("%s: %" PRIu64 " pages of physical memory " "could not be allocated, retrying...\n", device_xname(sc->sc_dev), nhpages); @@ -507,9 +507,9 @@ viomb_thread(void *arg) if (r != 0) sleeptime = 10000; else - sleeptime = 1000; + sleeptime = 100; } else - sleeptime = 100; + sleeptime = 20; } else if (sc->sc_npages < sc->sc_actual + sc->sc_inflight) { if (sc->sc_inflight == 0) r = deflate(sc); |
