Re: svn commit: r361568 - head/sys/powerpc/aim
Justin Hibbits chmeeedalf at gmail.com wrote on Thu May 28 02:41:06 UTC 2020 : > On Thu, 28 May 2020 00:49:03 + (UTC) > Brandon Bergren wrote: > > > Author: bdragon > > Date: Thu May 28 00:49:02 2020 > > New Revision: 361568 > > URL: https://svnweb.freebsd.org/changeset/base/361568 > > > > Log: > > [PowerPC] Fix radix crash when passing -1 from userspace > > > > Found by running libc tests with radix enabled. > > > > Detect unsigned integer wrapping with a postcondition. > > > > Note: Radix MMU is not enabled by default yet. > > > > Sponsored by: Tag1 Consulting, Inc. > > > > Modified: > > head/sys/powerpc/aim/mmu_radix.c > > > > Modified: head/sys/powerpc/aim/mmu_radix.c > > == > > --- head/sys/powerpc/aim/mmu_radix.cWed May 27 23:20:35 > > 2020(r361567) +++ head/sys/powerpc/aim/mmu_radix.c Thu > > May 28 00:49:02 2020(r361568) @@ -6000,7 +6000,8 @@ > > mmu_radix_kremove(vm_offset_t va) int mmu_radix_map_user_ptr(pmap_t > > pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t > > *klen) { > > - if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS) > > + if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS || > > + (uintptr_t)uaddr + ulen < (uintptr_t)uaddr) > > return (EFAULT); > > > > *kaddr = (void *)(uintptr_t)uaddr; > > Wouldn't > > if ((uintptr_t)uaddr >= VM_MAXUSER_ADDRESS || > (uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS) > > be more appropriate? Using: #define VM_MAXUSER_ADDRESS320xf000 as an example for 32-bit AIM powerpc. Let (uintptr_t)uaddr==0xe000u Let ulen==0x3000u Then (uintptr_t)uaddr+ulen == 0x1000u (wrapped/truncated: "Detect unsigned integer wrapping") So (right hand sides forced unsigned by left hand sides being so): (uintptr_t)uaddr= VM_MAXUSER_ADDRESS || (uintptr_t)uaddr >= (uintptr_t)VM_MAXUSER_ADDRESS - ulen (I've left equality handling as it was, despite, for example, 0xe000u with length 0x2000u having a last address of 0xefffu and 0xefffu < 0xf000u . There may be reasons to disallow that for all I know.) === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) ___ 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: r361570 - head/sys/powerpc/powerpc
Author: jhibbits Date: Thu May 28 03:08:50 2020 New Revision: 361570 URL: https://svnweb.freebsd.org/changeset/base/361570 Log: powerpc/pmap: Remove some debug from r361544 Modified: head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/sys/powerpc/powerpc/pmap_dispatch.c == --- head/sys/powerpc/powerpc/pmap_dispatch.cThu May 28 01:53:35 2020 (r361569) +++ head/sys/powerpc/powerpc/pmap_dispatch.cThu May 28 03:08:50 2020 (r361570) @@ -205,19 +205,15 @@ pmap_mmu_install(char *name, int prio) mmu_t *mmupp, mmup; static int curr_prio = 0; - printf("Trying to install pmap %s\n", name); - /* * Try and locate the MMU kobj corresponding to the name */ SET_FOREACH(mmupp, mmu_set) { mmup = *mmupp; - printf("Checking %s(%p)\n", mmup->name, mmup->name); if (mmup->name && !strcmp(mmup->name, name) && (prio >= curr_prio || mmu_obj == NULL)) { - printf("match found: %p\n", mmup); curr_prio = prio; mmu_obj = mmup; return (TRUE); ___ 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: r361568 - head/sys/powerpc/aim
On Thu, 28 May 2020 00:49:03 + (UTC) Brandon Bergren wrote: > Author: bdragon > Date: Thu May 28 00:49:02 2020 > New Revision: 361568 > URL: https://svnweb.freebsd.org/changeset/base/361568 > > Log: > [PowerPC] Fix radix crash when passing -1 from userspace > > Found by running libc tests with radix enabled. > > Detect unsigned integer wrapping with a postcondition. > > Note: Radix MMU is not enabled by default yet. > > Sponsored by: Tag1 Consulting, Inc. > > Modified: > head/sys/powerpc/aim/mmu_radix.c > > Modified: head/sys/powerpc/aim/mmu_radix.c > == > --- head/sys/powerpc/aim/mmu_radix.c Wed May 27 23:20:35 > 2020 (r361567) +++ head/sys/powerpc/aim/mmu_radix.c Thu > May 28 00:49:02 2020 (r361568) @@ -6000,7 +6000,8 @@ > mmu_radix_kremove(vm_offset_t va) int mmu_radix_map_user_ptr(pmap_t > pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t > *klen) { > - if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS) > + if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS || > + (uintptr_t)uaddr + ulen < (uintptr_t)uaddr) > return (EFAULT); > > *kaddr = (void *)(uintptr_t)uaddr; Wouldn't if ((uintptr_t)uaddr >= VM_MAXUSER_ADDRESS || (uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS) be more appropriate? - Justin ___ 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: r361568 - head/sys/powerpc/aim
Author: bdragon Date: Thu May 28 00:49:02 2020 New Revision: 361568 URL: https://svnweb.freebsd.org/changeset/base/361568 Log: [PowerPC] Fix radix crash when passing -1 from userspace Found by running libc tests with radix enabled. Detect unsigned integer wrapping with a postcondition. Note: Radix MMU is not enabled by default yet. Sponsored by: Tag1 Consulting, Inc. Modified: head/sys/powerpc/aim/mmu_radix.c Modified: head/sys/powerpc/aim/mmu_radix.c == --- head/sys/powerpc/aim/mmu_radix.cWed May 27 23:20:35 2020 (r361567) +++ head/sys/powerpc/aim/mmu_radix.cThu May 28 00:49:02 2020 (r361568) @@ -6000,7 +6000,8 @@ mmu_radix_kremove(vm_offset_t va) int mmu_radix_map_user_ptr(pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen) { - if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS) + if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS || + (uintptr_t)uaddr + ulen < (uintptr_t)uaddr) return (EFAULT); *kaddr = (void *)(uintptr_t)uaddr; ___ 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: r361567 - head/sys/kern
Author: rmacklem Date: Wed May 27 23:20:35 2020 New Revision: 361567 URL: https://svnweb.freebsd.org/changeset/base/361567 Log: Fix sosend() for the case where mbufs are passed in while doing ktls. For kernel tls, sosend() needs to call ktls_frame() on the mbuf list to be sent. Without this patch, this was only done when sosend()'s arguments used a uio_iov and not when an mbuf list is passed in. At this time, sosend() is never called with an mbuf list argument when kernel tls is in use, but will be once nfs-over-tls has been incorporated into head. Reviewed by: gallatin, glebius Differential Revision:https://reviews.freebsd.org/D24674 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Wed May 27 22:48:34 2020(r361566) +++ head/sys/kern/uipc_socket.c Wed May 27 23:20:35 2020(r361567) @@ -1678,6 +1678,13 @@ restart: resid = 0; if (flags & MSG_EOR) top->m_flags |= M_EOR; +#ifdef KERN_TLS + if (tls != NULL) { + ktls_frame(top, tls, _enq_cnt, + tls_rtype); + tls_rtype = TLS_RLTYPE_APP; + } +#endif } else { /* * Copy the data from userland into a mbuf ___ 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: r361566 - head/sys/dev/ath/ath_rate/sample
Author: adrian Date: Wed May 27 22:48:34 2020 New Revision: 361566 URL: https://svnweb.freebsd.org/changeset/base/361566 Log: [ath] Update ath_rate_sample to use the same base type as ticks. Until net80211 grows a specific ticks type that matches the system, manually use the same type as the kernel/net80211 'ticks' type (signed int.) Tested: * AR9380, STA mode Modified: head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.h == --- head/sys/dev/ath/ath_rate/sample/sample.h Wed May 27 22:34:46 2020 (r361565) +++ head/sys/dev/ath/ath_rate/sample/sample.h Wed May 27 22:48:34 2020 (r361566) @@ -105,7 +105,7 @@ struct sample_node { int current_rix[NUM_PACKET_SIZE_BINS]; int packets_since_switch[NUM_PACKET_SIZE_BINS]; - unsigned ticks_since_switch[NUM_PACKET_SIZE_BINS]; + int ticks_since_switch[NUM_PACKET_SIZE_BINS]; int packets_since_sample[NUM_PACKET_SIZE_BINS]; unsigned sample_tt[NUM_PACKET_SIZE_BINS]; ___ 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: r361563 - head/sys/vm
Author: kib Date: Wed May 27 21:44:26 2020 New Revision: 361563 URL: https://svnweb.freebsd.org/changeset/base/361563 Log: Simplify the condition to enable superpage mappings in vm_fault_soft_fast(). The list of arches list there matches the list of arches where default VM_NRESERVLEVEL > 0. Before sparc64 removal, that was the only arch that defined VM_NRESERVLEVEL > 0 to help with cache coloring, but did not implemented superpages. Now it can be simplified. Submitted by: alc Reviewed by: markj Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Wed May 27 19:13:26 2020(r361562) +++ head/sys/vm/vm_fault.c Wed May 27 21:44:26 2020(r361563) @@ -299,9 +299,7 @@ static int vm_fault_soft_fast(struct faultstate *fs) { vm_page_t m, m_map; -#if (defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \ -__ARM_ARCH >= 6) || defined(__i386__) || defined(__powerpc64__) || \ -defined(__riscv)) && VM_NRESERVLEVEL > 0 +#if VM_NRESERVLEVEL > 0 vm_page_t m_super; int flags; #endif @@ -320,9 +318,7 @@ vm_fault_soft_fast(struct faultstate *fs) } m_map = m; psind = 0; -#if (defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \ -__ARM_ARCH >= 6) || defined(__i386__) || defined(__powerpc64__) || \ -defined(__riscv)) && VM_NRESERVLEVEL > 0 +#if VM_NRESERVLEVEL > 0 if ((m->flags & PG_FICTITIOUS) == 0 && (m_super = vm_reserv_to_superpage(m)) != NULL && rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start && ___ 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: r361562 - head/sys/geom/eli
Author: asomers Date: Wed May 27 19:13:26 2020 New Revision: 361562 URL: https://svnweb.freebsd.org/changeset/base/361562 Log: geli: fix a livelock during panic During any kind of shutdown, kern_reboot calls geli's pre_sync event hook, which tries to destroy all unused geli devices. But during a panic, geli can't destroy any devices, because the scheduler is stopped, so it can't switch threads. A livelock results, and the system never dumps core. This commit fixes the problem by refusing to destroy any devices during panic, used or otherwise. PR: 246207 Reviewed by: jhb MFC after:2 weeks Sponsored by: Axcient Differential Revision:https://reviews.freebsd.org/D24697 Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c == --- head/sys/geom/eli/g_eli.c Wed May 27 18:55:24 2020(r361561) +++ head/sys/geom/eli/g_eli.c Wed May 27 19:13:26 2020(r361562) @@ -1416,11 +1416,13 @@ g_eli_shutdown_pre_sync(void *arg, int howto) continue; pp = LIST_FIRST(>provider); KASSERT(pp != NULL, ("No provider? gp=%p (%s)", gp, gp->name)); - if (pp->acr + pp->acw + pp->ace == 0) - error = g_eli_destroy(sc, TRUE); - else { + if (pp->acr != 0 || pp->acw != 0 || pp->ace != 0 || + SCHEDULER_STOPPED()) + { sc->sc_flags |= G_ELI_FLAG_RW_DETACH; gp->access = g_eli_access; + } else { + error = g_eli_destroy(sc, TRUE); } } g_topology_unlock(); ___ 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: r361560 - head/sys/net80211
Author: adrian Date: Wed May 27 18:32:12 2020 New Revision: 361560 URL: https://svnweb.freebsd.org/changeset/base/361560 Log: [net80211] Fix interrupted scan logic and ticks comparison The scan task refactoring stuff circa 2014-2016 broke the blocking task into a taskqueue with some async bits, but it apparently broke scans being interrupted by traffic. Notably - the new "field" SCAN_PAUSE sets both SCAN_INTERRUPT and SCAN_CANCEL, and a bunch of existing code was checking for SCAN_CANCEL only and breaking the scan. Unfortunately it was then (a) cancelling the scan entirely and (b) not notifying userland that scan was done. So: * Update the calls to scan_end() to only pass in 1 (saying the scan is complete) if SCAN_CANCEL is set WITHOUT SCAN_INTERRUPT. If both are set then yes, the scan is interrupted, but it isn't canceled - it's just paused. * Update the "did the scan flags change whilst the driver was called" logic to check for canceled scans, not interrupted scans. * The "scan done" logic now explicitly checks for either interrupted or completed scans. This accounts for the situation where a scan is being aborted via traffic but it ALSO happens to have finished (ie the last channel was checked.) This doesn't ENTIRELY fix scanning as the resume function is broken due to incorrect ticks math. Thus, the second half of this patch changes the ieee80211_ticks_*() macros to use int instead of long, matching the logic that the TCP code does with ticks and handles wrapping / negative ticks values. If cast to long then the wrapping math wouldn't work right (ie, if ticks was actually negative, ie, after the system has been up for a while.) This allows contbgscan() to correctly calculate if a scan should continue based on ticks and ic->ic_lastdata . Reviewed by: bz Differential Revision:https://reviews.freebsd.org/D25031 Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_scan_sw.c Modified: head/sys/net80211/ieee80211_freebsd.h == --- head/sys/net80211/ieee80211_freebsd.h Wed May 27 18:26:10 2020 (r361559) +++ head/sys/net80211/ieee80211_freebsd.h Wed May 27 18:32:12 2020 (r361560) @@ -254,9 +254,9 @@ voidieee80211_vap_destroy(struct ieee80211vap *); #defineticks_to_msecs(t) TICKS_2_MSEC(t) #defineticks_to_secs(t)((t) / hz) -#define ieee80211_time_after(a,b) ((long)(b) - (long)(a) < 0) +#define ieee80211_time_after(a,b) ((int)(b) - (int)(a) < 0) #define ieee80211_time_before(a,b) ieee80211_time_after(b,a) -#define ieee80211_time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) +#define ieee80211_time_after_eq(a,b) ((int)(a) - (int)(b) >= 0) #define ieee80211_time_before_eq(a,b) ieee80211_time_after_eq(b,a) struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen); Modified: head/sys/net80211/ieee80211_scan_sw.c == --- head/sys/net80211/ieee80211_scan_sw.c Wed May 27 18:26:10 2020 (r361559) +++ head/sys/net80211/ieee80211_scan_sw.c Wed May 27 18:32:12 2020 (r361560) @@ -675,19 +675,32 @@ scan_curchan_task(void *arg, int pending) struct ieee80211com *ic = ss->ss_ic; struct ieee80211_channel *chan; unsigned long maxdwell; - int scandone; + int scandone, scanstop; IEEE80211_LOCK(ic); end: + /* +* Note: only /end/ the scan if we're CANCEL rather than +* CANCEL+INTERRUPT (ie, 'PAUSE'). +* +* We can stop the scan if we hit cancel, but we shouldn't +* call scan_end(ss, 1) if we're just PAUSEing the scan. +*/ scandone = (ss->ss_next >= ss->ss_last) || - (ss_priv->ss_iflags & ISCAN_CANCEL) != 0; + ((ss_priv->ss_iflags & ISCAN_PAUSE) == ISCAN_CANCEL); + scanstop = (ss->ss_next >= ss->ss_last) || + ((ss_priv->ss_iflags & ISCAN_CANCEL) != 0); IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, - "%s: loop start; scandone=%d\n", + "%s: loop start; scandone=%d, scanstop=%d, ss_iflags=0x%x, ss_next=%u, ss_last=%u\n", __func__, - scandone); + scandone, + scanstop, + (uint32_t) ss_priv->ss_iflags, + (uint32_t) ss->ss_next, + (uint32_t) ss->ss_last); - if (scandone || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) || + if (scanstop || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) || (ss_priv->ss_iflags & ISCAN_ABORT) || ieee80211_time_after(ticks + ss->ss_mindwell, ss_priv->ss_scanend)) { ss_priv->ss_iflags &= ~ISCAN_RUNNING; @@ -787,11 +800,12 @@ scan_end(struct ieee80211_scan_state *ss, int scandone * Since a cancellation may
svn commit: r361559 - head/lib/libifconfig
Author: vangyzen Date: Wed May 27 18:26:10 2020 New Revision: 361559 URL: https://svnweb.freebsd.org/changeset/base/361559 Log: libifconfig: remove redundant NULL check Submitted by: puneeth_kumar.jotha...@emc.com Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/lib/libifconfig/libifconfig_inet6.c Modified: head/lib/libifconfig/libifconfig_inet6.c == --- head/lib/libifconfig/libifconfig_inet6.cWed May 27 18:24:50 2020 (r361558) +++ head/lib/libifconfig/libifconfig_inet6.cWed May 27 18:26:10 2020 (r361559) @@ -97,7 +97,7 @@ ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, addr->lifetime = ifr6.ifr_ifru.ifru_lifetime; /* struct copy */ /* Set the vhid */ - if (ifa->ifa_data && ifa->ifa_data) { + if (ifa->ifa_data) { addr->vhid = ((struct if_data *)ifa->ifa_data)->ifi_vhid; } ___ 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: r361553 - in head/tests/sys: netinet netinet6
Author: syrinx Date: Wed May 27 16:33:00 2020 New Revision: 361553 URL: https://svnweb.freebsd.org/changeset/base/361553 Log: Proper check if divert(4) module is present by the relevant tests Fix the netinet/netinet6 divert tests falsely reporting 'ipdivert module is not loaded' when the divert module is built into the kernel Sponsored by: Axiado Differential Revision:https://reviews.freebsd.org/D25026 Modified: head/tests/sys/netinet/divert.sh head/tests/sys/netinet6/divert.sh Modified: head/tests/sys/netinet/divert.sh == --- head/tests/sys/netinet/divert.shWed May 27 15:06:03 2020 (r361552) +++ head/tests/sys/netinet/divert.shWed May 27 16:33:00 2020 (r361553) @@ -31,7 +31,7 @@ . $(atf_get_srcdir)/../common/vnet.subr load_divert_module() { - kldstat -q -n ipdivert + kldstat -q -m ipdivert if [ $? -ne 0 ]; then atf_skip "ipdivert module is not loaded" fi Modified: head/tests/sys/netinet6/divert.sh == --- head/tests/sys/netinet6/divert.sh Wed May 27 15:06:03 2020 (r361552) +++ head/tests/sys/netinet6/divert.sh Wed May 27 16:33:00 2020 (r361553) @@ -31,7 +31,7 @@ . $(atf_get_srcdir)/../common/vnet.subr load_divert_module() { - kldstat -q -n ipdivert + kldstat -q -m ipdivert if [ $? -ne 0 ]; then atf_skip "ipdivert module is not loaded" fi ___ 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: r361551 - head/sys/compat/linuxkpi/common/include/linux
Author: manu Date: Wed May 27 11:42:09 2020 New Revision: 361551 URL: https://svnweb.freebsd.org/changeset/base/361551 Log: linuxkpi: Add kstrtou16 This function convert a char * to a u16. Simply use strtoul and cast to compare for ERANGE Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision:https://reviews.freebsd.org/D24996 Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h == --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 27 10:01:30 2020(r361550) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 27 11:42:09 2020(r361551) @@ -374,6 +374,24 @@ kstrtouint(const char *cp, unsigned int base, unsigned } static inline int +kstrtou16(const char *cp, unsigned int base, u16 *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, , base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (u16)temp) + return (-ERANGE); + return (0); +} + +static inline int kstrtou32(const char *cp, unsigned int base, u32 *res) { char *end; ___ 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: r361550 - head/sys/compat/linuxkpi/common/include/linux
Author: manu Date: Wed May 27 10:01:30 2020 New Revision: 361550 URL: https://svnweb.freebsd.org/changeset/base/361550 Log: linuxkpi: Add rcu_swap_protected This macros swap an rcu pointer with a normal pointer. The condition only seems to be used for debug/warning under linux, ignore for now. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision:https://reviews.freebsd.org/D24954 Modified: head/sys/compat/linuxkpi/common/include/linux/rcupdate.h Modified: head/sys/compat/linuxkpi/common/include/linux/rcupdate.h == --- head/sys/compat/linuxkpi/common/include/linux/rcupdate.hWed May 27 09:31:50 2020(r361549) +++ head/sys/compat/linuxkpi/common/include/linux/rcupdate.hWed May 27 10:01:30 2020(r361550) @@ -97,6 +97,12 @@ (uintptr_t)(v));\ } while (0) +#definercu_swap_protected(rcu, ptr, c) do {\ + typeof(ptr) p = rcu_dereference_protected(rcu, c); \ + rcu_assign_pointer(rcu, ptr); \ + (ptr) = p; \ +} while (0) + /* prototypes */ extern void linux_call_rcu(unsigned type, struct rcu_head *ptr, rcu_callback_t func); ___ 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: r361549 - head/sys/compat/linuxkpi/common/include/linux
Author: manu Date: Wed May 27 09:31:50 2020 New Revision: 361549 URL: https://svnweb.freebsd.org/changeset/base/361549 Log: linuxkpi: Add overflow.h Only add check_add_overflow and check_mul_overflow as those are the only two needed function by DRM v5.3. Both gcc and clang have builtin to do this check so use them directly but throw an error if the compiler/code checker doesn't support this builtin. Sponsored-by: The FreeBSD Foundation Reviewed by: hselsasky Differential Revision:https://reviews.freebsd.org/D25015 Added: head/sys/compat/linuxkpi/common/include/linux/overflow.h (contents, props changed) Added: head/sys/compat/linuxkpi/common/include/linux/overflow.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/overflow.hWed May 27 09:31:50 2020(r361549) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_OVERFLOW_H__ +#define__LINUX_OVERFLOW_H__ + +#ifndef__has_builtin +#define__has_builtin(x)0 +#endif + +#if __has_builtin(__builtin_add_overflow) +#define check_add_overflow(a, b, c)\ + __builtin_add_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_add_overflow" +#endif + +#if __has_builtin(__builtin_mul_overflow) +#define check_mul_overflow(a, b, c)\ + __builtin_mul_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_mul_overflow" +#endif + +#endif /* __LINUX_OVERFLOW_H__ */ ___ 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: r361548 - head/sbin/ifconfig
Author: eugen Date: Wed May 27 08:16:17 2020 New Revision: 361548 URL: https://svnweb.freebsd.org/changeset/base/361548 Log: ifconfig(8): spell "groupname" consistently with SYNOPSYS. MFC after:1 week Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 == --- head/sbin/ifconfig/ifconfig.8 Wed May 27 08:00:38 2020 (r361547) +++ head/sbin/ifconfig/ifconfig.8 Wed May 27 08:16:17 2020 (r361548) @@ -369,7 +369,7 @@ the system will not attempt to transmit messages through that interface. If possible, the interface will be reset to disable reception as well. This action does not automatically disable routes using the interface. -.It Cm group Ar group-name +.It Cm group Ar groupname Assign the interface to a .Dq group . Any interface can be in multiple groups. @@ -382,7 +382,7 @@ is a member of the PPP interface family group, .\" The interface(s) the default route(s) point to are members of the .\" .Em egress .\" interface group. -.It Cm -group Ar group-name +.It Cm -group Ar groupname Remove the interface from the given .Dq group . .It Cm eui64 ___ 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: r361547 - in head/sys/arm64: arm64 include
Author: andrew Date: Wed May 27 08:00:38 2020 New Revision: 361547 URL: https://svnweb.freebsd.org/changeset/base/361547 Log: Support creating and using arm64 pmap at stage 2 Add minimal support for creating stage 2 IPA -> PA mappings. For this we need to: - Create a new vmid set to allocate a vmid for each Virtual Machine - Add the missing stage 2 attributes - Use these in pmap_enter to create a new mapping - Handle stage 2 faults The vmid set is based on the current asid set that was generalised in r358328. It adds a function pointer for bhyve to use when the kernel needs to reset the vmid set. This will need to call into EL2 and invalidate the TLB. The stage 2 attributes have been added. To simplify setting these fields two new functions are added to get the memory type and protection fields. These are slightly different on stage 1 and stage 2 tables. We then use them in pmap_enter to set the new level 3 entry to be stored. The D-cache on all entries is cleaned to the point of coherency. This is to allow the data to be visible to the VM. To allow for userspace to load code when creating a new executable entry an invalid entry is created. When the VM tried to use it the I-cache is invalidated. As the D-cache has already been cleaned this will ensure the I-cache is synchronised with the D-cache. When the hardware implements a VPIPT I-cache we need to either have the correct VMID set or invalidate it from EL2. As the host kernel will have the wrong VMID set we need to call into EL2 to clean it. For this a second function pointer is added that is called when this invalidation is needed. Sponsored by: Innovate UK Differential Revision:https://reviews.freebsd.org/D23875 Modified: head/sys/arm64/arm64/pmap.c head/sys/arm64/include/cpufunc.h head/sys/arm64/include/pcpu.h head/sys/arm64/include/pmap.h head/sys/arm64/include/pte.h Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Wed May 27 02:10:09 2020(r361546) +++ head/sys/arm64/arm64/pmap.c Wed May 27 08:00:38 2020(r361547) @@ -150,6 +150,7 @@ __FBSDID("$FreeBSD$"); #include #definePMAP_ASSERT_STAGE1(pmap)MPASS((pmap)->pm_stage == PM_STAGE1) +#definePMAP_ASSERT_STAGE2(pmap)MPASS((pmap)->pm_stage == PM_STAGE2) #defineNL0PG (PAGE_SIZE/(sizeof (pd_entry_t))) #defineNL1PG (PAGE_SIZE/(sizeof (pd_entry_t))) @@ -293,6 +294,7 @@ struct asid_set { }; static struct asid_set asids; +static struct asid_set vmids; static SYSCTL_NODE(_vm_pmap, OID_AUTO, asid, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "ASID allocator"); @@ -303,6 +305,17 @@ SYSCTL_INT(_vm_pmap_asid, OID_AUTO, next, CTLFLAG_RD, SYSCTL_INT(_vm_pmap_asid, OID_AUTO, epoch, CTLFLAG_RD, _epoch, 0, "The current epoch number"); +static SYSCTL_NODE(_vm_pmap, OID_AUTO, vmid, CTLFLAG_RD, 0, "VMID allocator"); +SYSCTL_INT(_vm_pmap_vmid, OID_AUTO, bits, CTLFLAG_RD, _bits, 0, +"The number of bits in an VMID"); +SYSCTL_INT(_vm_pmap_vmid, OID_AUTO, next, CTLFLAG_RD, _next, 0, +"The last allocated VMID plus one"); +SYSCTL_INT(_vm_pmap_vmid, OID_AUTO, epoch, CTLFLAG_RD, _epoch, 0, +"The current epoch number"); + +void (*pmap_clean_stage2_tlbi)(void); +void (*pmap_invalidate_vpipt_icache)(void); + /* * A pmap's cookie encodes an ASID and epoch number. Cookies for reserved * ASIDs have a negative epoch number, specifically, INT_MIN. Cookies for @@ -590,6 +603,58 @@ pmap_l3_valid(pt_entry_t l3) CTASSERT(L1_BLOCK == L2_BLOCK); +static pt_entry_t +pmap_pte_memattr(pmap_t pmap, vm_memattr_t memattr) +{ + pt_entry_t val; + + if (pmap->pm_stage == PM_STAGE1) { + val = ATTR_S1_IDX(memattr); + if (memattr == VM_MEMATTR_DEVICE) + val |= ATTR_S1_XN; + return (val); + } + + val = 0; + + switch (memattr) { + case VM_MEMATTR_DEVICE: + return (ATTR_S2_MEMATTR(ATTR_S2_MEMATTR_DEVICE_nGnRnE) | + ATTR_S2_XN(ATTR_S2_XN_ALL)); + case VM_MEMATTR_UNCACHEABLE: + return (ATTR_S2_MEMATTR(ATTR_S2_MEMATTR_NC)); + case VM_MEMATTR_WRITE_BACK: + return (ATTR_S2_MEMATTR(ATTR_S2_MEMATTR_WB)); + case VM_MEMATTR_WRITE_THROUGH: + return (ATTR_S2_MEMATTR(ATTR_S2_MEMATTR_WT)); + default: + panic("%s: invalid memory attribute %x", __func__, memattr); + } +} + +static pt_entry_t +pmap_pte_prot(pmap_t pmap, vm_prot_t prot) +{ + pt_entry_t val; + + val = 0; + if (pmap->pm_stage == PM_STAGE1) { + if ((prot & VM_PROT_EXECUTE) == 0) + val |= ATTR_S1_XN; + if ((prot & VM_PROT_WRITE) == 0) + val |= ATTR_S1_AP(ATTR_S1_AP_RO); + } else { +