svn commit: r367980 - head/sys/kern

2020-11-23 Thread Cy Schubert
Author: cy
Date: Tue Nov 24 06:42:32 2020
New Revision: 367980
URL: https://svnweb.freebsd.org/changeset/base/367980

Log:
  Fix a typo in a comment.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_ntptime.c

Modified: head/sys/kern/kern_ntptime.c
==
--- head/sys/kern/kern_ntptime.cTue Nov 24 04:16:49 2020
(r367979)
+++ head/sys/kern/kern_ntptime.cTue Nov 24 06:42:32 2020
(r367980)
@@ -590,7 +590,7 @@ ntp_update_second(int64_t *adjustment, time_t *newsec)
 
/*
 * Apply any correction from adjtime(2).  If more than one second
-* off we slew at a rate of 5ms/s (5000 PPM) else 500us/s (500PPM)
+* off we slew at a rate of 5ms/s (5000 PPM) else 500us/s (500 PPM)
 * until the last second is slewed the final < 500 usecs.
 */
if (time_adjtime != 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: r367979 - head/sys/dev/isp

2020-11-23 Thread Alexander Motin
Author: mav
Date: Tue Nov 24 04:16:49 2020
New Revision: 367979
URL: https://svnweb.freebsd.org/changeset/base/367979

Log:
  Implement request queue overflow protection.
  
  Before this change in case of request queue overflow driver just froze the
  device queue for 100ms to retry after.  It was pretty bad for performance.
  This change introduces SIM queue freezing when free space on the request
  queue drops below 255 entries (worst case of maximum I/O size S/G list),
  checking for a chance to release it on I/O completion.  If the queue still
  get overflowed somehow, the old mechanism is still in place, just with
  delay reduced to 10ms.
  
  With the earlier queue length increase overflows should not happen often,
  but it is still easily reachable on synthetic tests.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/ispmbox.h
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Tue Nov 24 03:49:37 2020(r367978)
+++ head/sys/dev/isp/isp.c  Tue Nov 24 04:16:49 2020(r367979)
@@ -263,6 +263,9 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
return;
}
 
+   isp->isp_reqidx = isp->isp_reqodx = 0;
+   isp->isp_resodx = 0;
+   isp->isp_atioodx = 0;
ISP_WRITE(isp, BIU2400_REQINP, 0);
ISP_WRITE(isp, BIU2400_REQOUTP, 0);
ISP_WRITE(isp, BIU2400_RSPINP, 0);
@@ -573,14 +576,16 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
}
isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
 
+   /*
+* For the maximum number of commands take free exchange control block
+* buffer count reported by firmware, limiting it to the maximum of our
+* hardcoded handle format (16K now) minus some management reserve.
+*/
MBSINIT(, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0);
isp_mboxcmd(isp, );
-   if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+   if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
return;
-   }
-   isp->isp_maxcmds = mbs.param[3];
-   /* Limit to the maximum of our hardcoded handle format (16K now). */
-   isp->isp_maxcmds = MIN(isp->isp_maxcmds, ISP_HANDLE_MAX - 
ISP_HANDLE_RESERVE);
+   isp->isp_maxcmds = MIN(mbs.param[3], ISP_HANDLE_MAX - 
ISP_HANDLE_RESERVE);
isp_prt(isp, ISP_LOGCONFIG, "%d max I/O command limit set", 
isp->isp_maxcmds);
 
