Merge ^/head r321307 through r321350.

This commit is contained in:
Dimitry Andric 2017-07-21 18:54:34 +00:00
commit 90a5403fea
24 changed files with 541 additions and 86 deletions

View File

@ -11,6 +11,9 @@ a(b+)c - abc abc b
a(b+)c - abbbc abbbc bbb
a(b*)c - ac ac @c
(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
# Begin FreeBSD
a\(b\|c\)d b ab|cd ab|cd b|c
# End FreeBSD
# the regression tester only asks for 9 subexpressions
a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k

View File

@ -87,7 +87,7 @@ FILESGROUPS+= truncate_test_FILES
truncate_test_FILES= truncate_test.root_owned
truncate_test_FILESDIR= ${TESTSDIR}
truncate_test_FILESMODE= 0600
truncate_test_FILESOWNER= root
truncate_test_FILESOWN= root
truncate_test_FILESGRP= wheel
truncate_test_FILESPACKAGE= ${PACKAGE}

View File

@ -26,6 +26,7 @@ FBSD_1.0 {
};
FBSD_1.5 {
lio_listio;
mq_getfd_np;
timer_oshandle_np;
};

View File

@ -44,6 +44,7 @@ __weak_reference(__aio_write, aio_write);
__weak_reference(__aio_return, aio_return);
__weak_reference(__aio_waitcomplete, aio_waitcomplete);
__weak_reference(__aio_fsync, aio_fsync);
__weak_reference(__lio_listio, lio_listio);
typedef void (*aio_func)(union sigval val, struct aiocb *iocb);
@ -53,6 +54,8 @@ extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *tim
extern ssize_t __sys_aio_return(struct aiocb *iocb);
extern int __sys_aio_error(struct aiocb *iocb);
extern int __sys_aio_fsync(int op, struct aiocb *iocb);
extern int __sys_lio_listio(int mode, struct aiocb * const list[], int nent,
struct sigevent *sig);
static void
aio_dispatch(struct sigev_node *sn)
@ -63,8 +66,8 @@ aio_dispatch(struct sigev_node *sn)
}
static int
aio_sigev_alloc(struct aiocb *iocb, struct sigev_node **sn,
struct sigevent *saved_ev)
aio_sigev_alloc(sigev_id_t id, struct sigevent *sigevent,
struct sigev_node **sn, struct sigevent *saved_ev)
{
if (__sigev_check_init()) {
/* This might be that thread library is not enabled. */
@ -72,15 +75,15 @@ aio_sigev_alloc(struct aiocb *iocb, struct sigev_node **sn,
return (-1);
}
*sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1);
*sn = __sigev_alloc(SI_ASYNCIO, sigevent, NULL, 1);
if (*sn == NULL) {
errno = EAGAIN;
return (-1);
}
*saved_ev = iocb->aio_sigevent;
(*sn)->sn_id = (sigev_id_t)iocb;
__sigev_get_sigevent(*sn, &iocb->aio_sigevent, (*sn)->sn_id);
*saved_ev = *sigevent;
(*sn)->sn_id = id;
__sigev_get_sigevent(*sn, sigevent, (*sn)->sn_id);
(*sn)->sn_dispatch = aio_dispatch;
__sigev_list_lock();
@ -102,7 +105,8 @@ aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb *iocb))
return (ret);
}
ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn,
&saved_ev);
if (ret)
return (ret);
ret = sysfunc(iocb);
@ -183,7 +187,8 @@ __aio_fsync(int op, struct aiocb *iocb)
if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD)
return __sys_aio_fsync(op, iocb);
ret = aio_sigev_alloc(iocb, &sn, &saved_ev);
ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn,
&saved_ev);
if (ret)
return (ret);
ret = __sys_aio_fsync(op, iocb);
@ -197,3 +202,29 @@ __aio_fsync(int op, struct aiocb *iocb)
}
return (ret);
}
int
__lio_listio(int mode, struct aiocb * const list[], int nent,
struct sigevent *sig)
{
struct sigev_node *sn;
struct sigevent saved_ev;
int ret, err;
if (sig == NULL || sig->sigev_notify != SIGEV_THREAD)
return (__sys_lio_listio(mode, list, nent, sig));
ret = aio_sigev_alloc((sigev_id_t)list, sig, &sn, &saved_ev);
if (ret)
return (ret);
ret = __sys_lio_listio(mode, list, nent, sig);
*sig = saved_ev;
if (ret != 0) {
err = errno;
__sigev_list_lock();
__sigev_delete_node(sn);
__sigev_list_unlock();
errno = err;
}
return (ret);
}

