Re: svn commit: r358733 - head/sys/sys
On 3/11/20 9:16 PM, Mateusz Guzik wrote: On 3/10/20, Konstantin Belousov wrote: On Tue, Mar 10, 2020 at 12:22:09AM +0100, Mateusz Guzik wrote: On 3/9/20, Konstantin Belousov wrote: On Mon, Mar 09, 2020 at 01:56:17AM +0100, Mateusz Guzik wrote: On 3/8/20, Mateusz Guzik wrote: Author: mjg Date: Sun Mar 8 00:22:32 2020 New Revision: 358733 URL: https://svnweb.freebsd.org/changeset/base/358733 Log: seqc: tidy up - avoid hand-rolled read - match begin/end in terms of fence style There were off lists questions about this so let me clarify. The first bit is a cosmetic change, but the second one is not. Modified: head/sys/sys/seqc.h Modified: head/sys/sys/seqc.h == --- head/sys/sys/seqc.h Sat Mar 7 15:37:23 2020(r358732) +++ head/sys/sys/seqc.h Sun Mar 8 00:22:32 2020(r358733) @@ -66,7 +66,8 @@ static __inline void seqc_write_end(seqc_t *seqcp) { - atomic_store_rel_int(seqcp, *seqcp + 1); + atomic_thread_fence_rel(); + *seqcp += 1; MPASS(!seqc_in_modify(*seqcp)); critical_exit(); } For correct operation the counter has to be modified *before* any work is done and *after* it is completed. Consider a trivial case: seqc++; foo[0] = 0; foo[1] = 1; seqc++; There are 2 ways in which this can be mucked with: - the compiler can be looking at reordering or reworking the increment (e.g., to collapse it to just += 2 instead). a compiler barrier prevents that. - even with generated machine code which increments in correct places the cpu can be looking at reordering the operation (which is heavily dependent on architecture), in particular it could end up issuing seqc++; foo[1] = 1; which would defeat the point. This is where release fences come in. With the patched code there is: seqc++; atomic_thread_fence_rel(); /* make sure seqc++ is issued before foo starts getting modified */ foo[0] = 0; foo[1] = 1; atomic_thread_fence_rel(); /* make sure modifications to foo don't leak past this spot */ seqc++; In comparison, the previous code was: seqc++; atomic_thread_fence_rel(); /* make sure seqc++ is issued before foo starts getting modified */ foo[0] = 0; foo[1] = 1; atomic_store_rel_int(seqcp, *seqcp + 1); /* make sure modifications to too don't leak past this spot and update seqc immediately */ There are 2 differences here -- one is an improvement and second one does not matter: the win is: the previous code forces the compiler to compute an incremented value and then store it. On amd64 this translates to the following (with rdx holding the address of the counter): mov(%rdx),%eax /* load the value */ add$0x1,%eax/* add 1 */ mov%eax,(%rdx) /* store it */ On patched kernel this is: addl $0x1,(%rdx) which is clearly much nicer. I am not sure that the new code on amd64 is much nicer. But the point was that on non-amd64, i.e. armv8 and potentially on powerpc 3.0, the patch substitutes release store with full barrier. The later is (much) slower. If an arch performs something significantly more expensive here it's probably a performance bug in the port. It is a question of how much hardware support for fine-grained fences. Relaxed architectures add some optimized operations already, but did not (yet) implemented complete C11 optimized set. I think they eventually converge. Until they did not, I think it is more important to not pessimize to-be Tier1 arches than to collapse three fast integer instructions on amd64 into one rw op. But perhaps more importantly there are significantly more frequent users of atomic_thread_fence_rel, like refcount(9). If the issue is real that should be looked at. For refcount(9) use of release fence removal, we would need atomic_fetchadd_rel_int(). To reiterate, if atomic_thread_fence_rel is indeed very expensive on certain architectures compared to other _rel variants, the kernel is already heavily pessimized because of use of said standalone fence in refcount(9) and few other places and this needs to be fixed. Just to be clear, this is not just a matter of whether our release fences are poorly or inefficiently implemented. Release fences (as defined by the C/C++ standards that inspire our atomics) have *different* semantics than release stores. Specifically, a release fence places more ordering restrictions on the nearby store accesses than a release store does. (In fact, "man 9 atomic" describes this.) Thus, it is almost inevitable that a release fence will have a higher cost than the best possible implementation of a release store. If the cost can't be reduced (e.g., perhaps this can do a no-op store + fence somewhere akin to how lock xadd 0,(%esp) trickery used to work), then the atomic APIs do indeed not to be completed w.r.t. adding all the missing acq/rel variants (that's at least fetchadd and swap). We can also extend the API to do relevant addition/subtraction without gua
Re: svn commit: r358733 - head/sys/sys
On 12/03/2020 09:48, Alan Cox wrote: > Just to be clear, this is not just a matter of whether our release fences are > poorly or inefficiently implemented. Release fences (as defined by the C/C++ > standards that inspire our atomics) have *different* semantics than release > stores. Specifically, a release fence places more ordering restrictions on the > nearby store accesses than a release store does. (In fact, "man 9 atomic" > describes this.) Thus, it is almost inevitable that a release fence will > have a > higher cost than the best possible implementation of a release store. For people like me who are new to these things here is a good explanation (perhaps a bad title, though): https://preshing.com/20131125/acquire-and-release-fences-dont-work-the-way-youd-expect/ -- Andriy Gapon ___ 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: r358907 - head
Author: dim Date: Thu Mar 12 11:39:04 2020 New Revision: 358907 URL: https://svnweb.freebsd.org/changeset/base/358907 Log: Allow -DNO_CLEAN build across r358851. The openmp 10.0.0 import renamed one .c file to .cpp, and this is something our dependency system does not handle correctly. Add another ad-hoc cleanup to get rid of the stale dependency. PR: 244251 MFC after:6 weeks X-MFC-With: 358851 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Thu Mar 12 06:45:08 2020(r358906) +++ head/Makefile.inc1 Thu Mar 12 11:39:04 2020(r358907) @@ -924,6 +924,15 @@ _sanity_check: .PHONY .MAKE _cleanobj_fast_depend_hack: .PHONY # Syscall stubs rewritten in C and obsolete MD assembly implementations # Date SVN Rev Syscalls/Changes +# 20200310 r358851 rename of openmp's ittnotify_static.c to .cpp +.for f in ittnotify_static + @if [ -e "${OBJTOP}/lib/libomp/.depend.${f}.pico" ] && \ + egrep -qw '${f}\.c' ${OBJTOP}/lib/libomp/.depend.${f}.pico; then \ + echo "Removing stale dependencies for ${f}"; \ + rm -f ${OBJTOP}/lib/libomp/.depend.${f}.* \ + ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libomp/.depend.${f}.*}; \ + fi +.endfor # 20191009 r353340 removal of opensolaris_atomic.S (also r353381) .if ${MACHINE} != i386 .for f in opensolaris_atomic ___ 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: r358908 - in head/sys: conf modules powerpc/conf
Author: luporl Date: Thu Mar 12 12:47:10 2020 New Revision: 358908 URL: https://svnweb.freebsd.org/changeset/base/358908 Log: Enable ixl device on PowerPC64 The ixl driver now works on PowerPC64 and may be compiled in-kernel and as a module. Reviewed by: alfredo, erj Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D23974 Modified: head/sys/conf/files.powerpc head/sys/conf/options.powerpc head/sys/modules/Makefile head/sys/powerpc/conf/GENERIC64 Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Thu Mar 12 11:39:04 2020(r358907) +++ head/sys/conf/files.powerpc Thu Mar 12 12:47:10 2020(r358908) @@ -38,6 +38,43 @@ dev/iicbus/max6690.c optionalmax6690 powermac dev/iicbus/ofw_iicbus.coptionaliicbus aim dev/ipmi/ipmi.coptionalipmi dev/ipmi/ipmi_opal.c optionalpowernv ipmi +dev/ixl/if_ixl.c optionalixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_main.c optionalixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_qmgr.c optionalixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_iov.c optionalixl pci pci_iov powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_i2c.c optionalixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/if_iavf.c optionaliavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/iavf_vc.c optionaliavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_txrx.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_osdep.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_lan_hmc.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_hmc.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_common.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_nvm.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_adminq.c optionalixl pci powerpc64 | \ + iavf pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/i40e_dcb.c optionalixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" # Most ofw stuff below is brought in by conf/files for options FDT, but # we always want it, even on non-FDT platforms. dev/fdt/simplebus.cstandard Modified: head/sys/conf/options.powerpc == --- head/sys/conf/options.powerpc Thu Mar 12 11:39:04 2020 (r358907) +++ head/sys/conf/options.powerpc Thu Mar 12 12:47:10 2020 (r358908) @@ -37,3 +37,5 @@ OFWCONS_POLL_HZ opt_ofw.h # AGP debugging support AGP_DEBUG opt_agp.h +# iWARP client interface support in ixl +IXL_IW opt_ixl.h Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Thu Mar 12 11:39:04 2020(r358907) +++ head/sys/modules/Makefile Thu Mar 12 12:47:10 2020(r358908) @@ -766,6 +766,7 @@ _virtio=virtio .if ${MACHINE_ARCH} == "powerpc64" _ipmi= ipmi +_ixl= ixl _nvram=opal_nvram .endif .if ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc" Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Thu Mar 12 11:39:04 2020 (r358907) +++ head/sys/powerpc/conf/GENERIC64 Thu Mar 12 12:47:10 2020 (r358908) @@ -168,6 +168,7 @@ device iflib # Ethernet hardware device em # Intel PRO/1000 Gigabit Ethernet Family device ix # Intel PRO/10GbE PCIE PF Ethernet Family +device ixl
svn commit: r358909 - head
Author: emaste Date: Thu Mar 12 13:42:08 2020 New Revision: 358909 URL: https://svnweb.freebsd.org/changeset/base/358909 Log: Extend r358907 to explicitly remove stale lib32 dependency After r325072 stale lib32 dependencies were not remooved. A more holistic approach is needed to address this but for the immediate issue (-DNO_CLEAN builds across r358851) just readd the explicit lib32 path. Reported by: dim Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Thu Mar 12 12:47:10 2020(r358908) +++ head/Makefile.inc1 Thu Mar 12 13:42:08 2020(r358909) @@ -930,6 +930,7 @@ _cleanobj_fast_depend_hack: .PHONY egrep -qw '${f}\.c' ${OBJTOP}/lib/libomp/.depend.${f}.pico; then \ echo "Removing stale dependencies for ${f}"; \ rm -f ${OBJTOP}/lib/libomp/.depend.${f}.* \ + ${OBJTOP}/obj-lib32/lib/libomp/.depend.${f}.* \ ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libomp/.depend.${f}.*}; \ fi .endfor ___ 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: r358910 - head
Author: emaste Date: Thu Mar 12 14:01:17 2020 New Revision: 358910 URL: https://svnweb.freebsd.org/changeset/base/358910 Log: Makefile.inc1: move dependency hack comment to the block it applies to Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Thu Mar 12 13:42:08 2020(r358909) +++ head/Makefile.inc1 Thu Mar 12 14:01:17 2020(r358910) @@ -922,7 +922,6 @@ _sanity_check: .PHONY .MAKE # tree changes, particularly with respect to removing source files and # replacing generated files. Handle these cases here in an ad-hoc fashion. _cleanobj_fast_depend_hack: .PHONY -# Syscall stubs rewritten in C and obsolete MD assembly implementations # Date SVN Rev Syscalls/Changes # 20200310 r358851 rename of openmp's ittnotify_static.c to .cpp .for f in ittnotify_static @@ -934,6 +933,7 @@ _cleanobj_fast_depend_hack: .PHONY ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libomp/.depend.${f}.*}; \ fi .endfor +# Syscall stubs rewritten in C and obsolete MD assembly implementations # 20191009 r353340 removal of opensolaris_atomic.S (also r353381) .if ${MACHINE} != i386 .for f in opensolaris_atomic ___ 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: r358911 - in head/sys/netinet: . tcp_stacks
Author: tuexen Date: Thu Mar 12 15:37:41 2020 New Revision: 358911 URL: https://svnweb.freebsd.org/changeset/base/358911 Log: Use KMOD_TCPSTAT_INC instead of TCPSTAT_INC for RACK and BBR, since these are kernel modules. Also add a KMOD_TCPSTAT_ADD and use that instead of TCPSTAT_ADD. Reviewed by: jtl@, rrs@ MFC after:1 week Sponsored by: Netflix, Inc. Differential Revision:https://reviews.freebsd.org/D23904 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/rack_bbr_common.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cThu Mar 12 14:01:17 2020 (r358910) +++ head/sys/netinet/tcp_input.cThu Mar 12 15:37:41 2020 (r358911) @@ -266,14 +266,14 @@ VNET_SYSUNINIT(tcp_vnet_uninit, SI_SUB_PROTO_IFATTACHD #endif /* VIMAGE */ /* - * Kernel module interface for updating tcpstat. The argument is an index + * Kernel module interface for updating tcpstat. The first argument is an index * into tcpstat treated as an array. */ void -kmod_tcpstat_inc(int statnum) +kmod_tcpstat_add(int statnum, int val) { - counter_u64_add(VNET(tcpstat)[statnum], 1); + counter_u64_add(VNET(tcpstat)[statnum], val); } #ifdef TCP_HHOOK Modified: head/sys/netinet/tcp_stacks/bbr.c == --- head/sys/netinet/tcp_stacks/bbr.c Thu Mar 12 14:01:17 2020 (r358910) +++ head/sys/netinet/tcp_stacks/bbr.c Thu Mar 12 15:37:41 2020 (r358911) @@ -1866,7 +1866,7 @@ bbr_progress_timeout_check(struct tcp_bbr *bbr) bbr_log_progress_event(bbr, bbr->rc_tp, ticks, PROGRESS_DROP, __LINE__); BBR_STAT_INC(bbr_progress_drops); #ifdef NETFLIX_STATS - TCPSTAT_INC(tcps_progdrops); + KMOD_TCPSTAT_INC(tcps_progdrops); #endif return (1); } @@ -4067,7 +4067,7 @@ bbr_cong_signal(struct tcpcb *tp, struct tcphdr *th, u } break; case CC_RTO_ERR: - TCPSTAT_INC(tcps_sndrexmitbad); + KMOD_TCPSTAT_INC(tcps_sndrexmitbad); /* RTO was unnecessary, so reset everything. */ bbr_reset_lt_bw_sampling(bbr, bbr->r_ctl.rc_rcvtime); if (bbr->rc_bbr_state != BBR_STATE_PROBE_RTT) { @@ -4808,7 +4808,7 @@ bbr_timeout_delack(struct tcpcb *tp, struct tcp_bbr *b bbr_log_to_event(bbr, cts, BBR_TO_FRM_DELACK); tp->t_flags &= ~TF_DELACK; tp->t_flags |= TF_ACKNOW; - TCPSTAT_INC(tcps_delack); + KMOD_TCPSTAT_INC(tcps_delack); bbr->r_ctl.rc_hpts_flags &= ~PACE_TMR_DELACK; return (0); } @@ -4840,7 +4840,7 @@ bbr_timeout_persist(struct tcpcb *tp, struct tcp_bbr * */ bbr_log_to_event(bbr, cts, BBR_TO_FRM_PERSIST); bbr->r_ctl.rc_hpts_flags &= ~PACE_TMR_PERSIT; - TCPSTAT_INC(tcps_persisttimeo); + KMOD_TCPSTAT_INC(tcps_persisttimeo); /* * Have we exceeded the user specified progress time? */ @@ -4857,7 +4857,7 @@ bbr_timeout_persist(struct tcpcb *tp, struct tcp_bbr * if (tp->t_rxtshift == TCP_MAXRXTSHIFT && (ticks - tp->t_rcvtime >= tcp_maxpersistidle || ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff)) { - TCPSTAT_INC(tcps_persistdrop); + KMOD_TCPSTAT_INC(tcps_persistdrop); tcp_set_inp_to_drop(bbr->rc_inp, ETIMEDOUT); goto out; } @@ -4873,7 +4873,7 @@ bbr_timeout_persist(struct tcpcb *tp, struct tcp_bbr * */ if (tp->t_state > TCPS_CLOSE_WAIT && (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) { - TCPSTAT_INC(tcps_persistdrop); + KMOD_TCPSTAT_INC(tcps_persistdrop); tcp_set_inp_to_drop(bbr->rc_inp, ETIMEDOUT); goto out; } @@ -4916,7 +4916,7 @@ bbr_timeout_keepalive(struct tcpcb *tp, struct tcp_bbr * Keep-alive timer went off; send something or drop connection if * idle for too long. */ - TCPSTAT_INC(tcps_keeptimeo); + KMOD_TCPSTAT_INC(tcps_keeptimeo); if (tp->t_state < TCPS_ESTABLISHED) goto dropit; if ((V_tcp_always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) && @@ -4933,7 +4933,7 @@ bbr_timeout_keepalive(struct tcpcb *tp, struct tcp_bbr * protocol spec, this requires the correspondent TCP to * respond. */ - TCPSTAT_INC(tcps_keepprobe); + KMOD_TCPSTAT_INC(tcps_keepprobe); t_template = tcpip_maketemplate(inp); if (t_template) {
svn commit: r358912 - head/tools/build/mk
Author: ngie Date: Thu Mar 12 16:06:26 2020 New Revision: 358912 URL: https://svnweb.freebsd.org/changeset/base/358912 Log: Remove /usr/share/snmp/defs/tc.def with delete-old if MK_BSNMP == no This removes a lingering file on new installs of CURRENT, originally added in r345797. MFC after:1 week MFC with: r345797 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc == --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Mar 12 15:37:41 2020(r358911) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Mar 12 16:06:26 2020(r358912) @@ -972,6 +972,7 @@ OLD_FILES+=usr/share/snmp/defs/mibII_tree.def OLD_FILES+=usr/share/snmp/defs/netgraph_tree.def OLD_FILES+=usr/share/snmp/defs/pf_tree.def OLD_FILES+=usr/share/snmp/defs/target_tree.def +OLD_FILES+=usr/share/snmp/defs/tc.def OLD_FILES+=usr/share/snmp/defs/tree.def OLD_FILES+=usr/share/snmp/defs/usm_tree.def OLD_FILES+=usr/share/snmp/defs/vacm_tree.def ___ 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: r358655 - head/sbin/mount_nfs
On Thu, Mar 05, 2020 at 11:15:04PM +0100, Dimitry Andric wrote: D> > S> > Why don't just declare the buffer as: D> > S> > D> > S> > struct if_msghdr buf; D> > S> > D> > S> > and then do: D> > S> > D> > S> > nread = read(s, &buf, sizeof buf); D> > S> > D> > S> > ? You are never reading more than one if_msghdr anyway, and then there D> > S> > is no need to cast anything. D> > S> D> > S> My inspiration: route socket can return other messages (man 4 route) D> > D> > Yes, exactly. We don't know what size next datagram is going to be. D> D> Oh, in that case this code seems completely wrong. How do you know the D> full datagram will be delivered with one read() call? D> D> If it always is, then there is no need to read more than the size of D> struct if_msghdr, since you are not using any data beyond it. So in D> that case, you can suffice with read(..., sizeof(if_msghdr)). D> D> If the read() call will return partial results, you must repeatedly call D> it in a loop, until you either reach EOF, or have enough data. In that D> case, a buffer with the size of if_msghdr is also enough, since you D> never need to read beyond that. Sorry for delayed answer. The routing socket is a datagram socket, it isn't like TCP, it can't deliver partial datagrams. If we don't supply enough space for datagram that arrived, it won't be delivered. So the right solution is suppling plenty of space, but parse only part we are interested in. -- Gleb Smirnoff ___ 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: r358902 - head/lib/libc/powerpc64/string
To be clear here, I meant non qword-aligned, as it was the VSX implementation that was actually tripping up here. The problem manifested when the source and destination didn't match on the least significant nybble. Apparently it's also somewhat uncommon for programs to ever do anything with the return value as well. On Wed, Mar 11, 2020, at 6:34 PM, Brandon Bergren wrote: > Author: bdragon > Date: Wed Mar 11 23:34:44 2020 > New Revision: 358902 > URL: https://svnweb.freebsd.org/changeset/base/358902 > > Log: > Fix r358688 -- Remember to actually save r3 before processing. > > Crash was noticed by pkubaj building gcc9. > > Apparently non dword-aligned char pointers are somewhat rare in the wild. > > Reported by:pkubaj > Sponsored by: Tag1 Consulting, Inc. > > Modified: > head/lib/libc/powerpc64/string/memcpy.S > > Modified: head/lib/libc/powerpc64/string/memcpy.S > == > --- head/lib/libc/powerpc64/string/memcpy.S Wed Mar 11 22:25:45 2020 > (r358901) > +++ head/lib/libc/powerpc64/string/memcpy.S Wed Mar 11 23:34:44 2020 > (r358902) > @@ -58,8 +58,8 @@ ENTRY(FN_NAME) > andi. %r7, %r4, ALIGN_MASK > cmpd%r8, %r7 > mr %r7, %r5 > - bne .Lcopy_remaining_fix_index_byte > mr %r8, %r3/* save dst */ > + bne .Lcopy_remaining_fix_index_byte > > /* align src */ > .Lalignment_loop: > -- Brandon Bergren bdra...@imap.cc ___ 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: r358916 - head/lib/libc/gen
Author: 0mp (doc,ports committer) Date: Thu Mar 12 18:28:23 2020 New Revision: 358916 URL: https://svnweb.freebsd.org/changeset/base/358916 Log: ftw.3: Follow style(9) in the example Reported by: oshogbo Approved by: bcr (mentor) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D24043 Modified: head/lib/libc/gen/ftw.3 Modified: head/lib/libc/gen/ftw.3 == --- head/lib/libc/gen/ftw.3 Thu Mar 12 16:15:03 2020(r358915) +++ head/lib/libc/gen/ftw.3 Thu Mar 12 18:28:23 2020(r358916) @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 5, 2020 +.Dd March 12, 2020 .Dt FTW 3 .Os .Sh NAME @@ -209,6 +209,7 @@ nftw_callback(const char *path, const struct stat *sb, int main(int argc, char **argv) { + if (argc != 2) { printf("Usage %s \\n", argv[0]); return (EX_USAGE); ___ 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: r358919 - head/usr.bin/logger
Author: oshogbo Date: Thu Mar 12 19:55:51 2020 New Revision: 358919 URL: https://svnweb.freebsd.org/changeset/base/358919 Log: logger: capsicumize Submitted by: Tiger Gao Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D23744 Modified: head/usr.bin/logger/Makefile head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/Makefile == --- head/usr.bin/logger/MakefileThu Mar 12 19:10:53 2020 (r358918) +++ head/usr.bin/logger/MakefileThu Mar 12 19:55:51 2020 (r358919) @@ -9,4 +9,10 @@ PROG= logger CFLAGS+= -DINET6 .endif +.if ${MK_CASPER} != "no" +LIBADD+=casper +LIBADD+=cap_syslog +CFLAGS+=-DWITH_CASPER +.endif + .include Modified: head/usr.bin/logger/logger.c == --- head/usr.bin/logger/logger.cThu Mar 12 19:10:53 2020 (r358918) +++ head/usr.bin/logger/logger.cThu Mar 12 19:55:51 2020 (r358919) @@ -44,10 +44,12 @@ static char sccsid[] = "@(#)logger.c8.1 (Berkeley) 6/ #include __FBSDID("$FreeBSD$"); +#include #include #include #include +#include #include #include #include @@ -57,6 +59,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #defineSYSLOG_NAMES #include @@ -76,6 +81,7 @@ static void logmessage(int, const char *, const char * struct socks *, ssize_t, const char *); static voidusage(void); +static cap_channel_t *capsyslog; #ifdef INET6 static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */ #else @@ -92,12 +98,13 @@ static int send_to_all = 0; /* send message to all IPv int main(int argc, char *argv[]) { + cap_channel_t *capcas; struct socks *socks; ssize_t nsock; time_t now; int ch, logflags, pri; char *tag, *host, buf[1024], *timestamp, tbuf[26], - *hostname, hbuf[MAXHOSTNAMELEN]; + *hostname, hbuf[MAXHOSTNAMELEN], *pristr; const char *svcname, *src; tag = NULL; @@ -107,6 +114,7 @@ main(int argc, char *argv[]) src = NULL; socks = NULL; pri = LOG_USER | LOG_NOTICE; + pristr = NULL; logflags = 0; unsetenv("TZ"); while ((ch = getopt(argc, argv, "46Af:H:h:iP:p:S:st:")) != -1) @@ -140,7 +148,7 @@ main(int argc, char *argv[]) svcname = optarg; break; case 'p': /* priority */ - pri = pencode(optarg); + pristr = optarg; break; case 's': /* log to standard error */ logflags |= LOG_PERROR; @@ -168,12 +176,25 @@ main(int argc, char *argv[]) nsock = 0; } + capcas = cap_init(); + if (capcas == NULL) + err(1, "Unable to contact Casper"); + caph_cache_catpages(); + caph_cache_tzdata(); + if (caph_enter() < 0) + err(1, "Unable to enter capability mode"); + capsyslog = cap_service_open(capcas, "system.syslog"); + if (capsyslog == NULL) + err(1, "Unable to open system.syslog service"); + cap_close(capcas); + + if (pristr != NULL) + pri = pencode(pristr); if (tag == NULL) tag = getlogin(); /* setup for logging */ if (host == NULL) - openlog(tag, logflags, 0); - (void) fclose(stdout); + cap_openlog(capsyslog, tag, logflags, 0); (void )time(&now); (void )ctime_r(&now, tbuf); @@ -349,7 +370,7 @@ logmessage(int pri, const char *timestamp, const char int len, i, lsent; if (nsock == 0) { - syslog(pri, "%s", buf); + cap_syslog(capsyslog, pri, "%s", buf); return; } if ((len = asprintf(&line, "<%d>%s %s %s: %s", pri, timestamp, ___ 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: r358922 - head/sys/kern
Author: cem Date: Thu Mar 12 21:26:36 2020 New Revision: 358922 URL: https://svnweb.freebsd.org/changeset/base/358922 Log: kern_shutdown: Add missing EKCD ifdef Submitted by: Puneeth Jothaiah Reviewed by: bdrewery Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c == --- head/sys/kern/kern_shutdown.c Thu Mar 12 20:59:00 2020 (r358921) +++ head/sys/kern/kern_shutdown.c Thu Mar 12 21:26:36 2020 (r358922) @@ -1231,6 +1231,7 @@ dumper_insert(const struct dumperinfo *di_template, co #endif } if (kda->kda_compression != KERNELDUMP_COMP_NONE) { +#ifdef EKCD /* * We can't support simultaneous unpadded block cipher * encryption and compression because there is no guarantee the @@ -1241,6 +1242,7 @@ dumper_insert(const struct dumperinfo *di_template, co error = EOPNOTSUPP; goto cleanup; } +#endif newdi->kdcomp = kerneldumpcomp_create(newdi, kda->kda_compression); if (newdi->kdcomp == NULL) { ___ 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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat
Author: freqlabs Date: Thu Mar 12 23:04:40 2020 New Revision: 358923 URL: https://svnweb.freebsd.org/changeset/base/358923 Log: libpmcstat: Try /boot/modules if module not found Modules from ports/pkg are commonly installed to /boot/modules rather than to the same directory the kernel resides in. Look there if a module is not found next to the kernel. Submitted by: mmacy Reported by: Nick Principe Approved by: mmacy (mentor) MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/lib/libpmcstat/libpmcstat_image.c head/usr.sbin/pmcstat/pmcstat.8 Modified: head/lib/libpmcstat/libpmcstat_image.c == --- head/lib/libpmcstat/libpmcstat_image.c Thu Mar 12 21:26:36 2020 (r358922) +++ head/lib/libpmcstat/libpmcstat_image.c Thu Mar 12 23:04:40 2020 (r358923) @@ -278,6 +278,7 @@ pmcstat_image_get_elf_params(struct pmcstat_image *ima GElf_Shdr sh; enum pmcstat_image_type image_type; char buffer[PATH_MAX]; + char buffer_modules[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -292,23 +293,32 @@ pmcstat_image_get_elf_params(struct pmcstat_image *ima assert(path != NULL); /* -* Look for kernel modules under FSROOT/KERNELPATH/NAME, -* and user mode executable objects under FSROOT/PATHNAME. +* Look for kernel modules under FSROOT/KERNELPATH/NAME and +* FSROOT/boot/modules/NAME, and user mode executable objects +* under FSROOT/PATHNAME. */ - if (image->pi_iskernelmodule) + if (image->pi_iskernelmodule) { (void) snprintf(buffer, sizeof(buffer), "%s%s/%s", args->pa_fsroot, args->pa_kernel, path); - else + (void) snprintf(buffer_modules, sizeof(buffer_modules), + "%s/boot/modules/%s", args->pa_fsroot, path); + } else { (void) snprintf(buffer, sizeof(buffer), "%s%s", args->pa_fsroot, path); + } e = NULL; - if ((fd = open(buffer, O_RDONLY, 0)) < 0) { + fd = open(buffer, O_RDONLY, 0); + if (fd < 0 && !image->pi_iskernelmodule) { warnx("WARNING: Cannot open \"%s\".", buffer); goto done; } - + if (fd < 0 && (fd = open(buffer_modules, O_RDONLY, 0)) < 0) { + warnx("WARNING: Cannot open \"%s\" or \"%s\".", + buffer, buffer_modules); + goto done; + } if (elf_version(EV_CURRENT) == EV_NONE) { warnx("WARNING: failed to init elf\n"); goto done; Modified: head/usr.sbin/pmcstat/pmcstat.8 == --- head/usr.sbin/pmcstat/pmcstat.8 Thu Mar 12 21:26:36 2020 (r358922) +++ head/usr.sbin/pmcstat/pmcstat.8 Thu Mar 12 23:04:40 2020 (r358923) @@ -309,6 +309,8 @@ should look for the kernel and its modules. The default is to use the path of the running kernel obtained from the .Va kern.bootfile sysctl. +Modules will also be searched for in /boot/modules if not found in +.Ar kerneldir . .It Fl l Ar secs Set system-wide performance measurement duration for .Ar secs ___ 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: r358924 - head/sys/dev/cxgbe
Author: np Date: Fri Mar 13 00:12:15 2020 New Revision: 358924 URL: https://svnweb.freebsd.org/changeset/base/358924 Log: cxgbe(4): Do not display error messages related to the CLIP table if it's not in use by TOE or KTLS. Reviewed by: jhb@ MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D24046 Modified: head/sys/dev/cxgbe/t4_clip.c Modified: head/sys/dev/cxgbe/t4_clip.c == --- head/sys/dev/cxgbe/t4_clip.cThu Mar 12 23:04:40 2020 (r358923) +++ head/sys/dev/cxgbe/t4_clip.cFri Mar 13 00:12:15 2020 (r358924) @@ -273,8 +273,12 @@ update_clip_table(struct adapter *sc) inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); - log(LOG_ERR, "%s: could not add %s (%d)\n", - __func__, ip, rc); + if (sc->flags & KERN_TLS_OK || + sc->active_ulds != 0) { + log(LOG_ERR, + "%s: could not add %s (%d)\n", + __func__, ip, rc); + } free(ce, M_CXGBE); } next: ___ 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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat
On Thu, Mar 12, 2020 at 6:05 PM Ryan Moeller wrote: > > Author: freqlabs > Date: Thu Mar 12 23:04:40 2020 > New Revision: 358923 > URL: https://svnweb.freebsd.org/changeset/base/358923 > > Log: > libpmcstat: Try /boot/modules if module not found > > Modules from ports/pkg are commonly installed to /boot/modules rather than > to > the same directory the kernel resides in. Look there if a module is not > found > next to the kernel. > > Submitted by: mmacy > Reported by: Nick Principe > Approved by: mmacy (mentor) > MFC after:2 weeks > Sponsored by: iXsystems, Inc. > It's unclear from the context- is there any particular reason this can't instead using sysctl kern.module_path and accept a semicolon delimited list of directories for -k (maybe calling it -k kernelpath instead)? Thanks, Kyle Evans ___ 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: r358928 - in head/sys/powerpc: booke powerpc
Author: jhibbits Date: Fri Mar 13 01:27:37 2020 New Revision: 358928 URL: https://svnweb.freebsd.org/changeset/base/358928 Log: powerpc: Simplify _nodrop variants of FPU and vector register saves No need for an extra temporary. It doesn't even help with readability. Suggested by: kib (almost 2 years ago) Modified: head/sys/powerpc/booke/spe.c head/sys/powerpc/powerpc/altivec.c head/sys/powerpc/powerpc/fpu.c Modified: head/sys/powerpc/booke/spe.c == --- head/sys/powerpc/booke/spe.cFri Mar 13 01:06:08 2020 (r358927) +++ head/sys/powerpc/booke/spe.cFri Mar 13 01:27:37 2020 (r358928) @@ -183,14 +183,11 @@ save_vec(struct thread *td) void save_vec_nodrop(struct thread *td) { - struct thread *vtd; struct pcb *pcb; int i; - vtd = PCPU_GET(vecthread); - if (td == vtd) { + if (td == PCPU_GET(vecthread)) save_vec_int(td); - } pcb = td->td_pcb; Modified: head/sys/powerpc/powerpc/altivec.c == --- head/sys/powerpc/powerpc/altivec.c Fri Mar 13 01:06:08 2020 (r358927) +++ head/sys/powerpc/powerpc/altivec.c Fri Mar 13 01:27:37 2020 (r358928) @@ -168,12 +168,7 @@ save_vec(struct thread *td) void save_vec_nodrop(struct thread *td) { - struct thread *vtd; - vtd = PCPU_GET(vecthread); - if (td != vtd) { - return; - } - - save_vec_int(td); + if (td == PCPU_GET(vecthread)) + save_vec_int(td); } Modified: head/sys/powerpc/powerpc/fpu.c == --- head/sys/powerpc/powerpc/fpu.c Fri Mar 13 01:06:08 2020 (r358927) +++ head/sys/powerpc/powerpc/fpu.c Fri Mar 13 01:27:37 2020 (r358928) @@ -204,12 +204,7 @@ save_fpu(struct thread *td) void save_fpu_nodrop(struct thread *td) { - struct thread *ftd; - ftd = PCPU_GET(fputhread); - if (td != ftd) { - return; - } - - save_fpu_int(td); + if (td == PCPU_GET(fputhread)) + save_fpu_int(td); } ___ 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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat
On Thu, Mar 12, 2020, 6:35 PM Kyle Evans wrote: > On Thu, Mar 12, 2020 at 6:05 PM Ryan Moeller wrote: > > > > Author: freqlabs > > Date: Thu Mar 12 23:04:40 2020 > > New Revision: 358923 > > URL: https://svnweb.freebsd.org/changeset/base/358923 > > > > Log: > > libpmcstat: Try /boot/modules if module not found > > > > Modules from ports/pkg are commonly installed to /boot/modules rather > than to > > the same directory the kernel resides in. Look there if a module is > not found > > next to the kernel. > > > > Submitted by: mmacy > > Reported by: Nick Principe > > Approved by: mmacy (mentor) > > MFC after:2 weeks > > Sponsored by: iXsystems, Inc. > > > > It's unclear from the context- is there any particular reason this > can't instead using sysctl kern.module_path and accept a semicolon > delimited list of directories for -k (maybe calling it -k kernelpath > instead)? > There are also #defines for these paths. Warner Thanks, > > Kyle Evans > ___ 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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat
> It's unclear from the context- is there any particular reason this > can't instead using sysctl kern.module_path and accept a semicolon > delimited list of directories for -k (maybe calling it -k kernelpath > instead)? No, that looks technically possible. -Ryan ___ 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"