Re: svn commit: r290221 - head/sys/powerpc/powerpc
On Fri, 30 Oct 2015, Justin Hibbits wrote: On Oct 30, 2015, at 9:27 PM, Conrad Meyer wrote: Comments inline. On Fri, Oct 30, 2015 at 7:08 PM, Justin Hibbits wrote: Author: jhibbits Date: Sat Oct 31 02:08:39 2015 New Revision: 290221 URL: https://svnweb.freebsd.org/changeset/base/290221 Log: Print unsigned memory sizes, to handle >2GB RAM on 32-bit powerpc. ... = = --- head/sys/powerpc/powerpc/machdep.c Sat Oct 31 02:07:30 2015 (r290220) +++ head/sys/powerpc/powerpc/machdep.c Sat Oct 31 02:08:39 2015 (r290221) @@ -176,12 +176,12 @@ cpu_startup(void *dummy) #ifdef PERFMON perfmon_init(); #endif - printf("real memory = %ld (%ld MB)\n", ptoa(physmem), + printf("real memory = %lu (%lu MB)\n", ptoa(physmem), ptoa(physmem) / 1048576); Shouldn't this be "real memory = %ju (%lu MB)\n" and (uintmax_t)ptoa(physmem), or it may overflow on >4GB RAM systems? No. Any overflow that may occur happens in ptoa() before this cast can effect it. Such overflow is supposed to be prevented by bogusly casting to the undocumented type unsigned long in the undocumented macro ptoa(). %lu is correct since it matches this type. Any mismatch (except the old sign mismatch) would be detected by printf format checking. Casting to uintmax_t would have no effect except to bloat the code from 32 bits to 64 bits in the 32-bit case and simplify matching the printf format with the type. There are about 100 different combinations of bogus types, bogus casts, no casts, and printf formats in various arches. Perhaps the bogus cast in powerpc32 ptoa() doesn't actually work. It only works up to 4GB. i386 used to have that limit and had to be changed for PAE. It now uses no cast in ptoa(). Callers must cast the arg to vm_paddr_t for efficiency or uintmax_t for simplicity. That is best since it forces them to be careful with types. The i386 code corresponding to the above uses uintmax_t for everything for simplicity. The bogus types start with physmem being long. That is more than large enough, at least on 32-bit arches, since its units are pages. But it is inconsistent with vm's page counters mostly having type u_int except where. On 64-bit arches, long is much longer than u_int, so using it tends to mask bugs, but on 32-bit arches it is shorter than u_int, so using it tends to unmask bugs. In the above, its signedness makes little difference since the bogus cast in the macro kills its sign bit. Yes, it should, and it will. However, currently ptoa() casts to unsigned long, and I didn't want to change that yet (I will eventually). In fact, the machine I'm testing on has 8GB, which I've had to artificially limit to <4GB because of the various memory accounting size limits. Similar to i386 with PAE. realmem = physmem; if (bootverbose) - printf("available KVA = %zd (%zd MB)\n", + printf("available KVA = %zu (%zu MB)\n", virtual_end - virtual_avail, (virtual_end - virtual_avail) / 1048576); This has logical type mismatches. The types are vm_offset_t, and it is assumed that this is the same as size_t so that it matches size_t. This defeats the reason for existence of fancy types like vm_offset_t. MD code can more easily just hard-code vm_offset_t and size_t as u_int ot u_long everywhere. This only works for virtual addresses. The types remain useful in MI code and for keeping really different things like physical memory sizes different. %zu is also logically wrong for the size in MB. size_t is only logically correct for sizes in bytes. The expression for the size in MB normally has type size_t too, but this is MD. vm has a vm_size_t type to add to the confusion. It is hard to remember to convert between offsets and sizes when they are physically identical. But IIRC, vm doesn't have a type for its page counts where the differences are physical. @@ -199,7 +199,7 @@ cpu_startup(void *dummy) #ifdef __powerpc64__ printf("0x%016lx - 0x%016lx, %ld bytes (%ld pages)\n", #else - printf("0x%08x - 0x%08x, %d bytes (%ld pages)\n", + printf("0x%08x - 0x%08x, %u bytes (%lu pages)\n", It seems wrong that bytes is only %u here and pages is a %lu. I think bytes should probably be %ju too? What is the type of size1? This is perfectly backwards. Byte counts are large so they need to have type vm_paddr_t or larger. Page counts are small so they can be signed int. But surely the types are correct here since the printf format checker would have detected any mismatch except for signs? Bogus long format specifiers are likely to be needed to match the bogus long type of physmem. All of the code just before here has type errors. It starts with the style bugs of a nested declaration of vm_offset_t size1 and an
Re: svn commit: r289759 - in head/sys/arm: arm include
On Fri, Oct 23, 2015 at 12:38 AM, Jason A. Harmening wrote: > Author: jah > Date: Thu Oct 22 16:38:01 2015 > New Revision: 289759 > URL: https://svnweb.freebsd.org/changeset/base/289759 > > Log: > Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache > maintenance. This makes it safe to sync buffers that have no VA mapping > associated with the busdma map, but may have other mappings, possibly on > different CPUs. This also makes it safe to sync unmapped bounce buffers in > non-sleepable thread contexts. > > Similar to r286787 for x86, this treats userspace buffers the same as > unmapped buffers and no longer borrows the UVA for sync operations. > > Submitted by: Svatopluk Kraus (earlier > revision) > Tested by:Svatopluk Kraus > Differential Revision:https://reviews.freebsd.org/D3869 It seems I can't boot Odroid C1 with this change. http://pastebin.ca/3227678 r289758 works for me. Am I missing something? thanks, Ganbold > > > Modified: > head/sys/arm/arm/busdma_machdep-v6.c > head/sys/arm/include/cpu-v6.h > > Modified: head/sys/arm/arm/busdma_machdep-v6.c > > == > --- head/sys/arm/arm/busdma_machdep-v6.cThu Oct 22 15:42:53 2015 > (r289758) > +++ head/sys/arm/arm/busdma_machdep-v6.cThu Oct 22 16:38:01 2015 > (r289759) > @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); > > #include > #include > -#include > +#include > #include > > #define MAX_BPAGES 64 > @@ -104,14 +104,16 @@ struct bounce_page { > vm_offset_t vaddr; /* kva of bounce buffer */ > bus_addr_t busaddr;/* Physical address */ > vm_offset_t datavaddr; /* kva of client data */ > - bus_addr_t dataaddr; /* client physical address */ > + vm_page_t datapage; /* physical page of client data */ > + vm_offset_t dataoffs; /* page offset of client data */ > bus_size_t datacount; /* client data count */ > STAILQ_ENTRY(bounce_page) links; > }; > > struct sync_list { > vm_offset_t vaddr; /* kva of client data */ > - bus_addr_t busaddr;/* client physical address */ > + vm_page_t pages; /* starting page of client data */ > + vm_offset_t dataoffs; /* page offset of client data */ > bus_size_t datacount; /* client data count */ > }; > > @@ -181,7 +183,6 @@ struct bus_dmamap { > intpagesreserved; > bus_dma_tag_t dmat; > struct memdesc mem; > - pmap_t pmap; > bus_dmamap_callback_t *callback; > void *callback_arg; > int flags; > @@ -206,12 +207,14 @@ static bus_addr_t add_bounce_page(bus_dm > vm_offset_t vaddr, bus_addr_t addr, > bus_size_t size); > static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page > *bpage); > -static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, > -void *buf, bus_size_t buflen, int flags); > +static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, pmap_t pmap, > +bus_dmamap_t map, void *buf, bus_size_t buflen, int flags); > static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, > vm_paddr_t buf, bus_size_t buflen, int flags); > static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, > int flags); > +static void dma_preread_safe(vm_offset_t va, vm_paddr_t pa, vm_size_t > size); > +static void dma_dcache_sync(struct sync_list *sl, bus_dmasync_op_t op); > > static busdma_bufalloc_t coherent_allocator; /* Cache of coherent > buffers */ > static busdma_bufalloc_t standard_allocator; /* Cache of standard > buffers */ > @@ -896,7 +899,8 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma > while (buflen != 0) { > sgsize = MIN(buflen, dmat->maxsegsz); > if (must_bounce(dmat, map, curaddr, sgsize) != 0) { > - sgsize = MIN(sgsize, PAGE_SIZE); > + sgsize = MIN(sgsize, > + PAGE_SIZE - (curaddr & PAGE_MASK)); > map->pagesneeded++; > } > curaddr += sgsize; > @@ -907,7 +911,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma > } > > static void > -_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, > +_bus_dmamap_count_pages(bus_dma_tag_t dmat, pmap_t pmap, bus_dmamap_t map, > void *buf, bus_size_t buflen, int flags) > { > vm_offset_t vaddr; > @@ -927,10 +931,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm > vendaddr = (vm_offset_t)buf + buflen; > > while (vaddr < vendaddr) { > -
svn commit: r290225 - stable/10/usr.sbin/newsyslog
Author: bapt Date: Sat Oct 31 09:32:39 2015 New Revision: 290225 URL: https://svnweb.freebsd.org/changeset/base/290225 Log: MFC: 289879 newsyslog.conf: allow to configure the signal using the signal name. Submitted by: Alexandre Perrin Relnotes: yes Differential Revision:https://reviews.freebsd.org/D3961 Modified: stable/10/usr.sbin/newsyslog/newsyslog.c stable/10/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/newsyslog/newsyslog.c == --- stable/10/usr.sbin/newsyslog/newsyslog.cSat Oct 31 04:53:07 2015 (r290224) +++ stable/10/usr.sbin/newsyslog/newsyslog.cSat Oct 31 09:32:39 2015 (r290225) @@ -280,6 +280,7 @@ static int age_old_log(const char *file) static void savelog(char *from, char *to); static void createdir(const struct conf_entry *ent, char *dirpart); static void createlog(const struct conf_entry *ent); +static int parse_signal(const char *str); /* * All the following take a parameter of 'int', but expect values in the @@ -1338,12 +1339,13 @@ no_trimat: if (q && *q) { if (*q == '/') working->pid_cmd_file = strdup(q); - else if (isdigit(*q)) + else if (isalnum(*q)) goto got_sig; - else + else { errx(1, - "illegal pid file or signal number in config file:\n%s", + "illegal pid file or signal in config file:\n%s", errline); + } } if (eol) q = NULL; @@ -1354,17 +1356,13 @@ no_trimat: working->sig = SIGHUP; if (q && *q) { - if (isdigit(*q)) { - got_sig: - working->sig = atoi(q); - } else { - err_sig: +got_sig: + working->sig = parse_signal(q); + if (working->sig < 1 || working->sig >= sys_nsig) { errx(1, - "illegal signal number in config file:\n%s", + "illegal signal in config file:\n%s", errline); } - if (working->sig < 1 || working->sig >= NSIG) - goto err_sig; } /* @@ -2662,3 +2660,28 @@ change_attrs(const char *fname, const st warn("can't chflags %s NODUMP", fname); } } + +/* + * Parse a signal number or signal name. Returns the signal number parsed or -1 + * on failure. + */ +static int +parse_signal(const char *str) +{ + int sig, i; + const char *errstr; + + sig = strtonum(str, 1, sys_nsig - 1, &errstr); + + if (errstr == NULL) + return (sig); + if (strncasecmp(str, "SIG", 3) == 0) + str += 3; + + for (i = 1; i < sys_nsig; i++) { + if (strcasecmp(str, sys_signame[i]) == 0) + return (i); + } + + return (-1); +} Modified: stable/10/usr.sbin/newsyslog/newsyslog.conf.5 == --- stable/10/usr.sbin/newsyslog/newsyslog.conf.5 Sat Oct 31 04:53:07 2015(r290224) +++ stable/10/usr.sbin/newsyslog/newsyslog.conf.5 Sat Oct 31 09:32:39 2015(r290225) @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd March 21, 2012 +.Dd October 24, 2015 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -337,7 +337,7 @@ process ID or to find a group process ID .Cm U flag was specified. If this field is present, a -.Ar signal_number +.Ar signal is sent to the process ID contained in this file. If this field is not present and the .Cm N @@ -358,14 +358,23 @@ flag, the file is treated as a path to a by the .Xr newsyslog 8 after rotation instead of sending the signal out. -.It Ar signal_number -This optional field specifies the signal number that will be sent -to the daemon process (or to all processes in a process group, if the +.It Ar signal +This optional field specifies the signal that will be sent to the daemon +process (or to all processes in a process group, if the .Cm U flag was specified). If this field is not present, then a .Dv SIGHUP signal will be sent. +Signal names +must start with +.Dq SIG +and be the signal name, e.g., +.Dv SIGUSR1 . +Alternatively, +.Ar signal +can be the signal number, e.g., 30 for +.Dv SIGUSR1 . .El .Sh EXAMPLES The following is an example of the _
svn commit: r290226 - head/usr.sbin/newsyslog
Author: bapt Date: Sat Oct 31 09:45:11 2015 New Revision: 290226 URL: https://svnweb.freebsd.org/changeset/base/290226 Log: newsyslog: treat 'c' flag in the config as 'C' When -C was introduced in r114137 the plan was to have -C and -c being used for "create" due to a typo in FreeBSD <= 4.8 a temporary compatibility hack has been added to make -c being like -G aka GLOB and a warning was issued for the user to be aware of the futur change for -c. 12 years later it is more than time to remove that hack and finish the what was intent in r114137 Submitted by: Alexandre Perrin Relnotes: yes Differential Revision:https://reviews.freebsd.org/D4000 Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Sat Oct 31 09:32:39 2015 (r290225) +++ head/usr.sbin/newsyslog/newsyslog.c Sat Oct 31 09:45:11 2015 (r290226) @@ -1271,20 +1271,6 @@ no_trimat: working->flags |= CE_BINARY; break; case 'c': - /* -* XXX -Ick! Ugly! Remove ASAP! -* We want `c' and `C' for "create". But we -* will temporarily treat `c' as `g', because -* FreeBSD releases <= 4.8 have a typo of -* checking ('G' || 'c') for CE_GLOB. -*/ - if (*q == 'c') { - warnx("Assuming 'g' for 'c' in flags for line:\n%s", - errline); - warnx("The 'c' flag will eventually mean 'CREATE'"); - working->flags |= CE_GLOB; - break; - } working->flags |= CE_CREATE; break; case 'd': ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r289759 - in head/sys/arm: arm include
On 10/31/15 03:21, Ganbold Tsagaankhuu wrote: > On Fri, Oct 23, 2015 at 12:38 AM, Jason A. Harmening > wrote: > >> Author: jah >> Date: Thu Oct 22 16:38:01 2015 >> New Revision: 289759 >> URL: https://svnweb.freebsd.org/changeset/base/289759 >> >> Log: >> Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache >> maintenance. This makes it safe to sync buffers that have no VA mapping >> associated with the busdma map, but may have other mappings, possibly on >> different CPUs. This also makes it safe to sync unmapped bounce buffers in >> non-sleepable thread contexts. >> >> Similar to r286787 for x86, this treats userspace buffers the same as >> unmapped buffers and no longer borrows the UVA for sync operations. >> >> Submitted by: Svatopluk Kraus (earlier >> revision) >> Tested by:Svatopluk Kraus >> Differential Revision:https://reviews.freebsd.org/D3869 > > > > It seems I can't boot Odroid C1 with this change. > > http://pastebin.ca/3227678 > > r289758 works for me. > > Am I missing something? > > thanks, > > Ganbold > > Hmmm, the fault address of 0x20 and the fact that this is happening during mi_startup() make me wonder if the per-cpu pageframes used by pmap_quick* haven't been initialized yet. I wonder if changing the order of qpages_init in sys/arm/arm/pmap-v6[-new].c to something other than SI_ORDER_ANY would help? It seems like we'd want SI_ORDER_FOURTH or SI_ORDER_MIDDLE, since mp_start() is SI_ORDER_THIRD. It would be nice to know what's calling bus_dmamap_sync() in this case. I can't figure that out, but maybe that's because I haven't had coffee yet. Unfortunately I'm going to have limited time to help debug this over the next week, as I'm moving across the country starting (hopefully) today. --Jason signature.asc Description: OpenPGP digital signature
svn commit: r290227 - head/lib/msun/tests
Author: andrew Date: Sat Oct 31 10:16:44 2015 New Revision: 290227 URL: https://svnweb.freebsd.org/changeset/base/290227 Log: We have long double on arm64, and the tests pass so enable them. Sponsored by: ABT Systems Ltd Modified: head/lib/msun/tests/Makefile Modified: head/lib/msun/tests/Makefile == --- head/lib/msun/tests/MakefileSat Oct 31 09:45:11 2015 (r290226) +++ head/lib/msun/tests/MakefileSat Oct 31 10:16:44 2015 (r290227) @@ -7,7 +7,9 @@ CFLAGS+=-DHAVE_FENV_H # Not sure why this isn't defined for all architectures, since most # have long double. -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +.if ${MACHINE_CPUARCH} == "aarch64" || \ +${MACHINE_CPUARCH} == "amd64" || \ +${MACHINE_CPUARCH} == "i386" CFLAGS+= -D__HAVE_LONG_DOUBLE .endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290228 - head/sys/dev/drm2/i915
Author: dumbbell Date: Sat Oct 31 15:09:31 2015 New Revision: 290228 URL: https://svnweb.freebsd.org/changeset/base/290228 Log: drm/i915: Reduce diff with Linux 3.8 There is no functional change. The goal is to ease the future update to Linux 3.8's i915 driver. MFC after:2 months Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c head/sys/dev/drm2/i915/intel_pm.c head/sys/dev/drm2/i915/intel_ringbuffer.h Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c == --- head/sys/dev/drm2/i915/i915_gem_execbuffer.cSat Oct 31 10:16:44 2015(r290227) +++ head/sys/dev/drm2/i915/i915_gem_execbuffer.cSat Oct 31 15:09:31 2015(r290228) @@ -221,9 +221,10 @@ eb_create(int size) { struct eb_objects *eb; - eb = malloc(sizeof(*eb), DRM_I915_GEM, M_WAITOK | M_ZERO); + eb = malloc(sizeof(*eb), +DRM_I915_GEM, M_WAITOK | M_ZERO); eb->buckets = hashinit(size, DRM_I915_GEM, &eb->hashmask); - return (eb); + return eb; } static void @@ -250,9 +251,10 @@ eb_get_object(struct eb_objects *eb, uns LIST_FOREACH(obj, &eb->buckets[handle & eb->hashmask], exec_node) { if (obj->exec_handle == handle) - return (obj); + return obj; } - return (NULL); + + return NULL; } static void @@ -374,7 +376,7 @@ i915_gem_execbuffer_relocate_entry(struc /* We can't wait for rendering with pagefaults disabled */ if (obj->active && (curthread->td_pflags & TDP_NOFAULTING) != 0) - return (-EFAULT); + return -EFAULT; reloc->delta += target_offset; if (use_cpu_reloc(obj)) { @@ -389,7 +391,7 @@ i915_gem_execbuffer_relocate_entry(struc sf = sf_buf_alloc(obj->pages[OFF_TO_IDX(reloc->offset)], SFB_NOWAIT); if (sf == NULL) - return (-ENOMEM); + return -ENOMEM; vaddr = (void *)sf_buf_kva(sf); *(uint32_t *)(vaddr + page_offset) = reloc->delta; sf_buf_free(sf); @@ -509,14 +511,13 @@ i915_gem_execbuffer_relocate(struct drm_ i915_gem_retire_requests(dev); ret = 0; - pflags = vm_fault_disable_pagefaults(); /* This is the fast path and we cannot handle a pagefault whilst * holding the device lock lest the user pass in the relocations * contained within a mmaped bo. For in such a case we, the page * fault handler would call i915_gem_fault() and we would try to * acquire the device lock again. Obviously this is bad. */ - + pflags = vm_fault_disable_pagefaults(); list_for_each_entry(obj, objects, exec_list) { ret = i915_gem_execbuffer_relocate_object(obj, eb); if (ret) @@ -585,7 +586,8 @@ i915_gem_execbuffer_reserve(struct intel struct drm_i915_gem_object *obj; struct list_head ordered_objects; bool has_fenced_gpu_access = INTEL_INFO(ring->dev)->gen < 4; - int ret, retry; + int retry; + int ret; dev_priv = ring->dev->dev_private; INIT_LIST_HEAD(&ordered_objects); @@ -957,11 +959,12 @@ validate_exec_list(struct drm_i915_gem_e return -EINVAL; length = exec[i].relocation_count * - sizeof(struct drm_i915_gem_relocation_entry); + sizeof(struct drm_i915_gem_relocation_entry); if (length == 0) { (*map)[i] = NULL; continue; } + /* * Since both start and end of the relocation region * may be not aligned on the page boundary, be @@ -977,7 +980,7 @@ validate_exec_list(struct drm_i915_gem_e if ((*maplen)[i] == -1) { free(ma, DRM_I915_GEM); (*map)[i] = NULL; - return (-EFAULT); + return -EFAULT; } } @@ -1058,7 +1061,7 @@ i915_gem_fix_mi_batchbuffer_end(struct d char *mkva; uint64_t po_r, po_w; uint32_t cmd; - + po_r = batch_obj->base.dev->agp->base + batch_obj->gtt_offset + batch_start_offset + batch_len; if (batch_len > 0) @@ -1088,7 +1091,7 @@ DRM_DEBUG("batchbuffer does not end by M int i915_fix_mi_batchbuffer_end = 0; - static int +static int i915_reset_gen7_sol_offsets(struct drm_device *dev, struct intel_ring_buffer *ring) { @@ -1125,13 +1128,13 @@ i915_gem_do_execbuffer(struct drm_device struct drm_i915_gem_object *batch_obj; struct drm_clip_rect *cliprects = NULL; struct intel_ring_buffer *ring; - vm_page_t **relocs_ma; - int *relocs_l
svn commit: r290229 - in head: share/man/man4 sys/dev/ioat
Author: cem Date: Sat Oct 31 20:38:06 2015 New Revision: 290229 URL: https://svnweb.freebsd.org/changeset/base/290229 Log: ioat: Handle channel-fatal HW errors safely Certain invalid operations trigger hardware error conditions. Error conditions that only halt one channel can be detected and recovered by resetting the channel. Error conditions that halt the whole device are generally not recoverable. Add a sysctl to inject channel-fatal HW errors, 'dev.ioat..force_hw_error=1'. When a halt due to a channel error is detected, ioat(4) blocks new operations from being queued on the channel, completes any outstanding operations with an error status, and resets the channel before allowing new operations to be queued again. Update ioat.4 to document error recovery; document blockfill introduced in r290021 while we are here; document ioat_put_dmaengine() added in r289907; document DMA_NO_WAIT added in r289982. Sponsored by: EMC / Isilon Storage Division Modified: head/share/man/man4/ioat.4 head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h head/sys/dev/ioat/ioat_hw.h head/sys/dev/ioat/ioat_internal.h head/sys/dev/ioat/ioat_test.c Modified: head/share/man/man4/ioat.4 == --- head/share/man/man4/ioat.4 Sat Oct 31 15:09:31 2015(r290228) +++ head/share/man/man4/ioat.4 Sat Oct 31 20:38:06 2015(r290229) @@ -24,14 +24,25 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2015 +.Dd October 31, 2015 .Dt IOAT 4 .Os .Sh NAME .Nm I/OAT .Nd Intel I/O Acceleration Technology .Sh SYNOPSIS +To compile this driver into your kernel, +place the following line in your kernel configuration file: +.Bd -ragged -offset indent .Cd "device ioat" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ioat_load="YES" +.Ed +.Pp In .Xr loader.conf 5 : .Pp @@ -46,11 +57,13 @@ In (only critical errors; maximum of 3) .Pp .Ft typedef void -.Fn (*bus_dmaengine_callback_t) "void *arg" +.Fn (*bus_dmaengine_callback_t) "void *arg" "int error" .Pp .Ft bus_dmaengine_t .Fn ioat_get_dmaengine "uint32_t channel_index" .Ft void +.Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine" +.Ft void .Fn ioat_acquire "bus_dmaengine_t dmaengine" .Ft void .Fn ioat_release "bus_dmaengine_t dmaengine" @@ -65,6 +78,16 @@ In .Fa "uint32_t flags" .Fc .Ft struct bus_dmadesc * +.Fo ioat_blockfill +.Fa "bus_dmaengine_t dmaengine" +.Fa "bus_addr_t dst" +.Fa "uint64_t fillpattern" +.Fa "bus_size_t len" +.Fa "bus_dmaengine_callback_t callback_fn" +.Fa "void *callback_arg" +.Fa "uint32_t flags" +.Fc +.Ft struct bus_dmadesc * .Fo ioat_null .Fa "bus_dmaengine_t dmaengine" .Fa "bus_dmaengine_callback_t callback_fn" @@ -82,7 +105,9 @@ There is a number of DMA channels per CP Each may be used independently. Operations on a single channel proceed sequentially. .Pp -Copy operations may be used to offload memory copies to the DMA engines. +Blockfill operations can be used to write a 64-bit pattern to memory. +.Pp +Copy operations can be used to offload memory copies to the DMA engines. .Pp Null operations do nothing, but may be used to test the interrupt and callback mechanism. @@ -92,6 +117,26 @@ All operations can optionally trigger an flag. For example, a user might submit multiple operations to the same channel and only enable an interrupt and callback for the last operation. +.Pp +All operations are safe to use in a non-blocking context with the +.Ar DMA_NO_WAIT +flag. +(Of course, allocations may fail and operations requested with +.Ar DMA_NO_WAIT +may return NULL.) +.Pp +All operations, as well as +.Fn ioat_get_dmaengine , +can return NULL in special circumstances. +For example, if the +.Nm +driver is being unloaded, or the administrator has induced a hardware reset, or +a usage error has resulted in a hardware error state that needs to be recovered +from. +.Pp +It is invalid to attempt to submit new DMA operations in a +.Fa bus_dmaengine_callback_t +context. .Sh USAGE A typical user will lookup the DMA engine object for a given channel with .Fn ioat_get_dmaengine . @@ -101,10 +146,11 @@ the .Ar bus_dmaengine_t object for exclusive access to enqueue operations on that channel. Then, they will submit one or more operations using -.Fn ioat_copy +.Fn ioat_blockfill , +.Fn ioat_copy , or .Fn ioat_null . -Finally, they will +After queueing one or more individual DMA operations, they will .Fn ioat_release the .Ar bus_dmaengine_t @@ -114,6 +160,19 @@ The routine they provided for the argument will be invoked with the provided .Fa callback_arg when the operation is complete. +When they are finished with the +.Ar bus_dmaengine_t , +the user should +.Fn ioat_put_dmaengine . +.Pp +Users MUST NOT block between +.Fn ioat_acquire +and +.Fn ioat_release . +Users SHOULD NOT hold +.Ar bus_dmaengine_t +references for a very long
svn commit: r290230 - head/lib/libc/stdio
Author: ache Date: Sun Nov 1 06:15:14 2015 New Revision: 290230 URL: https://svnweb.freebsd.org/changeset/base/290230 Log: Don't seek to the end if write buffer is empty (in append modes). PR: 204156 MFC after: 1 week Modified: head/lib/libc/stdio/ftell.c Modified: head/lib/libc/stdio/ftell.c == --- head/lib/libc/stdio/ftell.c Sat Oct 31 20:38:06 2015(r290229) +++ head/lib/libc/stdio/ftell.c Sun Nov 1 06:15:14 2015(r290230) @@ -119,7 +119,18 @@ _ftello(FILE *fp, fpos_t *offset) if (HASUB(fp)) pos -= fp->_r; /* Can be negative at this point. */ } else if ((fp->_flags & __SWR) && fp->_p != NULL) { - if ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP)) { + /* +* Writing. Any buffered characters cause the +* position to be greater than that in the +* underlying object. +*/ + n = fp->_p - fp->_bf._base; + if (pos > OFF_MAX - n) { + errno = EOVERFLOW; + return (1); + } + if (n > 0 && + ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP))) { int serrno = errno; errno = 0; @@ -137,16 +148,6 @@ _ftello(FILE *fp, fpos_t *offset) } errno = serrno; } - /* -* Writing. Any buffered characters cause the -* position to be greater than that in the -* underlying object. -*/ - n = fp->_p - fp->_bf._base; - if (pos > OFF_MAX - n) { - errno = EOVERFLOW; - return (1); - } pos += n; } *offset = pos; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290231 - head/lib/libc/stdio
Author: ache Date: Sun Nov 1 06:47:05 2015 New Revision: 290231 URL: https://svnweb.freebsd.org/changeset/base/290231 Log: Addition to prev. commit. In some edge cases fp->_p can be changed in _sseek(), recalculate. PR: 204156 MFC after: 1 week Modified: head/lib/libc/stdio/ftell.c Modified: head/lib/libc/stdio/ftell.c == --- head/lib/libc/stdio/ftell.c Sun Nov 1 06:15:14 2015(r290230) +++ head/lib/libc/stdio/ftell.c Sun Nov 1 06:47:05 2015(r290231) @@ -125,10 +125,6 @@ _ftello(FILE *fp, fpos_t *offset) * underlying object. */ n = fp->_p - fp->_bf._base; - if (pos > OFF_MAX - n) { - errno = EOVERFLOW; - return (1); - } if (n > 0 && ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP))) { int serrno = errno; @@ -147,6 +143,12 @@ _ftello(FILE *fp, fpos_t *offset) } } errno = serrno; + /* fp->_p can be changed in _sseek(), recalculate. */ + n = fp->_p - fp->_bf._base; + } + if (pos > OFF_MAX - n) { + errno = EOVERFLOW; + return (1); } pos += n; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"