View File

@ -26,6 +26,10 @@ installfiles: installfiles-${group}
${group}OWN?= ${SHAREOWN}
${group}GRP?= ${SHAREGRP}
.if ${MK_INSTALL_AS_USER} == "yes"
${group}OWN= ${SHAREOWN}
${group}GRP= ${SHAREGRP}
.endif
${group}MODE?= ${SHAREMODE}
${group}DIR?= ${BINDIR}
STAGE_SETS+= ${group:C,[/*],_,g}
@ -46,6 +50,10 @@ _${group}FILES=
defined(${group}NAME_${file:T}) || defined(${group}NAME)
${group}OWN_${file:T}?= ${${group}OWN}
${group}GRP_${file:T}?= ${${group}GRP}
.if ${MK_INSTALL_AS_USER} == "yes"
${group}OWN_${file:T}= ${SHAREOWN}
${group}GRP_${file:T}= ${SHAREGRP}
.endif
${group}MODE_${file:T}?= ${${group}MODE}
${group}DIR_${file:T}?= ${${group}DIR}
.if defined(${group}NAME)

View File

@ -145,6 +145,23 @@ CWARNFLAGS+= -Wno-error=misleading-indentation \
-Wno-error=unused-const-variable
.endif
# GCC 7.1.0
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 70100
CWARNFLAGS+= -Wno-error=deprecated \
-Wno-error=pointer-compare \
-Wno-error=format-truncation \
-Wno-error=implicit-fallthrough \
-Wno-error=expansion-to-defined \
-Wno-error=int-in-bool-context \
-Wno-error=bool-operation \
-Wno-error=format-overflow \
-Wno-error=stringop-overflow \
-Wno-error=memset-elt-size \
-Wno-error=int-in-bool-context \
-Wno-error=unused-const-variable \
-Wno-error=nonnull
.endif
# How to handle FreeBSD custom printf format specifiers.
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__

View File

@ -274,8 +274,6 @@ pmap_modified_bit(pmap_t pmap)
return (mask);
}
extern struct pcpu __pcpu[];
#if !defined(DIAGNOSTIC)
#ifdef __GNUC_GNU_INLINE__
#define PMAP_INLINE __attribute__((__gnu_inline__)) inline
@ -1063,8 +1061,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
kernel_pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN;
kernel_pmap->pm_pcids[i].pm_gen = 1;
}
__pcpu[0].pc_pcid_next = PMAP_PCID_KERN + 1;
__pcpu[0].pc_pcid_gen = 1;
PCPU_SET(pcid_next, PMAP_PCID_KERN + 1);
PCPU_SET(pcid_gen, 1);
/*
* pcpu area for APs is zeroed during AP startup.
* pc_pcid_next and pc_pcid_gen are initialized by AP

View File

@ -15,7 +15,7 @@ font.h optional sc \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
# There is only an asm version on ppc64.
cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc | dtrace powerpc compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc | dtrace powerpc | zfs powerpcspe | dtrace powerpcspe compile-with "${ZFS_C}"
cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S optional zfs powerpc64 | dtrace powerpc64 compile-with "${ZFS_S}"
cddl/dev/dtrace/powerpc/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
cddl/dev/dtrace/powerpc/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
@ -118,6 +118,7 @@ powerpc/booke/platform_bare.c optional booke
powerpc/booke/pmap.c optional booke
powerpc/booke/spe.c optional powerpcspe
powerpc/cpufreq/dfs.c optional cpufreq
powerpc/cpufreq/mpc85xx_jog.c optional cpufreq mpc85xx
powerpc/cpufreq/pcr.c optional cpufreq aim
powerpc/cpufreq/pmufreq.c optional cpufreq aim pmu
powerpc/fpu/fpu_add.c optional fpu_emu

View File

@ -1663,9 +1663,7 @@ em_if_timer(if_ctx_t ctx, uint16_t qid)
if (qid != 0)
return;
em_if_update_admin_status(ctx);
em_update_stats_counters(adapter);
iflib_admin_intr_deferred(ctx);
/* Reset LAA into RAR[0] on 82571 */
if ((adapter->hw.mac.type == e1000_82571) &&
e1000_get_laa_state_82571(&adapter->hw))
@ -1781,6 +1779,7 @@ em_if_update_admin_status(if_ctx_t ctx)
iflib_link_state_change(ctx, LINK_STATE_DOWN, ifp->if_baudrate);
printf("link state changed to down\n");
}
em_update_stats_counters(adapter);
E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC);
}

