svn commit: r343087 - head/sys/x86/x86
Author: kib Date: Wed Jan 16 06:10:55 2019 New Revision: 343087 URL: https://svnweb.freebsd.org/changeset/base/343087 Log: Style(9) fixes for x86/busdma_bounce.c. Remove extra parentheses. Adjust indents and lines fill. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/x86/x86/busdma_bounce.c Modified: head/sys/x86/x86/busdma_bounce.c == --- head/sys/x86/x86/busdma_bounce.cWed Jan 16 05:51:03 2019 (r343086) +++ head/sys/x86/x86/busdma_bounce.cWed Jan 16 06:10:55 2019 (r343087) @@ -137,19 +137,16 @@ static void init_bounce_pages(void *dummy); static int alloc_bounce_zone(bus_dma_tag_t dmat); static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - int commit); +int commit); static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_offset_t vaddr, bus_addr_t addr1, - bus_addr_t addr2, bus_size_t size); +vm_offset_t vaddr, bus_addr_t addr1, bus_addr_t addr2, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - pmap_t pmap, void *buf, bus_size_t buflen, - int flags); +pmap_t pmap, void *buf, bus_size_t buflen, int flags); static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t buf, bus_size_t buflen, - int flags); +vm_paddr_t buf, bus_size_t buflen, int flags); static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, -int flags); +int flags); static int bounce_bus_dma_zone_setup(bus_dma_tag_t dmat) @@ -202,15 +199,15 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si newtag->map_count = 0; newtag->segments = NULL; - if (parent != NULL && ((newtag->common.filter != NULL) || - ((parent->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0))) + if (parent != NULL && (newtag->common.filter != NULL || + (parent->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0)) newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE; if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) || newtag->common.alignment > 1) newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE; - if (((newtag->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) && + if ((newtag->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0 && (flags & BUS_DMA_ALLOCNOW) != 0) error = bounce_bus_dma_zone_setup(newtag); else @@ -309,7 +306,7 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags * exclusion region, a data alignment that is stricter than 1, and/or * an active address boundary. */ - if (dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) { + if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) { /* Must bounce */ if (dmat->bounce_zone == NULL) { if ((error = alloc_bounce_zone(dmat)) != 0) @@ -448,14 +445,15 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad * * In the meantime warn the user if malloc gets it wrong. */ - if ((dmat->common.maxsize <= PAGE_SIZE) && - (dmat->common.alignment <= dmat->common.maxsize) && + if (dmat->common.maxsize <= PAGE_SIZE && + dmat->common.alignment <= dmat->common.maxsize && dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc_domainset(dmat->common.maxsize, M_DEVBUF, DOMAINSET_PREF(dmat->common.domain), mflags); } else if (dmat->common.nsegments >= - howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz, PAGE_SIZE)) && + howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz, + PAGE_SIZE)) && dmat->common.alignment <= PAGE_SIZE && (dmat->common.boundary % PAGE_SIZE) == 0) { /* Page-based multi-segment allocations allowed */ @@ -512,7 +510,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_ bus_addr_t curaddr; bus_size_t sgsize; - if ((map != _dmamap && map->pagesneeded == 0)) { + if (map != _dmamap && map->pagesneeded == 0) { /* * Count the number of bounce pages * needed in order to complete this transfer @@ -541,7 +539,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap bus_addr_t paddr; bus_size_t sg_len; - if ((map != _dmamap && map->pagesneeded == 0)) { +
svn commit: r343086 - head/sys/x86/x86
Author: kib Date: Wed Jan 16 05:51:03 2019 New Revision: 343086 URL: https://svnweb.freebsd.org/changeset/base/343086 Log: Remove unused prototype. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/x86/x86/busdma_bounce.c Modified: head/sys/x86/x86/busdma_bounce.c == --- head/sys/x86/x86/busdma_bounce.cWed Jan 16 05:44:14 2019 (r343085) +++ head/sys/x86/x86/busdma_bounce.cWed Jan 16 05:51:03 2019 (r343086) @@ -142,7 +142,6 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, vm_offset_t vaddr, bus_addr_t addr1, bus_addr_t addr2, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap, void *buf, bus_size_t buflen, int flags); ___ 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: r343085 - head/sys/net
Author: kib Date: Wed Jan 16 05:44:14 2019 New Revision: 343085 URL: https://svnweb.freebsd.org/changeset/base/343085 Log: Improve iflib busdma(9) KPI use. - Specify BUS_DMA_NOWAIT for bus_dmamap_load() on rx refill, since callbacks are not supposed to be used. - Match tso/non-tso tags to corresponding tx map operations. Create separate tso maps for tx descriptors. In particular, do not use non-tso tag to load, unload, or destroy a map created with tso tag. - Add missed bus_dmamap_sync() calls. Submitted by: marius. Reported and tested by: pho Reviewed by: marius Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Jan 16 05:17:27 2019(r343084) +++ head/sys/net/iflib.cWed Jan 16 05:44:14 2019(r343085) @@ -282,6 +282,7 @@ typedef struct iflib_sw_rx_desc_array { typedef struct iflib_sw_tx_desc_array { bus_dmamap_t*ifsd_map; /* bus_dma maps for packet */ + bus_dmamap_t*ifsd_tso_map; /* bus_dma maps for TSO packet */ struct mbuf**ifsd_m; /* pkthdr mbufs */ } if_txsd_vec_t; @@ -1491,6 +1492,8 @@ iflib_fast_intr_rxtx(void *arg) ctx = rxq->ifr_ctx; + bus_dmamap_sync(rxq->ifr_ifdi->idi_tag, rxq->ifr_ifdi->idi_map, + BUS_DMASYNC_POSTREAD); if (!ctx->isc_txd_credits_update(ctx->ifc_softc, txqid, false)) { IFDI_TX_QUEUE_INTR_ENABLE(ctx, txqid); continue; @@ -1583,6 +1586,7 @@ iflib_txsd_alloc(iflib_txq_t txq) device_t dev = ctx->ifc_dev; bus_size_t tsomaxsize; int err, nsegments, ntsosegments; + bool tso; nsegments = scctx->isc_tx_nsegments; ntsosegments = scctx->isc_tx_tso_segments_max; @@ -1617,8 +1621,8 @@ iflib_txsd_alloc(iflib_txq_t txq) (uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize); goto fail; } - if ((if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) && - (err = bus_dma_tag_create(bus_get_dma_tag(dev), + tso = (if_getcapabilities(ctx->ifc_ifp) & IFCAP_TSO) != 0; + if (tso && (err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0,/* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ @@ -1631,7 +1635,6 @@ iflib_txsd_alloc(iflib_txq_t txq) NULL,/* lockfuncarg */ >ift_tso_desc_tag))) { device_printf(dev,"Unable to allocate TX TSO DMA tag: %d\n", err); - goto fail; } if (!(txq->ift_sds.ifsd_m = @@ -1643,19 +1646,38 @@ iflib_txsd_alloc(iflib_txq_t txq) } /* Create the descriptor buffer dma maps */ - if (!(txq->ift_sds.ifsd_map = - (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc_ntxd[txq->ift_br_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + if ((txq->ift_sds.ifsd_map = (bus_dmamap_t *)malloc( + sizeof(bus_dmamap_t) * scctx->isc_ntxd[txq->ift_br_offset], + M_IFLIB, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "Unable to allocate tx_buffer map memory\n"); err = ENOMEM; goto fail; } + if (tso && (txq->ift_sds.ifsd_tso_map = (bus_dmamap_t *)malloc( + sizeof(bus_dmamap_t) * scctx->isc_ntxd[txq->ift_br_offset], + M_IFLIB, M_NOWAIT | M_ZERO)) == NULL) { + device_printf(dev, "Unable to allocate TSO tx_buffer " + "map memory\n"); + err = ENOMEM; + goto fail; + } + for (int i = 0; i < scctx->isc_ntxd[txq->ift_br_offset]; i++) { - err = bus_dmamap_create(txq->ift_desc_tag, 0, >ift_sds.ifsd_map[i]); + err = bus_dmamap_create(txq->ift_desc_tag, 0, + >ift_sds.ifsd_map[i]); if (err != 0) { device_printf(dev, "Unable to create TX DMA map\n"); goto fail; } + if (!tso) + continue; + err = bus_dmamap_create(txq->ift_tso_desc_tag, 0, + >ift_sds.ifsd_tso_map[i]); + if (err != 0) { + device_printf(dev, "Unable to create TSO TX DMA map\n"); + goto fail; + } } return (0); fail: @@ -1673,10 +1695,22 @@ iflib_txsd_destroy(if_ctx_t ctx, iflib_txq_t txq, int if (txq->ift_sds.ifsd_map != NULL) map = txq->ift_sds.ifsd_map[i]; if (map != NULL) {
svn commit: r343082 - in head: contrib/netbsd-tests/kernel lib/libc/sys sys/kern sys/sys sys/vm
Author: kib Date: Wed Jan 16 05:15:57 2019 New Revision: 343082 URL: https://svnweb.freebsd.org/changeset/base/343082 Log: Implement shmat(2) flag SHM_REMAP. Based on the description in Linux man page. Reviewed by: markj, ngie (previous version) Sponsored by: Mellanox Technologies MFC after:1 week Differential revision:https://reviews.freebsd.org/D18837 Modified: head/contrib/netbsd-tests/kernel/t_sysv.c head/lib/libc/sys/shmat.2 head/sys/kern/sysv_shm.c head/sys/sys/shm.h head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/contrib/netbsd-tests/kernel/t_sysv.c == --- head/contrib/netbsd-tests/kernel/t_sysv.c Wed Jan 16 05:09:29 2019 (r343081) +++ head/contrib/netbsd-tests/kernel/t_sysv.c Wed Jan 16 05:15:57 2019 (r343082) @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -772,19 +773,27 @@ ATF_TC_BODY(shm, tc) atf_tc_fail("sender: received unexpected signal"); } -ATF_TC_CLEANUP(shm, tc) +static void +shmid_cleanup(const char *name) { - int sender_shmid; + int shmid; /* * Remove the shared memory area if it exists. */ - sender_shmid = read_int("sender_shmid"); - if (sender_shmid != -1) - if (shmctl(sender_shmid, IPC_RMID, NULL) == -1) + shmid = read_int(name); + if (shmid != -1) { + if (shmctl(shmid, IPC_RMID, NULL) == -1) err(1, "shmctl IPC_RMID"); + } } +ATF_TC_CLEANUP(shm, tc) +{ + + shmid_cleanup("sender_shmid"); +} + void print_shmid_ds(struct shmid_ds *sp, mode_t mode) { @@ -837,12 +846,53 @@ sharer(void) exit(0); } +#ifdef SHM_REMAP +ATF_TC_WITH_CLEANUP(shm_remap); +ATF_TC_HEAD(shm_remap, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Checks SHM_REMAP"); +} + +ATF_TC_BODY(shm_remap, tc) +{ + char *shm_buf; + int shmid_remap; + + pgsize = sysconf(_SC_PAGESIZE); + + shmkey = get_ftok(4160); + ATF_REQUIRE_MSG(shmkey != (key_t)-1, "get_ftok failed"); + + ATF_REQUIRE_MSG((shmid_remap = shmget(shmkey, pgsize, + IPC_CREAT | 0640)) != -1, "shmget: %d", errno); + write_int("shmid_remap", shmid_remap); + + ATF_REQUIRE_MSG((shm_buf = mmap(NULL, pgsize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0)) != MAP_FAILED, "mmap: %d", errno); + + ATF_REQUIRE_MSG(shmat(shmid_remap, shm_buf, 0) == (void *)-1, + "shmat without MAP_REMAP succeeded"); + ATF_REQUIRE_MSG(shmat(shmid_remap, shm_buf, SHM_REMAP) == shm_buf, + "shmat(SHM_REMAP): %d", errno); +} + +ATF_TC_CLEANUP(shm_remap, tc) +{ + + shmid_cleanup("shmid_remap"); +} +#endif /* SHM_REMAP */ + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, msg); ATF_TP_ADD_TC(tp, sem); ATF_TP_ADD_TC(tp, shm); +#ifdef SHM_REMAP + ATF_TP_ADD_TC(tp, shm_remap); +#endif return atf_no_error(); } Modified: head/lib/libc/sys/shmat.2 == --- head/lib/libc/sys/shmat.2 Wed Jan 16 05:09:29 2019(r343081) +++ head/lib/libc/sys/shmat.2 Wed Jan 16 05:15:57 2019(r343082) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2018 +.Dd January 14, 2019 .Dt SHMAT 2 .Os .Sh NAME @@ -64,17 +64,38 @@ kernel. .It If .Fa addr -is nonzero and SHM_RND is not specified in +is nonzero and +.Va SHM_RND +is not specified in .Fa flag , the segment is attached the specified address. .It If .Fa addr -is specified and SHM_RND is specified, +is specified and +.Va SHM_RND +is specified, .Fa addr is rounded down to the nearest multiple of SHMLBA. .El .Pp +If the +.Va SHM_REMAP +flag is specified and the passed +.Fa addr +is not +.Dv NULL , +any existing mappings in the virtual addresses range are +cleared before the segment is attached. +If the flag is not specified, +.Fa addr +is not +.Dv NULL , +and the virtual address range contains +some pre-existing mappings, the +.Fn shmat +call fails. +.Pp The .Fn shmdt system call @@ -104,6 +125,14 @@ The .Fa addr argument was not an acceptable address. +.It Bq Er ENOMEM +The specified +.Fa addr +cannot be used for mapping, for instance due to the amount of available +space being smaller than the segment size, +or because pre-existing mappings are in the range and no +.Va SHM_REMAP +flag was provided. .It Bq Er EMFILE Failed to attach the shared memory segment because the per-process .Va kern.ipc.shmseg Modified: head/sys/kern/sysv_shm.c == --- head/sys/kern/sysv_shm.cWed Jan 16 05:09:29 2019(r343081) +++ head/sys/kern/sysv_shm.cWed Jan 16 05:15:57 2019(r343082) @@ -388,7 +388,7 @@ kern_shmat_locked(struct thread *td, int shmid, const vm_offset_t
svn commit: r343081 - head/contrib/netbsd-tests/kernel
Author: kib Date: Wed Jan 16 05:09:29 2019 New Revision: 343081 URL: https://svnweb.freebsd.org/changeset/base/343081 Log: Trim spaces at the end of lines. Reviewed by: markj, ngie Sponsored by: Mellanox Technologies MFC after:1 week Differential revision:https://reviews.freebsd.org/D18837 Modified: head/contrib/netbsd-tests/kernel/t_sysv.c Modified: head/contrib/netbsd-tests/kernel/t_sysv.c == --- head/contrib/netbsd-tests/kernel/t_sysv.c Wed Jan 16 04:02:08 2019 (r343080) +++ head/contrib/netbsd-tests/kernel/t_sysv.c Wed Jan 16 05:09:29 2019 (r343081) @@ -840,9 +840,9 @@ sharer(void) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, msg); - ATF_TP_ADD_TC(tp, sem); - ATF_TP_ADD_TC(tp, shm); + ATF_TP_ADD_TC(tp, msg); + ATF_TP_ADD_TC(tp, sem); + ATF_TP_ADD_TC(tp, shm); return atf_no_error(); } ___ 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: r343080 - head/sys/vm
Author: glebius Date: Wed Jan 16 04:02:08 2019 New Revision: 343080 URL: https://svnweb.freebsd.org/changeset/base/343080 Log: Whitespace. Modified: head/sys/vm/uma_int.h Modified: head/sys/vm/uma_int.h == --- head/sys/vm/uma_int.h Wed Jan 16 04:01:30 2019(r343079) +++ head/sys/vm/uma_int.h Wed Jan 16 04:02:08 2019(r343080) @@ -365,7 +365,7 @@ struct uma_zone { uint16_tuz_count_min; /* Minimal amount of items in bucket */ /* Offset 256, stats. */ - counter_u64_t uz_allocs; /* Total number of allocations */ + counter_u64_t uz_allocs; /* Total number of allocations */ counter_u64_t uz_frees; /* Total number of frees */ counter_u64_t uz_fails; /* Total number of alloc failures */ uint64_tuz_sleeps; /* Total number of alloc sleeps */ ___ 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: r343078 - head/sys/powerpc/fpu
Author: jhibbits Date: Wed Jan 16 03:52:43 2019 New Revision: 343078 URL: https://svnweb.freebsd.org/changeset/base/343078 Log: powerpc: Fix FPU fsqrt emulation special case results If fsqrts is emulated with +INF as its argument, the 0 return value causes a NULL pointer dereference, panicking the system. Follow the PowerISA and return +INF with no FP exception. MFC after:1 week Modified: head/sys/powerpc/fpu/fpu_sqrt.c Modified: head/sys/powerpc/fpu/fpu_sqrt.c == --- head/sys/powerpc/fpu/fpu_sqrt.c Wed Jan 16 03:46:27 2019 (r343077) +++ head/sys/powerpc/fpu/fpu_sqrt.c Wed Jan 16 03:52:43 2019 (r343078) @@ -226,12 +226,12 @@ fpu_sqrt(struct fpemu *fe) return (x); } if (x->fp_sign) { + fe->fe_cx |= FPSCR_VXSQRT; return (fpu_newnan(fe)); } if (ISINF(x)) { - fe->fe_cx |= FPSCR_VXSQRT; - DUMPFPN(FPE_REG, 0); - return (0); + DUMPFPN(FPE_REG, x); + return (x); } /* ___ 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: r343077 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jan 16 03:46:27 2019 New Revision: 343077 URL: https://svnweb.freebsd.org/changeset/base/343077 Log: Fix broken uart on Win2016 guest. Obtained from:Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4) MFC after:3 weeks. Modified: head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/uart_emul.c == --- head/usr.sbin/bhyve/uart_emul.c Wed Jan 16 03:07:32 2019 (r343076) +++ head/usr.sbin/bhyve/uart_emul.c Wed Jan 16 03:46:27 2019 (r343077) @@ -431,6 +431,13 @@ uart_write(struct uart_softc *sc, int offset, uint8_t sc->thre_int_pending = true; break; case REG_IER: + /* Assert an interrupt if re-enabling the THRE intr, since we +* always report THRE as active in the status register. +*/ + if ((sc->ier & IER_ETXRDY) == 0 && + (value & IER_ETXRDY) != 0) { + sc->thre_int_pending = true; + } /* * Apply mask so that bits 4-7 are 0 * Also enables bits 0-3 only if they're 1 ___ 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: r343075 - in head/sys: amd64/vmm x86/x86
Author: cem Date: Wed Jan 16 02:19:04 2019 New Revision: 343075 URL: https://svnweb.freebsd.org/changeset/base/343075 Log: vmm(4): Take steps towards multicore bhyve AMD support vmm's CPUID emulation presented Intel topology information to the guest, but disabled AMD topology information and in some cases passed through garbage. I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but guest CPUs can migrate between host threads, so the information presented was not consistent. This could easily be observed with 'cpucontrol -i 0xfoo /dev/cpuctl0'. Slightly improve this situation by enabling the AMD topology feature flag and presenting at least the CPUID fields used by FreeBSD itself to probe topology on more modern AMD64 hardware (Family 15h+). Older stuff is probably less interesting. I have not been able to empirically confirm it is sufficient, but it should not regress anything either. Reviewed by: araujo (previous version) Relnotes: sure Modified: head/sys/amd64/vmm/x86.c head/sys/amd64/vmm/x86.h head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/vmm/x86.c == --- head/sys/amd64/vmm/x86.cWed Jan 16 02:13:21 2019(r343074) +++ head/sys/amd64/vmm/x86.cWed Jan 16 02:19:04 2019(r343075) @@ -136,18 +136,23 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, case CPUID_8000_0008: cpuid_count(*eax, *ecx, regs); if (vmm_is_amd()) { + vm_get_topology(vm, , , , + ); /* -* XXX this might appear silly because AMD -* cpus don't have threads. +* Here, width is ApicIdCoreIdSize, present on +* at least Family 15h and newer. It +* represents the "number of bits in the +* initial apicid that indicate thread id +* within a package." * -* However this matches the logical cpus as -* advertised by leaf 0x1 and will work even -* if threads is set incorrectly on an AMD host. +* Our topo_probe_amd() uses it for +* pkg_id_shift and other OSes may rely on it. */ - vm_get_topology(vm, , , , - ); - logical_cpus = threads * cores; - regs[2] = logical_cpus - 1; + width = MIN(0xF, log2(threads * cores)); + if (width < 0x4) + width = 0; + logical_cpus = MIN(0xFF, threads * cores - 1); + regs[2] = (width << AMDID_COREID_SIZE_SHIFT) | logical_cpus; } break; @@ -155,9 +160,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); /* -* Hide SVM and Topology Extension features from guest. +* Hide SVM from guest. */ - regs[2] &= ~(AMDID2_SVM | AMDID2_TOPOLOGY); + regs[2] &= ~AMDID2_SVM; /* * Don't advertise extended performance counter MSRs @@ -219,6 +224,68 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, regs[3] |= AMDPM_TSC_INVARIANT; break; + case CPUID_8000_001D: + /* AMD Cache topology, like _0004 for Intel. */ + if (!vmm_is_amd()) + goto default_leaf; + + /* +* Similar to Intel, generate a ficticious cache +* topology for the guest with L3 shared by the +* package, and L1 and L2 local to a core. +*/ + vm_get_topology(vm, , , , + ); + switch (*ecx) { + case 0: + logical_cpus = threads; + level = 1; + func = 1; /* data cache */ + break; + case 1: + logical_cpus = threads; + level = 2; + func = 3; /* unified cache */ +
svn commit: r343074 - in head/sys: contrib/ena-com dev/ena
Author: mw Date: Wed Jan 16 02:13:21 2019 New Revision: 343074 URL: https://svnweb.freebsd.org/changeset/base/343074 Log: Suppress excessive error prints in ENA TX hotpath In FreeBSD, this is normal situation that the Tx ring is being full. In hat case, the packet is put back into drbr and the next attempt to send it is taken after the cleanup. Too much logs like this can cause system instability and even cause the device reset (because keep alive or cleanup could be missed). To fix that, the log level of this message is changed to debug. Upon this change upgrade the driver version to v0.8.2. Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/contrib/ena-com/ena_eth_com.c head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h Directory Properties: head/sys/contrib/ena-com/ (props changed) Modified: head/sys/contrib/ena-com/ena_eth_com.c == --- head/sys/contrib/ena-com/ena_eth_com.c Wed Jan 16 02:05:42 2019 (r343073) +++ head/sys/contrib/ena-com/ena_eth_com.c Wed Jan 16 02:13:21 2019 (r343074) @@ -386,7 +386,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq, /* num_bufs +1 for potential meta desc */ if (!ena_com_sq_have_enough_space(io_sq, num_bufs + 1)) { - ena_trc_err("Not enough space in the tx queue\n"); + ena_trc_dbg("Not enough space in the tx queue\n"); return ENA_COM_NO_MEM; } Modified: head/sys/dev/ena/ena.c == --- head/sys/dev/ena/ena.c Wed Jan 16 02:05:42 2019(r343073) +++ head/sys/dev/ena/ena.c Wed Jan 16 02:13:21 2019(r343074) @@ -2813,7 +2813,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf ** /* Prepare the packet's descriptors and send them to device */ rc = ena_com_prepare_tx(io_sq, _tx_ctx, _hw_desc); if (unlikely(rc != 0)) { - device_printf(adapter->pdev, "failed to prepare tx bufs\n"); + ena_trace(ENA_DBG | ENA_TXPTH, "failed to prepare tx bufs\n"); counter_u64_add(tx_ring->tx_stats.prepare_ctx_err, 1); goto dma_error; } Modified: head/sys/dev/ena/ena.h == --- head/sys/dev/ena/ena.h Wed Jan 16 02:05:42 2019(r343073) +++ head/sys/dev/ena/ena.h Wed Jan 16 02:13:21 2019(r343074) @@ -41,7 +41,7 @@ #define DRV_MODULE_VER_MAJOR 0 #define DRV_MODULE_VER_MINOR 8 -#define DRV_MODULE_VER_SUBMINOR 1 +#define DRV_MODULE_VER_SUBMINOR 2 #define DRV_MODULE_NAME"ena" ___ 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: r343073 - head/contrib/ipfilter
Author: cy Date: Wed Jan 16 02:05:42 2019 New Revision: 343073 URL: https://svnweb.freebsd.org/changeset/base/343073 Log: Remove an IRIX-only source file. MFC after:1 week Deleted: head/contrib/ipfilter/mli_ipl.c ___ 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: r343069 - in head/sys: arm64/conf dts/arm/overlays dts/arm64/overlays modules/dtb/rpi
Author: gonzo Date: Wed Jan 16 01:08:34 2019 New Revision: 343069 URL: https://svnweb.freebsd.org/changeset/base/343069 Log: [rpi] Reorganize spigen(4) overlays for Raspberry Pi - Remove CS=2 entry from spigen-rpi2 since it didn't work - Add spigen-rpi3 overlay for Raspberry Pi 3 - Enable rpi overlay modules for GENERIC kernel on aarch64 PR: 233489 Submitted by: b...@mrp3.com Reviewed by: db MFC after:1 week Differential Revision:https://reviews.freebsd.org/D16088 Added: head/sys/dts/arm64/overlays/spigen-rpi3.dtso (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/dts/arm/overlays/spigen-rpi2.dtso head/sys/modules/dtb/rpi/Makefile Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Wed Jan 16 00:39:23 2019(r343068) +++ head/sys/arm64/conf/GENERIC Wed Jan 16 01:08:34 2019(r343069) @@ -296,4 +296,4 @@ options FDT device acpi # DTBs -makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rockchip" +makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rockchip dtb/rpi" Modified: head/sys/dts/arm/overlays/spigen-rpi2.dtso == --- head/sys/dts/arm/overlays/spigen-rpi2.dtso Wed Jan 16 00:39:23 2019 (r343068) +++ head/sys/dts/arm/overlays/spigen-rpi2.dtso Wed Jan 16 01:08:34 2019 (r343069) @@ -12,6 +12,7 @@ spigen0: spigen0 { compatible = "freebsd,spigen"; reg = <0>; + spi-max-frequency = <50>; /* Req'd property, override with spi(8) */ status = "okay"; }; spigen1: spigen1 { @@ -20,20 +21,10 @@ spi-max-frequency = <50>; /* Req'd property, override with spi(8) */ status = "okay"; }; - spigen2: spigen2 { - compatible = "freebsd,spigen"; - reg = <2>; - spi-max-frequency = <50>; /* Req'd property, override with spi(8) */ - status = "okay"; - }; }; &{/soc/gpio@7e20/spi0_cs_pins} { - brcm,pins = <8 7 16>; + brcm,pins = <8 7>; brcm,function = <4>; /* ALT0 */ -}; - -&{/soc/gpio@7e20/spi0_gpio7} { - brcm,pins = <7 8 16 9 10 11>; }; Added: head/sys/dts/arm64/overlays/spigen-rpi3.dtso == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoWed Jan 16 01:08:34 2019(r343069) @@ -0,0 +1,30 @@ +/* $FreeBSD$ */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2837"; +}; + +&{/soc/spi@7e204000} { + status = "okay"; + spigen0: spigen0 { + compatible = "freebsd,spigen"; + reg = <0>; + spi-max-frequency = <50>; /* Req'd property, override with spi(8) */ + status = "okay"; + }; + spigen1: spigen1 { + compatible = "freebsd,spigen"; + reg = <1>; + spi-max-frequency = <50>; /* Req'd property, override with spi(8) */ + status = "okay"; + }; +}; + +&{/soc/gpio@7e20/spi0_cs_pins} { + brcm,pins = <8 7>; + brcm,function = <4>; /* ALT0 */ +}; + Modified: head/sys/modules/dtb/rpi/Makefile == --- head/sys/modules/dtb/rpi/Makefile Wed Jan 16 00:39:23 2019 (r343068) +++ head/sys/modules/dtb/rpi/Makefile Wed Jan 16 01:08:34 2019 (r343069) @@ -1,7 +1,12 @@ # $FreeBSD$ # DTS files for the Raspberry Pi-B +.if ${MACHINE_ARCH:Marmv[67]*} != "" DTSO= \ spigen-rpi-b.dtso \ - spigen-rpi2.dtso \ + spigen-rpi2.dtso +.elif ${MACHINE_ARCH} == "aarch64" +DTSO= \ + spigen-rpi3.dtso +.endif .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343068 - head/usr.sbin/bhyve
Author: araujo Date: Wed Jan 16 00:39:23 2019 New Revision: 343068 URL: https://svnweb.freebsd.org/changeset/base/343068 Log: Use capsicum_helpers(3) that allow us to simplify the code and its functions will return success when the kernel is built without support of the capability mode. It is important to note, that I'm taking a more conservative approach with these changes and it will be done in small steps. Reviewed by: jhb MFC after:6 weeks Differential Revision:https://reviews.freebsd.org/D18744 Modified: head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/block_if.c head/usr.sbin/bhyve/consport.c head/usr.sbin/bhyve/dbgport.c head/usr.sbin/bhyve/gdb.c head/usr.sbin/bhyve/mevent.c head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_passthru.c head/usr.sbin/bhyve/pci_virtio_console.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/pci_virtio_rnd.c head/usr.sbin/bhyve/rfb.c head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jan 16 00:39:23 2019 (r343068) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -949,15 +948,13 @@ do_open(const char *vmname) #ifndef WITHOUT_CAPSICUM cap_rights_init(, CAP_IOCTL, CAP_MMAP_RW); - if (cap_rights_limit(vm_get_device_fd(ctx), ) == -1 && - errno != ENOSYS) + if (caph_rights_limit(vm_get_device_fd(ctx), ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); vm_get_ioctls(); cmds = vm_get_ioctls(NULL); if (cmds == NULL) errx(EX_OSERR, "out of memory"); - if (cap_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); free((cap_ioctl_t *)cmds); #endif Modified: head/usr.sbin/bhyve/block_if.c == --- head/usr.sbin/bhyve/block_if.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/block_if.c Wed Jan 16 00:39:23 2019 (r343068) @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -473,7 +476,7 @@ blockif_open(const char *optstr, const char *ident) if (ro) cap_rights_clear(, CAP_FSYNC, CAP_WRITE); - if (cap_rights_limit(fd, ) == -1 && errno != ENOSYS) + if (caph_rights_limit(fd, ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -504,7 +507,7 @@ blockif_open(const char *optstr, const char *ident) psectsz = sbuf.st_blksize; #ifndef WITHOUT_CAPSICUM - if (cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(fd, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: head/usr.sbin/bhyve/consport.c == --- head/usr.sbin/bhyve/consport.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/consport.c Wed Jan 16 00:39:23 2019 (r343068) @@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$"); #endif #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -138,11 +141,9 @@ console_handler(struct vmctx *ctx, int vcpu, int in, i #ifndef WITHOUT_CAPSICUM cap_rights_init(, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if (cap_rights_limit(STDIN_FILENO, ) == -1 && - errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, ) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif ttyopen(); Modified: head/usr.sbin/bhyve/dbgport.c == --- head/usr.sbin/bhyve/dbgport.c Tue Jan 15 23:37:49 2019 (r343067) +++ head/usr.sbin/bhyve/dbgport.c Wed Jan 16 00:39:23 2019 (r343068) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -167,7 +170,7 @@ init_dbgport(int sport) #ifndef WITHOUT_CAPSICUM
svn commit: r343067 - head/share/mk
Author: sjg Date: Tue Jan 15 23:37:49 2019 New Revision: 343067 URL: https://svnweb.freebsd.org/changeset/base/343067 Log: Fix STAGE_DIR.* to handle indirect *DIR variables. bsd.{files,conf}.mk recently changed to allow *DIR to name a variable rather than a path. STAGE_DIR.* need to adapt. Reviewed by: bdrewery Differential Revision:D18847 Modified: head/share/mk/bsd.confs.mk head/share/mk/bsd.files.mk Modified: head/share/mk/bsd.confs.mk == --- head/share/mk/bsd.confs.mk Tue Jan 15 23:35:53 2019(r343066) +++ head/share/mk/bsd.confs.mk Tue Jan 15 23:37:49 2019(r343067) @@ -40,7 +40,6 @@ ${group}GRP?= ${SHAREGRP} ${group}MODE?= ${CONFMODE} ${group}DIR?= ${CONFDIR} STAGE_SETS+= ${group:C,[/*],_,g} -STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} . if defined(NO_ROOT) .if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} @@ -65,6 +64,7 @@ DIRS+=${group}DIR _${group}DIR= ${group}DIR . endif +STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} . for cnf in ${${group}} ${group}OWN_${cnf}?= ${${group}OWN} @@ -119,7 +119,7 @@ INSTALL_COPY= -C STAGE_AS_SETS+= ${cnf:T} STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}} # XXX {group}OWN,GRP,MODE -STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${group}DIR_${cnf:T}} +STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${_${group}DIR_${cnf}}} stage_as.${cnf:T}: ${cnf} realinstallconfig: installdirs-${_${group}DIR_${cnf}} _${group}INS_${cnf:T} Modified: head/share/mk/bsd.files.mk == --- head/share/mk/bsd.files.mk Tue Jan 15 23:35:53 2019(r343066) +++ head/share/mk/bsd.files.mk Tue Jan 15 23:37:49 2019(r343067) @@ -37,7 +37,6 @@ ${group}GRP= ${SHAREGRP} ${group}MODE?= ${SHAREMODE} ${group}DIR?= BINDIR STAGE_SETS+= ${group:C,[/*],_,g} -STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} .if defined(NO_ROOT) .if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} @@ -57,6 +56,7 @@ DIRS+=${group}DIR _${group}DIR= ${group}DIR .endif +STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} .for file in ${${group}} ${group}OWN_${file}?= ${${group}OWN} @@ -100,7 +100,7 @@ ${group}NAME_${file}?= ${file:T} STAGE_AS_SETS+=${file} STAGE_AS_${file}= ${${group}NAME_${file}} # XXX {group}OWN,GRP,MODE -STAGE_DIR.${file}= ${STAGE_OBJTOP}${${group}DIR_${file}} +STAGE_DIR.${file}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} stage_as.${file}: ${file} installfiles-${group}: _${group}INS1_${file} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343066 - head/share/mk
Author: sjg Date: Tue Jan 15 23:35:53 2019 New Revision: 343066 URL: https://svnweb.freebsd.org/changeset/base/343066 Log: Use .undef per variable Attempting to expand a variable to a list of vars to .undef does not actually work. Reviewed by: bdrewery Differential Revision:D17251 Modified: head/share/mk/dirdeps-options.mk Modified: head/share/mk/dirdeps-options.mk == --- head/share/mk/dirdeps-options.mkTue Jan 15 22:31:54 2019 (r343065) +++ head/share/mk/dirdeps-options.mkTue Jan 15 23:35:53 2019 (r343066) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: dirdeps-options.mk,v 1.8 2018/05/29 22:31:21 sjg Exp $ +# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ # # @(#) Copyright (c) 2018, Simon J. Gerraty # @@ -54,7 +54,8 @@ DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} DIRDEPS := ${DIRDEPS:O:u} # avoid cross contamination .for o in ${DIRDEPS_OPTIONS:tu} -.undef DIRDEPS.$o.yes DIRDEPS.$o.no +.undef DIRDEPS.$o.yes +.undef DIRDEPS.$o.no .endfor .else # whether options are enabled or not, ___ 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: r343065 - head/sys/dev/iwm
Author: bz Date: Tue Jan 15 22:31:54 2019 New Revision: 343065 URL: https://svnweb.freebsd.org/changeset/base/343065 Log: With the sync from Dragonfly BSD in r318216 a bug slipped in (also still present upstream it seems). The tlv variable was changed to a pointer but the advancement of the data pointer was left as sizeof(tlv). While the sizeof the (now) pointer equals the sizeof 2 x uint32_t (size of the struct) on 64bit platforms, on 32bit platforms the size of the advancement of the data pointer was wrong leading to firmware load issues. Correctly advance the data pointer by the size of the structure and not by the size of a pointer. PR: 219683 Submitted by: waddlesplash gamil.com (Haiku) on irc MFC after:1 week Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Tue Jan 15 21:43:18 2019(r343064) +++ head/sys/dev/iwm/if_iwm.c Tue Jan 15 22:31:54 2019(r343065) @@ -626,7 +626,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode goto parse_out; } len -= roundup2(tlv_len, 4); - data += sizeof(tlv) + roundup2(tlv_len, 4); + data += sizeof(*tlv) + roundup2(tlv_len, 4); switch ((int)tlv_type) { case IWM_UCODE_TLV_PROBE_MAX_LEN: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343060 - head/sys/dev/drm
Author: gonzo Date: Tue Jan 15 21:06:58 2019 New Revision: 343060 URL: https://svnweb.freebsd.org/changeset/base/343060 Log: [drm] Fix off-by-one error when accessing driver-specific ioctl handlers array PR: 231513 Submitted by: Young_X Approved by: imp MFC after:1 week Modified: head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drm_drv.c == --- head/sys/dev/drm/drm_drv.c Tue Jan 15 20:27:21 2019(r343059) +++ head/sys/dev/drm/drm_drv.c Tue Jan 15 21:06:58 2019(r343060) @@ -745,7 +745,7 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t d if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) { /* The array entries begin at DRM_COMMAND_BASE ioctl nr */ nr -= DRM_COMMAND_BASE; - if (nr > dev->driver->max_ioctl) { + if (nr >= dev->driver->max_ioctl) { DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n", nr, dev->driver->max_ioctl); return EINVAL; ___ 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
On 1/15/19 12:33 PM, Gleb Smirnoff wrote: > On Tue, Jan 15, 2019 at 01:20:14PM -0700, Ian Lepore wrote: > I> On Tue, 2019-01-15 at 12:06 -0800, Gleb Smirnoff wrote: > I> > On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote: > I> > J> Why not #include counter.h in the relevant vm_machdep.c files > I> > instead? > I> > > I> > This also is ugly :( Not sure more or less. Probably less, but I > I> > urged to plug all possible compilation failures at a time. > I> > > I> > What is ugly is that most files just need counter_u64_t size, > I> > and they don't use counter(9) KPI. > I> > > I> > The fact that vm_machdep or Linux KPI want to look into internal > I> > type uma_zone_t is also ugly. > I> > > I> > I> Isn't the usual fix for this problem to create a __counter_u64_t in > I> sys/types.h and use it in places where including the full header file > I> is undesirable for some reason? > > I'm inclined to this solution. Do you want to sign up as reviewer? :) I think normally we'd put the __counter_u64_t in sys/_types.h if we went that route. -- John Baldwin ___ 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
On Tue, Jan 15, 2019 at 01:20:14PM -0700, Ian Lepore wrote: I> On Tue, 2019-01-15 at 12:06 -0800, Gleb Smirnoff wrote: I> > On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote: I> > J> Why not #include counter.h in the relevant vm_machdep.c files I> > instead? I> > I> > This also is ugly :( Not sure more or less. Probably less, but I I> > urged to plug all possible compilation failures at a time. I> > I> > What is ugly is that most files just need counter_u64_t size, I> > and they don't use counter(9) KPI. I> > I> > The fact that vm_machdep or Linux KPI want to look into internal I> > type uma_zone_t is also ugly. I> > I> I> Isn't the usual fix for this problem to create a __counter_u64_t in I> sys/types.h and use it in places where including the full header file I> is undesirable for some reason? I'm inclined to this solution. Do you want to sign up as reviewer? :) -- 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
On Tue, 2019-01-15 at 12:06 -0800, Gleb Smirnoff wrote: > On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote: > J> Why not #include counter.h in the relevant vm_machdep.c files > instead? > > This also is ugly :( Not sure more or less. Probably less, but I > urged to plug all possible compilation failures at a time. > > What is ugly is that most files just need counter_u64_t size, > and they don't use counter(9) KPI. > > The fact that vm_machdep or Linux KPI want to look into internal > type uma_zone_t is also ugly. > Isn't the usual fix for this problem to create a __counter_u64_t in sys/types.h and use it in places where including the full header file is undesirable for some reason? -- Ian ___ 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
On Tue, Jan 15, 2019 at 01:46:23PM -0600, Justin Hibbits wrote: J> Why not #include counter.h in the relevant vm_machdep.c files instead? This also is ugly :( Not sure more or less. Probably less, but I urged to plug all possible compilation failures at a time. What is ugly is that most files just need counter_u64_t size, and they don't use counter(9) KPI. The fact that vm_machdep or Linux KPI want to look into internal type uma_zone_t is also ugly. -- 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
On Tue, 15 Jan 2019 19:33:47 + (UTC) Gleb Smirnoff wrote: > Author: glebius > Date: Tue Jan 15 19:33:47 2019 > New Revision: 343058 > URL: https://svnweb.freebsd.org/changeset/base/343058 > > Log: > Fix compilation failures on different arches that have vm_machdep.c > not aware of counter_u64_t by including counter.h into uma_int.h. I'm > not happy about this inclusion, but it fixes compilation ASAP. > > Modified: > head/sys/compat/linuxkpi/common/src/linux_page.c > head/sys/vm/uma_dbg.c > head/sys/vm/uma_int.h > > Modified: head/sys/compat/linuxkpi/common/src/linux_page.c > == > --- head/sys/compat/linuxkpi/common/src/linux_page.c Tue Jan > 15 19:01:04 2019 (r343057) +++ > head/sys/compat/linuxkpi/common/src/linux_page.c Tue Jan 15 > 19:33:47 2019 (r343058) @@ -31,7 +31,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > -#include > #include > #include > #include > > Modified: head/sys/vm/uma_dbg.c > == > --- head/sys/vm/uma_dbg.c Tue Jan 15 19:01:04 2019 > (r343057) +++ head/sys/vm/uma_dbg.c Tue Jan 15 19:33:47 > 2019 (r343058) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include > #include > #include > #include > > Modified: head/sys/vm/uma_int.h > == > --- head/sys/vm/uma_int.h Tue Jan 15 19:01:04 2019 > (r343057) +++ head/sys/vm/uma_int.h Tue Jan 15 19:33:47 > 2019 (r343058) @@ -30,6 +30,7 @@ > * > */ > > +#include > #include > #include > #include > Why not #include counter.h in the relevant vm_machdep.c files instead? - 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: r343058 - in head/sys: compat/linuxkpi/common/src vm
Author: glebius Date: Tue Jan 15 19:33:47 2019 New Revision: 343058 URL: https://svnweb.freebsd.org/changeset/base/343058 Log: Fix compilation failures on different arches that have vm_machdep.c not aware of counter_u64_t by including counter.h into uma_int.h. I'm not happy about this inclusion, but it fixes compilation ASAP. Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/vm/uma_dbg.c head/sys/vm/uma_int.h Modified: head/sys/compat/linuxkpi/common/src/linux_page.c == --- head/sys/compat/linuxkpi/common/src/linux_page.cTue Jan 15 19:01:04 2019(r343057) +++ head/sys/compat/linuxkpi/common/src/linux_page.cTue Jan 15 19:33:47 2019(r343058) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/vm/uma_dbg.c == --- head/sys/vm/uma_dbg.c Tue Jan 15 19:01:04 2019(r343057) +++ head/sys/vm/uma_dbg.c Tue Jan 15 19:33:47 2019(r343058) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/vm/uma_int.h == --- head/sys/vm/uma_int.h Tue Jan 15 19:01:04 2019(r343057) +++ head/sys/vm/uma_int.h Tue Jan 15 19:33:47 2019(r343058) @@ -30,6 +30,7 @@ * */ +#include #include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343056 - head/sys/dev/cxgbe/crypto
Author: jhb Date: Tue Jan 15 18:53:45 2019 New Revision: 343056 URL: https://svnweb.freebsd.org/changeset/base/343056 Log: Reject new sessions if the necessary queues aren't initialized. ccr reuses the control queue and first rx queue from the first port on each adapter. The driver cannot send requests until those queues are initialized. Refuse to create sessions for now if the queues aren't ready. This is a workaround until cxgbe allocates one or more dedicated queues for ccr. PR: 233851 MFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D18478 Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c == --- head/sys/dev/cxgbe/crypto/t4_crypto.c Tue Jan 15 18:50:11 2019 (r343055) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Tue Jan 15 18:53:45 2019 (r343056) @@ -1652,12 +1652,6 @@ ccr_attach(device_t dev) struct ccr_softc *sc; int32_t cid; - /* -* TODO: Crypto requests will panic if the parent device isn't -* initialized so that the queues are up and running. Need to -* figure out how to handle that correctly, maybe just reject -* requests if the adapter isn't fully initialized? -*/ sc = device_get_softc(dev); sc->dev = dev; sc->adapter = device_get_softc(device_get_parent(dev)); @@ -2058,6 +2052,16 @@ ccr_newsession(device_t dev, crypto_session_t cses, st } sc = device_get_softc(dev); + + /* +* XXX: Don't create a session if the queues aren't +* initialized. This is racy as the rxq can be destroyed by +* the associated VI detaching. Eventually ccr should use +* dedicated queues. +*/ + if (sc->rxq->iq.adapter == NULL || sc->txq->adapter == NULL) + return (ENXIO); + mtx_lock(>lock); if (sc->detaching) { mtx_unlock(>lock); ___ 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: r343055 - head/sys/vm
Author: glebius Date: Tue Jan 15 18:50:11 2019 New Revision: 343055 URL: https://svnweb.freebsd.org/changeset/base/343055 Log: style(9): break long line. Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Tue Jan 15 18:49:31 2019(r343054) +++ head/sys/vm/uma_core.c Tue Jan 15 18:50:11 2019(r343055) @@ -2924,7 +2924,8 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i zone->uz_sleeps++; zone->uz_sleepers++; while (zone->uz_items >= zone->uz_max_items) - mtx_sleep(zone, zone->uz_lockptr, PVM, "zonelimit", 0); + mtx_sleep(zone, zone->uz_lockptr, PVM, + "zonelimit", 0); zone->uz_sleepers--; if (zone->uz_sleepers > 0 && zone->uz_items + 1 < zone->uz_max_items) ___ 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: r343054 - head/sys/vm
Author: glebius Date: Tue Jan 15 18:49:31 2019 New Revision: 343054 URL: https://svnweb.freebsd.org/changeset/base/343054 Log: Remove harmless leftover from code that cycles over zone's kegs. Just use + instead of +=. There is no functional change. Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Tue Jan 15 18:47:19 2019(r343053) +++ head/sys/vm/uma_core.c Tue Jan 15 18:49:31 2019(r343054) @@ -3914,10 +3914,10 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) kz->uk_ppera; else uth.uth_pages = kz->uk_pages; - uth.uth_maxpages += (z->uz_max_items / kz->uk_ipers) * + uth.uth_maxpages = (z->uz_max_items / kz->uk_ipers) * kz->uk_ppera; uth.uth_limit = z->uz_max_items; - uth.uth_keg_free += z->uz_keg->uk_free; + uth.uth_keg_free = z->uz_keg->uk_free; /* * A zone is secondary is it is not the first entry ___ 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: r343053 - head/lib/libmemstat
Author: glebius Date: Tue Jan 15 18:47:19 2019 New Revision: 343053 URL: https://svnweb.freebsd.org/changeset/base/343053 Log: This was missed in r343051: make uz_allocs, uz_frees and uz_fails counter(9). Modified: head/lib/libmemstat/memstat_uma.c Modified: head/lib/libmemstat/memstat_uma.c == --- head/lib/libmemstat/memstat_uma.c Tue Jan 15 18:32:26 2019 (r343052) +++ head/lib/libmemstat/memstat_uma.c Tue Jan 15 18:47:19 2019 (r343053) @@ -29,6 +29,7 @@ */ #include +#include #include #include @@ -406,9 +407,12 @@ memstat_kvm_uma(struct memory_type_list *list, void *k * Reset the statistics on a current node. */ _memstat_mt_reset_stats(mtp, mp_maxid + 1); - mtp->mt_numallocs = uz.uz_allocs; - mtp->mt_numfrees = uz.uz_frees; - mtp->mt_failures = uz.uz_fails; + mtp->mt_numallocs = kvm_counter_u64_fetch(kvm, + (unsigned long )uz.uz_allocs); + mtp->mt_numfrees = kvm_counter_u64_fetch(kvm, + (unsigned long )uz.uz_frees); + mtp->mt_failures = kvm_counter_u64_fetch(kvm, + (unsigned long )uz.uz_fails); mtp->mt_sleeps = uz.uz_sleeps; if (kz.uk_flags & UMA_ZFLAG_INTERNAL) goto skip_percpu; ___ 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: r343052 - head/sys/vm
Author: glebius Date: Tue Jan 15 18:32:26 2019 New Revision: 343052 URL: https://svnweb.freebsd.org/changeset/base/343052 Log: Only do uz_items accounting for zones that have a limit set in uz_max_items. This reduces amount of locking required for these zones. Also, for cache only zones (UMA_ZFLAG_CACHE) accounting uz_items wasn't correct at all, since they may allocate items directly from their backing store and then free them via UMA underflowing uz_items. Tested by:pho Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Tue Jan 15 18:24:34 2019(r343051) +++ head/sys/vm/uma_core.c Tue Jan 15 18:32:26 2019(r343052) @@ -736,11 +736,13 @@ bucket_drain(uma_zone_t zone, uma_bucket_t bucket) for (i = 0; i < bucket->ub_cnt; i++) zone->uz_fini(bucket->ub_bucket[i], zone->uz_size); zone->uz_release(zone->uz_arg, bucket->ub_bucket, bucket->ub_cnt); - ZONE_LOCK(zone); - zone->uz_items -= bucket->ub_cnt; - if (zone->uz_sleepers && zone->uz_items < zone->uz_max_items) - wakeup_one(zone); - ZONE_UNLOCK(zone); + if (zone->uz_max_items > 0) { + ZONE_LOCK(zone); + zone->uz_items -= bucket->ub_cnt; + if (zone->uz_sleepers && zone->uz_items < zone->uz_max_items) + wakeup_one(zone); + ZONE_UNLOCK(zone); + } bucket->ub_cnt = 0; } @@ -2515,9 +2517,9 @@ zalloc_start: goto zalloc_item; maxbucket = MIN(zone->uz_count, zone->uz_max_items - zone->uz_items); + zone->uz_items += maxbucket; } else maxbucket = zone->uz_count; - zone->uz_items += maxbucket; ZONE_UNLOCK(zone); /* @@ -2530,9 +2532,8 @@ zalloc_start: zone->uz_name, zone, bucket); ZONE_LOCK(zone); if (bucket != NULL) { - if (bucket->ub_cnt < maxbucket) { - MPASS(zone->uz_flags & UMA_ZFLAG_CACHE || - zone->uz_items >= maxbucket - bucket->ub_cnt); + if (zone->uz_max_items > 0 && bucket->ub_cnt < maxbucket) { + MPASS(zone->uz_items >= maxbucket - bucket->ub_cnt); zone->uz_items -= maxbucket - bucket->ub_cnt; if (zone->uz_sleepers > 0 && zone->uz_items < zone->uz_max_items) @@ -2562,7 +2563,7 @@ zalloc_start: zone_put_bucket(zone, zdom, bucket, false); ZONE_UNLOCK(zone); goto zalloc_start; - } else { + } else if (zone->uz_max_items > 0) { zone->uz_items -= maxbucket; if (zone->uz_sleepers > 0 && zone->uz_items + 1 < zone->uz_max_items) @@ -2912,24 +2913,25 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i ZONE_LOCK_ASSERT(zone); - if (zone->uz_max_items > 0 && zone->uz_items >= zone->uz_max_items) { - zone_log_warning(zone); - zone_maxaction(zone); - if (flags & M_NOWAIT) { - ZONE_UNLOCK(zone); - return (NULL); + if (zone->uz_max_items > 0) { + if (zone->uz_items >= zone->uz_max_items) { + zone_log_warning(zone); + zone_maxaction(zone); + if (flags & M_NOWAIT) { + ZONE_UNLOCK(zone); + return (NULL); + } + zone->uz_sleeps++; + zone->uz_sleepers++; + while (zone->uz_items >= zone->uz_max_items) + mtx_sleep(zone, zone->uz_lockptr, PVM, "zonelimit", 0); + zone->uz_sleepers--; + if (zone->uz_sleepers > 0 && + zone->uz_items + 1 < zone->uz_max_items) + wakeup_one(zone); } - zone->uz_sleeps++; - zone->uz_sleepers++; - while (zone->uz_items >= zone->uz_max_items) - mtx_sleep(zone, zone->uz_lockptr, PVM, "zonelimit", 0); - zone->uz_sleepers--; - if (zone->uz_sleepers > 0 && - zone->uz_items + 1 < zone->uz_max_items) - wakeup_one(zone); + zone->uz_items++; } - - zone->uz_items++; ZONE_UNLOCK(zone); if (domain != UMA_ANYDOMAIN) { @@ -2978,9 +2980,11 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i return (item); fail: - ZONE_LOCK(zone); - zone->uz_items--; - ZONE_UNLOCK(zone); + if
svn commit: r343051 - in head/sys: compat/linuxkpi/common/src vm
Author: glebius Date: Tue Jan 15 18:24:34 2019 New Revision: 343051 URL: https://svnweb.freebsd.org/changeset/base/343051 Log: Make uz_allocs, uz_frees and uz_fails counter(9). This removes some atomic updates and reduces amount of data protected by zone lock. During startup point these fields to EARLY_COUNTER. After startup allocate them for all early zones. Tested by:pho Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/vm/uma_core.c head/sys/vm/uma_dbg.c head/sys/vm/uma_int.h Modified: head/sys/compat/linuxkpi/common/src/linux_page.c == --- head/sys/compat/linuxkpi/common/src/linux_page.cTue Jan 15 18:22:16 2019(r343050) +++ head/sys/compat/linuxkpi/common/src/linux_page.cTue Jan 15 18:24:34 2019(r343051) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Tue Jan 15 18:22:16 2019(r343050) +++ head/sys/vm/uma_core.c Tue Jan 15 18:24:34 2019(r343051) @@ -1715,6 +1715,15 @@ keg_ctor(void *mem, int size, void *udata, int flags) return (0); } +static void +zone_alloc_counters(uma_zone_t zone) +{ + + zone->uz_allocs = counter_u64_alloc(M_WAITOK); + zone->uz_frees = counter_u64_alloc(M_WAITOK); + zone->uz_fails = counter_u64_alloc(M_WAITOK); +} + /* * Zone header ctor. This initializes all fields, locks, etc. * @@ -1736,9 +1745,6 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone->uz_slab = zone_fetch_slab; zone->uz_init = NULL; zone->uz_fini = NULL; - zone->uz_allocs = 0; - zone->uz_frees = 0; - zone->uz_fails = 0; zone->uz_sleeps = 0; zone->uz_count = 0; zone->uz_count_min = 0; @@ -1750,6 +1756,14 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone->uz_bkt_max = ULONG_MAX; timevalclear(>uz_ratecheck); + if (__predict_true(booted == BOOT_RUNNING)) + zone_alloc_counters(zone); + else { + zone->uz_allocs = EARLY_COUNTER; + zone->uz_frees = EARLY_COUNTER; + zone->uz_fails = EARLY_COUNTER; + } + /* * This is a pure cache zone, no kegs. */ @@ -1908,6 +1922,9 @@ zone_dtor(void *arg, int size, void *udata) rw_wunlock(_rwlock); zone_free_item(kegs, keg, NULL, SKIP_NONE); } + counter_u64_free(zone->uz_allocs); + counter_u64_free(zone->uz_frees); + counter_u64_free(zone->uz_fails); if (zone->uz_lockptr == >uz_lock) ZONE_LOCK_FINI(zone); } @@ -1928,12 +1945,19 @@ zone_foreach(void (*zfunc)(uma_zone_t)) uma_keg_t keg; uma_zone_t zone; - rw_rlock(_rwlock); + /* +* Before BOOT_RUNNING we are guaranteed to be single +* threaded, so locking isn't needed. Startup functions +* are allowed to use M_WAITOK. +*/ + if (__predict_true(booted == BOOT_RUNNING)) + rw_rlock(_rwlock); LIST_FOREACH(keg, _kegs, uk_link) { LIST_FOREACH(zone, >uk_zones, uz_link) zfunc(zone); } - rw_runlock(_rwlock); + if (__predict_true(booted == BOOT_RUNNING)) + rw_runlock(_rwlock); } /* @@ -2109,6 +2133,7 @@ uma_startup3(void) uma_dbg_cnt = counter_u64_alloc(M_WAITOK); uma_skip_cnt = counter_u64_alloc(M_WAITOK); #endif + zone_foreach(zone_alloc_counters); callout_init(_callout, 1); callout_reset(_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); booted = BOOT_RUNNING; @@ -2387,7 +2412,7 @@ zalloc_start: zone->uz_dtor != trash_dtor) && #endif zone->uz_ctor(item, zone->uz_size, udata, flags) != 0) { - atomic_add_long(>uz_fails, 1); + counter_u64_add(zone->uz_fails, 1); zone_free_item(zone, item, udata, SKIP_DTOR | SKIP_CNT); return (NULL); } @@ -2845,7 +2870,7 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do if (bucket->ub_cnt == 0) { bucket_free(zone, bucket, udata); - atomic_add_long(>uz_fails, 1); + counter_u64_add(zone->uz_fails, 1); return (NULL); } @@ -2905,7 +2930,6 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i } zone->uz_items++; - zone->uz_allocs++; ZONE_UNLOCK(zone); if (domain != UMA_ANYDOMAIN) { @@ -2947,6 +2971,7 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i if (flags & M_ZERO) uma_zero_item(item, zone); +
svn commit: r343048 - head
Author: jhb Date: Tue Jan 15 18:20:20 2019 New Revision: 343048 URL: https://svnweb.freebsd.org/changeset/base/343048 Log: Update the note about the need for COMPAT_FREEBSD kernel options. Rather than mentioning the requirement for 4.x binaries but not explaining why (it was assuming an upgrade from 4.x to 5.0-current), explain when compat options are needed (for running existing host binaries) in a more general way while using a more modern example (COMPAT_FREEBSD11 for 11.x binaries). While here, explicitly mention that a GENERIC kernel should always work. Reported by: Robert Huff Reviewed by: imp MFC after:1 week Differential Revision:https://reviews.freebsd.org/D18740 Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Tue Jan 15 17:40:19 2019(r343047) +++ head/UPDATING Tue Jan 15 18:20:20 2019(r343048) @@ -1901,12 +1901,13 @@ COMMON ITEMS: can be deleted by "make delete-old-libs", but you have to make sure that no program is using those libraries anymore. - [8] In order to have a kernel that can run the 4.x binaries needed to - do an installworld, you must include the COMPAT_FREEBSD4 option in - your kernel. Failure to do so may leave you with a system that is - hard to boot to recover. A similar kernel option COMPAT_FREEBSD5 is - required to run the 5.x binaries on more recent kernels. And so on - for COMPAT_FREEBSD6 and COMPAT_FREEBSD7. + [8] The new kernel must be able to run existing binaries used by + an installworld. When upgrading across major versions, the new + kernel's configuration must include the correct COMPAT_FREEBSD + option for existing binaries (e.g. COMPAT_FREEBSD11 to run 11.x + binaries). Failure to do so may leave you with a system that is + hard to boot to recover. A GENERIC kernel will include suitable + compatibility options to run binaries from older branches. Make sure that you merge any new devices from GENERIC since the last time you updated your kernel config file. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm
On Tue, Jan 15, 2019 at 11:13:18AM -0500, Pedro Giffuni wrote: P> >> Allocate pager bufs from UMA instead of 80-ish mutex protected P> >> linked list. P> > P> >> Together with: gallatin P> > P> > Thank you so much for carrying this over the finish line! P> > P> It appears to be very impressive! Plans for MFC? Nope. I'm very conservative about stable branch being stable branch :) -- 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"
svn commit: r343047 - head/sys/netinet
Author: shurd Date: Tue Jan 15 17:40:19 2019 New Revision: 343047 URL: https://svnweb.freebsd.org/changeset/base/343047 Log: Fix window update issue when scaling disabled When the TCP window scale option is not used, and the window opens up enough in one soreceive, a window update will not be sent. For example, if recwin == 65535, so->so_rcv.sb_hiwat >= 262144, and so->so_rcv.sb_hiwat <= 524272, the window update will never be sent. This is because recwin and adv are clamped to TCP_MAXWIN << tp->rcv_scale, and so will never be >= so->so_rcv.sb_hiwat / 4 or <= so->so_rcv.sb_hiwat / 8. This patch ensures a window update is sent if the window opens by TCP_MAXWIN << tp->rcv_scale, which should only happen when the window size goes from zero to the max expressible. This issue looks like it was introduced in r306769 when recwin was clamped to TCP_MAXWIN << tp->rcv_scale. MFC after:1 week Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D18821 Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c == --- head/sys/netinet/tcp_output.c Tue Jan 15 16:12:47 2019 (r343046) +++ head/sys/netinet/tcp_output.c Tue Jan 15 17:40:19 2019 (r343047) @@ -656,7 +656,8 @@ after_sack_rexmit: if (adv >= (int32_t)(2 * tp->t_maxseg) && (adv >= (int32_t)(so->so_rcv.sb_hiwat / 4) || recwin <= (so->so_rcv.sb_hiwat / 8) || -so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg)) +so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg || +adv >= TCP_MAXWIN << tp->rcv_scale)) goto send; if (2 * adv >= (int32_t)so->so_rcv.sb_hiwat) goto send; ___ 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: r343043 - head/crypto/openssh
> Author: emaste > Date: Tue Jan 15 15:35:14 2019 > New Revision: 343043 > URL: https://svnweb.freebsd.org/changeset/base/343043 > > Log: > scp: disallow empty or current directory > > Obtained from: OpenBSD scp.c 1.198 > Security: CVE-2018-20685 > Sponsored by: The FreeBSD Foundation Can this be MFCed to 12, 11 and 10? > > Modified: > head/crypto/openssh/scp.c > > Modified: head/crypto/openssh/scp.c > == > --- head/crypto/openssh/scp.c Tue Jan 15 09:48:18 2019(r343042) > +++ head/crypto/openssh/scp.c Tue Jan 15 15:35:14 2019(r343043) > @@ -1106,7 +1106,8 @@ sink(int argc, char **argv) > SCREWUP("size out of range"); > size = (off_t)ull; > > - if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) { > + if (*cp == '\0' || strchr(cp, '/') != NULL || > + strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) { > run_err("error: unexpected filename: %s", cp); > exit(1); > } > > -- Rod Grimes rgri...@freebsd.org ___ 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: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm
On 1/15/19 11:07 AM, Andrew Gallatin wrote: On 1/14/19 8:02 PM, Gleb Smirnoff wrote: Log: Allocate pager bufs from UMA instead of 80-ish mutex protected linked list. <...> Together with: gallatin Thank you so much for carrying this over the finish line! Drew It appears to be very impressive! Plans for MFC? Pedro. ___ 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: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm
On 1/14/19 8:02 PM, Gleb Smirnoff wrote: Log: Allocate pager bufs from UMA instead of 80-ish mutex protected linked list. <...> Together with: gallatin Thank you so much for carrying this over the finish line! Drew ___ 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: r343043 - head/crypto/openssh
Author: emaste Date: Tue Jan 15 15:35:14 2019 New Revision: 343043 URL: https://svnweb.freebsd.org/changeset/base/343043 Log: scp: disallow empty or current directory Obtained from:OpenBSD scp.c 1.198 Security: CVE-2018-20685 Sponsored by: The FreeBSD Foundation Modified: head/crypto/openssh/scp.c Modified: head/crypto/openssh/scp.c == --- head/crypto/openssh/scp.c Tue Jan 15 09:48:18 2019(r343042) +++ head/crypto/openssh/scp.c Tue Jan 15 15:35:14 2019(r343043) @@ -1106,7 +1106,8 @@ sink(int argc, char **argv) SCREWUP("size out of range"); size = (off_t)ull; - if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) { + if (*cp == '\0' || strchr(cp, '/') != NULL || + strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) { run_err("error: unexpected filename: %s", cp); exit(1); } ___ 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: r343042 - head/sys/arm64/arm64
Author: andrew Date: Tue Jan 15 09:48:18 2019 New Revision: 343042 URL: https://svnweb.freebsd.org/changeset/base/343042 Log: Ensure the I-Cache is correctly handled in arm64_icache_sync_range The cache_handle_range macro to handle the arm64 instruction and data cache operations would return when it was complete. This causes problems for arm64_icache_sync_range and arm64_icache_sync_range_checked as they assume they can execute the i-cache handling instruction after it has been called. Fix this by making this assumption correct. While here add missing instruction barriers and adjust the style to match the rest of the assembly. Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D18838 Modified: head/sys/arm64/arm64/cpufunc_asm.S Modified: head/sys/arm64/arm64/cpufunc_asm.S == --- head/sys/arm64/arm64/cpufunc_asm.S Tue Jan 15 08:59:51 2019 (r343041) +++ head/sys/arm64/arm64/cpufunc_asm.S Tue Jan 15 09:48:18 2019 (r343042) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); .if \ic != 0 isb .endif - ret .endm ENTRY(arm64_nullop) @@ -112,6 +111,7 @@ END(arm64_tlb_flushID) */ ENTRY(arm64_dcache_wb_range) cache_handle_range dcop = cvac + ret END(arm64_dcache_wb_range) /* @@ -119,6 +119,7 @@ END(arm64_dcache_wb_range) */ ENTRY(arm64_dcache_wbinv_range) cache_handle_range dcop = civac + ret END(arm64_dcache_wbinv_range) /* @@ -129,6 +130,7 @@ END(arm64_dcache_wbinv_range) */ ENTRY(arm64_dcache_inv_range) cache_handle_range dcop = ivac + ret END(arm64_dcache_inv_range) /* @@ -136,6 +138,7 @@ END(arm64_dcache_inv_range) */ ENTRY(arm64_idcache_wbinv_range) cache_handle_range dcop = civac, ic = 1, icop = ivau + ret END(arm64_idcache_wbinv_range) /* @@ -150,6 +153,8 @@ ENTRY(arm64_icache_sync_range) cache_handle_range dcop = cvau ic ialluis dsb ish + isb + ret END(arm64_icache_sync_range) /* @@ -161,7 +166,8 @@ ENTRY(arm64_icache_sync_range_checked) /* XXX: See comment in arm64_icache_sync_range */ cache_handle_range dcop = cvau ic ialluis - dsb ish + dsb ish + isb SET_FAULT_HANDLER(xzr, x6) mov x0, #0 ret ___ 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: r343041 - head/sys/netpfil/pf
Author: kp Date: Tue Jan 15 08:59:51 2019 New Revision: 343041 URL: https://svnweb.freebsd.org/changeset/base/343041 Log: pf: silence a runtime warning Sometimes, for negated tables, pf can log 'pfr_update_stats: assertion failed'. This warning does not clarify anything for users, so silence it, just as OpenBSD has. PR: 234874 MFC after:1 week Modified: head/sys/netpfil/pf/pf_table.c Modified: head/sys/netpfil/pf/pf_table.c == --- head/sys/netpfil/pf/pf_table.c Tue Jan 15 06:52:34 2019 (r343040) +++ head/sys/netpfil/pf/pf_table.c Tue Jan 15 08:59:51 2019 (r343041) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x + #defineACCEPT_FLAGS(flags, oklist) \ do {\ if ((flags & ~(oklist)) & \ @@ -1992,7 +1994,8 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr } if ((ke == NULL || ke->pfrke_not) != notrule) { if (op_pass != PFR_OP_PASS) - printf("pfr_update_stats: assertion failed.\n"); + DPFPRINTF(PF_DEBUG_URGENT, + ("pfr_update_stats: assertion failed.\n")); op_pass = PFR_OP_XPASS; } kt->pfrkt_packets[dir_out][op_pass]++; ___ 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"