svn commit: r354633 - head/usr.bin/netstat
Author: karels Date: Tue Nov 12 01:03:08 2019 New Revision: 354633 URL: https://svnweb.freebsd.org/changeset/base/354633 Log: Fix netstat -gs with ip_mroute module and/or vnet The code for "netstat -gs -f inet" failed if the kernel namelist did not include the _mrtstat symbol. However, that symbol is not in a standard kernel even with the ip_mroute module loaded, where the functionality is available. It is also not in a kernel with MROUTING but also VIMAGE, as there can be multiple sets of stats. However, when running the command on a live system, the symbol is not used; a sysctl is used. Go ahead and try the sysctl in any case, and complain that IPv4 MROUTING is not present only if the sysctl fails with ENOENT. Also fail if _mrtstat is not defined when running on a core file; netstat doesn't know about vnets, so can only work if MROUTING was included, and VIMAGE was not. Reviewed by: bz MFC after:1 week Differential Revision:https://reviews.freebsd.org/D22311 Modified: head/usr.bin/netstat/mroute.c Modified: head/usr.bin/netstat/mroute.c == --- head/usr.bin/netstat/mroute.c Tue Nov 12 00:32:33 2019 (r354632) +++ head/usr.bin/netstat/mroute.c Tue Nov 12 01:03:08 2019 (r354633) @@ -409,14 +409,12 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, , - sizeof(mrtstat), kread_counters) != 0) + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; + } xo_emit("{T:IPv4 multicast forwarding}:\n"); ___ 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: r354632 - head/sys/ufs/ufs
Author: chs Date: Tue Nov 12 00:32:33 2019 New Revision: 354632 URL: https://svnweb.freebsd.org/changeset/base/354632 Log: In ufs_dir_dd_ino(), always initialize *dd_vp since the caller expects it. Reviewed by: kib, mckusick Approved by: imp (mentor) Sponsored by: Netflix Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c == --- head/sys/ufs/ufs/ufs_lookup.c Mon Nov 11 22:18:05 2019 (r354631) +++ head/sys/ufs/ufs/ufs_lookup.c Tue Nov 12 00:32:33 2019 (r354632) @@ -1408,6 +1408,7 @@ ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, i int error, namlen; ASSERT_VOP_LOCKED(vp, "ufs_dir_dd_ino"); + *dd_vp = NULL; if (vp->v_type != VDIR) return (ENOTDIR); /* @@ -1440,7 +1441,6 @@ ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, i dirbuf.dotdot_name[1] != '.') return (ENOTDIR); *dd_ino = dirbuf.dotdot_ino; - *dd_vp = NULL; return (0); } ___ 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: r354631 - head/sys/x86/x86
Author: scottl Date: Mon Nov 11 22:18:05 2019 New Revision: 354631 URL: https://svnweb.freebsd.org/changeset/base/354631 Log: Add the text attribute for MDS_NO in the IA32_ARCH_CAP MSR. Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c == --- head/sys/x86/x86/identcpu.c Mon Nov 11 21:59:20 2019(r354630) +++ head/sys/x86/x86/identcpu.c Mon Nov 11 22:18:05 2019(r354631) @@ -1045,6 +1045,7 @@ printcpuinfo(void) "\003RSBA" "\004SKIP_L1DFL_VME" "\005SSB_NO" + "\006MDS_NO" ); } ___ 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: r354458 - head/libexec/rc/rc.d
On T1349, Ian Lepore wrote: > On Sun, 2019-11-10 at 16:08 +, Edward Tomasz Napierala wrote: > > On 1109T2049, Alexander Leidinger wrote: > > > Quoting Edward Tomasz Napierala (from Thu, 7 > > > Nov > > > 2019 18:15:24 + (UTC)): > > > > > > > Author: trasz > > > > Date: Thu Nov 7 18:15:24 2019 > > > > New Revision: 354458 > > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > > > Log: > > > > Extend the linux rc script to mount the neccessary file > > > > systems, > > > > set ELF fallback brand, and load pty(4). > > > > > > We never did something like that. We have it documented > > > everywhere > > > that it needs to be done manually. So this is at least a POLA > > > violation. It is great that the nocover option is used in the > > > mount, > > > but it's still some kind of layering violation (I may want to > > > have > > > only a subset mounted, or nothing at all). > > > > It is kind of a POLA violation, but previously the linux_enable > > knob didn't do much apart from loading the linux{,64}.ko kernel > > module and doing something weird with ldconfig, which I'm not > > even sure is actually useful. In other words, the old behaviour > > can be restored by just not using linux_enable, and instead > > loading the kernel modules the same way all the others are loaded. > > > > Could you give me some use case why someone would want only a subset > > of the filesystems? > > > > Well, there's my use case, where the subset of those filesystems that I > want mounted is: none of them. > > The apps I use under the linuxlator work fine without having a single > one of those filesystems mounted, and I don't want something to start > mounting them for me when I don't even need them. Thanks, makes sense. See https://reviews.freebsd.org/D22320; I've added both you and Alexander as reviewers. ___ 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: r354458 - head/libexec/rc/rc.d
On T2115, Alexander Leidinger wrote: > Quoting Edward Tomasz Napierała (from Sun, 10 Nov > 2019 20:25:04 +): > > > On 1110T1147, Conrad Meyer wrote: > > >> I am on board with making this stuff more “batteries included” and usable > >> by default, but just echoing the request for configurable knobs (I don’t > >> care about the defaults). > > > > My point is... well, there are two. First is, it's configurable already: > > you can comment out parts of the rc script you don't want, or you can not > > We want to have the system rc scripts "no touch" scripts, don't we? I don't quite agree, but I'm not going to fight for it. > > set linux_enable in the first place and do things it would otherwise do > > for you by in the usual manner - add the modules to loader.conf, add a > > line to sysctl.conf etc. The script simply provides a shortcut to match > > what 90% of users want. > > I agree. > > > Second, in order to implement something properly, I need to understand > > how it's going to be used. I guess I worded it quite badly in the > > previous mail; it's wasn't supposed to sound like "Can you give me some > > use case because I think you're wrong", but rather a "Can you give me > > some use case, because without it I have no idea how to design it to > > fit it". > > What about a config variable which enables or disables the mounts? > That way we don't have to modify the rc script to get back to the old > behavior in cases were we need it. Okay, this is easy to do; see https://reviews.freebsd.org/D22320. ___ 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: r354630 - head/sys/amd64/amd64
Author: kib Date: Mon Nov 11 21:59:20 2019 New Revision: 354630 URL: https://svnweb.freebsd.org/changeset/base/354630 Log: amd64: Issue MFENCE on context switch on AMD CPUs when reusing address space. On some AMD CPUs, in particular, machines that do not implement CLFLUSHOPT but do provide CLFLUSH, the CLFLUSH instruction is only synchronized with MFENCE. Code using CLFLUSH typicall needs to brace it with MFENCE both before and after flush, see for instance pmap_invalidate_cache_range(). If context switch occurs while inside the protected region, we need to ensure visibility of flushes done on the old CPU, to new CPU. For all other machines, locked operation done to lock switched thread, should be enough. For case of different address spaces, reload of %cr3 is serializing. Reviewed by: cem, jhb, scottph Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D22007 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Mon Nov 11 20:44:30 2019(r354629) +++ head/sys/amd64/amd64/pmap.c Mon Nov 11 21:59:20 2019(r354630) @@ -8810,8 +8810,11 @@ pmap_activate_sw(struct thread *td) oldpmap = PCPU_GET(curpmap); pmap = vmspace_pmap(td->td_proc->p_vmspace); - if (oldpmap == pmap) + if (oldpmap == pmap) { + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); return; + } cpuid = PCPU_GET(cpuid); #ifdef SMP CPU_SET_ATOMIC(cpuid, >pm_active); ___ 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: r354458 - head/libexec/rc/rc.d
On Sun, 2019-11-10 at 16:08 +, Edward Tomasz Napierala wrote: > On 1109T2049, Alexander Leidinger wrote: > > Quoting Edward Tomasz Napierala (from Thu, 7 > > Nov > > 2019 18:15:24 + (UTC)): > > > > > Author: trasz > > > Date: Thu Nov 7 18:15:24 2019 > > > New Revision: 354458 > > > URL: https://svnweb.freebsd.org/changeset/base/354458 > > > > > > Log: > > > Extend the linux rc script to mount the neccessary file > > > systems, > > > set ELF fallback brand, and load pty(4). > > > > We never did something like that. We have it documented > > everywhere > > that it needs to be done manually. So this is at least a POLA > > violation. It is great that the nocover option is used in the > > mount, > > but it's still some kind of layering violation (I may want to > > have > > only a subset mounted, or nothing at all). > > It is kind of a POLA violation, but previously the linux_enable > knob didn't do much apart from loading the linux{,64}.ko kernel > module and doing something weird with ldconfig, which I'm not > even sure is actually useful. In other words, the old behaviour > can be restored by just not using linux_enable, and instead > loading the kernel modules the same way all the others are loaded. > > Could you give me some use case why someone would want only a subset > of the filesystems? > Well, there's my use case, where the subset of those filesystems that I want mounted is: none of them. The apps I use under the linuxlator work fine without having a single one of those filesystems mounted, and I don't want something to start mounting them for me when I don't even need them. -- 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"
svn commit: r354629 - head/sys/kern
Author: markj Date: Mon Nov 11 20:44:30 2019 New Revision: 354629 URL: https://svnweb.freebsd.org/changeset/base/354629 Log: Fix handling of PIPE_EOF in the direct write path. Suppose a writing thread has pinned its pages and gone to sleep with pipe_map.cnt > 0. Suppose that the thread is woken up by a signal (so error != 0) and the other end of the pipe has simultaneously been closed. In this case, to satisfy the assertion about pipe_map.cnt in pipe_destroy_write_buffer(), we must mark the buffer as empty. Reported by: syzbot+5cce271bf2cb1b1e1...@syzkaller.appspotmail.com Reviewed by: kib Tested by:pho MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D22261 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c == --- head/sys/kern/sys_pipe.cMon Nov 11 19:54:08 2019(r354628) +++ head/sys/kern/sys_pipe.cMon Nov 11 20:44:30 2019(r354629) @@ -970,15 +970,8 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0) { - if (wpipe->pipe_state & PIPE_EOF) { - wpipe->pipe_map.cnt = 0; - pipe_destroy_write_buffer(wpipe); - pipeselwakeup(wpipe); - pipeunlock(wpipe); - error = EPIPE; - goto error1; - } + while (wpipe->pipe_map.cnt != 0 && + (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -993,12 +986,16 @@ retry: break; } - if (wpipe->pipe_state & PIPE_EOF) + if ((wpipe->pipe_state & PIPE_EOF) != 0) { + wpipe->pipe_map.cnt = 0; + pipe_destroy_write_buffer(wpipe); + pipeselwakeup(wpipe); error = EPIPE; - if (error == EINTR || error == ERESTART) + } else if (error == EINTR || error == ERESTART) { pipe_clone_write_buffer(wpipe); - else + } else { pipe_destroy_write_buffer(wpipe); + } pipeunlock(wpipe); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("pipe %p leaked PIPE_DIRECTW", wpipe)); ___ 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: r354458 - head/libexec/rc/rc.d
Quoting Edward Tomasz Napierała (from Sun, 10 Nov 2019 20:25:04 +): On 1110T1147, Conrad Meyer wrote: I am on board with making this stuff more “batteries included” and usable by default, but just echoing the request for configurable knobs (I don’t care about the defaults). My point is... well, there are two. First is, it's configurable already: you can comment out parts of the rc script you don't want, or you can not We want to have the system rc scripts "no touch" scripts, don't we? set linux_enable in the first place and do things it would otherwise do for you by in the usual manner - add the modules to loader.conf, add a line to sysctl.conf etc. The script simply provides a shortcut to match what 90% of users want. I agree. Second, in order to implement something properly, I need to understand how it's going to be used. I guess I worded it quite badly in the previous mail; it's wasn't supposed to sound like "Can you give me some use case because I think you're wrong", but rather a "Can you give me some use case, because without it I have no idea how to design it to fit it". What about a config variable which enables or disables the mounts? That way we don't have to modify the rc script to get back to the old behavior in cases were we need it. Bye, Alexander. -- http://www.Leidinger.net alexan...@leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.orgnetch...@freebsd.org : PGP 0x8F31830F9F2772BF pgp4EWwHtJjqv.pgp Description: Digitale PGP-Signatur
svn commit: r354627 - head/sys/i386/i386
Author: avg Date: Mon Nov 11 19:06:04 2019 New Revision: 354627 URL: https://svnweb.freebsd.org/changeset/base/354627 Log: db_nextframe/i386: reduce the number of special frame types This change removes TRAP_INTERRUPT and TRAP_TIMERINT frame types. Their names are a bit confusing: trap + interrupt, what is that? The TRAP_TIMERINT name is too specific -- can it only be used for timer "trap-interrupts"? What is so special about them? My understanding of the code is that INTERRUPT, TRAP_INTERRUPT and TRAP_TIMERINT differ only in how an offset from callee's frame pointer to a trap frame on the stack is calculated. And that depends on a number of arguments that a special handler passes to a callee (a function with a normal C calling convention). So, this change makes that logic explicit and collapses all interrupt frame types into the INTERRUPT type. Reviewed by: markj Discussed with: kib, jhb MFC after:3 weeks Differential Revision: https://reviews.freebsd.org/D22303 Modified: head/sys/i386/i386/db_trace.c Modified: head/sys/i386/i386/db_trace.c == --- head/sys/i386/i386/db_trace.c Mon Nov 11 17:45:06 2019 (r354626) +++ head/sys/i386/i386/db_trace.c Mon Nov 11 19:06:04 2019 (r354627) @@ -191,8 +191,6 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int o #defineINTERRUPT 2 #defineSYSCALL 3 #defineDOUBLE_FAULT4 -#defineTRAP_INTERRUPT 5 -#defineTRAP_TIMERINT 6 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); @@ -299,6 +297,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st { struct trapframe *tf; int frame_type; + int narg; int eip, esp, ebp; db_expr_t offset; c_db_sym_t sym; @@ -317,6 +316,15 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st * actually made the call. */ frame_type = NORMAL; + + /* +* This is the number of arguments that a syscall / trap / interrupt +* service routine passes to its callee. This number is used only for +* special frame types. In most cases there is one argument: the trap +* frame address. +*/ + narg = 1; + if (eip >= PMAP_TRM_MIN_ADDRESS) { sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, ); @@ -329,20 +337,24 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st strcmp(name, "fork_trampoline") == 0) frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || - strncmp(name, "Xapic_isr", 9) == 0) + strncmp(name, "Xapic_isr", 9) == 0) { + /* Additional argument: vector number. */ + narg = 2; frame_type = INTERRUPT; - else if (strcmp(name, "Xlcall_syscall") == 0 || + } else if (strcmp(name, "Xlcall_syscall") == 0 || strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0) - frame_type = TRAP_TIMERINT; + frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; + strcmp(name, "Xipi_intr_bitmap_handler") == 0) { + /* No arguments. */ + narg = 0; + frame_type = INTERRUPT; + } } /* @@ -375,14 +387,11 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st /* * Point to base of trapframe which is just above the -* current frame. +* current frame. Note that struct i386_frame already accounts for one +* argument. */ - if (frame_type == INTERRUPT) - tf = (struct trapframe *)((int)*fp + 16); - else if (frame_type == TRAP_INTERRUPT) - tf = (struct trapframe *)((int)*fp + 8); - else - tf = (struct trapframe *)((int)*fp + 12); + tf = (struct trapframe *)((char *)*fp + sizeof(struct i386_frame) + + 4 * (narg - 1)); esp = get_esp(tf); eip = tf->tf_eip; @@ -395,8 +404,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st db_printf("--- syscall"); decode_syscall(tf->tf_eax,
svn commit: r354624 - head/usr.bin/tip/tip
Author: vangyzen Date: Mon Nov 11 17:41:52 2019 New Revision: 354624 URL: https://svnweb.freebsd.org/changeset/base/354624 Log: tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/usr.bin/tip/tip/tip.c Modified: head/usr.bin/tip/tip/tip.c == --- head/usr.bin/tip/tip/tip.c Mon Nov 11 17:36:57 2019(r354623) +++ head/usr.bin/tip/tip/tip.c Mon Nov 11 17:41:52 2019(r354624) @@ -252,7 +252,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -402,11 +401,16 @@ tipin(void) } while (1) { - gch = getchar()_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -420,7 +424,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -444,8 +451,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags) && uid) ___ 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: r354625 - head/contrib/libc++/include
Author: dim Date: Mon Nov 11 17:41:56 2019 New Revision: 354625 URL: https://svnweb.freebsd.org/changeset/base/354625 Log: Merge commit 371ea70bb from llvm git (by Louis Dionne): [libc++] Harden usage of static_assert against C++03 In C++03, we emulate static_assert with a macro, and we must parenthesize multiple arguments. llvm-svn: 373328 This is a follow-up to r354460, which causes errors for pre-C++11 programs using , similar to: /usr/include/c++/v1/cmath:622:68: error: too many arguments provided to function-like macro invocation Reported by: antoine MFC after:immediately (because of ports breakage) Modified: head/contrib/libc++/include/cmath Modified: head/contrib/libc++/include/cmath == --- head/contrib/libc++/include/cmath Mon Nov 11 17:41:52 2019 (r354624) +++ head/contrib/libc++/include/cmath Mon Nov 11 17:41:56 2019 (r354625) @@ -644,8 +644,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_fl static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); static_assert(is_integral<_IntT>::value, "must be an integral type"); static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); - static_assert(_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value - || _IsSame<_FloatT,long double>::value, "unsupported floating point type"); + static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value + || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); } ___ 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: r354620 - head/sys/cam/scsi
Author: imp Date: Mon Nov 11 17:36:42 2019 New Revision: 354620 URL: https://svnweb.freebsd.org/changeset/base/354620 Log: Fix panic message to indicate right action that was improper. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:11:49 2019(r354619) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:42 2019(r354620) @@ -1686,7 +1686,7 @@ da_periph_release_locked(struct cam_periph *periph, da da_ref_text[token], token); cnt = atomic_fetchadd_int(>ref_flags[token], -1); if (cnt != 1) - panic("Unholding %d with cnt = %d", token, cnt); + panic("releasing (locked) %d with cnt = %d", token, cnt); cam_periph_release_locked(periph); } ___ 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: r354621 - head/sys/cam/scsi
Author: imp Date: Mon Nov 11 17:36:47 2019 New Revision: 354621 URL: https://svnweb.freebsd.org/changeset/base/354621 Log: Require and enforce that dareprobe() has to be called with the periph lock held. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:42 2019(r354620) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:47 2019(r354621) @@ -2133,8 +2133,8 @@ daasync(void *callback_arg, u_int32_t code, "Capacity data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } else if (asc == 0x28 && ascq == 0x00) { cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; @@ -2145,8 +2145,8 @@ daasync(void *callback_arg, u_int32_t code, "INQUIRY data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } } break; @@ -5826,6 +5826,8 @@ dareprobe(struct cam_periph *periph) int status; softc = (struct da_softc *)periph->softc; + + cam_periph_assert(periph, MA_OWNED); /* Probe in progress; don't interfere. */ if (softc->state != DA_STATE_NORMAL) ___ 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: r354622 - head/sys/cam/scsi
Author: imp Date: Mon Nov 11 17:36:52 2019 New Revision: 354622 URL: https://svnweb.freebsd.org/changeset/base/354622 Log: Update the softc state of the da driver before releasing the CCB. There are contexts where releasing the ccb triggers dastart() to be run inline. When da was written, there was always a deferral, so it didn't matter much. Now, with direct dispatch, we can call dastart from the dadone* routines. If the probe state isn't updated, then dastart will redo things with stale information. This normally isn't a problem, because we run the probe state machine once at boot... Except that we also run it for each open of the device, which means we can have multiple threads racing each other to try to kick off the probe. However, if we update the state before we release the CCB, we can avoid the race. While it's needed only for the probewp and proberc* states, do it everywhere because it won't hurt the other places. The race here happens because we reprobe dozens of times on boot when drives have lots of partitions. We should consider caching this info for 1-2 seconds to avoid this thundering hurd. Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:47 2019(r354621) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:52 2019(r354622) @@ -4645,11 +4645,11 @@ dadone_probewp(struct cam_periph *periph, union ccb *d } free(csio->data_ptr, M_SCSIDA); - xpt_release_ccb(done_ccb); if ((softc->flags & DA_FLAG_CAN_RC16) != 0) softc->state = DA_STATE_PROBE_RC16; else softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4709,8 +4709,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d */ if (maxsector == 0x) { free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC16; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4816,8 +4816,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_CAN_RC16; free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4924,14 +4924,14 @@ dadone_proberc(struct cam_periph *periph, union ccb *d dadeleteflag(softc, DA_DELETE_WS10, 1); dadeleteflag(softc, DA_DELETE_UNMAP, 1); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_LBP; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4988,8 +4988,8 @@ dadone_probelbp(struct cam_periph *periph, union ccb * } free(lbp, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BLK_LIMITS; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5082,8 +5082,8 @@ dadone_probeblklimits(struct cam_periph *periph, union } free(block_limits, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5183,8 +5183,8 @@ dadone_probebdc(struct cam_periph *periph, union ccb * } free(bdc, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_ATA; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5323,8 +5323,8 @@ dadone_probeata(struct cam_periph *periph, union ccb * continue_probe = 1; } if (continue_probe != 0) { - xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); + xpt_release_ccb(done_ccb); return; } else daprobedone(periph, done_ccb); @@ -5813,8 +5813,8 @@ dadone_tur(struct
svn commit: r354623 - head/sys/cam/scsi
Author: imp Date: Mon Nov 11 17:36:57 2019 New Revision: 354623 URL: https://svnweb.freebsd.org/changeset/base/354623 Log: Add asserts for some state transitions For the PROBEWP and PROBERC* states, add assertiosn that both the da device state is in the right state, as well as the ccb state is the right one when we enter dadone_probe{wp,rc}. This will ensure that we don't sneak through when we're re-probing the size and write protection status of the device and thereby leak a reference which can later lead to an invalidated peripheral going away before all references are released (and resulting panic). Reviewed by: scottl, ken Differential Revision: https://reviews.freebsd.org/D22295 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:52 2019(r354622) +++ head/sys/cam/scsi/scsi_da.c Mon Nov 11 17:36:57 2019(r354623) @@ -4613,6 +4613,14 @@ dadone_probewp(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); + KASSERT(softc->state == DA_STATE_PROBE_WP, + ("State (%d) not PROBE_WP in dadone_probewp, periph %p ccb %p", + softc->state, periph, done_ccb)); +KASSERT((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == DA_CCB_PROBE_WP, + ("CCB State (%lu) not PROBE_WP in dadone_probewp, periph %p ccb %p", + (unsigned long)csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK, periph, + done_ccb)); + if (softc->minimum_cmd_size > 6) { mode_hdr10 = (struct scsi_mode_header_10 *)csio->data_ptr; dev_spec = mode_hdr10->dev_spec; @@ -4672,6 +4680,13 @@ dadone_proberc(struct cam_periph *periph, union ccb *d priority = done_ccb->ccb_h.pinfo.priority; csio = _ccb->csio; state = csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK; + + KASSERT(softc->state == DA_STATE_PROBE_RC || softc->state == DA_STATE_PROBE_RC16, + ("State (%d) not PROBE_RC* in dadone_proberc, periph %p ccb %p", + softc->state, periph, done_ccb)); + KASSERT(state == DA_CCB_PROBE_RC || state == DA_CCB_PROBE_RC16, + ("CCB State (%lu) not PROBE_RC* in dadone_probewp, periph %p ccb %p", + (unsigned long)state, periph, done_ccb)); lbp = 0; rdcap = NULL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354619 - head/sys/amd64/amd64
Author: avg Date: Mon Nov 11 17:11:49 2019 New Revision: 354619 URL: https://svnweb.freebsd.org/changeset/base/354619 Log: db_nextframe/amd64: remove TRAP_INTERRUPT frame type Besides the confusing name, this type is effectively unused. In all cases where it could be set, the INTERRUPT type is set by the earlier code. The conditions for TRAP_INTERRUPT are a subset of the conditions for INTERRUPT. Reviewed by: kib, markj MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D22305 Modified: head/sys/amd64/amd64/db_trace.c Modified: head/sys/amd64/amd64/db_trace.c == --- head/sys/amd64/amd64/db_trace.c Mon Nov 11 16:59:49 2019 (r354618) +++ head/sys/amd64/amd64/db_trace.c Mon Nov 11 17:11:49 2019 (r354619) @@ -123,7 +123,6 @@ db_frame(struct db_variable *vp, db_expr_t *valuep, in #defineTRAP1 #defineINTERRUPT 2 #defineSYSCALL 3 -#defineTRAP_INTERRUPT 5 static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static void db_print_stack_entry(const char *, db_addr_t, void *); @@ -218,13 +217,6 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s else if (strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; #endif - /* XXX: These are interrupts with trap frames. */ - else if (strcmp(name, "Xtimerint") == 0 || - strcmp(name, "Xcpustop") == 0 || - strcmp(name, "Xcpususpend") == 0 || - strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; } /* @@ -256,7 +248,6 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s db_printf("--- syscall"); decode_syscall(tf->tf_rax, td); break; - case TRAP_INTERRUPT: case INTERRUPT: db_printf("--- interrupt"); break; ___ 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: r354618 - head/sys/vm
Author: dougm Date: Mon Nov 11 16:59:49 2019 New Revision: 354618 URL: https://svnweb.freebsd.org/changeset/base/354618 Log: swap_pager_meta_free() frees allocated blocks in a way that exploits the sparsity of allocated blocks in a range, without issuing an "are you there?" query for every block in the range. swap_pager_copy() is not so smart. Modify the implementation of swap_pager_meta_free() slightly so that swap_pager_copy() can use that smarter implementation too. Based on an observation of: Yoshihiro Ota (ota_j.email.ne.jp) Reviewed by: kib,alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D22280 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Nov 11 16:11:15 2019(r354617) +++ head/sys/vm/swap_pager.cMon Nov 11 16:59:49 2019(r354618) @@ -422,6 +422,8 @@ static daddr_t swp_pager_getswapspace(int *npages, int */ static daddr_t swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); +static void swp_pager_meta_transfer(vm_object_t src, vm_object_t dst, +vm_pindex_t pindex, vm_pindex_t count); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); @@ -933,6 +935,33 @@ swap_pager_reserve(vm_object_t object, vm_pindex_t sta return (0); } +static bool +swp_pager_xfer_source(vm_object_t srcobject, vm_object_t dstobject, +vm_pindex_t pindex, daddr_t addr) +{ + daddr_t dstaddr; + + if (swp_pager_meta_ctl(dstobject, pindex, 0) != SWAPBLK_NONE) { + /* Caller should destroy the source block. */ + return (false); + } + + /* +* Destination has no swapblk and is not resident, transfer source. +* swp_pager_meta_build() can sleep. +*/ + vm_object_pip_add(srcobject, 1); + VM_OBJECT_WUNLOCK(srcobject); + vm_object_pip_add(dstobject, 1); + dstaddr = swp_pager_meta_build(dstobject, pindex, addr); + KASSERT(dstaddr == SWAPBLK_NONE, + ("Unexpected destination swapblk")); + vm_object_pip_wakeup(dstobject); + VM_OBJECT_WLOCK(srcobject); + vm_object_pip_wakeup(srcobject); + return (true); +} + /* * SWAP_PAGER_COPY() - copy blocks from source pager to destination pager * and destroy the source. @@ -956,8 +985,6 @@ void swap_pager_copy(vm_object_t srcobject, vm_object_t dstobject, vm_pindex_t offset, int destroysource) { - vm_pindex_t i; - daddr_t dstaddr, n_free, s_free, srcaddr; VM_OBJECT_ASSERT_WLOCKED(srcobject); VM_OBJECT_ASSERT_WLOCKED(dstobject); @@ -984,39 +1011,8 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dst /* * Transfer source to destination. */ - swp_pager_init_freerange(_free, _free); - for (i = 0; i < dstobject->size; ++i) { - srcaddr = swp_pager_meta_ctl(srcobject, i + offset, SWM_POP); - if (srcaddr == SWAPBLK_NONE) - continue; - dstaddr = swp_pager_meta_ctl(dstobject, i, 0); - if (dstaddr != SWAPBLK_NONE) { - /* -* Destination has valid swapblk or it is represented -* by a resident page. We destroy the source block. -*/ - swp_pager_update_freerange(_free, _free, srcaddr); - continue; - } + swp_pager_meta_transfer(srcobject, dstobject, offset, dstobject->size); - /* -* Destination has no swapblk and is not resident, -* copy source. -* -* swp_pager_meta_build() can sleep. -*/ - vm_object_pip_add(srcobject, 1); - VM_OBJECT_WUNLOCK(srcobject); - vm_object_pip_add(dstobject, 1); - dstaddr = swp_pager_meta_build(dstobject, i, srcaddr); - KASSERT(dstaddr == SWAPBLK_NONE, - ("Unexpected destination swapblk")); - vm_object_pip_wakeup(dstobject); - VM_OBJECT_WLOCK(srcobject); - vm_object_pip_wakeup(srcobject); - } - swp_pager_freeswapspace(s_free, n_free); - /* * Free left over swap blocks in source. * @@ -2003,31 +1999,30 @@ allocated: } /* - * SWP_PAGER_META_FREE() - free a range of blocks in the object's swap metadata + * SWP_PAGER_META_TRANSFER() - free a range of blocks in the srcobject's swap + * metadata, or transfer it into dstobject. * - * The requested range of blocks is freed, with any associated swap - * returned to the swap bitmap. - * * This routine will free swap metadata structures
Re: svn commit: r354149 - head/sys/net
On 09/11/19 01:16, Gleb Smirnoff wrote: > Renato, > > can you please try out the attached patch? I upgraded to r354607 with the patch applied and the problem is now fixed. Thanks -- Renato Botelho ___ 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"