/*
@@ -888,6 +893,8 @@ isp_init(ispsoftc_t *isp)
isp_prt(isp, ISP_LOGERR, "No valid WWNs to use");
return;
}
+   icbp->icb_rspnsin = isp->isp_resodx;
+   icbp->icb_rqstout = isp->isp_reqidx;
icbp->icb_retry_count = fcp->isp_retry_count;
 
icbp->icb_rqstqlen = RQUEST_QUEUE_LEN(isp);
@@ -913,6 +920,7 @@ isp_init(ispsoftc_t *isp)
 
 #ifdef ISP_TARGET_MODE
/* unconditionally set up the ATIO queue if we support target mode */
+   icbp->icb_atio_in = isp->isp_atioodx;
icbp->icb_atioqlen = ATIO_QUEUE_LEN(isp);
if (icbp->icb_atioqlen < 8) {
isp_prt(isp, ISP_LOGERR, "bad ATIO queue length %d", 
icbp->icb_atioqlen);
@@ -1031,11 +1039,6 @@ isp_init(ispsoftc_t *isp)
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
-   isp->isp_reqidx = 0;
-   isp->isp_reqodx = 0;
-   isp->isp_residx = 0;
-   isp->isp_resodx = 0;
-   isp->isp_atioodx = 0;
 
/*
 * Whatever happens, we're now committed to being here.
@@ -3237,8 +3240,6 @@ isp_intr_respq(ispsoftc_t *isp)
}
 
iptr = ISP_READ(isp, BIU2400_RSPINP);
-   isp->isp_residx = iptr;
-
optr = isp->isp_resodx;
while (optr != iptr) {
sptr = cptr = optr;

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Tue Nov 24 03:49:37 2020
(r367978)
+++ head/sys/dev/isp/isp_freebsd.c  Tue Nov 24 04:16:49 2020
(r367979)
@@ -54,6 +54,8 @@ static const char prom3[] = "Chan %d [%u] PortID 0x%06
 
 static void isp_freeze_loopdown(ispsoftc_t *, int);
 static void isp_loop_changed(ispsoftc_t *isp, int chan);
+static void isp_rq_check_above(ispsoftc_t *);
+static void isp_rq_check_below(ispsoftc_t *);
 static d_ioctl_t ispioctl;
 static void isp_poll(struct cam_sim *);
 static callout_func_t isp_watchdog;
@@ -350,6 +352,36 @@ isp_unfreeze_loopdown(ispsoftc_t *isp, int chan)
}
 }
 
+/*
+ * Functions to protect from request queue overflow by freezing SIM queue.
+ * XXX: freezing only one arbitrary SIM, since they all share the queue.
+ */
+static void
+isp_rq_check_above(ispsoftc_t *isp)
+{
+   struct isp_fc *fc = ISP_FC_PC(isp, 0);
+
+   if (isp->isp_rqovf || fc->sim == NULL)
+   return;
+ 

svn commit: r367978 - head/sys/kern

2020-11-23 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 24 03:49:37 2020
New Revision: 367978
URL: https://svnweb.freebsd.org/changeset/base/367978

Log:
  locks: push lock_delay_arg_init calls down
  
  Minor cleanup to skip doing them when recursing on locks and so that
  they can act on found lock value if need be.

Modified:
  head/sys/kern/kern_lock.c
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Tue Nov 24 03:48:44 2020(r367977)
+++ head/sys/kern/kern_lock.c   Tue Nov 24 03:49:37 2020(r367978)
@@ -603,10 +603,10 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
if (LK_CAN_WITNESS(flags))
WITNESS_CHECKORDER(>lock_object, LOP_NEWORDER,
file, line, flags & LK_INTERLOCK ? ilk : NULL);
+   x = lockmgr_read_value(lk);
lock_delay_arg_init(, _delay);
if (!lk_adaptive)
flags &= ~LK_ADAPTIVE;
-   x = lockmgr_read_value(lk);
/*
 * The lock may already be locked exclusive by curthread,
 * avoid deadlock.

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Tue Nov 24 03:48:44 2020(r367977)
+++ head/sys/kern/kern_mutex.c  Tue Nov 24 03:49:37 2020(r367978)
@@ -535,12 +535,6 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v)
if (SCHEDULER_STOPPED_TD(td))
return;
 
-#if defined(ADAPTIVE_MUTEXES)
-   lock_delay_arg_init(, _delay);
-#elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init_noadapt();
-#endif
-
if (__predict_false(v == MTX_UNOWNED))
v = MTX_READ_VALUE(m);
 
@@ -562,6 +556,12 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v)
opts &= ~MTX_RECURSE;
 #endif
 
+#if defined(ADAPTIVE_MUTEXES)
+   lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init_noadapt();
+#endif
+
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);
 #endif
@@ -746,12 +746,12 @@ _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t
if (SCHEDULER_STOPPED())
return;
 
-   lock_delay_arg_init(, _spin_delay);
-
if (LOCK_LOG_TEST(>lock_object, opts))
CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m);
KTR_STATE1(KTR_SCHED, "thread", sched_tdname((struct thread *)tid),
"spinning", "lockname:\"%s\"", m->lock_object.lo_name);
+
+   lock_delay_arg_init(, _spin_delay);
 
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Tue Nov 24 03:48:44 2020(r367977)
+++ head/sys/kern/kern_rwlock.c Tue Nov 24 03:49:37 2020(r367978)
@@ -948,11 +948,6 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
if (SCHEDULER_STOPPED())
return;
 
-#if defined(ADAPTIVE_RWLOCKS)
-   lock_delay_arg_init(, _delay);
-#elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init_noadapt();
-#endif
if (__predict_false(v == RW_UNLOCKED))
v = RW_READ_VALUE(rw);
 
@@ -970,6 +965,12 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
if (LOCK_LOG_TEST(>lock_object, 0))
CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
rw->lock_object.lo_name, (void *)rw->rw_lock, file, line);
+
+#if defined(ADAPTIVE_RWLOCKS)
+   lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init_noadapt();
+#endif
 
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Tue Nov 24 03:48:44 2020(r367977)
+++ head/sys/kern/kern_sx.c Tue Nov 24 03:49:37 2020(r367978)
@@ -620,12 +620,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
if (SCHEDULER_STOPPED())
return (0);
 
-#if defined(ADAPTIVE_SX)
-   lock_delay_arg_init(, _delay);
-#elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init_noadapt();
-#endif
-
if (__predict_false(x == SX_LOCK_UNLOCKED))
x = SX_READ_VALUE(sx);
 
@@ -644,6 +638,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
if (LOCK_LOG_TEST(>lock_object, 0))
CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
sx->lock_object.lo_name, (void *)sx->sx_lock, file, line);
+
+#if defined(ADAPTIVE_SX)
+   lock_delay_arg_init(, _delay);
+#elif defined(KDTRACE_HOOKS)
+   lock_delay_arg_init_noadapt();
+#endif
 
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);

svn commit: r367977 - head/sys/kern

2020-11-23 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 24 03:48:44 2020
New Revision: 367977
URL: https://svnweb.freebsd.org/changeset/base/367977

Log:
  sx: drop spurious volatile keyword

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Tue Nov 24 02:51:45 2020(r367976)
+++ head/sys/kern/kern_sx.c Tue Nov 24 03:48:44 2020(r367977)
@@ -573,7 +573,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
GIANT_DECLARE;
uintptr_t tid, setx;
 #ifdef ADAPTIVE_SX
-   volatile struct thread *owner;
+   struct thread *owner;
u_int i, n, spintries = 0;
enum { READERS, WRITER } sleep_reason = READERS;
bool in_critical = false;
@@ -1020,7 +1020,7 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO
GIANT_DECLARE;
struct thread *td;
 #ifdef ADAPTIVE_SX
-   volatile struct thread *owner;
+   struct thread *owner;
u_int i, n, spintries = 0;
 #endif
 #ifdef LOCK_PROFILING
___
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: r367976 - head/sbin/ping6

2020-11-23 Thread Alan Somers
Author: asomers
Date: Tue Nov 24 02:51:45 2020
New Revision: 367976
URL: https://svnweb.freebsd.org/changeset/base/367976

Log:
  ping6: update usage text after r365547
  
  MFC after:2 weeks

Modified:
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/ping6.c
==
--- head/sbin/ping6/ping6.c Tue Nov 24 02:05:43 2020(r367975)
+++ head/sbin/ping6/ping6.c Tue Nov 24 02:51:45 2020(r367976)
@@ -2868,7 +2868,8 @@ usage(void)
" [-P policy]"
 #endif
" [-S sourceaddr] [-s packetsize]\n"
-   " [-t timeout] [-W waittime] [hops ...] host\n");
+   " [-t timeout] [-W waittime] [-z tclass] [hops ...] "
+   "host\n");
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: r367963 - head/sbin/devd

2020-11-23 Thread Warner Losh
Author: imp
Date: Mon Nov 23 18:37:19 2020
New Revision: 367963
URL: https://svnweb.freebsd.org/changeset/base/367963

Log:
  Prefer Em to Ar for emphasis
  
  Em is better than Ar if all we want to do is underline the text.
  
  Submitted by: yuripv@

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Mon Nov 23 18:27:21 2020(r367962)
+++ head/sbin/devd/devd.conf.5  Mon Nov 23 18:37:19 2020(r367963)
@@ -416,7 +416,7 @@ node is destroyed.
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li ETHERNET Ta Ar inet Ta IFATTACH Ta
 Notification when the default VNET instance of the
-.Ar inet
+.Em inet
 interface is attached.
 .El
 .Pp
@@ -454,18 +454,18 @@ provider size has changed.
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li IFNET
-.It Li IFNET Ta Ar inet Ta Ta
+.It Li IFNET Ta Em inet Ta Ta
 The
 .Dq subsystem
 is the actual name of the network interface on which the event
 took place.
-.It Li IFNET Ta Ar inet Ta Li LINK_UP Ta
+.It Li IFNET Ta Em inet Ta Li LINK_UP Ta
 Carrier status changed to UP.
-.It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta
+.It Li IFNET Ta Em inet Ta Li LINK_DOWN Ta
 Carrier status changed to DOWN.
-.It Li IFNET Ta Ar inet Ta Li ATTACH Ta
+.It Li IFNET Ta Em inet Ta Li ATTACH Ta
 The network interface is attached to the system.
-.It Li IFNET Ta Ar inet Ta Li DETACH Ta
+.It Li IFNET Ta Em inet Ta Li DETACH Ta
 The network interface is detached from the system.
 .El
 .Pp
___
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: r367962 - in head/sys: kern sys

2020-11-23 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov 23 18:27:21 2020
New Revision: 367962
URL: https://svnweb.freebsd.org/changeset/base/367962

Log:
  dtrace: stop using eventhandlers for the part compiled into the kernel
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D27311

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_dtrace.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_thread.c
  head/sys/sys/dtrace_bsd.h

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Mon Nov 23 18:26:47 2020(r367961)
+++ head/sys/kern/init_main.c   Mon Nov 23 18:27:21 2020(r367962)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -607,6 +608,10 @@ proc0_init(void *dummy __unused)
 */
EVENTHANDLER_DIRECT_INVOKE(process_init, p);
EVENTHANDLER_DIRECT_INVOKE(thread_init, td);
+#ifdef KDTRACE_HOOKS
+   kdtrace_proc_ctor(p);
+   kdtrace_thread_ctor(td);
+#endif
EVENTHANDLER_DIRECT_INVOKE(process_ctor, p);
EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td);
 

Modified: head/sys/kern/kern_dtrace.c
==
--- head/sys/kern/kern_dtrace.c Mon Nov 23 18:26:47 2020(r367961)
+++ head/sys/kern/kern_dtrace.c Mon Nov 23 18:27:21 2020(r367962)
@@ -67,21 +67,19 @@ kdtrace_proc_size()
return (KDTRACE_PROC_SIZE);
 }
 
