svn commit: r358691 - head/lib/libc/powerpc64/string
Author: jhibbits Date: Fri Mar 6 03:46:48 2020 New Revision: 358691 URL: https://svnweb.freebsd.org/changeset/base/358691 Log: powerpc/memcpy: Don't predict the src and dst will be misaligned Predicting misalignment will pessimize the expected common case. Don't predict true or false in thise case. Modified: head/lib/libc/powerpc64/string/memcpy.S Modified: head/lib/libc/powerpc64/string/memcpy.S == --- head/lib/libc/powerpc64/string/memcpy.S Fri Mar 6 02:30:04 2020 (r358690) +++ head/lib/libc/powerpc64/string/memcpy.S Fri Mar 6 03:46:48 2020 (r358691) @@ -58,7 +58,7 @@ ENTRY(FN_NAME) andi. %r7, %r4, ALIGN_MASK cmpd%r8, %r7 mr %r7, %r5 - bne+.Lcopy_remaining_fix_index_byte + bne .Lcopy_remaining_fix_index_byte mr %r8, %r3/* save dst */ /* align src */ ___ 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: r358690 - head/lib/libc/powerpc64/string
Author: jhibbits Date: Fri Mar 6 02:30:04 2020 New Revision: 358690 URL: https://svnweb.freebsd.org/changeset/base/358690 Log: Finish revert of r358672, missed in r358688. Manual reverts never succeed correctly. Reported by: luporl Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c == --- head/lib/libc/powerpc64/string/bcopy_resolver.c Fri Mar 6 01:50:15 2020(r358689) +++ head/lib/libc/powerpc64/string/bcopy_resolver.c Fri Mar 6 02:30:04 2020(r358690) @@ -66,7 +66,7 @@ DEFINE_UIFUNC(, FN_RET, FN_NAME, FN_PARAMS) * Since POWER ISA 2.07B this is solved transparently * by the hardware */ - if (cpu_features2 & PPC_FEATURE_HAS_VSX) + if (cpu_features & PPC_FEATURE_HAS_VSX) return (FN_NAME_VSX); else return (FN_NAME_NOVSX); ___ 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: r358689 - head/sys/dev/mfi
Author: jhibbits Date: Fri Mar 6 01:50:15 2020 New Revision: 358689 URL: https://svnweb.freebsd.org/changeset/base/358689 Log: Fix a mistaken conditional in mfi_tbolt_send_frame() As written, the condition of (cdb[0] != 0x28 || cdb[0] != 0x2A) will always be true, since if it's one, it's obviously not the other. Reading the code, the intent appears to be that it should only perform the operation if it's neither, otherwise the conditional can be elided. Found by clang 10. Modified: head/sys/dev/mfi/mfi_tbolt.c Modified: head/sys/dev/mfi/mfi_tbolt.c == --- head/sys/dev/mfi/mfi_tbolt.cFri Mar 6 01:45:03 2020 (r358688) +++ head/sys/dev/mfi/mfi_tbolt.cFri Mar 6 01:50:15 2020 (r358689) @@ -1109,7 +1109,7 @@ mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_ if (hdr->cmd == MFI_CMD_PD_SCSI_IO) { /* check for inquiry commands coming from CLI */ - if (cdb[0] != 0x28 || cdb[0] != 0x2A) { + if (cdb[0] != 0x28 && cdb[0] != 0x2A) { if ((req_desc = mfi_tbolt_build_mpt_cmd(sc, cm)) == NULL) { device_printf(sc->mfi_dev, "Mapping from MFI " ___ 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: r358688 - head/lib/libc/powerpc64/string
Author: jhibbits Date: Fri Mar 6 01:45:03 2020 New Revision: 358688 URL: https://svnweb.freebsd.org/changeset/base/358688 Log: powerpc/powerpc64: Enforce natural alignment in memcpy Summary: POWER architecture CPUs (Book-S) require natural alignment for cache-inhibited storage accesses. Since we can't know the caching model for a page ahead of time, always enforce natural alignment in memcpy. This fixes a SIGBUS in X with acceleration enabled on POWER9. As part of this, revert r358672, it's no longer necessary with this fix. Regression tested by alfredo. Reviewed by: alfredo Differential Revision: https://reviews.freebsd.org/D23969 Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c head/lib/libc/powerpc64/string/memcpy.S head/lib/libc/powerpc64/string/memcpy_vsx.S Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c == --- head/lib/libc/powerpc64/string/bcopy_resolver.c Thu Mar 5 22:45:16 2020(r358687) +++ head/lib/libc/powerpc64/string/bcopy_resolver.c Fri Mar 6 01:45:03 2020(r358688) @@ -66,7 +66,7 @@ DEFINE_UIFUNC(, FN_RET, FN_NAME, FN_PARAMS) * Since POWER ISA 2.07B this is solved transparently * by the hardware */ - if (cpu_features2 & PPC_FEATURE2_ARCH_2_07) + if (cpu_features2 & PPC_FEATURE_HAS_VSX) return (FN_NAME_VSX); else return (FN_NAME_NOVSX); Modified: head/lib/libc/powerpc64/string/memcpy.S == --- head/lib/libc/powerpc64/string/memcpy.S Thu Mar 5 22:45:16 2020 (r358687) +++ head/lib/libc/powerpc64/string/memcpy.S Fri Mar 6 01:45:03 2020 (r358688) @@ -39,6 +39,11 @@ WEAK_REFERENCE(__memcpy, memcpy); #define BLOCK_BYTES(1 << BLOCK_BITS) #define BLOCK_MASK (BLOCK_BYTES - 1) +/* Minimum 8 byte alignment, to avoid cache-inhibited alignment faults. */ +#ifndef ALIGN_MASK +#defineALIGN_MASK 0x7 +#endif + /* * r3: dst * r4: src @@ -48,6 +53,12 @@ ENTRY(FN_NAME) cmpdi %r5, 0 /* len == 0? nothing to do */ beqlr- + /* If src and dst are relatively misaligned, do byte copies. */ + andi. %r8, %r3, ALIGN_MASK + andi. %r7, %r4, ALIGN_MASK + cmpd%r8, %r7 + mr %r7, %r5 + bne+.Lcopy_remaining_fix_index_byte mr %r8, %r3/* save dst */ /* align src */ Modified: head/lib/libc/powerpc64/string/memcpy_vsx.S == --- head/lib/libc/powerpc64/string/memcpy_vsx.S Thu Mar 5 22:45:16 2020 (r358687) +++ head/lib/libc/powerpc64/string/memcpy_vsx.S Fri Mar 6 01:45:03 2020 (r358688) @@ -30,6 +30,7 @@ #define FN_NAME__memcpy_vsx #define BLOCK_BITS 6 +#defineALIGN_MASK 0xf /* * r5: bytes to copy (multiple of BLOCK_BYTES) ___ 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: r358687 - head/libexec/tftpd/tests
On 3/5/20 2:45 PM, Kyle Evans wrote: > Author: kevans > Date: Thu Mar 5 22:45:16 2020 > New Revision: 358687 > URL: https://svnweb.freebsd.org/changeset/base/358687 > > Log: > tftpd: tests: raise targeted cstd to c11 > > r358556 added alignas() use to the functional tests, which isn't defined > until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}. > > Reported by:mhorne, Jenkins/CI Thanks for fixing! -- John Baldwin ___ 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: r358687 - head/libexec/tftpd/tests
Author: kevans Date: Thu Mar 5 22:45:16 2020 New Revision: 358687 URL: https://svnweb.freebsd.org/changeset/base/358687 Log: tftpd: tests: raise targeted cstd to c11 r358556 added alignas() use to the functional tests, which isn't defined until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}. Reported by: mhorne, Jenkins/CI Modified: head/libexec/tftpd/tests/Makefile Modified: head/libexec/tftpd/tests/Makefile == --- head/libexec/tftpd/tests/Makefile Thu Mar 5 21:01:47 2020 (r358686) +++ head/libexec/tftpd/tests/Makefile Thu Mar 5 22:45:16 2020 (r358687) @@ -10,5 +10,6 @@ TEST_METADATA.functional+=timeout=15 LIBADD=util WARNS?=6 +CSTD= c11 .include ___ 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: r358655 - head/sbin/mount_nfs
On 5 Mar 2020, at 22:01, Gleb Smirnoff wrote: > > On Thu, Mar 05, 2020 at 09:30:41PM +0300, Slawa Olhovchenkov wrote: > S> > > On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: > S> > > S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' > to 'struct > S> > > S> > > D> if_msghdr *' increases required alignment from 1 to 4 > S> > > S> > > D> [-Werror,-Wcast-align] > S> > > S> > > D> ifm = (struct if_msghdr *)buf; > S> > > S> > > D> ^~~ > S> > > S> > > D> 1 error generated. > S> > > S> > > D> > S> > > S> > > D> In practice I don't think the buffer can ever get > misaligned, so can you > S> > > S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? > S> > > S> > > > S> > > S> > > route(8) handles the same problem via intermediate (void *) > cast. What is > S> > > S> > > preferred way to solve the problem? Change compiler flags file > wide, or > S> > > S> > > just through (void *) cast? > S> > > S> > > S> > > S> > Copy to aligned buffer or got SIGBUS on some architectures? > S> > > S> > S> > > S> char buf[2048] __aligned(__alignof(struct if_msghdr)); > S> > > S> > S> > > S> resolve this watning. > S> > > > S> > > Thanks, Slawa! I think this is the most elegant solution. > S> > > S> > Why don't just declare the buffer as: > S> > > S> > struct if_msghdr buf; > S> > > S> > and then do: > S> > > S> > nread = read(s, , sizeof buf); > S> > > S> > ? You are never reading more than one if_msghdr anyway, and then there > S> > is no need to cast anything. > S> > S> My inspiration: route socket can return other messages (man 4 route) > > Yes, exactly. We don't know what size next datagram is going to be. Oh, in that case this code seems completely wrong. How do you know the full datagram will be delivered with one read() call? If it always is, then there is no need to read more than the size of struct if_msghdr, since you are not using any data beyond it. So in that case, you can suffice with read(..., sizeof(if_msghdr)). If the read() call will return partial results, you must repeatedly call it in a loop, until you either reach EOF, or have enough data. In that case, a buffer with the size of if_msghdr is also enough, since you never need to read beyond that. -Dimitry signature.asc Description: Message signed with OpenPGP
svn commit: r358686 - head/sbin/mount_nfs
Author: glebius Date: Thu Mar 5 21:01:47 2020 New Revision: 358686 URL: https://svnweb.freebsd.org/changeset/base/358686 Log: Align the buffer to the alignment of the structure we expect. Submitted by: Slawa Olhovchenkov Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c == --- head/sbin/mount_nfs/mount_nfs.c Thu Mar 5 20:53:43 2020 (r358685) +++ head/sbin/mount_nfs/mount_nfs.c Thu Mar 5 21:01:47 2020 (r358686) @@ -514,7 +514,7 @@ sec_num_to_name(int flavor) static time_t rtm_ifinfo_sleep(time_t sec) { - char buf[2048]; + char buf[2048] __aligned(__alignof(struct if_msghdr)); fd_set rfds; struct timeval tv, start; ssize_t nread; ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 09:30:41PM +0300, Slawa Olhovchenkov wrote: S> > > On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: S> > > S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct S> > > S> > > D> if_msghdr *' increases required alignment from 1 to 4 S> > > S> > > D> [-Werror,-Wcast-align] S> > > S> > > D> ifm = (struct if_msghdr *)buf; S> > > S> > > D> ^~~ S> > > S> > > D> 1 error generated. S> > > S> > > D> S> > > S> > > D> In practice I don't think the buffer can ever get misaligned, so can you S> > > S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? S> > > S> > > S> > > S> > > route(8) handles the same problem via intermediate (void *) cast. What is S> > > S> > > preferred way to solve the problem? Change compiler flags file wide, or S> > > S> > > just through (void *) cast? S> > > S> > S> > > S> > Copy to aligned buffer or got SIGBUS on some architectures? S> > > S> S> > > S> char buf[2048] __aligned(__alignof(struct if_msghdr)); S> > > S> S> > > S> resolve this watning. S> > > S> > > Thanks, Slawa! I think this is the most elegant solution. S> > S> > Why don't just declare the buffer as: S> > S> > struct if_msghdr buf; S> > S> > and then do: S> > S> > nread = read(s, , sizeof buf); S> > S> > ? You are never reading more than one if_msghdr anyway, and then there S> > is no need to cast anything. S> S> My inspiration: route socket can return other messages (man 4 route) Yes, exactly. We don't know what size next datagram is going to be. -- Gleb Smirnoff ___ 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: r358685 - head/contrib/elftoolchain/libelf
Author: emaste Date: Thu Mar 5 20:53:43 2020 New Revision: 358685 URL: https://svnweb.freebsd.org/changeset/base/358685 Log: libelf: rationalize error handling in ELF note conversion Previously _libelf_cvt_NOTE_tom (to host) returned false if a note's namesz + descsz exceeded the buffer size, while _libelf_cvt_NOTE_tof (to file) silently truncated. Return false in the latter case too. Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4 Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4 == --- head/contrib/elftoolchain/libelf/libelf_convert.m4 Thu Mar 5 20:04:41 2020(r358684) +++ head/contrib/elftoolchain/libelf/libelf_convert.m4 Thu Mar 5 20:53:43 2020(r358685) @@ -1022,7 +1022,7 @@ _libelf_cvt_NOTE_tof(unsigned char *dst, size_t dsz, u count -= sizeof(Elf_Note); if (count < sz) - sz = count; + return (0); (void) memcpy(dst, src, sz); ___ 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: r358684 - in head/sys: amd64/conf conf dev/aacraid modules modules/aacraid powerpc/conf
Author: luporl Date: Thu Mar 5 20:04:41 2020 New Revision: 358684 URL: https://svnweb.freebsd.org/changeset/base/358684 Log: [aacraid] Port driver to big-endian Port aacraid driver to big-endian (BE) hosts. The immediate goal of this change is to make it possible to use the aacraid driver on PowerPC64 machines that have Adaptec Series 8 SAS controllers. Adapters supported by this driver expect FIB contents in little-endian (LE) byte order. All FIBs have a fixed header part as well as a data part that depends on the command being issued to the controller. In this way, on BE hosts, the FIB header and all FIB data structures used in aacraid.c and aacraid_cam.c need to be converted to LE before being sent to the adapter and converted to BE when coming from it. The functions to convert each struct are on aacraid_endian.c. For little-endian (LE) targets, they are macros that expand to nothing. In some cases, when only a few fields of a large structure are used, the fields are converted inline, by the code using them. PR: 237463 Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D23887 Added: head/sys/dev/aacraid/aacraid_endian.c (contents, props changed) head/sys/dev/aacraid/aacraid_endian.h (contents, props changed) Modified: head/sys/amd64/conf/NOTES head/sys/conf/NOTES head/sys/conf/files.powerpc head/sys/dev/aacraid/aacraid.c head/sys/dev/aacraid/aacraid_cam.c head/sys/modules/Makefile head/sys/modules/aacraid/Makefile head/sys/powerpc/conf/GENERIC64 Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Thu Mar 5 19:43:43 2020(r358683) +++ head/sys/amd64/conf/NOTES Thu Mar 5 20:04:41 2020(r358684) @@ -417,10 +417,6 @@ device aac device aacp# SCSI Passthrough interface (optional, CAM required) # -# Adaptec by PMC RAID controllers, Series 6/7/8 and upcoming families -device aacraid # Container interface, CAM required - -# # Highpoint RocketRAID 27xx. device hpt27xx Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Thu Mar 5 19:43:43 2020(r358683) +++ head/sys/conf/NOTES Thu Mar 5 20:04:41 2020(r358684) @@ -1490,6 +1490,8 @@ options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK) # # SCSI host adapters: # +# aacraid: Adaptec by PMC RAID controllers, Series 6/7/8 and upcoming +# families. Container interface, CAM required. # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/ # 19160x/29160x, aic7770/aic78xx # ahd: Adaptec 29320/39320 Controllers. @@ -1512,6 +1514,7 @@ options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK) # 53C876, 53C885, 53C895, 53C895A, 53C896, 53C897, 53C1510D, # 53C1010-33, 53C1010-66. +device aacraid device ahc device ahd device esp Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Thu Mar 5 19:43:43 2020(r358683) +++ head/sys/conf/files.powerpc Thu Mar 5 20:04:41 2020(r358684) @@ -16,6 +16,7 @@ cddl/dev/dtrace/powerpc/dtrace_subr.c optional dtrace cddl/dev/fbt/powerpc/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" crypto/blowfish/bf_enc.c optionalcrypto | ipsec | ipsec_support crypto/des/des_enc.c optionalcrypto | ipsec | ipsec_support | netsmb +dev/aacraid/aacraid_endian.c optionalaacraid dev/adb/adb_bus.c optionaladb dev/adb/adb_kbd.c optionaladb dev/adb/adb_mouse.coptionaladb Modified: head/sys/dev/aacraid/aacraid.c == --- head/sys/dev/aacraid/aacraid.c Thu Mar 5 19:43:43 2020 (r358683) +++ head/sys/dev/aacraid/aacraid.c Thu Mar 5 20:04:41 2020 (r358684) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifndef FILTER_HANDLED #define FILTER_HANDLED 0x02 @@ -386,7 +387,7 @@ aac_daemon(void *arg) AAC_FIBSTATE_ASYNC | AAC_FIBSTATE_FAST_RESPONSE; fib->Header.Command = SendHostTime; - *(uint32_t *)fib->data = tv.tv_sec; + *(uint32_t *)fib->data = htole32(tv.tv_sec); aacraid_map_command_sg(cm, NULL, 0, 0); aacraid_release_command(cm); @@ -446,6 +447,7 @@ aac_get_container_info(struct aac_softc *sc, struct aa mi->Command = VM_NameServe; mi->MntType = FT_FILESYS; mi->MntCount =
svn commit: r358683 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Thu Mar 5 19:43:43 2020 New Revision: 358683 URL: https://svnweb.freebsd.org/changeset/base/358683 Log: Remove vfs.zfs.top_maxinflight tunable/sysctl. It is dead since sorted scrub import at r334844. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 5 18:11:47 2020(r358682) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 5 19:43:43 2020(r358683) @@ -137,12 +137,6 @@ extern int zfs_vdev_async_write_active_min_dirty_perce */ int zfs_scan_strict_mem_lim = B_FALSE; -/* - * Maximum number of parallelly executing I/Os per top-level vdev. - * Tune with care. Very high settings (hundreds) are known to trigger - * some firmware bugs and resets on certain SSDs. - */ -int zfs_top_maxinflight = 32; /* maximum I/Os per top-level */ unsigned int zfs_resilver_delay = 2; /* number of ticks to delay resilver -- 2 is a good number */ unsigned int zfs_scrub_delay = 4; /* number of ticks to delay scrub -- 4 is a good number */ unsigned int zfs_scan_idle = 50; /* idle window in clock ticks */ @@ -186,8 +180,6 @@ boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */ SYSCTL_DECL(_vfs_zfs); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, top_maxinflight, CTLFLAG_RWTUN, -_top_maxinflight, 0, "Maximum I/Os per top-level vdev"); SYSCTL_UINT(_vfs_zfs, OID_AUTO, resilver_delay, CTLFLAG_RWTUN, _resilver_delay, 0, "Number of ticks to delay resilver"); SYSCTL_UINT(_vfs_zfs, OID_AUTO, scrub_delay, CTLFLAG_RWTUN, @@ -1538,7 +1530,6 @@ dsl_scan_prefetch_thread(void *arg) dsl_scan_t *scn = arg; spa_t *spa = scn->scn_dp->dp_spa; vdev_t *rvd = spa->spa_root_vdev; - uint64_t maxinflight = rvd->vdev_children * zfs_top_maxinflight; scan_prefetch_issue_ctx_t *spic; /* loop until we are told to stop */ ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 07:19:59PM +0100, Dimitry Andric wrote: > On 5 Mar 2020, at 18:44, Gleb Smirnoff wrote: > > > > On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: > > S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to > > 'struct > > S> > > D> if_msghdr *' increases required alignment from 1 to 4 > > S> > > D> [-Werror,-Wcast-align] > > S> > > D> ifm = (struct if_msghdr *)buf; > > S> > > D> ^~~ > > S> > > D> 1 error generated. > > S> > > D> > > S> > > D> In practice I don't think the buffer can ever get misaligned, so > > can you > > S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? > > S> > > > > S> > > route(8) handles the same problem via intermediate (void *) cast. > > What is > > S> > > preferred way to solve the problem? Change compiler flags file wide, > > or > > S> > > just through (void *) cast? > > S> > > > S> > Copy to aligned buffer or got SIGBUS on some architectures? > > S> > > S> char buf[2048] __aligned(__alignof(struct if_msghdr)); > > S> > > S> resolve this watning. > > > > Thanks, Slawa! I think this is the most elegant solution. > > Why don't just declare the buffer as: > > struct if_msghdr buf; > > and then do: > > nread = read(s, , sizeof buf); > > ? You are never reading more than one if_msghdr anyway, and then there > is no need to cast anything. My inspiration: route socket can return other messages (man 4 route) ___ 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: r358655 - head/sbin/mount_nfs
On 5 Mar 2020, at 18:44, Gleb Smirnoff wrote: > > On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: > S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to > 'struct > S> > > D> if_msghdr *' increases required alignment from 1 to 4 > S> > > D> [-Werror,-Wcast-align] > S> > > D> ifm = (struct if_msghdr *)buf; > S> > > D> ^~~ > S> > > D> 1 error generated. > S> > > D> > S> > > D> In practice I don't think the buffer can ever get misaligned, so > can you > S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? > S> > > > S> > > route(8) handles the same problem via intermediate (void *) cast. What > is > S> > > preferred way to solve the problem? Change compiler flags file wide, or > S> > > just through (void *) cast? > S> > > S> > Copy to aligned buffer or got SIGBUS on some architectures? > S> > S> char buf[2048] __aligned(__alignof(struct if_msghdr)); > S> > S> resolve this watning. > > Thanks, Slawa! I think this is the most elegant solution. Why don't just declare the buffer as: struct if_msghdr buf; and then do: nread = read(s, , sizeof buf); ? You are never reading more than one if_msghdr anyway, and then there is no need to cast anything. -Dimitry signature.asc Description: Message signed with OpenPGP
Re: svn commit: r358556 - in head: libexec/tftpd libexec/tftpd/tests usr.bin/tftp
On Mon, Mar 2, 2020 at 5:19 PM John Baldwin wrote: > > Author: jhb > Date: Mon Mar 2 22:19:30 2020 > New Revision: 358556 > URL: https://svnweb.freebsd.org/changeset/base/358556 > > Log: > Add support for the TFTP windowsize option described in RFC 7440. > > The windowsize option permits multiple blocks to be transmitted > before the receiver sends an ACK improving throughput for larger > files. > > Reviewed by: asomers > MFC after:2 weeks > Sponsored by: DARPA > Differential Revision:https://reviews.freebsd.org/D23836 > > Modified: > head/libexec/tftpd/tests/functional.c > head/libexec/tftpd/tftp-file.c > head/libexec/tftpd/tftp-file.h > head/libexec/tftpd/tftp-options.c > head/libexec/tftpd/tftp-options.h > head/libexec/tftpd/tftp-transfer.c > head/libexec/tftpd/tftp-utils.c > head/libexec/tftpd/tftp-utils.h > head/libexec/tftpd/tftpd.8 > head/usr.bin/tftp/main.c > head/usr.bin/tftp/tftp.1 > > Modified: head/libexec/tftpd/tests/functional.c > == > --- head/libexec/tftpd/tests/functional.c Mon Mar 2 21:19:51 2020 > (r358555) > +++ head/libexec/tftpd/tests/functional.c Mon Mar 2 22:19:30 2020 > (r358556) > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -89,6 +90,13 @@ recv_ack(uint16_t blocknum) > RECV(hdr, NULL, 0); > } > > +static void > +recv_oack(const char *options, size_t options_len) > +{ > + char hdr[] = {0, 6}; > + RECV(hdr, options, options_len); > +} > + > /* > * Receive a data packet from tftpd > * @param blocknumExpected block number to be received > @@ -159,6 +167,11 @@ send_ack(uint16_t blocknum) > > } > > +/* > + * build an option string > + */ > +#define OPTION_STR(name, value)name "\000" value "\000" > + > /* > * send a read request to tftpd. > * @param filenamefilename as a string, absolute or relative > @@ -166,6 +179,11 @@ send_ack(uint16_t blocknum) > */ > #define SEND_RRQ(filename, mode) SEND_STR("\0\001" filename "\0" mode "\0") > > +/* > + * send a read request with options > + */ > +#define SEND_RRQ_OPT(filename, mode, options) SEND_STR("\0\001" filename > "\0" mode "\000" options) > + > /* > * send a write request to tftpd. > * @param filenamefilename as a string, absolute or relative > @@ -173,6 +191,11 @@ send_ack(uint16_t blocknum) > */ > #define SEND_WRQ(filename, mode) SEND_STR("\0\002" filename "\0" mode "\0") > > +/* > + * send a write request with options > + */ > +#define SEND_WRQ_OPT(filename, mode, options) SEND_STR("\0\002" filename > "\0" mode "\000" options) > + > /* Define a test case, for both IPv4 and IPv6 */ > #define TFTPD_TC_DEFINE(name, head, ...) \ > static void \ > @@ -573,6 +596,32 @@ TFTPD_TC_DEFINE(rrq_medium,) > } > > /* > + * Read a medium file with a window size of 2. > + */ > +TFTPD_TC_DEFINE(rrq_medium_window,) > +{ > + int fd; > + size_t i; > + uint32_t contents[192]; > + char options[] = OPTION_STR("windowsize", "2"); > + > + for (i = 0; i < nitems(contents); i++) > + contents[i] = i; > + > + fd = open("medium.txt", O_RDWR | O_CREAT, 0644); > + ATF_REQUIRE(fd >= 0); > + write_all(fd, contents, sizeof(contents)); > + close(fd); > + > + SEND_RRQ_OPT("medium.txt", "octet", OPTION_STR("windowsize", "2")); > + recv_oack(options, sizeof(options) - 1); > + send_ack(0); > + recv_data(1, (const char*)[0], 512); > + recv_data(2, (const char*)[128], 256); > + send_ack(2); > +} > + > +/* > * Read a file in netascii format > */ > TFTPD_TC_DEFINE(rrq_netascii,) > @@ -652,6 +701,59 @@ TFTPD_TC_DEFINE(rrq_small,) > } > > /* > + * Read a file following the example in RFC 7440. > + */ > +TFTPD_TC_DEFINE(rrq_window_rfc7440,) > +{ > + int fd; > + size_t i; > + char options[] = OPTION_STR("windowsize", "4"); > + alignas(uint32_t) char contents[13 * 512 - 4]; > + uint32_t *u32p; > + > + u32p = (uint32_t *)contents; > + for (i = 0; i < sizeof(contents) / sizeof(uint32_t); i++) > + u32p[i] = i; > + > + fd = open("rfc7440.txt", O_RDWR | O_CREAT, 0644); > + ATF_REQUIRE(fd >= 0); > + write_all(fd, contents, sizeof(contents)); > + close(fd); > + > + SEND_RRQ_OPT("rfc7440.txt", "octet", OPTION_STR("windowsize", "4")); > + recv_oack(options, sizeof(options) - 1); > + send_ack(0); > + recv_data(1, [0 * 512], 512); > + recv_data(2, [1 * 512], 512); > + recv_data(3, [2 * 512], 512); > + recv_data(4, [3 * 512], 512); > + send_ack(4); > + recv_data(5, [4 * 512], 512); > + recv_data(6, [5 * 512], 512); > + recv_data(7, [6 * 512], 512); > + recv_data(8, [7 * 512], 512); > + > + /* ACK 5 as
svn commit: r358680 - vendor/llvm-project/llvmorg-10.0.0-rc3-1-gc290cb61fdc
Author: dim Date: Thu Mar 5 18:06:29 2020 New Revision: 358680 URL: https://svnweb.freebsd.org/changeset/base/358680 Log: Tag llvm-project branch release/10.x llvmorg-10.0.0-rc3-1-gc290cb61fdc. Added: vendor/llvm-project/llvmorg-10.0.0-rc3-1-gc290cb61fdc/ - copied from r358679, vendor/llvm-project/release-10.x/ ___ 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: r358679 - in vendor/llvm-project/release-10.x: clang/include/clang/AST clang/include/clang/Sema clang/lib/AST clang/lib/Format clang/lib/Parse clang/lib/Sema lld/docs lldb/source/Plugin...
Author: dim Date: Thu Mar 5 18:05:37 2020 New Revision: 358679 URL: https://svnweb.freebsd.org/changeset/base/358679 Log: Vendor import of llvm-project branch release/10.x llvmorg-10.0.0-rc3-1-gc290cb61fdc. Added: vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/ vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/WindowsSupport.h (contents, props changed) Deleted: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/WindowsSupport.h Modified: vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h vendor/llvm-project/release-10.x/clang/lib/AST/ASTImporter.cpp vendor/llvm-project/release-10.x/clang/lib/Format/TokenAnnotator.cpp vendor/llvm-project/release-10.x/clang/lib/Parse/ParseExpr.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExpr.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExprCXX.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/TreeTransform.h vendor/llvm-project/release-10.x/lld/docs/ReleaseNotes.rst vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp vendor/llvm-project/release-10.x/llvm/include/llvm/module.modulemap vendor/llvm-project/release-10.x/llvm/lib/Analysis/TargetLibraryInfo.cpp vendor/llvm-project/release-10.x/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/CRC.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/Compression.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/CrashRecoveryContext.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/InitLLVM.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/RandomNumberGenerator.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/DynamicLibrary.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Host.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Memory.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Path.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Process.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Program.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Signals.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/ThreadLocal.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Threading.inc vendor/llvm-project/release-10.x/llvm/lib/Support/raw_ostream.cpp vendor/llvm-project/release-10.x/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp vendor/llvm-project/release-10.x/llvm/lib/Transforms/Scalar/SROA.cpp vendor/llvm-project/release-10.x/llvm/tools/llvm-ar/llvm-ar.cpp Modified: vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h == --- vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h Thu Mar 5 17:55:36 2020(r358678) +++ vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h Thu Mar 5 18:05:37 2020(r358679) @@ -3955,14 +3955,14 @@ class StmtExpr : public Expr { Stmt *SubStmt; SourceLocation LParenLoc, RParenLoc; public: - // FIXME: Does type-dependence need to be computed differently? - // FIXME: Do we need to compute instantiation instantiation-dependence for - // statements? (ugh!) StmtExpr(CompoundStmt *substmt, QualType T, - SourceLocation lp, SourceLocation rp) : + SourceLocation lp, SourceLocation rp, bool InDependentContext) : +// Note: we treat a statement-expression in a dependent context as always +// being value- and instantiation-dependent. This matches the behavior of +// lambda-expressions and GCC. Expr(StmtExprClass, T, VK_RValue, OK_Ordinary, - T->isDependentType(), false, false, false), -SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { } + T->isDependentType(), InDependentContext, InDependentContext, false), +SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) {} /// Build an empty statement expression. explicit StmtExpr(EmptyShell Empty) : Expr(StmtExprClass, Empty) { } Modified: vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h == --- vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.hThu Mar 5 17:55:36 2020(r358678) +++ vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.hThu Mar 5 18:05:37 2020(r358679) @@ -4923,7 +4923,7 @@ class Sema final { (public) LabelDecl *TheDecl); void ActOnStartStmtExpr(); - ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, + ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); //
svn commit: r358677 - head
Author: dim Date: Thu Mar 5 17:53:38 2020 New Revision: 358677 URL: https://svnweb.freebsd.org/changeset/base/358677 Log: Remove duplicate usr/libexec/cc1plus entry from ObsoleteFiles.inc. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Mar 5 15:52:34 2020(r358676) +++ head/ObsoleteFiles.inc Thu Mar 5 17:53:38 2020(r358677) @@ -648,7 +648,6 @@ OLD_FILES+=usr/lib32/libsupc++.so OLD_LIBS+=usr/lib32/libsupc++.so.1 OLD_FILES+=usr/lib32/libsupc++_p.a .endif -OLD_FILES+=usr/libexec/cc1plus OLD_LIBS+=usr/lib/libgomp.so.1 OLD_FILES+=usr/lib/libgomp_p.a OLD_FILES+=usr/lib32/libgcov.a ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct S> > > D> if_msghdr *' increases required alignment from 1 to 4 S> > > D> [-Werror,-Wcast-align] S> > > D> ifm = (struct if_msghdr *)buf; S> > > D> ^~~ S> > > D> 1 error generated. S> > > D> S> > > D> In practice I don't think the buffer can ever get misaligned, so can you S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? S> > > S> > > route(8) handles the same problem via intermediate (void *) cast. What is S> > > preferred way to solve the problem? Change compiler flags file wide, or S> > > just through (void *) cast? S> > S> > Copy to aligned buffer or got SIGBUS on some architectures? S> S> char buf[2048] __aligned(__alignof(struct if_msghdr)); S> S> resolve this watning. Thanks, Slawa! I think this is the most elegant solution. -- Gleb Smirnoff ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 08:24:54PM +0300, Slawa Olhovchenkov wrote: > On Thu, Mar 05, 2020 at 08:33:50AM -0800, Gleb Smirnoff wrote: > > > On Thu, Mar 05, 2020 at 03:29:23PM +0100, Dimitry Andric wrote: > > D> On 2020-03-04 23:27, Gleb Smirnoff wrote: > > D> > Author: glebius > > D> > Date: Wed Mar 4 22:27:16 2020 > > D> > New Revision: 358655 > > D> > URL: https://svnweb.freebsd.org/changeset/base/358655 > > D> > > > D> > Log: > > D> >When a machine boots the NFS mounting script is executed after > > D> >interfaces are configured, but for many interfaces (e.g. all Intel) > > D> >ifconfig causes link renegotiation, so the first attempt to mount > > D> >NFS always fails. After that mount_nfs sleeps for 30 seconds, while > > D> >only a couple seconds are actually required for interface to get up. > > D> >Instead of sleeping, do select(2) on routing socket and check if > > D> >some interface became UP and in this case retry immediately. > > D> > > D> At least on i386, this causes a -Werror warning: > > D> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct > > D> if_msghdr *' increases required alignment from 1 to 4 > > D> [-Werror,-Wcast-align] > > D> ifm = (struct if_msghdr *)buf; > > D> ^~~ > > D> 1 error generated. > > D> > > D> In practice I don't think the buffer can ever get misaligned, so can you > > D> please add a NO_WCAST_ALIGN= to the Makefile? > > > > route(8) handles the same problem via intermediate (void *) cast. What is > > preferred way to solve the problem? Change compiler flags file wide, or > > just through (void *) cast? > > Copy to aligned buffer or got SIGBUS on some architectures? char buf[2048] __aligned(__alignof(struct if_msghdr)); resolve this watning. ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 08:33:50AM -0800, Gleb Smirnoff wrote: > On Thu, Mar 05, 2020 at 03:29:23PM +0100, Dimitry Andric wrote: > D> On 2020-03-04 23:27, Gleb Smirnoff wrote: > D> > Author: glebius > D> > Date: Wed Mar 4 22:27:16 2020 > D> > New Revision: 358655 > D> > URL: https://svnweb.freebsd.org/changeset/base/358655 > D> > > D> > Log: > D> >When a machine boots the NFS mounting script is executed after > D> >interfaces are configured, but for many interfaces (e.g. all Intel) > D> >ifconfig causes link renegotiation, so the first attempt to mount > D> >NFS always fails. After that mount_nfs sleeps for 30 seconds, while > D> >only a couple seconds are actually required for interface to get up. > D> >Instead of sleeping, do select(2) on routing socket and check if > D> >some interface became UP and in this case retry immediately. > D> > D> At least on i386, this causes a -Werror warning: > D> > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct > D> if_msghdr *' increases required alignment from 1 to 4 > D> [-Werror,-Wcast-align] > D> ifm = (struct if_msghdr *)buf; > D> ^~~ > D> 1 error generated. > D> > D> In practice I don't think the buffer can ever get misaligned, so can you > D> please add a NO_WCAST_ALIGN= to the Makefile? > > route(8) handles the same problem via intermediate (void *) cast. What is > preferred way to solve the problem? Change compiler flags file wide, or > just through (void *) cast? Copy to aligned buffer or got SIGBUS on some architectures? ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 03:29:23PM +0100, Dimitry Andric wrote: D> On 2020-03-04 23:27, Gleb Smirnoff wrote: D> > Author: glebius D> > Date: Wed Mar 4 22:27:16 2020 D> > New Revision: 358655 D> > URL: https://svnweb.freebsd.org/changeset/base/358655 D> > D> > Log: D> >When a machine boots the NFS mounting script is executed after D> >interfaces are configured, but for many interfaces (e.g. all Intel) D> >ifconfig causes link renegotiation, so the first attempt to mount D> >NFS always fails. After that mount_nfs sleeps for 30 seconds, while D> >only a couple seconds are actually required for interface to get up. D> >Instead of sleeping, do select(2) on routing socket and check if D> >some interface became UP and in this case retry immediately. D> D> At least on i386, this causes a -Werror warning: D> D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct D> if_msghdr *' increases required alignment from 1 to 4 D> [-Werror,-Wcast-align] D> ifm = (struct if_msghdr *)buf; D> ^~~ D> 1 error generated. D> D> In practice I don't think the buffer can ever get misaligned, so can you D> please add a NO_WCAST_ALIGN= to the Makefile? route(8) handles the same problem via intermediate (void *) cast. What is preferred way to solve the problem? Change compiler flags file wide, or just through (void *) cast? -- Gleb Smirnoff ___ 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: r358676 - head/sys/kern
Author: kib Date: Thu Mar 5 15:52:34 2020 New Revision: 358676 URL: https://svnweb.freebsd.org/changeset/base/358676 Log: buffer pager: deref ucred immediately after read. Ucred is passed to bread(9) so that non-local filesystems use proper credentials. But, since clean buffer might be cached unless buf_pager_relbuf is not enabled, it makes credentials to have extra reference until buffer is reclaimed. Ucred reference would prevent jail from destroying if creds are jailed. Dereferencing the read credentials on the valid buffer avoid that, and should be fine because the buffer is valid and does not need re-read. PR: 238032 Reported by: bz Reproduced and tested by: pho Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D23775 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Thu Mar 5 15:51:44 2020(r358675) +++ head/sys/kern/vfs_bio.c Thu Mar 5 15:52:34 2020(r358676) @@ -5187,6 +5187,10 @@ again: br_flags, ); if (error != 0) goto end_pages; + if (bp->b_rcred == curthread->td_ucred) { + crfree(bp->b_rcred); + bp->b_rcred = NOCRED; + } if (LIST_EMPTY(>b_dep)) { /* * Invalidation clears m->valid, but ___ 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: r358675 - head/lib/libc/sys
Author: emaste Date: Thu Mar 5 15:51:44 2020 New Revision: 358675 URL: https://svnweb.freebsd.org/changeset/base/358675 Log: umtx_op.2: correct typo PR: 244611 Submitted by: John F. Carr MFC after:3 days Modified: head/lib/libc/sys/_umtx_op.2 Modified: head/lib/libc/sys/_umtx_op.2 == --- head/lib/libc/sys/_umtx_op.2Thu Mar 5 14:52:24 2020 (r358674) +++ head/lib/libc/sys/_umtx_op.2Thu Mar 5 15:51:44 2020 (r358675) @@ -99,7 +99,7 @@ The constants are defined for special values: .It Dv UMUTEX_UNOWNED Zero, the value stored in the unowned lock. .It Dv UMUTEX_CONTESTED -The contenion indicator. +The contention indicator. .It Dv UMUTEX_RB_OWNERDEAD A thread owning the robust mutex terminated. The mutex is in unlocked state. ___ 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: r346018 - head/sys/conf
Wow, what a speedy response, and so late at night! Thanks! On Wed, Mar 4, 2020 at 11:22 PM Warner Losh wrote: > > > On Wed, Mar 4, 2020 at 10:27 PM Alan Somers wrote: > >> On Sun, Apr 7, 2019 at 12:40 PM Warner Losh wrote: >> >>> Author: imp >>> Date: Sun Apr 7 18:39:55 2019 >>> New Revision: 346018 >>> URL: https://svnweb.freebsd.org/changeset/base/346018 >>> >>> Log: >>> Use default shell assignment rather more complicated if then >>> construct. >>> >>> Discussed with: emaste@, allanjude@ (changes (or not) based on their >>> feedback) >>> Differential Revision: https://reviews.freebsd.org/D19797 >>> >> >> Can we MFC this to stable/12? Before this change, setting >> BRANCH_OVERRIDE during "make release" would have no effect. >> > > Sure thing. There was a merge conflict, which makes sense, but I think I > resolved it correctly. > > Warner > ___ 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: r358674 - head/lib/libc/gen
Author: 0mp (doc,ports committer) Date: Thu Mar 5 14:52:24 2020 New Revision: 358674 URL: https://svnweb.freebsd.org/changeset/base/358674 Log: ftw.3: Add examples PR: 173448 [1] Submitted by: fernape@ (previous version) [1] Reviewed by: jilles Approved by: bcr (mentor) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D21750 Modified: head/lib/libc/gen/ftw.3 Modified: head/lib/libc/gen/ftw.3 == --- head/lib/libc/gen/ftw.3 Thu Mar 5 14:41:27 2020(r358673) +++ head/lib/libc/gen/ftw.3 Thu Mar 5 14:52:24 2020(r358674) @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 5, 2004 +.Dd March 5, 2020 .Dt FTW 3 .Os .Sh NAME @@ -157,6 +157,65 @@ and will stop processing the tree and return the value from .Fa fn . Both functions return \-1 if an error is detected. +.Sh EXAMPLES +Following there is an example that shows how +.Nm nftw +can be used. +It traverses the file tree starting at the directory pointed +by the only program argument and shows the complete path and a brief +indicator about the file type. +.Bd -literal -offset 2n +#include +#include +#include + +int +nftw_callback(const char *path, const struct stat *sb, int typeflag, struct FTW *ftw) +{ + char type; + + switch(typeflag) { + case FTW_F: + type = 'F'; + break; + case FTW_D: + type = 'D'; + break; + case FTW_DNR: + type = '-'; + break; + case FTW_DP: + type = 'd'; + break; + case FTW_NS: + type = 'X'; + break; + case FTW_SL: + type = 'S'; + break; + case FTW_SLN: + type = 's'; + break; + default: + type = '?'; + break; + } + + printf("[%c] %s\\n", type, path); + + return (0); +} + +int +main(int argc, char **argv) +{ + if (argc != 2) { + printf("Usage %s \\n", argv[0]); + return (EX_USAGE); + } else + return (nftw(argv[1], nftw_callback, /* UNUSED */ 1, 0)); +} +.Ed .Sh ERRORS The .Fn ftw ___ 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: r358483 - head/sys/compat/linux
On Thu, 5 Mar 2020 16:15:10 +0300 Yuri Pankov wrote: > Tijl Coosemans wrote: >> Author: tijl >> Date: Sun Mar 1 13:12:04 2020 >> New Revision: 358483 >> URL: https://svnweb.freebsd.org/changeset/base/358483 >> >> Log: >>linuxulator: Map scheduler priorities to Linux priorities. >> >>On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR >>scheduling policies is [1,99]. For SCHED_OTHER the single valid priority >> is >>0. On FreeBSD it is [0,31] for all policies. Programs are supposed to >>query the valid range using sched_get_priority_(min|max), but of course >> some >>programs assume the Linux values are valid. >> >>This commit adds a tunable compat.linux.map_sched_prio. When enabled >>sched_get_priority_(min|max) return the Linux values and >> sched_setscheduler >>and sched_(get|set)param translate between FreeBSD and Linux values. >> >>Because there are more Linux levels than FreeBSD levels, multiple Linux >>levels map to a single FreeBSD level, which means pre-emption might not >>happen as it does on Linux, so the tunable allows to disable this >> behaviour. >>It is enabled by default because I think it is unlikely that anyone runs >>real-time software under Linux emulation on FreeBSD that critically relies >>on correct pre-emption. >> >>This fixes FMOD, a commercial sound library used by several games. >> >>PR: 240043 >>Tested by:Alex S >>Reviewed by: dchagin >>MFC after:2 weeks >>Differential Revision:https://reviews.freebsd.org/D23790 >> >> Modified: >>head/sys/compat/linux/linux_misc.c >>head/sys/compat/linux/linux_misc.h >> >> Modified: head/sys/compat/linux/linux_misc.c >> == >> --- head/sys/compat/linux/linux_misc.c Sun Mar 1 12:34:27 2020 >> (r358482) >> +++ head/sys/compat/linux/linux_misc.c Sun Mar 1 13:12:04 2020 >> (r358483) >> @@ -144,6 +144,11 @@ struct l_pselect6arg { >> l_size_tss_len; >> }; >> >> +static bool map_sched_prio = true; >> +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, >> +_sched_prio, 0, "Map scheduler priorities to Linux priorities " >> +"(not POSIX compliant)"); > > I'm seeing the following in the log: > > sysctl_warn_reuse: can't re-use a leaf (compat.linux.map_sched_prio)! > > Should this be done for both linux and linux32 (when one exists) or made > to install one time only? Ah, thanks for the report, I've moved it to linux_common in r358673. ___ 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: r358673 - head/sys/compat/linux
Author: tijl Date: Thu Mar 5 14:41:27 2020 New Revision: 358673 URL: https://svnweb.freebsd.org/changeset/base/358673 Log: Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is only defined by linux_common kernel module and not both linux and linux64 modules. Reported by: Yuri Pankov Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_mib.c == --- head/sys/compat/linux/linux_mib.c Thu Mar 5 14:13:22 2020 (r358672) +++ head/sys/compat/linux/linux_mib.c Thu Mar 5 14:41:27 2020 (r358673) @@ -71,6 +71,11 @@ int linux_preserve_vstatus = 0; SYSCTL_INT(_compat_linux, OID_AUTO, preserve_vstatus, CTLFLAG_RWTUN, _preserve_vstatus, 0, "Preserve VSTATUS termios(4) flag"); +bool linux_map_sched_prio = true; +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, +_map_sched_prio, 0, "Map scheduler priorities to Linux priorities " +"(not POSIX compliant)"); + static int linux_set_osname(struct thread *td, char *osname); static int linux_set_osrelease(struct thread *td, char *osrelease); static int linux_set_oss_version(struct thread *td, int oss_version); Modified: head/sys/compat/linux/linux_mib.h == --- head/sys/compat/linux/linux_mib.h Thu Mar 5 14:13:22 2020 (r358672) +++ head/sys/compat/linux/linux_mib.h Thu Mar 5 14:41:27 2020 (r358673) @@ -64,5 +64,6 @@ int linux_kernver(struct thread *td); extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; +extern bool linux_map_sched_prio; #endif /* _LINUX_MIB_H_ */ Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Thu Mar 5 14:13:22 2020 (r358672) +++ head/sys/compat/linux/linux_misc.c Thu Mar 5 14:41:27 2020 (r358673) @@ -144,11 +144,6 @@ struct l_pselect6arg { l_size_tss_len; }; -static bool map_sched_prio = true; -SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, -_sched_prio, 0, "Map scheduler priorities to Linux priorities " -"(not POSIX compliant)"); - static int linux_utimensat_nsec_valid(l_long); @@ -1424,7 +1419,7 @@ linux_sched_setscheduler(struct thread *td, if (error) return (error); - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (policy) { case SCHED_OTHER: if (sched_param.sched_priority != 0) @@ -1494,7 +1489,7 @@ linux_sched_get_priority_max(struct thread *td, { struct sched_get_priority_max_args bsd; - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (args->policy) { case LINUX_SCHED_OTHER: td->td_retval[0] = 0; @@ -1530,7 +1525,7 @@ linux_sched_get_priority_min(struct thread *td, { struct sched_get_priority_min_args bsd; - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (args->policy) { case LINUX_SCHED_OTHER: td->td_retval[0] = 0; @@ -1934,7 +1929,7 @@ linux_sched_setparam(struct thread *td, if (tdt == NULL) return (ESRCH); - if( map_sched_prio ) { + if (linux_map_sched_prio) { error = kern_sched_getscheduler(td, tdt, ); if (error) goto out; @@ -1990,7 +1985,7 @@ linux_sched_getparam(struct thread *td, return (error); } - if (map_sched_prio) { + if (linux_map_sched_prio) { error = kern_sched_getscheduler(td, tdt, ); PROC_UNLOCK(tdt->td_proc); if (error) ___ 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: r358655 - head/sbin/mount_nfs
On 2020-03-04 23:27, Gleb Smirnoff wrote: Author: glebius Date: Wed Mar 4 22:27:16 2020 New Revision: 358655 URL: https://svnweb.freebsd.org/changeset/base/358655 Log: When a machine boots the NFS mounting script is executed after interfaces are configured, but for many interfaces (e.g. all Intel) ifconfig causes link renegotiation, so the first attempt to mount NFS always fails. After that mount_nfs sleeps for 30 seconds, while only a couple seconds are actually required for interface to get up. Instead of sleeping, do select(2) on routing socket and check if some interface became UP and in this case retry immediately. At least on i386, this causes a -Werror warning: sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct if_msghdr *' increases required alignment from 1 to 4 [-Werror,-Wcast-align] ifm = (struct if_msghdr *)buf; ^~~ 1 error generated. In practice I don't think the buffer can ever get misaligned, so can you please add a NO_WCAST_ALIGN= to the Makefile? -Dimitry ___ 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: r358672 - head/lib/libc/powerpc64/string
Author: alfredo Date: Thu Mar 5 14:13:22 2020 New Revision: 358672 URL: https://svnweb.freebsd.org/changeset/base/358672 Log: [PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07 VSX instructions were added in POWER ISA V2.06 (POWER7), but it requires data to be word-aligned. Such requirement was removed in ISA V2.07B (POWER8). Since current memcpy/bcopy optimization relies on VSX instructions handling misalignment transparently, and kernel doesn't currently implement an alignment error handler, this optimzation should be restrict to ISA V2.07 onwards. SIGBUS on stxvd2x instruction was reproduced in POWER7+ CPU. Reviewed by: luporl, jhibbits, bdragon Approved by: jhibbits (mentor) Differential Revision:https://reviews.freebsd.org/D23958 Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c Modified: head/lib/libc/powerpc64/string/bcopy_resolver.c == --- head/lib/libc/powerpc64/string/bcopy_resolver.c Thu Mar 5 14:05:22 2020(r358671) +++ head/lib/libc/powerpc64/string/bcopy_resolver.c Thu Mar 5 14:13:22 2020(r358672) @@ -61,7 +61,12 @@ FN_RET FN_NAME_VSX FN_PARAMS; DEFINE_UIFUNC(, FN_RET, FN_NAME, FN_PARAMS) { - if (cpu_features & PPC_FEATURE_HAS_VSX) + /* VSX instructions were added in POWER ISA 2.06, +* however it requires data to be word-aligned. +* Since POWER ISA 2.07B this is solved transparently +* by the hardware +*/ + if (cpu_features2 & PPC_FEATURE2_ARCH_2_07) return (FN_NAME_VSX); else return (FN_NAME_NOVSX); ___ 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: r358671 - stable/12/sys/conf
Author: imp Date: Thu Mar 5 14:05:22 2020 New Revision: 358671 URL: https://svnweb.freebsd.org/changeset/base/358671 Log: MFC r346022: r346022 | imp | 2019-04-07 15:01:02 -0600 (Sun, 07 Apr 2019) | 23 lines Make RELDATE be on a single line. All variable assignments that start in column 1 have to be on a single line for amd to build due to as weird dependency there (most likely it can be fixed to use the new VARS_ONLY feature, but it isn't today). usr.sbin/amd/include/Makefile calls usr.sbin/amd/include/newvers.sh which does: eval `LC_ALL=C egrep '^[A-Z]+=' $1 | grep -v COPYRIGHT` which is where that requirement comes from. It handles COPYRIGHT since that's an exception. Rather than add additional exceptions, cope with the long line in newvers.sh instead. Note: it no longer needs to filter COPYRIGHT because the assignment doesn't start in column 1 anymore. I had done a universe when I had an earlier version of r346018 that had it as one line. When I changed it to multi-line as suggested in the review, I only built kernels on a couple of architectures to make sure it didn't break anything. Add comment to newvers.sh noting this. Obviously, this unbreaks the amd build. Modified: stable/12/sys/conf/newvers.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/newvers.sh == --- stable/12/sys/conf/newvers.sh Thu Mar 5 12:24:48 2020 (r358670) +++ stable/12/sys/conf/newvers.sh Thu Mar 5 14:05:22 2020 (r358671) @@ -44,6 +44,9 @@ # checkout from a version control system. Metadata is # included if the tree is modified. +# Note: usr.sbin/amd/include/newvers.sh assumes all variable assignments of +# upper case variables starting in column 1 are on one line w/o continuation. + TYPE="FreeBSD" REVISION="12.1" BRANCH=${BRANCH_OVERRIDE:-STABLE} @@ -77,8 +80,7 @@ if [ -z "${SYSDIR}" ]; then SYSDIR=$(dirname $0)/.. fi -RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ - ${PARAMFILE:-${SYSDIR}/sys/param.h}) +RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h}) if [ -r "${SYSDIR}/../COPYRIGHT" ]; then year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' ${SYSDIR}/../COPYRIGHT) ___ 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: r358483 - head/sys/compat/linux
Tijl Coosemans wrote: Author: tijl Date: Sun Mar 1 13:12:04 2020 New Revision: 358483 URL: https://svnweb.freebsd.org/changeset/base/358483 Log: linuxulator: Map scheduler priorities to Linux priorities. On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR scheduling policies is [1,99]. For SCHED_OTHER the single valid priority is 0. On FreeBSD it is [0,31] for all policies. Programs are supposed to query the valid range using sched_get_priority_(min|max), but of course some programs assume the Linux values are valid. This commit adds a tunable compat.linux.map_sched_prio. When enabled sched_get_priority_(min|max) return the Linux values and sched_setscheduler and sched_(get|set)param translate between FreeBSD and Linux values. Because there are more Linux levels than FreeBSD levels, multiple Linux levels map to a single FreeBSD level, which means pre-emption might not happen as it does on Linux, so the tunable allows to disable this behaviour. It is enabled by default because I think it is unlikely that anyone runs real-time software under Linux emulation on FreeBSD that critically relies on correct pre-emption. This fixes FMOD, a commercial sound library used by several games. PR: 240043 Tested by: Alex S Reviewed by: dchagin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23790 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Sun Mar 1 12:34:27 2020 (r358482) +++ head/sys/compat/linux/linux_misc.c Sun Mar 1 13:12:04 2020 (r358483) @@ -144,6 +144,11 @@ struct l_pselect6arg { l_size_tss_len; }; +static bool map_sched_prio = true; +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, +_sched_prio, 0, "Map scheduler priorities to Linux priorities " +"(not POSIX compliant)"); I'm seeing the following in the log: sysctl_warn_reuse: can't re-use a leaf (compat.linux.map_sched_prio)! Should this be done for both linux and linux32 (when one exists) or made to install one time only? ___ 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: r358670 - head/sys/powerpc/powerpc
Author: alfredo Date: Thu Mar 5 12:24:48 2020 New Revision: 358670 URL: https://svnweb.freebsd.org/changeset/base/358670 Log: [PowerPC64] fix uma_small_free panic Fix panic "Freeing UMA block at 0xn with no associated page". Also replaces pmap_remove call by pmap_kremove, for symmetry. Reviewed by: jhibbits Approved by: jhibbits (mentor) Differential Revision:https://reviews.freebsd.org/D23931 Modified: head/sys/powerpc/powerpc/uma_machdep.c Modified: head/sys/powerpc/powerpc/uma_machdep.c == --- head/sys/powerpc/powerpc/uma_machdep.c Thu Mar 5 10:52:16 2020 (r358669) +++ head/sys/powerpc/powerpc/uma_machdep.c Thu Mar 5 12:24:48 2020 (r358670) @@ -95,14 +95,13 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t fla { vm_page_t m; - if (!hw_direct_map) - pmap_remove(kernel_pmap,(vm_offset_t)mem, - (vm_offset_t)mem + PAGE_SIZE); - if (hw_direct_map) m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)mem)); - else - m = PHYS_TO_VM_PAGE((vm_offset_t)mem); + else { + m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)mem)); + pmap_kremove((vm_offset_t)mem); + } + KASSERT(m != NULL, ("Freeing UMA block at %p with no associated page", mem)); #ifdef __powerpc64__ ___ 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: r358669 - head/sys/arm64/include
Author: andrew Date: Thu Mar 5 10:52:16 2020 New Revision: 358669 URL: https://svnweb.freebsd.org/changeset/base/358669 Log: Mark the arm64 machdep.h as kernel only None of this is useful for userspace. Sponsored by: Innovate UK Modified: head/sys/arm64/include/machdep.h Modified: head/sys/arm64/include/machdep.h == --- head/sys/arm64/include/machdep.hThu Mar 5 09:20:32 2020 (r358668) +++ head/sys/arm64/include/machdep.hThu Mar 5 10:52:16 2020 (r358669) @@ -29,6 +29,8 @@ #ifndef _MACHINE_MACHDEP_H_ #define_MACHINE_MACHDEP_H_ +#ifdef _KERNEL + struct arm64_bootparams { vm_offset_t modulep; vm_offset_t kern_l1pt; /* L1 page table for the kernel */ @@ -55,5 +57,7 @@ vm_offset_t parse_boot_param(struct arm64_bootparams * void parse_fdt_bootargs(void); #endif extern void (*pagezero)(void *); + +#endif /* _KERNEL */ #endif /* _MACHINE_MACHDEP_H_ */ ___ 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"