diff options
author | mdf <mdf@FreeBSD.org> | 2010-09-13 18:48:23 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2010-09-13 18:48:23 +0000 |
commit | 3ed6eac561ccce2958e668867ea38fd005bc635b (patch) | |
tree | b0bd953f5f99c28abddea5f8c7bb39d837607940 /sys/vm/vm_phys.c | |
parent | 9a10f7c4328c6763a33844ed9635ef3c2a7f1e84 (diff) | |
download | FreeBSD-src-3ed6eac561ccce2958e668867ea38fd005bc635b.zip FreeBSD-src-3ed6eac561ccce2958e668867ea38fd005bc635b.tar.gz |
Revert r212370, as it causes a LOR on powerpc. powerpc does a few
unexpected things in copyout(9) and so wiring the user buffer is not
sufficient to perform a copyout(9) while holding a random mutex.
Requested by: nwhitehorn
Diffstat (limited to 'sys/vm/vm_phys.c')
-rw-r--r-- | sys/vm/vm_phys.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 26e4981..e75c340 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -123,9 +123,12 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; struct vm_freelist *fl; + char *cbuf; + const int cbufsize = vm_nfreelists*(VM_NFREEORDER + 1)*81; int error, flind, oind, pind; - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); + sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); for (flind = 0; flind < vm_nfreelists; flind++) { sbuf_printf(&sbuf, "\nFREE LIST %d:\n" "\n ORDER (SIZE) | NUMBER" @@ -146,8 +149,10 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "\n"); } } - error = sbuf_finish(&sbuf); + sbuf_finish(&sbuf); + error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); sbuf_delete(&sbuf); + free(cbuf, M_TEMP); return (error); } @@ -159,9 +164,12 @@ sysctl_vm_phys_segs(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; struct vm_phys_seg *seg; + char *cbuf; + const int cbufsize = VM_PHYSSEG_MAX*(VM_NFREEORDER + 1)*81; int error, segind; - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); + sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); for (segind = 0; segind < vm_phys_nsegs; segind++) { sbuf_printf(&sbuf, "\nSEGMENT %d:\n\n", segind); seg = &vm_phys_segs[segind]; @@ -172,8 +180,10 @@ sysctl_vm_phys_segs(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "domain: %d\n", seg->domain); sbuf_printf(&sbuf, "free list: %p\n", seg->free_queues); } - error = sbuf_finish(&sbuf); + sbuf_finish(&sbuf); + error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); sbuf_delete(&sbuf); + free(cbuf, M_TEMP); return (error); } @@ -185,18 +195,23 @@ static int sysctl_vm_phys_lookup_lists(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; + char *cbuf; + const int cbufsize = (vm_nfreelists + 1) * VM_NDOMAIN * 81; int domain, error, flind, ndomains; ndomains = vm_nfreelists - VM_NFREELIST + 1; - sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); + sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); for (domain = 0; domain < ndomains; domain++) { sbuf_printf(&sbuf, "\nDOMAIN %d:\n\n", domain); for (flind = 0; flind < vm_nfreelists; flind++) sbuf_printf(&sbuf, " [%d]:\t%p\n", flind, vm_phys_lookup_lists[domain][flind]); } - error = sbuf_finish(&sbuf); + sbuf_finish(&sbuf); + error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); sbuf_delete(&sbuf); + free(cbuf, M_TEMP); return (error); } #endif |