View File

@ -671,7 +671,7 @@ nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr,
&rid, 0, ~0, *mem_size, RF_ACTIVE);
if (ptn_dev->pci_mem == NULL) {
*nm_paddr = 0;
*nm_addr = 0;
*nm_addr = NULL;
return ENOMEM;
}

View File

@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h> /* sockaddrs */
#include <sys/selinfo.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_var.h>
#include <machine/bus.h> /* bus_dmamap_* in netmap_kern.h */
@ -1198,6 +1199,13 @@ generic_netmap_attach(struct ifnet *ifp)
int retval;
u_int num_tx_desc, num_rx_desc;
#ifdef __FreeBSD__
if (ifp->if_type == IFT_LOOP) {
D("if_loop is not supported by %s", __func__);
return EINVAL;
}
#endif
num_tx_desc = num_rx_desc = netmap_generic_ringsize; /* starting point */
nm_os_generic_find_num_desc(ifp, &num_tx_desc, &num_rx_desc); /* ignore errors */

View File

@ -2146,7 +2146,7 @@ netmap_mem_pt_guest_deref(struct netmap_mem_d *nmd)
if (ptnmd->ptn_dev) {
nm_os_pt_memdev_iounmap(ptnmd->ptn_dev);
}
ptnmd->nm_addr = 0;
ptnmd->nm_addr = NULL;
ptnmd->nm_paddr = 0;
}
}

View File

@ -4674,6 +4674,11 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsclsession *sep,
struct nfsrv_descript *nd = &nfsd;
int error, irdcnt;
/* Make sure nm_rsize, nm_wsize is set. */
if (nmp->nm_rsize > NFS_MAXBSIZE || nmp->nm_rsize == 0)
nmp->nm_rsize = NFS_MAXBSIZE;
if (nmp->nm_wsize > NFS_MAXBSIZE || nmp->nm_wsize == 0)
nmp->nm_wsize = NFS_MAXBSIZE;
nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL);
NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
*tl++ = sep->nfsess_clientid.lval[0];

View File

@ -3020,19 +3020,23 @@ sogetopt(struct socket *so, struct sockopt *sopt)
goto integer;
case SO_SNDBUF:
optval = so->so_snd.sb_hiwat;
optval = SOLISTENING(so) ? so->sol_sbsnd_hiwat :
so->so_snd.sb_hiwat;
goto integer;
case SO_RCVBUF:
optval = so->so_rcv.sb_hiwat;
optval = SOLISTENING(so) ? so->sol_sbrcv_hiwat :
so->so_rcv.sb_hiwat;
goto integer;
case SO_SNDLOWAT:
optval = so->so_snd.sb_lowat;
optval = SOLISTENING(so) ? so->sol_sbsnd_lowat :
so->so_snd.sb_lowat;
goto integer;
case SO_RCVLOWAT:
optval = so->so_rcv.sb_lowat;
optval = SOLISTENING(so) ? so->sol_sbrcv_lowat :
so->so_rcv.sb_lowat;
goto integer;
case SO_SNDTIMEO:

View File