-static void
-kdtrace_proc_ctor(void *arg __unused, struct proc *p)
+void
+kdtrace_proc_ctor(struct proc *p)
 {
 
p->p_dtrace = malloc(KDTRACE_PROC_SIZE, M_KDTRACE, M_WAITOK|M_ZERO);
 }
 
-static void
-kdtrace_proc_dtor(void *arg __unused, struct proc *p)
+void
+kdtrace_proc_dtor(struct proc *p)
 {
 
-   if (p->p_dtrace != NULL) {
-   free(p->p_dtrace, M_KDTRACE);
-   p->p_dtrace = NULL;
-   }
+   free(p->p_dtrace, M_KDTRACE);
+   p->p_dtrace = NULL;
 }
 
 /* Return the DTrace thread data size compiled in the kernel hooks. */
@@ -92,38 +90,17 @@ kdtrace_thread_size()
return (KDTRACE_THREAD_SIZE);
 }
 
-static void
-kdtrace_thread_ctor(void *arg __unused, struct thread *td)
+void
+kdtrace_thread_ctor(struct thread *td)
 {
 
td->td_dtrace = malloc(KDTRACE_THREAD_SIZE, M_KDTRACE, M_WAITOK|M_ZERO);
 }
 
-static void
-kdtrace_thread_dtor(void *arg __unused, struct thread *td)
+void
+kdtrace_thread_dtor(struct thread *td)
 {
 
-   if (td->td_dtrace != NULL) {
-   free(td->td_dtrace, M_KDTRACE);
-   td->td_dtrace = NULL;
-   }
+   free(td->td_dtrace, M_KDTRACE);
+   td->td_dtrace = NULL;
 }
-
-/*
- *  Initialise the kernel DTrace hooks.
- */
-static void
-init_dtrace(void *dummy __unused)
-{
-
-   EVENTHANDLER_REGISTER(process_ctor, kdtrace_proc_ctor, NULL,
-   EVENTHANDLER_PRI_ANY);
-   EVENTHANDLER_REGISTER(process_dtor, kdtrace_proc_dtor, NULL,
-   EVENTHANDLER_PRI_ANY);
-   EVENTHANDLER_REGISTER(thread_ctor, kdtrace_thread_ctor, NULL,
-   EVENTHANDLER_PRI_ANY);
-   EVENTHANDLER_REGISTER(thread_dtor, kdtrace_thread_dtor, NULL,
-   EVENTHANDLER_PRI_ANY);
-}
-
-SYSINIT(kdtrace, SI_SUB_KDTRACE, SI_ORDER_FIRST, init_dtrace, NULL);

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Mon Nov 23 18:26:47 2020(r367961)
+++ head/sys/kern/kern_proc.c   Mon Nov 23 18:27:21 2020(r367962)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -207,6 +208,9 @@ proc_ctor(void *mem, int size, void *arg, int flags)
struct thread *td;
 
p = (struct proc *)mem;
+#ifdef KDTRACE_HOOKS
+   kdtrace_proc_ctor(p);
+#endif
EVENTHANDLER_DIRECT_INVOKE(process_ctor, p);
td = FIRST_THREAD_IN_PROC(p);
if (td != NULL) {
@@ -243,6 +247,9 @@ proc_dtor(void *mem, int size, void *arg)
EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td);
}
EVENTHANDLER_DIRECT_INVOKE(process_dtor, p);
+#ifdef KDTRACE_HOOKS
+   kdtrace_proc_dtor(p);
+#endif
if (p->p_ksi != NULL)
KASSERT(! KSI_ONQ(p->p_ksi), ("SIGCHLD queue"));
 }

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Mon Nov 23 18:26:47 2020(r367961)
+++ head/sys/kern/kern_thread.c Mon Nov 23 18:27:21 2020(r367962)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -358,6 +359,9 @@ thread_ctor(void *mem, int size, void *arg, int flags)
 #ifdef AUDIT
