svn commit: r366355 - head/sys/riscv/riscv
Author: kp Date: Fri Oct 2 07:30:11 2020 New Revision: 366355 URL: https://svnweb.freebsd.org/changeset/base/366355 Log: riscv: handle access faults in user mode Access faults in user mode are treated like TLB misses, which leads to an endless loop of faults. It's less serious than the same fault in kernel mode, because we can just terminate the process, but that's not ideal. Treat user mode access faults as a bus error. Suggested by: jrtc27 Reviewed by: br, jhb Sponsored by: Axiado Differential Revision:https://reviews.freebsd.org/D26621 Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c == --- head/sys/riscv/riscv/trap.c Fri Oct 2 05:59:55 2020(r366354) +++ head/sys/riscv/riscv/trap.c Fri Oct 2 07:30:11 2020(r366355) @@ -343,6 +343,10 @@ do_trap_user(struct trapframe *frame) case EXCP_FAULT_LOAD: case EXCP_FAULT_STORE: case EXCP_FAULT_FETCH: + call_trapsignal(td, SIGBUS, BUS_ADRERR, (void *)frame->tf_sepc, + exception); + userret(td, frame); + break; case EXCP_STORE_PAGE_FAULT: case EXCP_LOAD_PAGE_FAULT: case EXCP_INST_PAGE_FAULT: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366362 - head/lib/libmd
Author: emaste Date: Fri Oct 2 14:00:52 2020 New Revision: 366362 URL: https://svnweb.freebsd.org/changeset/base/366362 Log: libmd: add dependency workaround for r366344 r366344 fixed and reenabled the assembly optimized skein implementation, but skein_block objects were not being rebuilt in no-clean builds. This resulted in failing no-clean builds. SKEIN_USE_ASM controls which routines come from C vs assembly, and with no explicit dependency r366344's change to SKEIN_USE_ASM did not cause skein_block.{o,pico} to be rebuilt. Add a dependency on this Makefile for the skein_block objects. This dependency is broader in scope than absolutely required (that is, the skein_block objects will now be rebuilt on any change to this Makefile). There are ways this could be addressed, but it is probably not worth the additional effort or testing time to pursue them. PR: 248221 Reported by: kevans, Jeremy Faulkner Discussed with: kevans Sponsored by: The FreeBSD Foundation Modified: head/lib/libmd/Makefile Modified: head/lib/libmd/Makefile == --- head/lib/libmd/Makefile Fri Oct 2 13:36:29 2020(r366361) +++ head/lib/libmd/Makefile Fri Oct 2 14:00:52 2020(r366362) @@ -121,6 +121,10 @@ CFLAGS+= -DRMD160_ASM ACFLAGS+= -DSKEIN_LOOP=0 SRCS+= skein_block_asm.S CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792 +# 20201002 Add explict Makefile dependency for r366344 (reenabled assembly +# optimized version). SKEIN_USE_ASM determines which routines should come from +# the assembly vs C versions, and skein_block needs to be rebuilt if it changes. +skein_block.o skein_block.pico: Makefile .endif .if exists(${MACHINE_ARCH}/sha.S) || exists(${MACHINE_ARCH}/rmd160.S) || exists(${MACHINE_ARCH}/skein_block_asm.S) ACFLAGS+= -DELF -Wa,--noexecstack ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r366344 - in head: lib/libmd sys/crypto/skein/amd64
On Thu, 1 Oct 2020 at 21:18, Kyle Evans wrote: > > We need some kind of magic to walk across this for -DNO_CLEAN builds > -- skein_block.c has no reason to get rebuilt, but we need it to > because we're now defining SKEIN_USE_ASM=1792, which will strip out > some symbols. kevans and I discussed on IRC yesterday; a workaround is now committed in r366362 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366363 - head/sys/kern
Author: mjg Date: Fri Oct 2 14:50:03 2020 New Revision: 366363 URL: https://svnweb.freebsd.org/changeset/base/366363 Log: cache: update the commentary for path parsing Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c == --- head/sys/kern/vfs_cache.c Fri Oct 2 14:00:52 2020(r366362) +++ head/sys/kern/vfs_cache.c Fri Oct 2 14:50:03 2020(r366363) @@ -3948,10 +3948,10 @@ cache_fplookup_need_climb_mount(struct cache_fpl *fpl) /* * Parse the path. * - * The code is mostly copy-pasted from regular lookup, see lookup(). - * The structure is maintained along with comments for easier maintenance. - * Deduplicating the code will become feasible after fast path lookup - * becomes more feature-complete. + * The code was originally copy-pasted from regular lookup and despite + * clean ups leaves performance on the table. Any modifications here + * must take into account that in case off fallback the resulting + * nameidata state has to be compatible with the original. */ static int cache_fplookup_parse(struct cache_fpl *fpl) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366364 - head/stand/man
Author: 0mp (doc,ports committer) Date: Fri Oct 2 15:37:51 2020 New Revision: 366364 URL: https://svnweb.freebsd.org/changeset/base/366364 Log: Correct the documented size of kern.msgbufsize The correct value is 96KB after r226090. PR: 249971 Submitted by: johan...@jo-t.de MFC after:3 days Modified: head/stand/man/loader.8 Modified: head/stand/man/loader.8 == --- head/stand/man/loader.8 Fri Oct 2 14:50:03 2020(r366363) +++ head/stand/man/loader.8 Fri Oct 2 15:37:51 2020(r366364) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 11, 2020 +.Dd October 2, 2020 .Dt LOADER 8 .Os .Sh NAME @@ -652,7 +652,7 @@ Modifies .Dv VM_BCACHE_SIZE_MAX . .It Va kern.msgbufsize Sets the size of the kernel message buffer. -The default limit of 64KB is usually sufficient unless +The default limit of 96KB is usually sufficient unless large amounts of trace data need to be collected between opportunities to examine the buffer or dump it to a file. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366365 - head/tests/sys/fs/fusefs
Author: asomers Date: Fri Oct 2 17:06:05 2020 New Revision: 366365 URL: https://svnweb.freebsd.org/changeset/base/366365 Log: fusefs tests: quell Coverity "Argument cannot be negative" warnings Must abort tests early if open(2) fails. Reported by: Coverity Coverity CID: 1432810 and many others Reviewed by: kevans MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D26635 Modified: head/tests/sys/fs/fusefs/allow_other.cc head/tests/sys/fs/fusefs/create.cc head/tests/sys/fs/fusefs/default_permissions.cc head/tests/sys/fs/fusefs/flush.cc head/tests/sys/fs/fusefs/open.cc head/tests/sys/fs/fusefs/opendir.cc head/tests/sys/fs/fusefs/release.cc head/tests/sys/fs/fusefs/releasedir.cc head/tests/sys/fs/fusefs/write.cc Modified: head/tests/sys/fs/fusefs/allow_other.cc == --- head/tests/sys/fs/fusefs/allow_other.cc Fri Oct 2 15:37:51 2020 (r366364) +++ head/tests/sys/fs/fusefs/allow_other.cc Fri Oct 2 17:06:05 2020 (r366365) @@ -168,7 +168,7 @@ TEST_F(AllowOther, privilege_escalation) .WillRepeatedly(Invoke(ReturnErrno(EPERM))); fd1 = open(FULLPATH, O_RDONLY); - EXPECT_LE(0, fd1) << strerror(errno); + ASSERT_LE(0, fd1) << strerror(errno); }, [] { int fd0; Modified: head/tests/sys/fs/fusefs/create.cc == --- head/tests/sys/fs/fusefs/create.cc Fri Oct 2 15:37:51 2020 (r366364) +++ head/tests/sys/fs/fusefs/create.cc Fri Oct 2 17:06:05 2020 (r366365) @@ -143,7 +143,7 @@ TEST_F(Create, attr_cache) ).Times(0); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -184,7 +184,7 @@ TEST_F(Create, clear_attr_cache) EXPECT_EQ(0, stat("mountpoint", &sb)) << strerror(errno); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); EXPECT_EQ(0, stat("mountpoint", &sb)) << strerror(errno); leak(fd); @@ -254,7 +254,7 @@ TEST_F(Create, Enosys) }))); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -366,7 +366,7 @@ TEST_F(Create, ok) })); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -398,7 +398,7 @@ TEST_F(Create, wronly_0444) })); fd = open(FULLPATH, O_CREAT | O_WRONLY, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -422,7 +422,7 @@ TEST_F(Create_7_8, ok) })); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -446,6 +446,6 @@ TEST_F(Create_7_11, ok) })); fd = open(FULLPATH, O_CREAT | O_EXCL, mode); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } Modified: head/tests/sys/fs/fusefs/default_permissions.cc == --- head/tests/sys/fs/fusefs/default_permissions.cc Fri Oct 2 15:37:51 2020(r366364) +++ head/tests/sys/fs/fusefs/default_permissions.cc Fri Oct 2 17:06:05 2020(r366365) @@ -490,7 +490,7 @@ TEST_F(Create, ok) expect_create(RELPATH, ino); fd = open(FULLPATH, O_CREAT | O_EXCL, 0644); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } @@ -765,7 +765,7 @@ TEST_F(Open, ok) expect_open(ino, 0, 1); fd = open(FULLPATH, O_RDONLY); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); leak(fd); } Modified: head/tests/sys/fs/fusefs/flush.cc == --- head/tests/sys/fs/fusefs/flush.cc Fri Oct 2 15:37:51 2020 (r366364) +++ head/tests/sys/fs/fusefs/flush.cc Fri Oct 2 17:06:05 2020 (r366365) @@ -102,10 +102,10 @@ TEST_F(Flush, open_twice) expect_release(); fd = open(FULLPATH, O_WRONLY); - EXPECT_LE(0, fd) << strerror(errno); + ASSERT_LE(0, fd) << strerror(errno); fd2 = open(FULLPATH, O_WRONLY); - EXPECT_LE(0, fd2) << strerror(errno); + ASSERT_LE(0, fd2) << strerror(errno); EXPECT_EQ(0, close(fd2)) << strerror(errno); EXPECT_EQ(0, close(fd)) << strerror(errno); @@ -132,7 +132,7 @@ TEST_F(Flush, ei
svn commit: r366366 - head/sys/dev/flash
Author: nick Date: Fri Oct 2 17:33:56 2020 New Revision: 366366 URL: https://svnweb.freebsd.org/changeset/base/366366 Log: flash: Add support for SPI flash s25fl512s Reviewed by: kp Approved by: kp (mentor) Sponsored by: Axiado Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c == --- head/sys/dev/flash/mx25l.c Fri Oct 2 17:06:05 2020(r366365) +++ head/sys/dev/flash/mx25l.c Fri Oct 2 17:33:56 2020(r366366) @@ -133,6 +133,7 @@ static struct mx25l_flash_ident flash_devices[] = { { "s25fl064", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, { "s25fl256s", 0x01, 0x0219, 64 * 1024, 512, FL_NONE }, + { "s25fl512s", 0x01, 0x0220, 64 * 1024, 1024, FL_NONE }, { "SST25VF010A", 0xbf, 0x2549, 4 * 1024, 32, FL_ERASE_4K | FL_ERASE_32K }, { "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | FL_ERASE_32K }, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366367 - head/sys/kern
Author: markj Date: Fri Oct 2 17:49:13 2020 New Revision: 366367 URL: https://svnweb.freebsd.org/changeset/base/366367 Log: Simplify the check for non-dumpable VM object types OBJT_DEFAULT, _SWAP, _VNODE and _PHYS is exactly the set of non-fictitious object types, so just check for OBJ_FICTITIOUS. The check no longer excludes dead objects, but such objects have to be handled regardless. No functional change intended. Reviewed by: alc, dougm, kib Tested by:pho MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26589 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Fri Oct 2 17:33:56 2020(r366366) +++ head/sys/kern/imgact_elf.c Fri Oct 2 17:49:13 2020(r366367) @@ -1760,7 +1760,7 @@ each_dumpable_segment(struct thread *td, segment_callb vm_map_t map = &p->p_vmspace->vm_map; vm_map_entry_t entry; vm_object_t backing_object, object; - boolean_t ignore_entry; + bool ignore_entry; vm_map_lock_read(map); VM_MAP_ENTRY_FOREACH(entry, map) { @@ -1799,9 +1799,7 @@ each_dumpable_segment(struct thread *td, segment_callb VM_OBJECT_RUNLOCK(object); object = backing_object; } - ignore_entry = object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP && object->type != OBJT_VNODE && - object->type != OBJT_PHYS; + ignore_entry = (object->flags & OBJ_FICTITIOUS) != 0; VM_OBJECT_RUNLOCK(object); if (ignore_entry) continue; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366368 - in head/sys: kern vm
Author: markj Date: Fri Oct 2 17:50:22 2020 New Revision: 366368 URL: https://svnweb.freebsd.org/changeset/base/366368 Log: Implement sparse core dumps Currently we allocate and map zero-filled anonymous pages when dumping core. This can result in lots of needless disk I/O and page allocations. This change tries to make the core dumper more clever and represent unbacked ranges of virtual memory by holes in the core dump file. Add a new page fault type, VM_FAULT_NOFILL, which causes vm_fault() to clean up and return an error when it would otherwise map a zero-filled page. Then, in the core dumper code, prefault all user pages and handle errors by simply extending the size of the core file. This also fixes a bug related to the fact that vn_io_fault1() does not attempt partial I/O in the face of errors from vm_fault_quick_hold_pages(): if a truncated file is mapped into a user process, an attempt to dump beyond the end of the file results in an error, but this means that valid pages immediately preceding the end of the file might not have been dumped either. The change reduces the core dump size of trivial programs by a factor of ten simply by excluding unaccessed libc.so pages. PR: 249067 Reviewed by: kib Tested by:pho MFC after:1 month Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26590 Modified: head/sys/kern/imgact_elf.c head/sys/vm/vm_fault.c head/sys/vm/vm_map.h Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Fri Oct 2 17:49:13 2020(r366367) +++ head/sys/kern/imgact_elf.c Fri Oct 2 17:50:22 2020(r366368) @@ -1459,7 +1459,7 @@ extern int compress_user_cores_level; static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); static int core_write(struct coredump_params *, const void *, size_t, off_t, -enum uio_seg); +enum uio_seg, size_t *); static void each_dumpable_segment(struct thread *, segment_callback, void *); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, struct note_info_list *, size_t); @@ -1519,46 +1519,88 @@ core_compressed_write(void *base, size_t len, off_t of { return (core_write((struct coredump_params *)arg, base, len, offset, - UIO_SYSSPACE)); + UIO_SYSSPACE, NULL)); } static int core_write(struct coredump_params *p, const void *base, size_t len, -off_t offset, enum uio_seg seg) +off_t offset, enum uio_seg seg, size_t *resid) { return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, - p->active_cred, p->file_cred, NULL, p->td)); + p->active_cred, p->file_cred, resid, p->td)); } static int -core_output(void *base, size_t len, off_t offset, struct coredump_params *p, +core_output(char *base, size_t len, off_t offset, struct coredump_params *p, void *tmpbuf) { + vm_map_t map; + struct mount *mp; + size_t resid, runlen; int error; + bool success; + KASSERT((uintptr_t)base % PAGE_SIZE == 0, + ("%s: user address %#lx is not page-aligned", + __func__, (uintptr_t)base)); + if (p->comp != NULL) return (compress_chunk(p, base, tmpbuf, len)); - /* -* EFAULT is a non-fatal error that we can get, for example, -* if the segment is backed by a file but extends beyond its -* end. -*/ - error = core_write(p, base, len, offset, UIO_USERSPACE); - if (error == EFAULT) { - log(LOG_WARNING, "Failed to fully fault in a core file segment " - "at VA %p with size 0x%zx to be written at offset 0x%jx " - "for process %s\n", base, len, offset, curproc->p_comm); - + map = &p->td->td_proc->p_vmspace->vm_map; + for (; len > 0; base += runlen, offset += runlen, len -= runlen) { /* -* Write a "real" zero byte at the end of the target region -* in the case this is the last segment. -* The intermediate space will be implicitly zero-filled. +* Attempt to page in all virtual pages in the range. If a +* virtual page is not backed by the pager, it is represented as +* a hole in the file. This can occur with zero-filled +* anonymous memory or truncated files, for example. */ - error = core_write(p, zero_region, 1, offset + len - 1, - UIO_SYSSPACE); + for (runlen = 0; runlen < len; runlen += PAGE_SIZE) { + error = vm_fault(map, (uintptr_t)base + runlen, + VM_PROT_READ, VM_FAULT_NOFILL, NULL); +
svn commit: r366369 - in head: share/man/man9 sys/conf sys/dev/backlight sys/modules sys/modules/backlight sys/sys
Author: manu Date: Fri Oct 2 18:18:01 2020 New Revision: 366369 URL: https://svnweb.freebsd.org/changeset/base/366369 Log: Add backlight subsystem This is a simple subsystem that allow drivers to register as a backlight. Each backlight creates a device node under /dev/backlight/backlightX and an alias based on the name provided. Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26250 Added: head/share/man/man9/backlight.9 (contents, props changed) head/sys/dev/backlight/ head/sys/dev/backlight/backlight.c (contents, props changed) head/sys/dev/backlight/backlight.h (contents, props changed) head/sys/dev/backlight/backlight_if.m (contents, props changed) head/sys/modules/backlight/ head/sys/modules/backlight/Makefile (contents, props changed) head/sys/sys/backlight.h (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/conf/files head/sys/modules/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileFri Oct 2 17:50:22 2020 (r366368) +++ head/share/man/man9/MakefileFri Oct 2 18:18:01 2020 (r366369) @@ -10,6 +10,7 @@ MAN= accept_filter.9 \ alq.9 \ altq.9 \ atomic.9 \ + backlight.9 \ bhnd.9 \ bhnd_erom.9 \ bios.9 \ Added: head/share/man/man9/backlight.9 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/backlight.9 Fri Oct 2 18:18:01 2020 (r366369) @@ -0,0 +1,77 @@ +.\" Copyright (c) 2020 Emmanuel Vadot +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 02, 2020 +.Dt BACKLIGHT 9 +.Os +.Sh NAME +.Nm backlight , +.Nm backlight_register , +.Nm backlight_destroy , +.Nm BACKLIGHT_GET_STATUS , +.Nm BACKLIGHT_SET_STATUS , +.Nd BACKLIGHT methods +.Sh SYNOPSIS +.Cd "device backlight" +.In "backlight_if.h" +.In "sys/sys/backlight.h" +.Ft int +.Fn BACKLIGHT_GET_STATUS "device_t bus" "struct backlight_props *props" +.Ft int +.Fn BACKLIGHT_SET_STATUS "device_t bus" "struct backlight_props *props" +.Ft struct cdev * +.Fn backlight_register "const char *name" "device_t dev" +.Ft int +.Fn backlight_destroy "struct cdev *cdev" +.Sh DESCRIPTION +The backlight driver provides a generic way for handling a panel backlight. +.Pp +Drivers for backlight system register themselves globally using the +.Fn backlight_register +function. +They must define two methods, +.Fn BACKLIGHT_GET_STATUS +which is used to query the current brightness level and +.Fn BACKLIGHT_SET_STATUS +which is used to update it. +.Sh INTERFACE +.Bl -tag -width indent +.It Fn BACKLIGHT_GET_STATUS "device_t bus" "struct backlight_props *props" +Driver fills the current brightless level and the optional supported levels. +.It Fn BACKLIGHT_SET_STATUS "device_t bus" "struct backlight_props *props" +Driver update the backlight level based on the brightness member of the props +struct. +.El +.Sh FILES +.Bl -tag -width "/dev/backlight/*" +.It Pa /dev/backlight/* +.Sh HISTORY +The +.Nm backlight +interface first appear in +.Fx 13.0 . +The +.Nm backlight +driver and manual page was written by +.An Emmanuel Vadot Aq Mt m...@freebsd.org . Modified: head/sys/conf/files == --- head/sys/conf/files Fri Oct 2 17:50:22 2020(r366368) +++ head/sys/conf/files Fri Oct 2 18:18:01 2020(r366369) @@ -1312,6 +1312,8 @@ dev/ath/ath_rate/sample/sample.c optional ath_rate_sam
svn commit: r366370 - in head/usr.bin: . backlight
Author: manu Date: Fri Oct 2 18:21:30 2020 New Revision: 366370 URL: https://svnweb.freebsd.org/changeset/base/366370 Log: Add backlight(8) This tool is used to configure registered backlights. It can incr/decr (default to 10%) or accept a percentage value directly. Reviewed by: manpages (gbe@) Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26251 Added: head/usr.bin/backlight/ head/usr.bin/backlight/Makefile (contents, props changed) head/usr.bin/backlight/backlight.8 (contents, props changed) head/usr.bin/backlight/backlight.c (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile == --- head/usr.bin/Makefile Fri Oct 2 18:18:01 2020(r366369) +++ head/usr.bin/Makefile Fri Oct 2 18:21:30 2020(r366370) @@ -7,6 +7,7 @@ SUBDIR= alias \ apply \ asa \ awk \ + backlight \ banner \ basename \ brandelf \ Added: head/usr.bin/backlight/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/backlight/Makefile Fri Oct 2 18:21:30 2020 (r366370) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= backlight +MAN= backlight.8 + +.include Added: head/usr.bin/backlight/backlight.8 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/backlight/backlight.8 Fri Oct 2 18:21:30 2020 (r366370) @@ -0,0 +1,95 @@ +.\" Copyright (c) 2020 Emmanuel Vadot +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 02, 2020 +.Dt BACKLIGHT 8 +.Os +.Sh NAME +.Nm backlight +.Nd configure backlight hardware +.Sh SYNOPSIS +.Nm +.Op Fl f Ar device +.Op Fl q +.Op Fl i +.Op Ar value +.Nm +.Op Fl f Ar device +incr | + +.Op Ar value +.Nm +.Op Fl f Ar device +decr | - +.Op Ar value +.Sh DESCRIPTION +The +.Nm +utility can be used to configure brightness levels for registered backlights +.Pp +The options are as follows: +.Bl -tag -width "-f device" +.It Fl f Ar device +Device to operate on. +If not specified, +.Pa /dev/backlight/backlight0 +is used. +If an unqualified name is provided, +.Pa /dev/backlight +is automatically prepended. +.It Fl q +When querying the brightness level only print the value. +.It Fl i +Query information about the backlight (name, type). +.It Ar value +Set the brightness level to this value, must be between 0 and 100. +.It Ar incr | + +.Op Ar value +Decrement the backlight level. +If no value is specified a default of 10 percent is used. +.It Ar decr | - +.Op Ar value +Increment the backlight level. +If no value is specified a default of 10 percent is used. +.El +.Sh EXAMPLES +.Bl -bullet +.It +Show the current brightness level +.Bd -literal +backlight -f /dev/backlight/backlight0 +.Ed +.El +.Sh SEE ALSO +.Xr backlight 9 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +utility and this manual page were written by +.An Emmanuel Vadot Aq Mt m...@freebsd.org . Added: head/usr.bin/backlight/backlight.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/backlight/backlight.c Fri Oct 2 18:21:30 2020 (r366370) @@ -0,0 +1,220 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Emmanuel Vadot + * + * Redistribution and use in source and binary f
svn commit: r366371 - in head/sys: conf dev/pwm modules/pwm modules/pwm/pwm_backlight
Author: manu Date: Fri Oct 2 18:23:27 2020 New Revision: 366371 URL: https://svnweb.freebsd.org/changeset/base/366371 Log: Add pwm_backlight Driver for pwm-backlight compatible device. Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26252 Added: head/sys/dev/pwm/pwm_backlight.c (contents, props changed) head/sys/modules/pwm/pwm_backlight/ head/sys/modules/pwm/pwm_backlight/Makefile (contents, props changed) Modified: head/sys/conf/files head/sys/modules/pwm/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Fri Oct 2 18:21:30 2020(r366370) +++ head/sys/conf/files Fri Oct 2 18:23:27 2020(r366371) @@ -2755,6 +2755,7 @@ dev/pwm/pwmbus.c optional pwm | pwmbus dev/pwm/pwmbus_if.moptional pwm | pwmbus dev/pwm/ofw_pwm.c optional pwm fdt | pwmbus fdt dev/pwm/ofw_pwmbus.c optional pwm fdt | pwmbus fdt +dev/pwm/pwm_backlight.coptional pwm pwm_backlight fdt dev/quicc/quicc_core.c optional quicc dev/ral/rt2560.c optional ral dev/ral/rt2661.c optional ral Added: head/sys/dev/pwm/pwm_backlight.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pwm/pwm_backlight.cFri Oct 2 18:23:27 2020 (r366371) @@ -0,0 +1,311 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include + +#include "backlight_if.h" +#include "pwmbus_if.h" + +struct pwm_backlight_softc { + device_tpwmdev; + struct cdev *cdev; + + pwm_channel_t channel; + uint32_t*levels; + ssize_t nlevels; + int default_level; + ssize_t current_level; + + regulator_t power_supply; + uint64_tperiod; + uint64_tduty; + boolenabled; +}; + +static int pwm_backlight_find_level_per_percent(struct pwm_backlight_softc *sc, int percent); + +static struct ofw_compat_data compat_data[] = { + { "pwm-backlight", 1 }, + { NULL, 0 } +}; + +static int +pwm_backlight_probe(device_t dev) +{ + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "PWM Backlight"); + return (BUS_PROBE_DEFAULT); +} + +static int +pwm_backlight_attach(device_t dev) +{ + struct pwm_backlight_softc *sc; + phandle_t node; + int rv; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + + rv = pwm_get_by_ofw_propidx(dev, node, "pwms", 0, &sc->channel); + if (rv != 0) { + device_printf(dev, "Cannot map pwm channel %d\n", rv); + return (ENXIO); + } + + if (regulator_get_by_ofw_property(dev, 0, "power-supply", + &sc->power_supply) != 0) { + device_printf(dev, "No power-supply property\n"); + return (ENXIO); + } + + if (OF_hasprop(node, "brightness-levels")) { + sc->nlevels = OF_getencprop_alloc(node, "brightness-levels", +
svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf
Author: manu Date: Fri Oct 2 18:26:41 2020 New Revision: 366372 URL: https://svnweb.freebsd.org/changeset/base/366372 Log: linuxkpi: Add backlight support Add backlight function to linuxkpi. Graphics drivers expose the backlight of the panel directly so allow them to use the backlight subsystem so user can use backlight(8) to configure them. Reviewed by: hselasky Relnotes: yes Differential Revision:The FreeBSD Foundation Added: head/sys/compat/linuxkpi/common/include/linux/backlight.h (contents, props changed) Modified: head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/src/linux_kmod.c head/sys/compat/linuxkpi/common/src/linux_pci.c head/sys/conf/kmod.mk Added: head/sys/compat/linuxkpi/common/include/linux/backlight.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/backlight.h Fri Oct 2 18:26:41 2020(r366372) @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_BACKLIGHT_H_ +#define _LINUX_BACKLIGHT_H_ + +#include + +struct backlight_device; + +enum backlight_type { + BACKLIGHT_RAW = 0, +}; + +struct backlight_properties { + int type; + int max_brightness; + int brightness; + int power; +}; + +enum backlight_notification { + BACKLIGHT_REGISTERED, + BACKLIGHT_UNREGISTERED, +}; + +enum backlight_update_reason { + BACKLIGHT_UPDATE_HOTKEY = 0 +}; + +struct backlight_ops { + int options; +#defineBL_CORE_SUSPENDRESUME 1 + int (*update_status)(struct backlight_device *); + int (*get_brightness)(struct backlight_device *); +}; + +struct backlight_device { + const struct backlight_ops *ops; + struct backlight_properties props; + void *data; + struct device *dev; + char *name; +}; + +#define bl_get_data(bd) (bd)->data + +struct backlight_device *linux_backlight_device_register(const char *name, +struct device *dev, void *data, const struct backlight_ops *ops, struct backlight_properties *props); +void linux_backlight_device_unregister(struct backlight_device *bd); +#definebacklight_device_register(name, dev, data, ops, props) \ + linux_backlight_device_register(name, dev, data, ops, props) +#definebacklight_device_unregister(bd) linux_backlight_device_unregister(bd) + +static inline void +backlight_update_status(struct backlight_device *bd) +{ + bd->ops->update_status(bd); +} + +static inline void +backlight_force_update(struct backlight_device *bd, int reason) +{ + bd->props.brightness = bd->ops->get_brightness(bd); +} + +#endif /* _LINUX_BACKLIGHT_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/device.h == --- head/sys/compat/linuxkpi/common/include/linux/device.h Fri Oct 2 18:23:27 2020(r366371) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Fri Oct 2 18:26:41 2020(r366372) @@ -41,9 +41,11 @@ #include #include #include +#include #include #include +#include struct device; struct fwnode_handle; @@ -114,6 +116,8 @@ struct device { unsigned intirq_end; const struct attribute_group **groups; struct fwnode_handle *fwnode; + struct cdev *backlight_dev; + struct backlight_device *bd; spinlo
svn commit: r366373 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi
Author: manu Date: Fri Oct 2 18:28:00 2020 New Revision: 366373 URL: https://svnweb.freebsd.org/changeset/base/366373 Log: linuxkpi: Add dmi_* function dmi function are used to get smbios values. The DRM subsystem and drivers use it to enabled (or not) quirks. Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26046 Added: head/sys/compat/linuxkpi/common/include/linux/dmi.h (contents, props changed) head/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h (contents, props changed) head/sys/compat/linuxkpi/common/src/linux_dmi.c (contents, props changed) Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/conf/files head/sys/modules/linuxkpi/Makefile Added: head/sys/compat/linuxkpi/common/include/linux/dmi.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/dmi.h Fri Oct 2 18:28:00 2020(r366373) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_DMI_H__ +#define__LINUX_DMI_H__ + +#include + +int linux_dmi_check_system(const struct dmi_system_id *); +bool linux_dmi_match(enum dmi_field, const char *); +const struct dmi_system_id *linux_dmi_first_match(const struct dmi_system_id *); +const char *linux_dmi_get_system_info(int); + +#definedmi_check_system(sysid) linux_dmi_check_system(sysid) +#definedmi_match(f, str) linux_dmi_match(f, str) +#definedmi_first_match(sysid) linux_dmi_first_match(sysid) +#definedmi_get_system_info(sysid) linux_dmi_get_system_info(sysid) + +#endif /* __LINUX_DMI_H__ */ Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h == --- head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Oct 2 18:26:41 2020(r366372) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Fri Oct 2 18:28:00 2020(r366373) @@ -180,7 +180,7 @@ struct file_operations { #defineFMODE_READ FREAD #defineFMODE_WRITE FWRITE #defineFMODE_EXEC FEXEC - +#defineFMODE_UNSIGNED_OFFSET 0x2000 int __register_chrdev(unsigned int major, unsigned int baseminor, unsigned int count, const char *name, const struct file_operations *fops); Added: head/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/mod_devicetable.h Fri Oct 2 18:28:00 2020(r366373) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED B
svn commit: r366374 - head/sys/sys
Author: manu Date: Fri Oct 2 18:29:25 2020 New Revision: 366374 URL: https://svnweb.freebsd.org/changeset/base/366374 Log: Bump __FreeBSD_version after latest linuxkpi changes Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hFri Oct 2 18:28:00 2020(r366373) +++ head/sys/sys/param.hFri Oct 2 18:29:25 2020(r366374) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300117 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300118 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366375 - head/lib/libc/locale
Author: markj Date: Fri Oct 2 18:35:55 2020 New Revision: 366375 URL: https://svnweb.freebsd.org/changeset/base/366375 Log: newlocale(3): Fix a memory leak. newlocale() optionally takes a "base" locale, from which components not specified in the mask are inherited. POSIX says that newlocale() may modify "base" and return it, or free "base" and return a newly allocated locale. We were not doing either, so applications which use newlocale() to modify an existing base locale end up leaking memory on FreeBSD. This diff fixes the leak by releasing a reference to the base locale before returning. This is less efficient than modifying "base" directly, but is simpler for an initial bug fix. Also, update the man page to clarify behaviour with respect to "base". PR: 249416 MFC after:3 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26522 Modified: head/lib/libc/locale/newlocale.3 head/lib/libc/locale/xlocale.c Modified: head/lib/libc/locale/newlocale.3 == --- head/lib/libc/locale/newlocale.3Fri Oct 2 18:29:25 2020 (r366374) +++ head/lib/libc/locale/newlocale.3Fri Oct 2 18:35:55 2020 (r366375) @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 17, 2011 +.Dd October 2, 2020 .Dt NEWLOCALE 3 .Os .Sh NAME @@ -46,7 +46,20 @@ defines the components that the new locale will have s name specified in the .Fa locale parameter. -Any other components will be inherited from +Any components not specified in +.Fa mask +will be inherited from the locale referenced by +.Fa base , +if +.Fa base +is not +.Dv NULL . +If the call is successful, the state of the locale referenced by +.Fa base +is unspecified, and it must not be accessed. +The special locale +.Dv LC_GLOBAL_LOCALE +may not be specified for .Fa base . The .Fa mask Modified: head/lib/libc/locale/xlocale.c == --- head/lib/libc/locale/xlocale.c Fri Oct 2 18:29:25 2020 (r366374) +++ head/lib/libc/locale/xlocale.c Fri Oct 2 18:35:55 2020 (r366375) @@ -251,6 +251,7 @@ static int dupcomponent(int type, locale_t base, local locale_t newlocale(int mask, const char *locale, locale_t base) { + locale_t orig_base; int type; const char *realLocale = locale; int useenv = 0; @@ -263,6 +264,7 @@ locale_t newlocale(int mask, const char *locale, local return (NULL); } + orig_base = base; FIX_LOCALE(base); copyflags(new, base); @@ -297,6 +299,8 @@ locale_t newlocale(int mask, const char *locale, local if (0 == success) { xlocale_release(new); new = NULL; + } else if (base == orig_base) { + xlocale_release(base); } return (new); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366376 - head/sys/kern
Author: markj Date: Fri Oct 2 18:54:37 2020 New Revision: 366376 URL: https://svnweb.freebsd.org/changeset/base/366376 Log: Fix the INVARIANTS build for 32-bit platforms Reported by: Jenkins MFC with: r366368 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Fri Oct 2 18:35:55 2020(r366375) +++ head/sys/kern/imgact_elf.c Fri Oct 2 18:54:37 2020(r366376) @@ -1543,8 +1543,7 @@ core_output(char *base, size_t len, off_t offset, stru bool success; KASSERT((uintptr_t)base % PAGE_SIZE == 0, - ("%s: user address %#lx is not page-aligned", - __func__, (uintptr_t)base)); + ("%s: user address %p is not page-aligned", __func__, base)); if (p->comp != NULL) return (compress_chunk(p, base, tmpbuf, len)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366377 - head/sys/vm
Author: markj Date: Fri Oct 2 19:03:42 2020 New Revision: 366377 URL: https://svnweb.freebsd.org/changeset/base/366377 Log: uma: Remove newlines from panic messages Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Oct 2 18:54:37 2020(r366376) +++ head/sys/vm/uma_core.c Fri Oct 2 19:03:42 2020(r366377) @@ -3331,7 +3331,7 @@ uma_zalloc_smr(uma_zone_t zone, int flags) void *item; KASSERT((zone->uz_flags & UMA_ZONE_SMR) != 0, - ("uma_zalloc_arg: called with non-SMR zone.\n")); + ("uma_zalloc_arg: called with non-SMR zone.")); if (uma_zalloc_debug(zone, &item, NULL, flags) == EJUSTRETURN) return (item); #endif @@ -3362,7 +3362,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags void *item; KASSERT((zone->uz_flags & UMA_ZONE_SMR) == 0, - ("uma_zalloc_arg: called with SMR zone.\n")); + ("uma_zalloc_arg: called with SMR zone.")); if (uma_zalloc_debug(zone, &item, udata, flags) == EJUSTRETURN) return (item); #endif @@ -4007,7 +4007,7 @@ uma_zfree_smr(uma_zone_t zone, void *item) #ifdef UMA_ZALLOC_DEBUG KASSERT((zone->uz_flags & UMA_ZONE_SMR) != 0, - ("uma_zfree_smr: called with non-SMR zone.\n")); + ("uma_zfree_smr: called with non-SMR zone.")); KASSERT(item != NULL, ("uma_zfree_smr: Called with NULL pointer.")); SMR_ASSERT_NOT_ENTERED(zone->uz_smr); if (uma_zfree_debug(zone, item, NULL) == EJUSTRETURN) @@ -4060,7 +4060,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata #ifdef UMA_ZALLOC_DEBUG KASSERT((zone->uz_flags & UMA_ZONE_SMR) == 0, - ("uma_zfree_arg: called with SMR zone.\n")); + ("uma_zfree_arg: called with SMR zone.")); if (uma_zfree_debug(zone, item, udata) == EJUSTRETURN) return; #endif @@ -5271,14 +5271,14 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void * if (slab == NULL) { slab = uma_dbg_getslab(zone, item); if (slab == NULL) - panic("uma: item %p did not belong to zone %s\n", + panic("uma: item %p did not belong to zone %s", item, zone->uz_name); } keg = zone->uz_keg; freei = slab_item_index(slab, keg, item); if (BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg))) - panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n", + panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)", item, zone, zone->uz_name, slab, freei); BIT_SET_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)); } @@ -5297,22 +5297,22 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i if (slab == NULL) { slab = uma_dbg_getslab(zone, item); if (slab == NULL) - panic("uma: Freed item %p did not belong to zone %s\n", + panic("uma: Freed item %p did not belong to zone %s", item, zone->uz_name); } keg = zone->uz_keg; freei = slab_item_index(slab, keg, item); if (freei >= keg->uk_ipers) - panic("Invalid free of %p from zone %p(%s) slab %p(%d)\n", + panic("Invalid free of %p from zone %p(%s) slab %p(%d)", item, zone, zone->uz_name, slab, freei); if (slab_item(slab, keg, freei) != item) - panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n", + panic("Unaligned free of %p from zone %p(%s) slab %p(%d)", item, zone, zone->uz_name, slab, freei); if (!BIT_ISSET(keg->uk_ipers, freei, slab_dbg_bits(slab, keg))) - panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n", + panic("Duplicate free of %p from zone %p(%s) slab %p(%d)", item, zone, zone->uz_name, slab, freei); BIT_CLR_ATOMIC(keg->uk_ipers, freei, slab_dbg_bits(slab, keg)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366379 - head/sys/vm
Author: markj Date: Fri Oct 2 19:04:29 2020 New Revision: 366379 URL: https://svnweb.freebsd.org/changeset/base/366379 Log: uma: Use the bucket cache for cross-domain allocations uma_zalloc_domain() allocates from the requested domain instead of following a first-touch policy (the default for most zones). Currently it is only used by malloc_domainset(), and consumers free returned items with free(9) since r363834. Previously uma_zalloc_domain() worked by always going to the keg for an item. As a result, the use of UMA zone caches was unbalanced: we free items to the caches, but always allocate from the keg, skipping the caches. Make some effort to allocate from the UMA caches when performing a cross-domain allocation. This avoids blowing up the caches when something is performing many transient allocations with malloc_domainset(). Reported and tested by: dhw, glebius Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26427 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Oct 2 19:04:09 2020(r366378) +++ head/sys/vm/uma_core.c Fri Oct 2 19:04:29 2020(r366379) @@ -685,8 +685,13 @@ zone_fetch_bucket(uma_zone_t zone, uma_zone_domain_t z if (STAILQ_NEXT(bucket, ub_link) != NULL) zdom->uzd_seq = STAILQ_NEXT(bucket, ub_link)->ub_seq; } - MPASS(zdom->uzd_nitems >= bucket->ub_cnt); STAILQ_REMOVE_HEAD(&zdom->uzd_buckets, ub_link); + + KASSERT(zdom->uzd_nitems >= bucket->ub_cnt, + ("%s: item count underflow (%ld, %d)", + __func__, zdom->uzd_nitems, bucket->ub_cnt)); + KASSERT(bucket->ub_cnt > 0, + ("%s: empty bucket in bucket cache", __func__)); zdom->uzd_nitems -= bucket->ub_cnt; /* @@ -914,11 +919,8 @@ cache_fetch_bucket(uma_zone_t zone, uma_cache_t cache, * Check the zone's cache of buckets. */ zdom = zone_domain_lock(zone, domain); - if ((bucket = zone_fetch_bucket(zone, zdom, false)) != NULL) { - KASSERT(bucket->ub_cnt != 0, - ("cache_fetch_bucket: Returning an empty bucket.")); + if ((bucket = zone_fetch_bucket(zone, zdom, false)) != NULL) return (bucket); - } ZDOM_UNLOCK(zdom); return (NULL); @@ -3495,6 +3497,11 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * void * uma_zalloc_domain(uma_zone_t zone, void *udata, int domain, int flags) { +#ifdef NUMA + uma_bucket_t bucket; + uma_zone_domain_t zdom; + void *item; +#endif /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA); @@ -3509,8 +3516,45 @@ uma_zalloc_domain(uma_zone_t zone, void *udata, int do } KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("uma_zalloc_domain: called with spinlock or critical section held")); + KASSERT((zone->uz_flags & UMA_ZONE_SMR) == 0, + ("uma_zalloc_domain: called with SMR zone.")); +#ifdef NUMA + KASSERT((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) != 0, + ("uma_zalloc_domain: called with non-FIRSTTOUCH zone.")); + if (vm_ndomains == 1) + return (uma_zalloc_arg(zone, udata, flags)); + + /* +* Try to allocate from the bucket cache before falling back to the keg. +* We could try harder and attempt to allocate from per-CPU caches or +* the per-domain cross-domain buckets, but the complexity is probably +* not worth it. It is more important that frees of previous +* cross-domain allocations do not blow up the cache. +*/ + zdom = zone_domain_lock(zone, domain); + if ((bucket = zone_fetch_bucket(zone, zdom, false)) != NULL) { + item = bucket->ub_bucket[bucket->ub_cnt - 1]; +#ifdef INVARIANTS + bucket->ub_bucket[bucket->ub_cnt - 1] = NULL; +#endif + bucket->ub_cnt--; + zone_put_bucket(zone, domain, bucket, udata, true); + item = item_ctor(zone, zone->uz_flags, zone->uz_size, udata, + flags, item); + if (item != NULL) { + KASSERT(item_domain(item) == domain, + ("%s: bucket cache item %p from wrong domain", + __func__, item)); + counter_u64_add(zone->uz_allocs, 1); + } + return (item); + } + ZDOM_UNLOCK(zdom); return (zone_alloc_item(zone, udata, domain, flags)); +#else + return (uma_zalloc_arg(zone, udata, flags)); +#endif } /* ___ svn-src-head@freebsd.org mailing list https://list
svn commit: r366378 - head/sys/vm
Author: markj Date: Fri Oct 2 19:04:09 2020 New Revision: 366378 URL: https://svnweb.freebsd.org/changeset/base/366378 Log: uma: Use LIFO for non-SMR bucket caches When SMR was introduced, zone_put_bucket() was changed to always place full buckets at the end of the queue. However, it is generally preferable to use recently used buckets since their items are more likely to be resident in cache. So, for buckets that have no constraint on item reuse, use a last-in-first-out ordering as we did before. Reviewed by: rlibby Tested by:dhw, glebius Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26426 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Oct 2 19:03:42 2020(r366377) +++ head/sys/vm/uma_core.c Fri Oct 2 19:04:09 2020(r366378) @@ -733,7 +733,15 @@ zone_put_bucket(uma_zone_t zone, int domain, uma_bucke zone_domain_imax_set(zdom, zdom->uzd_nitems); if (STAILQ_EMPTY(&zdom->uzd_buckets)) zdom->uzd_seq = bucket->ub_seq; - STAILQ_INSERT_TAIL(&zdom->uzd_buckets, bucket, ub_link); + + /* +* Try to promote reuse of recently used items. For items +* protected by SMR, try to defer reuse to minimize polling. +*/ + if (bucket->ub_seq == SMR_SEQ_INVALID) + STAILQ_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); + else + STAILQ_INSERT_TAIL(&zdom->uzd_buckets, bucket, ub_link); ZDOM_UNLOCK(zdom); return; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366380 - head/sys/vm
Author: markj Date: Fri Oct 2 19:16:06 2020 New Revision: 366380 URL: https://svnweb.freebsd.org/changeset/base/366380 Log: vm_pageout: Avoid rounding down the inactive scan target With helper page daemon threads, enabled by default in r364786, we divide the inactive target by the number of threads, rounding down, and sum the total number of pages freed by the threads. This sum is compared with the original target, but by rounding down we might lose pages, causing the page daemon control loop to conclude that inactive queue scanning isn't keeping up with demand for free pages. Typically this results in excessive swapping. Fix the problem by accounting for the error in the main pagedaemon thread's target. Note that by default the problem will manifest only in systems with >16 CPUs in a NUMA domain. Reviewed by: cem Discussed with: dougm Reported and tested by: dhw, glebius Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26610 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cFri Oct 2 19:04:29 2020(r366379) +++ head/sys/vm/vm_pageout.cFri Oct 2 19:16:06 2020(r366380) @@ -1649,25 +1649,26 @@ reinsert: /* * Dispatch a number of inactive threads according to load and collect the - * results to prevent a coherent (CEM: incoherent?) view of paging activity on - * this domain. + * results to present a coherent view of paging activity on this domain. */ static int vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage) { - u_int freed, pps, threads, us; + u_int freed, pps, slop, threads, us; vmd->vmd_inactive_shortage = shortage; + slop = 0; /* * If we have more work than we can do in a quarter of our interval, we * fire off multiple threads to process it. */ - if (vmd->vmd_inactive_threads > 1 && vmd->vmd_inactive_pps != 0 && + threads = vmd->vmd_inactive_threads; + if (threads > 1 && vmd->vmd_inactive_pps != 0 && shortage > vmd->vmd_inactive_pps / VM_INACT_SCAN_RATE / 4) { - threads = vmd->vmd_inactive_threads; - vm_domain_pageout_lock(vmd); vmd->vmd_inactive_shortage /= threads; + slop = shortage % threads; + vm_domain_pageout_lock(vmd); blockcount_acquire(&vmd->vmd_inactive_starting, threads - 1); blockcount_acquire(&vmd->vmd_inactive_running, threads - 1); wakeup(&vmd->vmd_inactive_shortage); @@ -1675,7 +1676,7 @@ vm_pageout_inactive_dispatch(struct vm_domain *vmd, in } /* Run the local thread scan. */ - vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage); + vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage + slop); /* * Block until helper threads report results and then accumulate ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366381 - head/sys/modules/pwm
Author: manu Date: Fri Oct 2 19:56:54 2020 New Revision: 366381 URL: https://svnweb.freebsd.org/changeset/base/366381 Log: pwm_backlight: Restrict module to armv7 and aarch64 Both powerpc64 and riscv uses fdt but don't use EXT_RESOURCES. Reported by: jenkins Modified: head/sys/modules/pwm/Makefile Modified: head/sys/modules/pwm/Makefile == --- head/sys/modules/pwm/Makefile Fri Oct 2 19:16:06 2020 (r366380) +++ head/sys/modules/pwm/Makefile Fri Oct 2 19:56:54 2020 (r366381) @@ -6,8 +6,10 @@ SUBDIR = \ pwmbus \ pwmc \ +.if ${MACHINE_ARCH} == "armv7" || ${MACHINE_ARCH} == "aarch64" .if !empty(OPT_FDT) SUBDIR += pwm_backlight +.endif .endif .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366382 - in head/sys: amd64/conf arm/conf arm64/conf i386/conf powerpc/conf
Author: manu Date: Fri Oct 2 20:52:09 2020 New Revision: 366382 URL: https://svnweb.freebsd.org/changeset/base/366382 Log: Fix LINT: Add backlight to NOTES Modified: head/sys/amd64/conf/NOTES head/sys/arm/conf/NOTES head/sys/arm64/conf/NOTES head/sys/i386/conf/NOTES head/sys/powerpc/conf/NOTES Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Fri Oct 2 19:56:54 2020(r366381) +++ head/sys/amd64/conf/NOTES Fri Oct 2 20:52:09 2020(r366382) @@ -538,6 +538,7 @@ device ioat# Intel I/OAT DMA engine # Laptop/Notebook options: # +device backlight # # I2C Bus Modified: head/sys/arm/conf/NOTES == --- head/sys/arm/conf/NOTES Fri Oct 2 19:56:54 2020(r366381) +++ head/sys/arm/conf/NOTES Fri Oct 2 20:52:09 2020(r366382) @@ -45,6 +45,9 @@ devicenvmem device regulator device syscon +# Backlight subsystem +device backlight + # Undo options from sys/conf/NOTES that we do not want... nooptions COMPAT_FREEBSD4 Modified: head/sys/arm64/conf/NOTES == --- head/sys/arm64/conf/NOTES Fri Oct 2 19:56:54 2020(r366381) +++ head/sys/arm64/conf/NOTES Fri Oct 2 20:52:09 2020(r366382) @@ -191,6 +191,9 @@ device regulator device syscon device aw_syscon +# Backlight subsystem +device backlight + # Misc devices. device pl330 # ARM PL330 dma controller device xdma# xDMA framework for SoC on-chip dma controllers Modified: head/sys/i386/conf/NOTES == --- head/sys/i386/conf/NOTESFri Oct 2 19:56:54 2020(r366381) +++ head/sys/i386/conf/NOTESFri Oct 2 20:52:09 2020(r366382) @@ -784,6 +784,8 @@ device aesni # AES-NI OpenCrypto module # apm under `Miscellaneous hardware' # above. +device backlight + # For older notebooks that signal a powerfail condition (external # power supply dropped, or battery state low) by issuing an NMI: Modified: head/sys/powerpc/conf/NOTES == --- head/sys/powerpc/conf/NOTES Fri Oct 2 19:56:54 2020(r366381) +++ head/sys/powerpc/conf/NOTES Fri Oct 2 20:52:09 2020(r366382) @@ -68,6 +68,9 @@ devicesnd_ai2s# Apple I2S Audio device snd_davbus # Apple Davbus Audio device adm1030 # Apple G4 MDD fan controller +# Backlight subsystem +device backlight + # # Devices we don't want to deal with ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366384 - head/sys/dev/cxgbe/tom
Author: np Date: Fri Oct 2 23:48:57 2020 New Revision: 366384 URL: https://svnweb.freebsd.org/changeset/base/366384 Log: cxgbe(4): set up the firmware flowc for the tid before send_abort_rpl. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c == --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Oct 2 21:15:49 2020 (r366383) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Oct 2 23:48:57 2020 (r366384) @@ -342,48 +342,32 @@ release_lctx(struct adapter *sc, struct listen_ctx *lc } static void -send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) +send_flowc_wr_synqe(struct adapter *sc, struct synq_entry *synqe) { - struct adapter *sc = tod->tod_softc; struct mbuf *m = synqe->syn; struct ifnet *ifp = m->m_pkthdr.rcvif; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; struct wrqe *wr; struct fw_flowc_wr *flowc; - struct cpl_abort_req *req; - int flowclen; struct sge_wrq *ofld_txq; struct sge_ofld_rxq *ofld_rxq; const int nparams = 6; + const int flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); const u_int pfvf = sc->pf << S_FW_VIID_PFN; INP_WLOCK_ASSERT(synqe->lctx->inp); + MPASS((synqe->flags & TPF_FLOWC_WR_SENT) == 0); - CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", - __func__, synqe, synqe->flags, synqe->tid, - synqe->flags & TPF_ABORT_SHUTDOWN ? - " (abort already in progress)" : ""); - if (synqe->flags & TPF_ABORT_SHUTDOWN) - return; /* abort already in progress */ - synqe->flags |= TPF_ABORT_SHUTDOWN; - ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; ofld_rxq = &sc->sge.ofld_rxq[synqe->params.rxq_idx]; - /* The wrqe will have two WRs - a flowc followed by an abort_req */ - flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); - - wr = alloc_wrqe(roundup2(flowclen, EQ_ESIZE) + sizeof(*req), ofld_txq); + wr = alloc_wrqe(roundup2(flowclen, 16), ofld_txq); if (wr == NULL) { /* XXX */ panic("%s: allocation failure.", __func__); } flowc = wrtod(wr); - req = (void *)((caddr_t)flowc + roundup2(flowclen, EQ_ESIZE)); - - /* First the flowc ... */ memset(flowc, 0, wr->wr_len); flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | V_FW_FLOWC_WR_NPARAMS(nparams)); @@ -397,19 +381,47 @@ send_reset_synqe(struct toedev *tod, struct synq_entry flowc->mnemval[2].val = htobe32(pi->tx_chan); flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID; flowc->mnemval[3].val = htobe32(ofld_rxq->iq.abs_id); - flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF; - flowc->mnemval[4].val = htobe32(512); - flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; - flowc->mnemval[5].val = htobe32(512); + flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF; + flowc->mnemval[4].val = htobe32(512); + flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS; + flowc->mnemval[5].val = htobe32(512); + synqe->flags |= TPF_FLOWC_WR_SENT; + t4_wrq_tx(sc, wr); +} - /* ... then ABORT request */ +static void +send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) +{ + struct adapter *sc = tod->tod_softc; + struct wrqe *wr; + struct cpl_abort_req *req; + + INP_WLOCK_ASSERT(synqe->lctx->inp); + + CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", + __func__, synqe, synqe->flags, synqe->tid, + synqe->flags & TPF_ABORT_SHUTDOWN ? + " (abort already in progress)" : ""); + if (synqe->flags & TPF_ABORT_SHUTDOWN) + return; /* abort already in progress */ + synqe->flags |= TPF_ABORT_SHUTDOWN; + + if (!(synqe->flags & TPF_FLOWC_WR_SENT)) + send_flowc_wr_synqe(sc, synqe); + + wr = alloc_wrqe(sizeof(*req), &sc->sge.ofld_txq[synqe->params.txq_idx]); + if (wr == NULL) { + /* XXX */ + panic("%s: allocation failure.", __func__); + } + req = wrtod(wr); INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid); req->rsvd0 = 0; /* don't have a snd_nxt */ req->rsvd1 = 1; /* no data sent yet */ req->cmd = CPL_ABORT_SEND_RST; - t4_l2t_send(sc, wr, e); + t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]); } static int @@ -891,6 +903,9 @@ do_abort_req_synqe(struct sge_iq *iq, const struct rss INP_WLOCK(inp); ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; + + if (!(synqe->flags & TPF_FLOWC_WR_SENT)) +
Re: svn commit: r366381 - head/sys/modules/pwm
On 10/2/20, Emmanuel Vadot wrote: > Author: manu > Date: Fri Oct 2 19:56:54 2020 > New Revision: 366381 > URL: https://svnweb.freebsd.org/changeset/base/366381 > > Log: > pwm_backlight: Restrict module to armv7 and aarch64 > > Both powerpc64 and riscv uses fdt but don't use EXT_RESOURCES. > > Reported by:jenkins > > Modified: > head/sys/modules/pwm/Makefile > > Modified: head/sys/modules/pwm/Makefile > == > --- head/sys/modules/pwm/Makefile Fri Oct 2 19:16:06 2020 > (r366380) > +++ head/sys/modules/pwm/Makefile Fri Oct 2 19:56:54 2020 > (r366381) > @@ -6,8 +6,10 @@ SUBDIR = \ > pwmbus \ > pwmc \ > > +.if ${MACHINE_ARCH} == "armv7" || ${MACHINE_ARCH} == "aarch64" > .if !empty(OPT_FDT) > SUBDIR += pwm_backlight > +.endif > .endif > > .include I don't know which commits are to blame, but the following is broken in tinderbox: arm GENERIC kernel failed, check _.arm.GENERIC for details arm GENERIC-NODEBUG kernel failed, check _.arm.GENERIC-NODEBUG for details arm TEGRA124 kernel failed, check _.arm.TEGRA124 for details arm ARMADA38X kernel failed, check _.arm.ARMADA38X for details arm VYBRID kernel failed, check _.arm.VYBRID for details arm GENERIC-MMCCAM kernel failed, check _.arm.GENERIC-MMCCAM for details arm LINT kernel failed, check _.arm.LINT for details arm IMX53 kernel failed, check _.arm.IMX53 for details arm IMX6 kernel failed, check _.arm.IMX6 for details arm EFIKA_MX kernel failed, check _.arm.EFIKA_MX for details arm ZEDBOARD kernel failed, check _.arm.ZEDBOARD for details -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r366381 - head/sys/modules/pwm
In message , Mateusz Guzik writes: > On 10/2/20, Emmanuel Vadot wrote: > > Author: manu > > Date: Fri Oct 2 19:56:54 2020 > > New Revision: 366381 > > URL: https://svnweb.freebsd.org/changeset/base/366381 > > > > Log: > > pwm_backlight: Restrict module to armv7 and aarch64 > > > > Both powerpc64 and riscv uses fdt but don't use EXT_RESOURCES. > > > > Reported by: jenkins > > > > Modified: > > head/sys/modules/pwm/Makefile > > > > Modified: head/sys/modules/pwm/Makefile > > === > === > > --- head/sys/modules/pwm/Makefile Fri Oct 2 19:16:06 2020(r36638 > 0) > > +++ head/sys/modules/pwm/Makefile Fri Oct 2 19:56:54 2020(r36638 > 1) > > @@ -6,8 +6,10 @@ SUBDIR = \ > > pwmbus \ > > pwmc \ > > > > +.if ${MACHINE_ARCH} == "armv7" || ${MACHINE_ARCH} == "aarch64" > > .if !empty(OPT_FDT) > > SUBDIR += pwm_backlight > > +.endif > > .endif > > > > .include > > I don't know which commits are to blame, but the following is broken > in tinderbox: > arm GENERIC kernel failed, check _.arm.GENERIC for details > arm GENERIC-NODEBUG kernel failed, check _.arm.GENERIC-NODEBUG for details > arm TEGRA124 kernel failed, check _.arm.TEGRA124 for details > arm ARMADA38X kernel failed, check _.arm.ARMADA38X for details > arm VYBRID kernel failed, check _.arm.VYBRID for details > arm GENERIC-MMCCAM kernel failed, check _.arm.GENERIC-MMCCAM for details > arm LINT kernel failed, check _.arm.LINT for details > arm IMX53 kernel failed, check _.arm.IMX53 for details > arm IMX6 kernel failed, check _.arm.IMX6 for details > arm EFIKA_MX kernel failed, check _.arm.EFIKA_MX for details > arm ZEDBOARD kernel failed, check _.arm.ZEDBOARD for details And on amd64 my laptop is useless now. Oct 2 18:23:58 slippy kernel: link_elf_obj: symbol acpi_video_get_backlight_type undefined Oct 2 18:23:58 slippy kernel: Warning: memory type debugfsint leaked memory on destroy (2 allocations, 80 bytes leaked). Oct 2 18:23:59 slippy kernel: linker_load_file: /boot/modules/i915kms.ko - unsupported file type And this is also after updating drm-current-kmod. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r366381 - head/sys/modules/pwm
On 20. 10. 3., Cy Schubert wrote: > In message om> > , Mateusz Guzik writes: >> On 10/2/20, Emmanuel Vadot wrote: >>> Author: manu >>> Date: Fri Oct 2 19:56:54 2020 >>> New Revision: 366381 >>> URL: https://svnweb.freebsd.org/changeset/base/366381 >>> >>> Log: >>> pwm_backlight: Restrict module to armv7 and aarch64 >>> >>> Both powerpc64 and riscv uses fdt but don't use EXT_RESOURCES. >>> >>> Reported by: jenkins >>> >>> Modified: >>> head/sys/modules/pwm/Makefile >>> >>> Modified: head/sys/modules/pwm/Makefile >>> === >> === >>> --- head/sys/modules/pwm/Makefile Fri Oct 2 19:16:06 2020(r36638 >> 0) >>> +++ head/sys/modules/pwm/Makefile Fri Oct 2 19:56:54 2020(r36638 >> 1) >>> @@ -6,8 +6,10 @@ SUBDIR = \ >>> pwmbus \ >>> pwmc \ >>> >>> +.if ${MACHINE_ARCH} == "armv7" || ${MACHINE_ARCH} == "aarch64" >>> .if !empty(OPT_FDT) >>> SUBDIR += pwm_backlight >>> +.endif >>> .endif >>> >>> .include >> >> I don't know which commits are to blame, but the following is broken >> in tinderbox: >> arm GENERIC kernel failed, check _.arm.GENERIC for details >> arm GENERIC-NODEBUG kernel failed, check _.arm.GENERIC-NODEBUG for details >> arm TEGRA124 kernel failed, check _.arm.TEGRA124 for details >> arm ARMADA38X kernel failed, check _.arm.ARMADA38X for details >> arm VYBRID kernel failed, check _.arm.VYBRID for details >> arm GENERIC-MMCCAM kernel failed, check _.arm.GENERIC-MMCCAM for details >> arm LINT kernel failed, check _.arm.LINT for details >> arm IMX53 kernel failed, check _.arm.IMX53 for details >> arm IMX6 kernel failed, check _.arm.IMX6 for details >> arm EFIKA_MX kernel failed, check _.arm.EFIKA_MX for details >> arm ZEDBOARD kernel failed, check _.arm.ZEDBOARD for details > > And on amd64 my laptop is useless now. > > Oct 2 18:23:58 slippy kernel: link_elf_obj: symbol > acpi_video_get_backlight_type undefined > Oct 2 18:23:58 slippy kernel: Warning: memory type debugfsint leaked > memory on destroy (2 allocations, 80 bytes leaked). > Oct 2 18:23:59 slippy kernel: linker_load_file: /boot/modules/i915kms.ko - > unsupported file type > > And this is also after updating drm-current-kmod. Create files directory, add the attached patch there, and try again. Jung-uk Kim ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"