@ -309,16 +309,16 @@ typedef void (*nm_cb_t)(u_char *, const struct nm_pkthdr *, const u_char *d);
* ifname (netmap:foo or vale:foo) is the port name
* a suffix can indicate the follwing:
* ^ bind the host (sw) ring pair
* * bind host and NIC ring pairs (transparent)
* * bind host and NIC ring pairs
* -NN bind individual NIC ring pair
* {NN bind master side of pipe NN
* }NN bind slave side of pipe NN
* a suffix starting with / and the following flags,
* in any order:
* x exclusive access
* z zero copy monitor
* t monitor tx side
* r monitor rx side
* z zero copy monitor (both tx and rx)
* t monitor tx side (copy monitor)
* r monitor rx side (copy monitor)
* R bind only RX ring(s)
* T bind only TX ring(s)
*
@ -634,9 +634,10 @@ nm_open(const char *ifname, const struct nmreq *req,
const char *vpname = NULL;
#define MAXERRMSG 80
char errmsg[MAXERRMSG] = "";
enum { P_START, P_RNGSFXOK, P_GETNUM, P_FLAGS, P_FLAGSOK } p_state;
enum { P_START, P_RNGSFXOK, P_GETNUM, P_FLAGS, P_FLAGSOK, P_MEMID } p_state;
int is_vale;
long num;
uint16_t nr_arg2 = 0;
if (strncmp(ifname, "netmap:", 7) &&
strncmp(ifname, NM_BDG_NAME, strlen(NM_BDG_NAME))) {
@ -665,7 +666,7 @@ nm_open(const char *ifname, const struct nmreq *req,
}
/* scan for a separator */
for (; *port && !index("-*^{}/", *port); port++)
for (; *port && !index("-*^{}/@", *port); port++)
;
if (is_vale && !nm_is_identifier(vpname, port)) {
@ -707,6 +708,9 @@ nm_open(const char *ifname, const struct nmreq *req,
case '/': /* start of flags */
p_state = P_FLAGS;
break;
case '@': /* start of memid */
p_state = P_MEMID;
break;
default:
snprintf(errmsg, MAXERRMSG, "unknown modifier: '%c'", *port);
goto fail;
@ -718,6 +722,9 @@ nm_open(const char *ifname, const struct nmreq *req,
case '/':
p_state = P_FLAGS;
break;
case '@':
p_state = P_MEMID;
break;
default:
snprintf(errmsg, MAXERRMSG, "unexpected character: '%c'", *port);
goto fail;
@ -736,6 +743,11 @@ nm_open(const char *ifname, const struct nmreq *req,
break;
case P_FLAGS:
case P_FLAGSOK:
if (*port == '@') {
port++;
p_state = P_MEMID;
break;
}
switch (*port) {
case 'x':
nr_flags |= NR_EXCLUSIVE;
@ -762,17 +774,25 @@ nm_open(const char *ifname, const struct nmreq *req,
port++;
p_state = P_FLAGSOK;
break;
case P_MEMID:
if (nr_arg2 != 0) {
snprintf(errmsg, MAXERRMSG, "double setting of memid");
goto fail;
}
num = strtol(port, (char **)&port, 10);
if (num <= 0) {
snprintf(errmsg, MAXERRMSG, "invalid memid %ld, must be >0", num);
goto fail;
}
nr_arg2 = num;
p_state = P_RNGSFXOK;
break;
}
}
if (p_state != P_START && p_state != P_RNGSFXOK && p_state != P_FLAGSOK) {
snprintf(errmsg, MAXERRMSG, "unexpected end of port name");
goto fail;
}
if ((nr_flags & NR_ZCOPY_MON) &&
!(nr_flags & (NR_MONITOR_TX|NR_MONITOR_RX))) {
snprintf(errmsg, MAXERRMSG, "'z' used but neither 'r', nor 't' found");
goto fail;
}
ND("flags: %s %s %s %s",
(nr_flags & NR_EXCLUSIVE) ? "EXCLUSIVE" : "",
(nr_flags & NR_ZCOPY_MON) ? "ZCOPY_MON" : "",
@ -799,6 +819,8 @@ nm_open(const char *ifname, const struct nmreq *req,
/* these fields are overridden by ifname and flags processing */
d->req.nr_ringid |= nr_ringid;
d->req.nr_flags |= nr_flags;
if (nr_arg2)
d->req.nr_arg2 = nr_arg2;
memcpy(d->req.nr_name, ifname, namelen);
d->req.nr_name[namelen] = '\0';
/* optionally import info from parent */
@ -848,7 +870,7 @@ nm_open(const char *ifname, const struct nmreq *req,
nr_reg = d->req.nr_flags & NR_REG_MASK;
if (nr_reg == NR_REG_SW) { /* host stack */
if (nr_reg == NR_REG_SW) { /* host stack */
d->first_tx_ring = d->last_tx_ring = d->req.nr_tx_rings;
d->first_rx_ring = d->last_rx_ring = d->req.nr_rx_rings;
} else if (nr_reg == NR_REG_ALL_NIC) { /* only nic */

View File

@ -1658,7 +1658,7 @@ ipfw_unref_table(struct ip_fw_chain *ch, uint16_t kidx)
}
/*
* Lookup an arbtrary key @paddr of legth @plen in table @tbl.
* Lookup an arbitrary key @paddr of length @plen in table @tbl.
* Stores found value in @val.
*
* Returns 1 if key was found.

View File

@ -0,0 +1,343 @@
/*-
* Copyright (c) 2017 Justin Hibbits
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/smp.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <machine/cpu.h>
#include <powerpc/mpc85xx/mpc85xx.h>
#include "cpufreq_if.h"
/* No worries about uint32_t math overflow in here, because the highest
* multiplier supported is 4, and the highest speed part is still well below
* 2GHz.
*/
#define GUTS_PORPLLSR (CCSRBAR_VA + 0xe0000)
#define GUTS_PMJCR (CCSRBAR_VA + 0xe007c)
#define PMJCR_RATIO_M 0x3f
#define PMJCR_CORE_MULT(x,y) ((x) << (16 + ((y) * 8)))
#define PMJCR_GET_CORE_MULT(x,y) (((x) >> (16 + ((y) * 8))) & 0x3f)
#define GUTS_POWMGTCSR (CCSRBAR_VA + 0xe0080)
#define POWMGTCSR_JOG 0x00200000
#define POWMGTCSR_INT_MASK 0x00000f00
#define MHZ 1000000
struct mpc85xx_jog_softc {
device_t dev;
int cpu;
int low;
int high;
int min_freq;
};
static struct ofw_compat_data *mpc85xx_jog_devcompat(void);
static void mpc85xx_jog_identify(driver_t *driver, device_t parent);
static int mpc85xx_jog_probe(device_t dev);
static int mpc85xx_jog_attach(device_t dev);
static int mpc85xx_jog_settings(device_t dev, struct cf_setting *sets, int *count);
static int mpc85xx_jog_set(device_t dev, const struct cf_setting *set);
static int mpc85xx_jog_get(device_t dev, struct cf_setting *set);
static int mpc85xx_jog_type(device_t dev, int *type);
static device_method_t mpc85xx_jog_methods[] = {
/* Device interface */
DEVMETHOD(device_identify, mpc85xx_jog_identify),
DEVMETHOD(device_probe, mpc85xx_jog_probe),
DEVMETHOD(device_attach, mpc85xx_jog_attach),
/* cpufreq interface */
DEVMETHOD(cpufreq_drv_set, mpc85xx_jog_set),
DEVMETHOD(cpufreq_drv_get, mpc85xx_jog_get),
DEVMETHOD(cpufreq_drv_type, mpc85xx_jog_type),
DEVMETHOD(cpufreq_drv_settings, mpc85xx_jog_settings),
{0, 0}
};
static driver_t mpc85xx_jog_driver = {
"jog",
mpc85xx_jog_methods,
sizeof(struct mpc85xx_jog_softc)
};
static devclass_t mpc85xx_jog_devclass;
DRIVER_MODULE(mpc85xx_jog, cpu, mpc85xx_jog_driver, mpc85xx_jog_devclass, 0, 0);
struct mpc85xx_constraints {
int threshold; /* Threshold frequency, in MHz, for setting CORE_SPD bit. */
int min_mult; /* Minimum PLL multiplier. */
};
static struct mpc85xx_constraints mpc8536_constraints = {
800,
3
};
static struct mpc85xx_constraints p1022_constraints = {
500,
2
};
static struct ofw_compat_data jog_compat[] = {
{"fsl,mpc8536-guts", (uintptr_t)&mpc8536_constraints},
{"fsl,p1022-guts", (uintptr_t)&p1022_constraints},
{NULL, 0}
};
static struct ofw_compat_data *
mpc85xx_jog_devcompat()
{
phandle_t node;
int i;
node = OF_finddevice("/soc");
if (node <= 0)
return (NULL);
for (i = 0; jog_compat[i].ocd_str != NULL; i++)
if (ofw_bus_find_compatible(node, jog_compat[i].ocd_str) > 0)
break;
if (jog_compat[i].ocd_str == NULL)
return (NULL);
return (&jog_compat[i]);
}
static void
mpc85xx_jog_identify(driver_t *driver, device_t parent)
{
struct ofw_compat_data *compat;
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "mpc85xx_jog", -1) != NULL)
return;
compat = mpc85xx_jog_devcompat();
if (compat == NULL)
return;
/*
* We attach a child for every CPU since settings need to
* be performed on every CPU in the SMP case.
*/
if (BUS_ADD_CHILD(parent, 10, "jog", -1) == NULL)
device_printf(parent, "add jog child failed\n");
}
static int
mpc85xx_jog_probe(device_t dev)
{
struct ofw_compat_data *compat;
compat = mpc85xx_jog_devcompat();
if (compat == NULL || compat->ocd_str == NULL)
return (ENXIO);
device_set_desc(dev, "Freescale CPU Jogger");
return (0);
}
static int
mpc85xx_jog_attach(device_t dev)
{
struct ofw_compat_data *compat;
struct mpc85xx_jog_softc *sc;
struct mpc85xx_constraints *constraints;
phandle_t cpu;
uint32_t reg;
sc = device_get_softc(dev);
sc->dev = dev;
compat = mpc85xx_jog_devcompat();
constraints = (struct mpc85xx_constraints *)compat->ocd_data;
cpu = ofw_bus_get_node(device_get_parent(dev));
if (cpu <= 0) {
device_printf(dev,"No CPU device tree node!\n");
return (ENXIO);
}
OF_getencprop(cpu, "reg", &sc->cpu, sizeof(sc->cpu));
reg = ccsr_read4(GUTS_PORPLLSR);
/*
* Assume power-on PLL is the highest PLL config supported on the
* board.
*/
sc->high = PMJCR_GET_CORE_MULT(reg, sc->cpu);
sc->min_freq = constraints->threshold;
sc->low = constraints->min_mult;
cpufreq_register(dev);
return (0);
}
static int
mpc85xx_jog_settings(device_t dev, struct cf_setting *sets, int *count)
{
struct mpc85xx_jog_softc *sc;
uint32_t sysclk;
int i;
sc = device_get_softc(dev);
if (sets == NULL || count == NULL)
return (EINVAL);
if (*count < sc->high - 1)
return (E2BIG);
sysclk = mpc85xx_get_system_clock();
/* Return a list of valid settings for this driver. */
memset(sets, CPUFREQ_VAL_UNKNOWN, sizeof(*sets) * sc->high);
for (i = sc->high; i >= sc->low; --i) {
sets[sc->high - i].freq = sysclk * i / MHZ;
sets[sc->high - i].dev = dev;
sets[sc->high - i].spec[0] = i;
}
*count = sc->high - sc->low + 1;
return (0);
}
struct jog_rv_args {
int cpu;
int mult;
int slow;
volatile int inprogress;
};
static void
mpc85xx_jog_set_int(void *arg)
{
struct jog_rv_args *args = arg;
uint32_t reg;
if (PCPU_GET(cpuid) == args->cpu) {
reg = ccsr_read4(GUTS_PMJCR);
reg &= ~PMJCR_CORE_MULT(PMJCR_RATIO_M, args->cpu);
reg |= PMJCR_CORE_MULT(args->mult, args->cpu);
if (args->slow)
reg &= ~(1 << (12 + args->cpu));
else
reg |= (1 << (12 + args->cpu));
ccsr_write4(GUTS_PMJCR, reg);
reg = ccsr_read4(GUTS_POWMGTCSR);
reg |= POWMGTCSR_JOG | POWMGTCSR_INT_MASK;
ccsr_write4(GUTS_POWMGTCSR, reg);
/* Wait for completion */
do {
DELAY(100);
reg = ccsr_read4(GUTS_POWMGTCSR);
} while (reg & POWMGTCSR_JOG);
reg = ccsr_read4(GUTS_POWMGTCSR);
ccsr_write4(GUTS_POWMGTCSR, reg & ~POWMGTCSR_INT_MASK);
ccsr_read4(GUTS_POWMGTCSR);
args->inprogress = 0;
} else {
while (args->inprogress)
cpu_spinwait();
}
}
static int
mpc85xx_jog_set(device_t dev, const struct cf_setting *set)
{
struct mpc85xx_jog_softc *sc;
struct jog_rv_args args;
if (set == NULL)
return (EINVAL);
sc = device_get_softc(dev);
args.slow = (set->freq <= sc->min_freq);
args.mult = set->spec[0];
args.cpu = PCPU_GET(cpuid);
args.inprogress = 1;
smp_rendezvous(smp_no_rendezvous_barrier, mpc85xx_jog_set_int,
smp_no_rendezvous_barrier, &args);
return (0);
}
static int
mpc85xx_jog_get(device_t dev, struct cf_setting *set)
{
struct mpc85xx_jog_softc *sc;
uint32_t pmjcr;
uint32_t freq;
if (set == NULL)
return (EINVAL);
sc = device_get_softc(dev);
memset(set, CPUFREQ_VAL_UNKNOWN, sizeof(*set));
pmjcr = ccsr_read4(GUTS_PORPLLSR);
freq = PMJCR_GET_CORE_MULT(pmjcr, sc->cpu);
freq *= mpc85xx_get_system_clock();
freq /= MHZ;
set->freq = freq;
set->dev = dev;
return (0);
}
static int
mpc85xx_jog_type(device_t dev, int *type)
{
if (type == NULL)
return (EINVAL);
*type = CPUFREQ_TYPE_ABSOLUTE;
return (0);
}

View File

@ -1598,7 +1598,7 @@ ffs_snapremove(vp)
struct buf *ibp;
struct fs *fs;
ufs2_daddr_t numblks, blkno, dblk;
int error, loc, last;
int error, i, last, loc;
struct snapdata *sn;
ip = VTOI(vp);
@ -1618,10 +1618,14 @@ ffs_snapremove(vp)
ip->i_nextsnap.tqe_prev = 0;
VI_UNLOCK(devvp);
lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
for (i = 0; i < sn->sn_lock.lk_recurse; i++)
lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
KASSERT(vp->v_vnlock == &sn->sn_lock,
("ffs_snapremove: lost lock mutation"));
vp->v_vnlock = &vp->v_lock;
VI_LOCK(devvp);
while (sn->sn_lock.lk_recurse > 0)
lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
try_free_snapdata(devvp);
} else
@ -1931,7 +1935,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum, vtype, wkhd)
*/
if (error != 0 && wkhd != NULL)
softdep_freework(wkhd);
lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
return (error);
}
@ -2634,8 +2638,8 @@ try_free_snapdata(struct vnode *devvp)
static struct snapdata *
ffs_snapdata_acquire(struct vnode *devvp)
{
struct snapdata *nsn;
struct snapdata *sn;
struct snapdata *nsn, *sn;
int error;
/*
* Allocate a free snapdata. This is done before acquiring the
@ -2643,23 +2647,37 @@ ffs_snapdata_acquire(struct vnode *devvp)
* held.
*/
nsn = ffs_snapdata_alloc();
/*
* If there snapshots already exist on this filesystem grab a
* reference to the shared lock. Otherwise this is the first
* snapshot on this filesystem and we need to use our
* pre-allocated snapdata.
*/
VI_LOCK(devvp);
if (devvp->v_rdev->si_snapdata == NULL) {
devvp->v_rdev->si_snapdata = nsn;
nsn = NULL;
for (;;) {
VI_LOCK(devvp);
sn = devvp->v_rdev->si_snapdata;
if (sn == NULL) {
/*
* This is the first snapshot on this
* filesystem and we use our pre-allocated
* snapdata. Publish sn with the sn_lock
* owned by us, to avoid the race.
*/
error = lockmgr(&nsn->sn_lock, LK_EXCLUSIVE |
LK_NOWAIT, NULL);
if (error != 0)
panic("leaked sn, lockmgr error %d", error);
sn = devvp->v_rdev->si_snapdata = nsn;
VI_UNLOCK(devvp);
nsn = NULL;
break;
}
/*
* There is a snapshots which already exists on this
* filesystem, grab a reference to the common lock.
*/
error = lockmgr(&sn->sn_lock, LK_INTERLOCK |
LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp));
if (error == 0)
break;
}
sn = devvp->v_rdev->si_snapdata;
/*
* Acquire the snapshot lock.
*/
lockmgr(&sn->sn_lock,
LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp));
/*
* Free any unused snapdata.
*/

View File

@ -171,11 +171,11 @@ struct vm_object {
#define OBJ_FICTITIOUS 0x0001 /* (c) contains fictitious pages */
#define OBJ_UNMANAGED 0x0002 /* (c) contains unmanaged pages */
#define OBJ_POPULATE 0x0004 /* pager implements populate() */
#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
#define OBJ_DEAD 0x0008 /* dead objects (during rundown) */
#define OBJ_NOSPLIT 0x0010 /* dont split this object */
#define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */
#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */
#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */
#define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */
#define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */
#define OBJ_COLORED 0x1000 /* pg_color is defined */

View File

@ -90,8 +90,6 @@ int mcount_lock;
int mp_naps; /* # of Applications processors */
int boot_cpu_id = -1; /* designated BSP */
extern struct pcpu __pcpu[];
/* AP uses this during bootstrap. Do not staticize. */
char *bootSTK;
int bootAP;

View File

@ -119,8 +119,8 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc)
struct aiocb *list = NULL;
struct sigevent sev;
atf_tc_expect_fail("Bug 220459 - lio_listio(2) doesn't support"
" SIGEV_THREAD");
atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends"
"asynchronous notification if nent==0");
ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0));
bzero(&sev, sizeof(sev));
sev.sigev_notify = SIGEV_THREAD;

View File

@ -28,7 +28,7 @@
.\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd March 31, 2016
.Dd July 24, 2017
.Dt KTRACE 1
.Os
.Sh NAME
@ -148,31 +148,31 @@ and
.Ar command
options are mutually exclusive.
.Sh EXAMPLES
# trace all kernel operations of process id 34
Trace all kernel operations of process id 34:
.Dl $ ktrace -p 34
.Pp
# trace all kernel operations of processes in process group 15 and
# pass the trace flags to all current and future children
Trace all kernel operations of processes in process group 15 and
pass the trace flags to all current and future children:
.Dl $ ktrace -idg 15
.Pp
# disable all tracing of process 65
Disable all tracing of process 65:
.Dl $ ktrace -cp 65
.Pp
# disable tracing signals on process 70 and all current children
Disable tracing signals on process 70 and all current children:
.Dl $ ktrace -t s -cdp 70
.Pp
# enable tracing of
Enable tracing of
.Tn I/O
on process 67
on process 67:
.Dl $ ktrace -ti -p 67
.Pp
# run the command "w", tracing only system calls
Run the command "w", tracing only system calls:
.Dl $ ktrace -tc w
.Pp
# disable all tracing to the file "tracedata"
Disable all tracing to the file "tracedata":
.Dl $ ktrace -c -f tracedata
.Pp
# disable tracing of all user-owned processes
Disable tracing of all user-owned processes:
.Dl $ ktrace -C
.Sh SEE ALSO
.Xr kdump 1 ,

View File

@ -1,6 +1,6 @@
.\" $FreeBSD$
.\"
.Dd February 23, 2016
.Dd July 24, 2017
.Dt TRUSS 1
.Os
.Sh NAME
@ -92,13 +92,16 @@ and
options are mutually exclusive.)
.El
.Sh EXAMPLES
# Follow the system calls used in echoing "hello"
Follow the system calls used in echoing "hello":
.Dl $ truss /bin/echo hello
# Do the same, but put the output into a file
.Pp
Do the same, but put the output into a file:
.Dl $ truss -o /tmp/truss.out /bin/echo hello
# Follow an already-running process
.Pp
Follow an already-running process:
.Dl $ truss -p 34
.Sh SEE ALSO
.Xr dtrace 1 ,
.Xr kdump 1 ,
.Xr ktrace 1 ,
.Xr ptrace 2 ,

View File

@ -42,11 +42,10 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \
"3 read_msgbuf" "Disable reading kernel message buffer for unprivileged users" ${read_msgbuf:-off} \
"4 proc_debug" "Disable process debugging facilities for unprivileged users" ${proc_debug:-off} \
"5 random_pid" "Randomize the PID of newly created processes" ${random_pid:-off} \
"6 stack_guard" "Set stack guard buffer size to 2MB" ${stack_guard:-off} \
"7 clear_tmp" "Clean the /tmp filesystem on system startup" ${clear_tmp:-off} \
"8 disable_syslogd" "Disable opening Syslogd network socket (disables remote logging)" ${disable_syslogd:-off} \
"9 disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \
"10 secure_console" "Enable console password prompt" ${secure_console:-off} \
"6 clear_tmp" "Clean the /tmp filesystem on system startup" ${clear_tmp:-off} \
"7 disable_syslogd" "Disable opening Syslogd network socket (disables remote logging)" ${disable_syslogd:-off} \
"8 disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \
"9 secure_console" "Enable console password prompt" ${secure_console:-off} \
2>&1 1>&3 )
exec 3>&-
@ -69,9 +68,6 @@ for feature in $FEATURES; do
if [ "$feature" = "random_pid" ]; then
echo kern.randompid=$(jot -r 1 9999) >> $BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
if [ "$feature" = "stack_guard" ]; then
echo security.bsd.stack_guard_page=512 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening
fi
if [ "$feature" = "clear_tmp" ]; then
echo 'clear_tmp_enable="YES"' >> $BSDINSTALL_TMPETC/rc.conf.hardening
fi