audit_thread_alloc(td);
 #endif
+#ifdef KDTRACE_HOOKS
+   kdtrace_thread_ctor(td);
+#endif
umtx_thread_alloc(td);
 

svn commit: r367961 - in head/sys: kern sys

2020-11-23 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov 23 18:26:47 2020
New Revision: 367961
URL: https://svnweb.freebsd.org/changeset/base/367961

Log:
  thread: stash domain id to work around vtophys problems on ppc64
  
  Adding to zombie list can be perfomed by idle threads, which on ppc64 leads to
  panics as it requires a sleepable lock.
  
  Reported by:  alfredo
  Reviewed by:  kib, markj
  Fixes:r367842 ("thread: numa-aware zombie reaping")
  Differential Revision:https://reviews.freebsd.org/D27288

Modified:
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Mon Nov 23 18:18:16 2020(r367960)
+++ head/sys/kern/kern_thread.c Mon Nov 23 18:26:47 2020(r367961)
@@ -346,6 +346,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
td = (struct thread *)mem;
td->td_state = TDS_INACTIVE;
td->td_lastcpu = td->td_oncpu = NOCPU;
+   td->td_allocdomain = vm_phys_domain(vtophys(td));
 
/*
 * Note that td_critnest begins life as 1 because the thread is not
@@ -544,7 +545,7 @@ thread_zombie(struct thread *td)
struct thread_domain_data *tdd;
struct thread *ztd;
 
-   tdd = _domain_data[vm_phys_domain(vtophys(td))];
+   tdd = _domain_data[td->td_allocdomain];
ztd = atomic_load_ptr(>tdd_zombies);
for (;;) {
td->td_zombie = ztd;

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Mon Nov 23 18:18:16 2020(r367960)
+++ head/sys/sys/proc.h Mon Nov 23 18:26:47 2020(r367961)
@@ -246,6 +246,7 @@ struct thread {
sigqueue_t  td_sigqueue;/* (c) Sigs arrived, not delivered. */
 #definetd_siglist  td_sigqueue.sq_signals
u_char  td_lend_user_pri; /* (t) Lend user pri. */
+   u_char  td_allocdomain; /* (b) NUMA domain backing this struct 
thread. */
 
 /* Cleared during fork1() */
 #definetd_startzero td_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: r367960 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux

2020-11-23 Thread Konstantin Belousov
Author: kib
Date: Mon Nov 23 18:18:16 2020
New Revision: 367960
URL: https://svnweb.freebsd.org/changeset/base/367960

Log:
  Linuxolator: Replace use of eventhandlers by sysent hooks.
  
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D27309

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/arm64/linux/linux_sysvec.c
  head/sys/compat/linux/linux_common.c
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_emul.h
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Mon Nov 23 17:29:25 2020
(r367959)
+++ head/sys/amd64/linux/linux_sysvec.c Mon Nov 23 18:18:16 2020
(r367960)
@@ -780,6 +780,9 @@ struct sysentvec elf_linux_sysvec = {
.sv_schedtail   = linux_schedtail,
.sv_thread_detach = linux_thread_detach,
.sv_trap= linux_vsyscall,
+   .sv_onexec  = linux_on_exec,
+   .sv_onexit  = linux_on_exit,
+   .sv_ontdexit= linux_thread_dtor,
 };
 
 static void

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Mon Nov 23 17:29:25 2020
(r367959)
+++ head/sys/amd64/linux32/linux32_sysvec.c Mon Nov 23 18:18:16 2020
(r367960)
@@ -925,6 +925,9 @@ struct sysentvec elf_linux_sysvec = {
.sv_schedtail   = linux_schedtail,
.sv_thread_detach = linux_thread_detach,
.sv_trap= NULL,
+   .sv_onexec  = linux_on_exec,
+   .sv_onexit  = linux_on_exit,
+   .sv_ontdexit= linux_thread_dtor,
 };
 
 static void

Modified: head/sys/arm64/linux/linux_sysvec.c
==
--- head/sys/arm64/linux/linux_sysvec.c Mon Nov 23 17:29:25 2020
(r367959)
+++ head/sys/arm64/linux/linux_sysvec.c Mon Nov 23 18:18:16 2020
(r367960)
@@ -419,6 +419,9 @@ struct sysentvec elf_linux_sysvec = {
.sv_schedtail   = linux_schedtail,
.sv_thread_detach = linux_thread_detach,
.sv_trap= linux_vsyscall,
+   .sv_onexec  = linux_on_exec,
+   .sv_onexit  = linux_on_exit,
+   .sv_ontdexit= linux_thread_dtor,
 };
 
 static void

Modified: head/sys/compat/linux/linux_common.c
==
--- head/sys/compat/linux/linux_common.cMon Nov 23 17:29:25 2020
(r367959)
+++ head/sys/compat/linux/linux_common.cMon Nov 23 18:18:16 2020
(r367960)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -71,10 +71,6 @@ TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_
 struct sx linux_ioctl_sx;
 SX_SYSINIT(linux_ioctl, _ioctl_sx, "Linux ioctl handlers");
 
-static eventhandler_tag linux_exec_tag;
-static eventhandler_tag linux_thread_dtor_tag;
-static eventhandler_taglinux_exit_tag;
-
 static int
 linux_common_modevent(module_t mod, int type, void *data)
 {
@@ -87,12 +83,6 @@ linux_common_modevent(module_t mod, int type, void *da
 #endif
linux_dev_shm_create();
linux_osd_jail_register();
-   linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
-   linux_proc_exit, NULL, 1000);
-   linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
-   linux_proc_exec, NULL, 1000);
-   linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
-   linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_register_handler(*ldhp);
LIST_INIT(_list);
@@ -104,9 +94,6 @@ linux_common_modevent(module_t mod, int type, void *da
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
mtx_destroy(_mtx);
-   EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
-   EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
-   EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
break;
default:
return (EOPNOTSUPP);

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Mon Nov 23 17:29:25 2020
(r367959)
+++ head/sys/compat/linux/linux_emul.c  Mon Nov 23 18:18:16 2020
(r367960)
@@ -199,14 +199,13 @@ linux_proc_init(struct thread *td, struct thread *newt
 }
 
 void
-linux_proc_exit(void *arg __unused, struct proc *p)
+linux_on_exit(struct proc *p)
 {
 

svn commit: r367959 - in head/sys: kern sys

2020-11-23 Thread Konstantin Belousov
Author: kib
Date: Mon Nov 23 17:29:25 2020
New Revision: 367959
URL: https://svnweb.freebsd.org/changeset/base/367959

Log:
  Provide ABI modules hooks for process exec/exit and thread exit.
  
  Exec and exit are same as corresponding eventhandler hooks.
  
  Thread exit hook is called somewhat earlier, while thread is still
  owned by the process and enough context is available.  Note that the
  process lock is owned when the hook is called.
  
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D27309

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_thr.c
  head/sys/sys/sysent.h

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Mon Nov 23 17:00:06 2020(r367958)
+++ head/sys/kern/kern_exec.c   Mon Nov 23 17:29:25 2020(r367959)
@@ -1051,6 +1051,8 @@ exec_new_vmspace(struct image_params *imgp, struct sys
sigfastblock_clear(td);
umtx_exec(p);
itimers_exec(p);
+   if (sv->sv_onexec != NULL)
+   sv->sv_onexec(p, imgp);
 
EVENTHANDLER_DIRECT_INVOKE(process_exec, p, imgp);
 

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Nov 23 17:00:06 2020(r367958)
+++ head/sys/kern/kern_exit.c   Mon Nov 23 17:29:25 2020(r367959)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef KTRACE
@@ -327,6 +328,9 @@ exit1(struct thread *td, int rval, int signo)
 
itimers_exit(p);
 
+   if (p->p_sysent->sv_onexit != NULL)
+   p->p_sysent->sv_onexit(p);
+
/*
 * Check if any loadable modules need anything done at process exit.
 * E.g. SYSV IPC stuff.
@@ -560,6 +564,9 @@ exit1(struct thread *td, int rval, int signo)
/* Save exit status. */
PROC_LOCK(p);
p->p_xthread = td;
+
+   if (p->p_sysent->sv_ontdexit != NULL)
+   p->p_sysent->sv_ontdexit(td);
 
 #ifdef KDTRACE_HOOKS
/*

Modified: head/sys/kern/kern_kthread.c
==
--- head/sys/kern/kern_kthread.cMon Nov 23 17:00:06 2020
(r367958)
+++ head/sys/kern/kern_kthread.cMon Nov 23 17:29:25 2020
(r367959)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,6 +356,10 @@ kthread_exit(void)
PROC_UNLOCK(p);
kproc_exit(0);
}
+
+   if (p->p_sysent->sv_ontdexit != NULL)
+   p->p_sysent->sv_ontdexit(td);
+
tidhash_remove(td);
umtx_thread_exit(td);
tdsigcleanup(td);

Modified: head/sys/kern/kern_thr.c
==
--- head/sys/kern/kern_thr.cMon Nov 23 17:00:06 2020(r367958)
+++ head/sys/kern/kern_thr.cMon Nov 23 17:29:25 2020(r367959)
@@ -353,6 +353,9 @@ kern_thr_exit(struct thread *td)
return (0);
}
 
+   if (p->p_sysent->sv_ontdexit != NULL)
+   p->p_sysent->sv_ontdexit(td);
+
td->td_dbgflags |= TDB_EXIT;
if (p->p_ptevents & PTRACE_LWP) {
p->p_pendingexits++;

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Mon Nov 23 17:00:06 2020(r367958)
+++ head/sys/sys/sysent.h   Mon Nov 23 17:29:25 2020(r367959)
@@ -145,6 +145,9 @@ struct sysentvec {
u_long  *sv_hwcap2; /* Value passed in AT_HWCAP2. */
const char  *(*sv_machine_arch)(struct proc *);
vm_offset_t sv_fxrng_gen_base;
+   void(*sv_onexec)(struct proc *, struct image_params *);
+   void(*sv_onexit)(struct proc *);
+   void(*sv_ontdexit)(struct thread *td);
 };
 
 #defineSV_ILP320x000100/* 32-bit executable. */
___
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: r367958 - head/bin/getfacl

2020-11-23 Thread Gleb Popov
Author: arrowd (ports committer)
Date: Mon Nov 23 17:00:06 2020
New Revision: 367958
URL: https://svnweb.freebsd.org/changeset/base/367958

Log:
  bin/setfacl: Little refactoring, no functional change.
  
  The acl_from_stat function accepts a stat_t * argument, but only uses its
  st_mode field. There is no reason to pass the whole struct, so make it accept
  a mode_t and rename the function to acl_from_mode.
  Linux has non-standard acl_from_mode function in its libacl, so naming the
  function this way may help discovering it during porting efforts.
  
  Reviewed by:  tsoome, markj
  Approved by:  markj
  Differential Revision:https://reviews.freebsd.org/D27292

Modified:
  head/bin/getfacl/getfacl.c

Modified: head/bin/getfacl/getfacl.c
==
--- head/bin/getfacl/getfacl.c  Mon Nov 23 16:26:49 2020(r367957)
+++ head/bin/getfacl/getfacl.c  Mon Nov 23 17:00:06 2020(r367958)
@@ -85,10 +85,10 @@ getgname(gid_t gid)
 
 /*
  * return an ACL corresponding to the permissions
- * contained in struct stat
+ * contained in mode_t
  */
 static acl_t
-acl_from_stat(const struct stat *sb)
+acl_from_mode(const mode_t mode)
 {
acl_t acl;
acl_entry_t entry;
@@ -111,13 +111,13 @@ acl_from_stat(const struct stat *sb)
return NULL;
 
/* calculate user mode */
-   if (sb->st_mode & S_IRUSR)
+   if (mode & S_IRUSR)
if (acl_add_perm(perms, ACL_READ) == -1)
return NULL;
-   if (sb->st_mode & S_IWUSR)
+   if (mode & S_IWUSR)
if (acl_add_perm(perms, ACL_WRITE) == -1)
return NULL;
-   if (sb->st_mode & S_IXUSR)
+   if (mode & S_IXUSR)
if (acl_add_perm(perms, ACL_EXECUTE) == -1)
return NULL;
if (acl_set_permset(entry, perms) == -1)
@@ -135,13 +135,13 @@ acl_from_stat(const struct stat *sb)
return NULL;
 
/* calculate group mode */
-   if (sb->st_mode & S_IRGRP)
+   if (mode & S_IRGRP)
if (acl_add_perm(perms, ACL_READ) == -1)
return NULL;
-   if (sb->st_mode & S_IWGRP)
+   if (mode & S_IWGRP)
if (acl_add_perm(perms, ACL_WRITE) == -1)
return NULL;
-   if (sb->st_mode & S_IXGRP)
+   if (mode & S_IXGRP)
if (acl_add_perm(perms, ACL_EXECUTE) == -1)
return NULL;
if (acl_set_permset(entry, perms) == -1)
@@ -159,13 +159,13 @@ acl_from_stat(const struct stat *sb)
return NULL;
 
/* calculate other mode */
-   if (sb->st_mode & S_IROTH)
+   if (mode & S_IROTH)
if (acl_add_perm(perms, ACL_READ) == -1)
return NULL;
-   if (sb->st_mode & S_IWOTH)
+   if (mode & S_IWOTH)
if (acl_add_perm(perms, ACL_WRITE) == -1)
return NULL;
-   if (sb->st_mode & S_IXOTH)
+   if (mode & S_IXOTH)
if (acl_add_perm(perms, ACL_EXECUTE) == -1)
return NULL;
if (acl_set_permset(entry, perms) == -1)
@@ -229,9 +229,9 @@ print_acl(char *path, acl_type_t type, int hflag, int 
errno = 0;
if (type == ACL_TYPE_DEFAULT)
return(0);
-   acl = acl_from_stat();
+   acl = acl_from_mode(sb.st_mode);
if (!acl) {
-   warn("%s: acl_from_stat() failed", path);
+   warn("%s: acl_from_mode() failed", path);
return(-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: r367955 - head/sys/dev/nvme

2020-11-23 Thread Michal Meloun
Author: mmel
Date: Mon Nov 23 14:30:22 2020
New Revision: 367955
URL: https://svnweb.freebsd.org/changeset/base/367955

Log:
  Ensure that the buffer is in nvme_single_map() mapped to single segment.
  Not a functional change.
  
  MFC after:1 week

Modified:
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hMon Nov 23 14:26:59 2020
(r367954)
+++ head/sys/dev/nvme/nvme_private.hMon Nov 23 14:30:22 2020
(r367955)
@@ -478,6 +478,7 @@ nvme_single_map(void *arg, bus_dma_segment_t *seg, int
 {
uint64_t *bus_addr = (uint64_t *)arg;
 
+   KASSERT(nseg == 1, ("number of segments (%d) is not 1", nseg));
if (error != 0)
printf("nvme_single_map err %d\n", error);
*bus_addr = seg[0].ds_addr;
___
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: r367956 - head/usr.sbin/ctladm

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 14:30:27 2020
New Revision: 367956
URL: https://svnweb.freebsd.org/changeset/base/367956

Log:
  Replace paths in ctladm(8) examples with something sensible.
  
  PR:   251181
  Reviewed by:  0mp, rm, ygy
  MFC after:2 weeks
  Sponsored by: EPSRC
  Differential Revision:https://reviews.freebsd.org/D27249

Modified:
  head/usr.sbin/ctladm/ctladm.8

Modified: head/usr.sbin/ctladm/ctladm.8
==
--- head/usr.sbin/ctladm/ctladm.8   Mon Nov 23 14:30:22 2020
(r367955)
+++ head/usr.sbin/ctladm/ctladm.8   Mon Nov 23 14:30:27 2020
(r367956)
@@ -36,7 +36,7 @@
 .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\" $FreeBSD$
 .\"
-.Dd August 6, 2020
+.Dd November 23, 2020
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -1029,23 +1029,17 @@ while reporting size of 10 terabytes,
 .Pp
 .Dl ctladm create -b ramdisk -s 10T -o capacity=10G
 .Pp
-Create a LUN using the block backend, and specify the file
-.Pa src/usr.sbin/ctladm/ctladm.8
-as the backing store.
-The size of the LUN will be derived from the size of the file.
-.Pp
-.Dl ctladm create -b block -o file=src/usr.sbin/ctladm/ctladm.8
-.Pp
-Create a LUN using the block backend, specify the file
-.Pa src/usr.sbin/ctladm/ctladm.8
+Create a LUN using the block backend, specify the ZFS volume
+.Pa tank/example
 as the backing store, and specify the
 .Tn SCSI
 VPD page 0x80 and 0x83 serial number
 .Fl ( S )
 and device ID
 .Fl ( d ) .
+The size of the LUN will be derived from the size of the ZVOL.
 .Pp
-.Dl ctladm create -b block -o file=src/usr.sbin/ctladm/ctladm.8 -S MYSERIAL321 
-d MYDEVID123
+.Dl ctladm create -b block -o file=/dev/zvol/tank/example -S MYSERIAL321 -d 
MYDEVID123
 .Pp
 Use to specify generic options on ioctl frontend port, now it is
 only possible to set pp and/or vp port number.
___
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: r367954 - head/share/man/man7

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 14:26:59 2020
New Revision: 367954
URL: https://svnweb.freebsd.org/changeset/base/367954

Log:
  Assorted tweaks to hier(7): punctuation, some .Xr's, clarify wording.
  
  Reviewed by:  0mp, bcr, imp
  MFC after:2 weeks
  Sponsored by: EPSRC
  Differential Revision:https://reviews.freebsd.org/D27248

Modified:
  head/share/man/man7/hier.7

Modified: head/share/man/man7/hier.7
==
--- head/share/man/man7/hier.7  Mon Nov 23 13:05:11 2020(r367953)
+++ head/share/man/man7/hier.7  Mon Nov 23 14:26:59 2020(r367954)
@@ -28,7 +28,7 @@
 .\"@(#)hier.7  8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2020
+.Dd November 23, 2020
 .Dt HIER 7
 .Os
 .Sh NAME
@@ -54,7 +54,7 @@ Compiled flattened device tree (FDT) files; see
 and
 .Xr dtc 1
 .It Pa efi/
-Mount point for EFI System Partition (ESP) on UEFI systems.
+Mount point for EFI System Partition (ESP) on UEFI systems
 .It Pa firmware/
 loadable kernel modules containing binary firmware for hardware that needs
 firmware downloaded to it to function
@@ -62,9 +62,8 @@ firmware downloaded to it to function
 pure kernel executable (the operating system loaded into memory
 at boot time) and kernel modules
 .It Pa modules/
-third-party loadable kernel modules;
-see
-.Xr kldstat 8
+third-party loadable kernel modules, such as the ones installed from
+.Xr ports 7
 .It Pa overlays/
 Compiled flattened device tree (FDT) overlays; see
 .Xr fdt 4
@@ -197,8 +196,9 @@ contains the majority of user utilities and applicatio
 .It Pa bin/
 common utilities, programming tools, and applications
 .It Pa compat/
-files needed to support binary compatibility with other operating systems,
-such as Linux
+files needed to support binary compatibility with other operating systems;
+see
+.Xr linux 4
 .It Pa include/
 standard C include files
 .Pp
@@ -435,7 +435,7 @@ tree
 .Xr ports 7 ,
 the
 .Fx
-ports collection.
+ports collection
 .It Pa sbin/
 system daemons & system utilities (executed by users)
 .It Pa share/
@@ -604,8 +604,8 @@ see
 .El
 .Pp
 .It Pa src/
-.Bx ,
-third-party, and/or local source files
+.Fx
+source code
 .Pp
 .Bl -tag -width "kerberos5/" -compact
 .It Pa bin/
@@ -734,10 +734,8 @@ source code for files in
 .It Pa tests/
 The
 .Fx
-test suite.
-See
+test suite; see
 .Xr tests 7
-for more details.
 .El
 .It Pa /var/
 multi-purpose log, temporary, transient, and spool files
___
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: r367953 - head/sys/dev/firewire

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 13:05:11 2020
New Revision: 367953
URL: https://svnweb.freebsd.org/changeset/base/367953

Log:
  Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
  
  Reviewed by:  imp, mav
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26843

Modified:
  head/sys/dev/firewire/sbp.c

Modified: head/sys/dev/firewire/sbp.c
==
--- head/sys/dev/firewire/sbp.c Mon Nov 23 13:02:23 2020(r367952)
+++ head/sys/dev/firewire/sbp.c Mon Nov 23 13:05:11 2020(r367953)
@@ -987,7 +987,7 @@ END_DEBUG
sdev = sbp_next_dev(target, sdev->lun_id + 1);
if (sdev == NULL) {
SBP_UNLOCK(sbp);
-   free(ccb, M_SBP);
+   xpt_free_ccb(ccb);
return;
}
/* reuse ccb */
@@ -1019,9 +1019,9 @@ SBP_DEBUG(0)
device_printf(sdev->target->sbp->fd.dev,
"%s:%s\n", __func__, sdev->bustgtlun);
 END_DEBUG
-   ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO);
+   ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
-   printf("sbp_cam_scan_target: malloc failed\n");
+   printf("sbp_cam_scan_target: xpt_alloc_ccb_nowait() failed\n");
return;
}
SBP_UNLOCK(target->sbp);
___
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: r367952 - head/sys/dev/tws

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 13:02:23 2020
New Revision: 367952
URL: https://svnweb.freebsd.org/changeset/base/367952

Log:
  Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free.
  
  Reviewed by:  imp
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26841

Modified:
  head/sys/dev/tws/tws.c

Modified: head/sys/dev/tws/tws.c
==
--- head/sys/dev/tws/tws.c  Mon Nov 23 12:59:56 2020(r367951)
+++ head/sys/dev/tws/tws.c  Mon Nov 23 13:02:23 2020(r367952)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 MALLOC_DEFINE(M_TWS, "twsbuf", "buffers used by tws driver");
 int tws_queue_depth = TWS_MAX_REQS;
@@ -412,7 +413,7 @@ tws_detach(device_t dev)
 callout_drain(>stats_timer);
 free(sc->reqs, M_TWS);
 free(sc->sense_bufs, M_TWS);
-free(sc->scan_ccb, M_TWS);
+xpt_free_ccb(sc->scan_ccb);
 if (sc->ioctl_data_mem)
 bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, 
sc->ioctl_data_map);
 if (sc->data_tag)
@@ -597,7 +598,7 @@ tws_init(struct tws_softc *sc)
   M_WAITOK | M_ZERO);
 sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS,
   M_WAITOK | M_ZERO);
-sc->scan_ccb = malloc(sizeof(union ccb), M_TWS, M_WAITOK | M_ZERO);
+sc->scan_ccb = xpt_alloc_ccb();
 if (bus_dmamem_alloc(sc->data_tag, (void **)>ioctl_data_mem,
 (BUS_DMA_NOWAIT | BUS_DMA_ZERO), >ioctl_data_map)) {
 device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\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: r367951 - head/sys/dev/hptmv

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 12:59:56 2020
New Revision: 367951
URL: https://svnweb.freebsd.org/changeset/base/367951

Log:
  Don't check return from xpt_alloc_ccb() for being NULL; since it's not
  the _nowait wariant, it cannot fail.
  
  Suggested by: mav
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.

Modified:
  head/sys/dev/hptmv/entry.c

Modified: head/sys/dev/hptmv/entry.c
==
--- head/sys/dev/hptmv/entry.c  Mon Nov 23 12:57:24 2020(r367950)
+++ head/sys/dev/hptmv/entry.c  Mon Nov 23 12:59:56 2020(r367951)
@@ -2008,15 +2008,10 @@ hpt_attach(device_t dev)
}
 
 
-   if ((ccb = xpt_alloc_ccb()) != NULL)
-   {
-   ccb->ccb_h.pinfo.priority = 1;
-   ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX;
-   }
-   else
-   {
-   return ENOMEM;
-   }
+   ccb = xpt_alloc_ccb();
+   ccb->ccb_h.pinfo.priority = 1;
+   ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX;
+
/*
 * Create the device queue for our SIM(s).
 */
___
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: r367950 - head/sys/dev/hptmv

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 12:57:24 2020
New Revision: 367950
URL: https://svnweb.freebsd.org/changeset/base/367950

Log:
  Make hptmv(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.
  
  Reviewed by:  imp, mav
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26842

Modified:
  head/sys/dev/hptmv/entry.c

Modified: head/sys/dev/hptmv/entry.c
==
--- head/sys/dev/hptmv/entry.c  Mon Nov 23 12:54:19 2020(r367949)
+++ head/sys/dev/hptmv/entry.c  Mon Nov 23 12:57:24 2020(r367950)
@@ -2008,9 +2008,8 @@ hpt_attach(device_t dev)
}
 
 
-   if((ccb = (union ccb *)malloc(sizeof(*ccb), M_DEVBUF, M_WAITOK)) != 
(union ccb*)NULL)
+   if ((ccb = xpt_alloc_ccb()) != NULL)
{
-   bzero(ccb, sizeof(*ccb));
ccb->ccb_h.pinfo.priority = 1;
ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX;
}
@@ -2065,7 +2064,7 @@ hpt_attach(device_t dev)
ccb->csa.callback = hpt_async;
ccb->csa.callback_arg = hpt_vsim;
xpt_action((union ccb *)ccb);
-   free(ccb, M_DEVBUF);
+   xpt_free_ccb(ccb);
 
if (device_get_unit(dev) == 0) {
/* Start the work thread.  XXX */
___
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: r367949 - head/sys/dev/smartpqi

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 12:54:19 2020
New Revision: 367949
URL: https://svnweb.freebsd.org/changeset/base/367949

Log:
  smartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that.
  
  Reviewed by:  imp
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26838

Modified:
  head/sys/dev/smartpqi/smartpqi_cam.c

Modified: head/sys/dev/smartpqi/smartpqi_cam.c
==
--- head/sys/dev/smartpqi/smartpqi_cam.cMon Nov 23 12:50:38 2020
(r367948)
+++ head/sys/dev/smartpqi/smartpqi_cam.cMon Nov 23 12:54:19 2020
(r367949)
@@ -623,7 +623,6 @@ static void smartpqi_lun_rescan(struct pqisrc_softstat
return;
}
 
-   bzero(ccb, sizeof(union ccb));
xpt_setup_ccb(>ccb_h, path, 5);
ccb->ccb_h.func_code = XPT_SCAN_LUN;
ccb->ccb_h.cbfcnp = smartpqi_lunrescan_cb;
___
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: r367948 - head/sys/dev/arcmsr

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 12:50:38 2020
New Revision: 367948
URL: https://svnweb.freebsd.org/changeset/base/367948

Log:
  arcmsr(4): don't bzero newly allocated ccb; xpt_alloc_ccb() already does that.
  
  Reviewed by:  delphij, imp, ching2...@areca.com.tw
  Tested by:ching2...@areca.com.tw
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26840

Modified:
  head/sys/dev/arcmsr/arcmsr.c

Modified: head/sys/dev/arcmsr/arcmsr.c
==
--- head/sys/dev/arcmsr/arcmsr.cMon Nov 23 12:47:23 2020
(r367947)
+++ head/sys/dev/arcmsr/arcmsr.cMon Nov 23 12:50:38 2020
(r367948)
@@ -1707,7 +1707,6 @@ static void   arcmsr_rescan_lun(struct 
AdapterControlBlo
return;
}
 /* printf("arcmsr_rescan_lun: Rescan Target=%x, Lun=%x\n", target, lun); */
-   bzero(ccb, sizeof(union ccb));
xpt_setup_ccb(>ccb_h, path, 5);
ccb->ccb_h.func_code = XPT_SCAN_LUN;
ccb->ccb_h.cbfcnp = arcmsr_rescanLun_cb;
___
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: r367947 - head/sys/kern

2020-11-23 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 23 12:47:23 2020
New Revision: 367947
URL: https://svnweb.freebsd.org/changeset/base/367947

Log:
  Remove the 'wantparent' variable, unused since r145004.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D27193

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Mon Nov 23 10:13:56 2020(r367946)
+++ head/sys/kern/vfs_lookup.c  Mon Nov 23 12:47:23 2020(r367947)
@@ -1305,7 +1305,6 @@ int
 relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
 {
struct vnode *dp = NULL;/* the directory we are 
searching */
-   int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
int error = 0;
 
@@ -1314,8 +1313,8 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct
/*
 * Setup: break out flag bits into variables.
 */
-   wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT);
-   KASSERT(wantparent, ("relookup: parent not wanted."));
+   KASSERT((cnp->cn_flags & (LOCKPARENT | WANTPARENT)) != 0,
+   ("relookup: parent not wanted"));
rdonly = cnp->cn_flags & RDONLY;
cnp->cn_flags &= ~ISSYMLINK;
dp = dvp;
@@ -1406,13 +1405,8 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct
/*
 * Set the parent lock/ref state to the requested state.
 */
-   if ((cnp->cn_flags & LOCKPARENT) == 0 && dvp != dp) {
-   if (wantparent)
-   VOP_UNLOCK(dvp);
-   else
-   vput(dvp);
-   } else if (!wantparent)
-   vrele(dvp);
+   if ((cnp->cn_flags & LOCKPARENT) == 0 && dvp != dp)
+   VOP_UNLOCK(dvp);
/*
 * Check for symbolic link
 */
___
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: r367946 - head/sys/netinet

2020-11-23 Thread Michael Tuexen
Author: tuexen
Date: Mon Nov 23 10:13:56 2020
New Revision: 367946
URL: https://svnweb.freebsd.org/changeset/base/367946

Log:
  Fix two occurences of a typo in a comment introduced in r367530.
  
  Reported by:  lstewart@
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27148

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cMon Nov 23 04:39:29 2020
(r367945)
+++ head/sys/netinet/tcp_input.cMon Nov 23 10:13:56 2020
(r367946)
@@ -1695,7 +1695,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
}
/*
 * If timestamps were not negotiated during SYN/ACK and a
-* segment without a timestamp is received, ignore the
+* segment with a timestamp is received, ignore the
 * timestamp and process the packet normally.
 * See section 3.2 of RFC 7323.
 */

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Mon Nov 23 04:39:29 2020
(r367945)
+++ head/sys/netinet/tcp_syncache.c Mon Nov 23 10:13:56 2020
(r367946)
@@ -1213,7 +1213,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt
 
/*
 * If timestamps were not negotiated during SYN/ACK and a
-* segment without a timestamp is received, ignore the
+* segment with a timestamp is received, ignore the
 * timestamp and process the packet normally.
 * See section 3.2 of RFC 7323.
 */
___
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"