Bladeren bron

Merge remote-tracking branch 'internal/freebsd/12-stable/master' into hardened/12-stable/master

remotes/github/hardened/12-stable/master
Shawn Webb 3 maanden geleden
bovenliggende
commit
bbf54312a5
27 gewijzigde bestanden met toevoegingen van 309 en 303 verwijderingen
  1. +2
    -0
      bin/sh/tests/execution/Makefile
  2. +16
    -0
      bin/sh/tests/execution/bg11.0
  3. +12
    -0
      bin/sh/tests/execution/bg12.0
  4. +6
    -2
      contrib/tnftp/src/cmds.c
  5. +2
    -0
      contrib/tnftp/src/ftp_var.h
  6. +10
    -0
      contrib/tnftp/src/main.c
  7. +14
    -0
      contrib/tnftp/src/util.c
  8. +10
    -5
      libexec/rtld-elf/rtld.c
  9. +2
    -147
      share/man/man4/umass.4
  10. +54
    -32
      sys/amd64/amd64/pmap.c
  11. +2
    -0
      sys/dev/cxgb/cxgb_main.c
  12. +2
    -0
      sys/dev/cxgbe/t4_main.c
  13. +7
    -3
      sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  14. +2
    -0
      sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  15. +6
    -2
      sys/dev/mxge/if_mxge.c
  16. +11
    -47
      sys/dev/netmap/if_vtnet_netmap.h
  17. +1
    -0
      sys/dev/oce/oce_if.c
  18. +23
    -8
      sys/dev/virtio/network/if_vtnet.c
  19. +6
    -0
      sys/dev/virtio/network/if_vtnetvar.h
  20. +18
    -8
      sys/i386/i386/pmap.c
  21. +8
    -1
      sys/i386/i386/vm_machdep.c
  22. +16
    -8
      sys/net/iflib.c
  23. +1
    -1
      sys/netinet/ip_mroute.c
  24. +9
    -4
      sys/x86/include/x86_smp.h
  25. +46
    -27
      sys/x86/x86/mp_x86.c
  26. +6
    -0
      usr.bin/top/display.c
  27. +17
    -8
      usr.bin/top/machine.c

+ 2
- 0
bin/sh/tests/execution/Makefile Bestand weergeven

@@ -17,6 +17,8 @@ ${PACKAGE}FILES+= bg7.0
${PACKAGE}FILES+= bg8.0
${PACKAGE}FILES+= bg9.0
${PACKAGE}FILES+= bg10.0 bg10.0.stdout
${PACKAGE}FILES+= bg11.0
${PACKAGE}FILES+= bg12.0
${PACKAGE}FILES+= fork1.0
${PACKAGE}FILES+= fork2.0
${PACKAGE}FILES+= fork3.0


+ 16
- 0
bin/sh/tests/execution/bg11.0 Bestand weergeven

@@ -0,0 +1,16 @@
# $FreeBSD$

T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
trap 'rm -rf $T' 0
cd $T || exit 3
mkfifo fifo1
# Use a trap, not the default action, since the shell may catch SIGINT and
# therefore its processing may be delayed.
{ trap 'exit 5' TERM; read dummy <fifo1; exit 4; } &
exec 3>fifo1
kill -INT "$!"
kill -TERM "$!"
exec 3>&-
wait "$!"
r=$?
[ "$r" = 5 ]

+ 12
- 0
bin/sh/tests/execution/bg12.0 Bestand weergeven

@@ -0,0 +1,12 @@
# $FreeBSD$

T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
trap 'rm -rf $T' 0
cd $T || exit 3
mkfifo fifo1
{ trap - INT; : >fifo1; sleep 5; exit 4; } &
: <fifo1
kill -INT "$!"
wait "$!"
r=$?
[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]

+ 6
- 2
contrib/tnftp/src/cmds.c Bestand weergeven

@@ -2653,10 +2653,14 @@ setxferbuf(int argc, char *argv[])
goto usage;
}

if (dir & RATE_PUT)
if (dir & RATE_PUT) {
sndbuf_size = size;
if (dir & RATE_GET)
auto_sndbuf = 0;
}
if (dir & RATE_GET) {
rcvbuf_size = size;
auto_rcvbuf = 0;
}
fprintf(ttyout, "Socket buffer sizes: send %d, receive %d.\n",
sndbuf_size, rcvbuf_size);
code = 0;


+ 2
- 0
contrib/tnftp/src/ftp_var.h Bestand weergeven

@@ -298,6 +298,8 @@ GLOBAL int options; /* used during socket creation */

GLOBAL int sndbuf_size; /* socket send buffer size */
GLOBAL int rcvbuf_size; /* socket receive buffer size */
GLOBAL int auto_sndbuf; /* flag: if != 0 then use auto sndbuf size */
GLOBAL int auto_rcvbuf; /* flag: if != 0 then use auto rcvbuf size */

GLOBAL int macnum; /* number of defined macros */
GLOBAL struct macel macros[16];


+ 10
- 0
contrib/tnftp/src/main.c Bestand weergeven

@@ -127,6 +127,9 @@ __RCSID(" NetBSD: main.c,v 1.117 2009/07/13 19:05:41 roy Exp ");
#include <locale.h>

#endif /* tnftp */
#ifdef __FreeBSD__
#include <sys/sysctl.h>
#endif

#define GLOBAL /* force GLOBAL decls in ftp_var.h to be declared */
#include "ftp_var.h"
@@ -510,6 +513,13 @@ main(int volatile argc, char **volatile argv)
(void)xsignal(SIGUSR2, crankrate);
(void)xsignal(SIGWINCH, setttywidth);

auto_rcvbuf = ((sysctlbyname("net.inet.tcp.recvbuf_auto",
&auto_rcvbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) &&
auto_rcvbuf == 1);
auto_sndbuf = ((sysctlbyname("net.inet.tcp.sendbuf_auto",
&auto_sndbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) &&
auto_sndbuf == 1);

if (argc > 0) {
if (isupload) {
rval = auto_put(argc, argv, upload_path);


+ 14
- 0
contrib/tnftp/src/util.c Bestand weergeven

@@ -1087,13 +1087,27 @@ setupsockbufsize(int sock)
sndbuf_size);
}

#ifdef __FreeBSD__
DPRINTF("auto_rcvbuf = %d\n", auto_rcvbuf);
if (auto_sndbuf == 0) {
#endif
if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
(void *)&sndbuf_size, sizeof(sndbuf_size)) == -1)
warn("Unable to set sndbuf size %d", sndbuf_size);
#ifdef __FreeBSD__
}
#endif

#ifdef __FreeBSD__
DPRINTF("auto_sndbuf = %d\n", auto_sndbuf);
if (auto_rcvbuf == 0) {
#endif
if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
(void *)&rcvbuf_size, sizeof(rcvbuf_size)) == -1)
warn("Unable to set rcvbuf size %d", rcvbuf_size);
#ifdef __FreeBSD__
}
#endif
}

/*


+ 10
- 5
libexec/rtld-elf/rtld.c Bestand weergeven

@@ -712,7 +712,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
preload_tail = globallist_curr(TAILQ_LAST(&obj_list, obj_entry_q));

dbg("loading needed objects");
if (load_needed_objects(obj_main, 0) == -1)
if (load_needed_objects(obj_main, ld_tracing != NULL ? RTLD_LO_TRACE :
0) == -1)
rtld_die();

/* Make a list of all objects loaded at startup. */
@@ -2669,12 +2670,13 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp,
obj->path = path;
if (!digest_dynamic(obj, 0))
goto errp;
if (obj->z_pie) {
dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
obj->valid_hash_sysv, obj->valid_hash_gnu, obj->dynsymcount);
if (obj->z_pie && (flags & RTLD_LO_TRACE) == 0) {
dbg("refusing to load PIE executable \"%s\"", obj->path);
_rtld_error("Cannot load PIE binary %s as DSO", obj->path);
goto errp;
}
dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
obj->valid_hash_sysv, obj->valid_hash_gnu, obj->dynsymcount);
if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) ==
RTLD_LO_DLOPEN) {
dbg("refusing to load non-loadable \"%s\"", obj->path);
@@ -3498,6 +3500,9 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
RtldLockState mlockstate;
int result;

dbg("dlopen_object name \"%s\" fd %d refobj \"%s\" lo_flags %#x mode %#x",
name != NULL ? name : "<null>", fd, refobj == NULL ? "<null>" :
refobj->path, lo_flags, mode);
objlist_init(&initlist);

if (lockstate == NULL && !(lo_flags & RTLD_LO_EARLY)) {
@@ -3533,7 +3538,7 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
}
if (result != -1)
result = load_needed_objects(obj, lo_flags & (RTLD_LO_DLOPEN |
RTLD_LO_EARLY | RTLD_LO_IGNSTLS));
RTLD_LO_EARLY | RTLD_LO_IGNSTLS | RTLD_LO_TRACE));
init_dag(obj);
ref_dag(obj);
if (result != -1)


+ 2
- 147
share/man/man4/umass.4 Bestand weergeven

@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 19, 2014
.Dd January 27, 2020
.Dt UMASS 4
.Os
.Sh NAME
@@ -73,114 +73,6 @@ requires
and
.Xr scbus 4
to be included in the kernel.
.Sh HARDWARE
The
.Nm
driver supports USB Mass Storage devices, including:
.Pp
.Bl -bullet -compact
.It
ADTEC Stick Drive AD-UST32M, 64M, 128M, 256M
.It
Denno FireWire/USB2 Removable 2.5-inch HDD Case MIFU-25CB20
.It
FujiFilm Zip USB Drive ZDR100 USB A
.It
GREEN HOUSE USB Flash Memory "PicoDrive" GH-UFD32M, 64M, 128M
.It
Huawei Mobile (SD slot)
.It
IBM 32MB USB Memory Key (P/N 22P5296)
.It
IBM 256MB USB Drive (MSYSTEM DiskOnKey2)
.It
IBM ThinkPad USB Portable CD-ROM Drive (P/N 33L5151)
.It
I-O DATA USB CD/CD-R/CD-RW/DVD-R/DVD-RW/DVD-RAM/DVD-ROM Drive DVR-iUH2 (CDROM, DVD-RAM only)
.It
I-O DATA USB x6 CD-RW Drive CDRW-i64/USB (CDROM only)
.It
I-O DATA USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI
.It
Iomega USB Zip 100/250 drive
.It
Iomega Zip750 USB2.0 drive
.It
Keian USB1.1/2.0 3.5-inch HDD Case KU350A
.It
Kurouto Shikou USB 2.5-inch HDD Case GAWAP2.5PS-USB2.0
.It
LaCie P3 HardDrive USB 200GB
.It
Logitec LDR-H443U2 DVD-RAM/-R/+R/-RW/+RW drive
.It
Logitec Mobile USB Memory LMC-256UD
.It
Logitec USB1.1/2.0 HDD Unit SHD-E60U2
.It
Logitec USB Double-Speed Floppy Drive LFD-31U2
.It
Logitec USB/IEEE1394 DVD-RAM/R/RW Unit LDR-N21FU2 (CDROM only)
.It
MELCO USB Flash Disk "ClipDrive", RUF-C32M, -C64M, -C128M, -C256M, -C512M
.It
MELCO USB Flash Disk "PetitDrive", RUF-32M, -64M, -128M, -256Mm
.It
MELCO USB2.0 Flash Disk "PetitDrive2", RUF-256M/U2, -512M/U2
.It
MELCO USB2.0 MO Drive MO-CH640U2
.It
Matshita CF-VFDU03 floppy drive
.It
Merlin SM300 MP3/WMA Player (256Mb)
.It
Microtech International, Inc.\& USB-SCSI-HD 50 USB to SCSI cable
.It
Motorola E398 Mobile Phone (TransFlash memory card)
.It
NOVAC USB2.0 2.5/3.5-inch HDD Case NV-HD351U
.It
PNY Attache Flash Drive
.It
Panasonic ("Matshita FDD CF-VFDU03")
.It
Panasonic KXL-CB20AN Portable DVD-ROM/CD-R/RW
.It
Panasonic KXL-CB35AN (DVD-ROM & CD-R/RW)
.It
Panasonic USB2.0 Portable CD-RW Drive KXL-RW40AN (CDROM only)
.It
Panasonic floppy drive
.It
Qware BeatZkey!\& Pro
.It
RATOC Systems USB2.0 Removable HDD Case U2-MDK1, U2-MDK1B
.It
SanDisk SDDR-31 (Compact Flash)
.It
SanDisk SDDR-75 (only Compact Flash port works)
.It
Sitecom CN-300 MultiFlash (MMC/SD, SmartMedia, CF, MemoryStick)
.It
Sony Portable CD-R/RW Drive CRX10U (CDROM only)
.It
TEAC Portable USB CD-ROM Unit CD-110PU/210PU
.It
Time DPA20B MP3 Player (1Gb)
.It
Trek Thumbdrive 8MB
.It
VAIO floppy drive (includes Y-E Data Flashbuster-U)
.It
Y-E Data floppy drive (720/1.44/2.88Mb)
.El
.Pp
Among the supported digital cameras are:
.Pp
.Bl -bullet -compact
.It
Asahi Optical (PENTAX) Optio 230 & 330
.El
.Sh EXAMPLES
.Bd -literal -offset indent
device umass
@@ -193,11 +85,6 @@ Add the
.Nm
driver to the kernel.
.Pp
.Dl "camcontrol rescan 0"
.Pp
Rescan a Zip drive that was added after boot.
The command above
assumes that the Zip drive is on the first SCSI bus in the system.
.Bd -literal -offset indent
camcontrol rescan 0:0:0
camcontrol rescan 0:0:1
@@ -208,46 +95,14 @@ camcontrol rescan 0:0:3
Rescan all slots on a multi-slot flash reader, where the slots map to separate
LUNs on a single SCSI ID.
Typically only the first slot will be enabled at boot time.
Again, this assumes that the flash reader is the first SCSI bus in the system.
.Bd -literal -offset indent
bsdlabel -w da0 zip100
newfs da0c
mount -t ufs /dev/da0c /mnt
.Ed
.Pp
Write a disklabel to the Zip drive (see
.Xr vpo 4
for the
.Xr disktab 5
entry), creates the file system and mounts the new file system on /mnt.
.Pp
.Dl "newfs_msdos /dev/da0"
.Pp
Create a new FAT type file system.
Care should be taken not to run
.Xr newfs 8
on devices that already contain data, as this will result in the
information being lost.
.Pp
Many consumer devices such as digital cameras automatically create
.Tn MS-DOS
based file systems when storing information such as images and
videos.
These file systems can be accessed by specifying the file system
type as
.Cm msdosfs
when using
.Xr mount 8 .
This assumes that the flash reader is the first SCSI bus in the system and has 4 slots.
.Sh SEE ALSO
.Xr cfumass 4 ,
.Xr ehci 4 ,
.Xr ohci 4 ,
.Xr uhci 4 ,
.Xr usb 4 ,
.Xr vpo 4 ,
.Xr xhci 4 ,
.Xr disktab 5 ,
.Xr bsdlabel 8 ,
.Xr camcontrol 8
.\".Sh HISTORY
.Sh AUTHORS


+ 54
- 32
sys/amd64/amd64/pmap.c Bestand weergeven

@@ -2420,6 +2420,20 @@ DEFINE_IFUNC(static, void, pmap_invalidate_page_mode, (pmap_t, vm_offset_t),
return (pmap_invalidate_page_nopcid);
}

static void
pmap_invalidate_page_curcpu_cb(pmap_t pmap, vm_offset_t va,
vm_offset_t addr2 __unused)
{

if (pmap == kernel_pmap) {
invlpg(va);
} else {
if (pmap == PCPU_GET(curpmap))
invlpg(va);
pmap_invalidate_page_mode(pmap, va);
}
}

void
pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
{
@@ -2432,16 +2446,8 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
KASSERT(pmap->pm_type == PT_X86,
("pmap_invalidate_page: invalid type %d", pmap->pm_type));

sched_pin();
if (pmap == kernel_pmap) {
invlpg(va);
} else {
if (pmap == PCPU_GET(curpmap))
invlpg(va);
pmap_invalidate_page_mode(pmap, va);
}
smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap);
sched_unpin();
smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap,
pmap_invalidate_page_curcpu_cb);
}

/* 4k PTEs -- Chosen to exceed the total size of Broadwell L2 TLB */
@@ -2517,10 +2523,26 @@ DEFINE_IFUNC(static, void, pmap_invalidate_range_mode, (pmap_t, vm_offset_t,
return (pmap_invalidate_range_nopcid);
}

static void
pmap_invalidate_range_curcpu_cb(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
{
vm_offset_t addr;

if (pmap == kernel_pmap) {
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
} else {
if (pmap == PCPU_GET(curpmap)) {
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
}
pmap_invalidate_range_mode(pmap, sva, eva);
}
}

void
pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
{
vm_offset_t addr;

if (eva - sva >= PMAP_INVLPG_THRESHOLD) {
pmap_invalidate_all(pmap);
@@ -2535,19 +2557,8 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
KASSERT(pmap->pm_type == PT_X86,
("pmap_invalidate_range: invalid type %d", pmap->pm_type));

sched_pin();
if (pmap == kernel_pmap) {
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
} else {
if (pmap == PCPU_GET(curpmap)) {
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
}
pmap_invalidate_range_mode(pmap, sva, eva);
}
smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap);
sched_unpin();
smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap,
pmap_invalidate_range_curcpu_cb);
}

static inline void
@@ -2634,6 +2645,14 @@ DEFINE_IFUNC(static, void, pmap_invalidate_all_mode, (pmap_t), static)
return (pmap_invalidate_all_nopcid);
}

static void
pmap_invalidate_all_curcpu_cb(pmap_t pmap, vm_offset_t addr1 __unused,
vm_offset_t addr2 __unused)
{

pmap_invalidate_all_mode(pmap);
}

void
pmap_invalidate_all(pmap_t pmap)
{
@@ -2646,20 +2665,23 @@ pmap_invalidate_all(pmap_t pmap)
KASSERT(pmap->pm_type == PT_X86,
("pmap_invalidate_all: invalid type %d", pmap->pm_type));

sched_pin();
pmap_invalidate_all_mode(pmap);
smp_masked_invltlb(pmap_invalidate_cpu_mask(pmap), pmap);
sched_unpin();
smp_masked_invltlb(pmap_invalidate_cpu_mask(pmap), pmap,
pmap_invalidate_all_curcpu_cb);
}

static void
pmap_invalidate_cache_curcpu_cb(pmap_t pmap __unused, vm_offset_t va __unused,
vm_offset_t addr2 __unused)
{

wbinvd();
}

void
pmap_invalidate_cache(void)
{

sched_pin();
wbinvd();
smp_cache_flush();
sched_unpin();
smp_cache_flush(pmap_invalidate_cache_curcpu_cb);
}

struct pde_action {


+ 2
- 0
sys/dev/cxgb/cxgb_main.c Bestand weergeven

@@ -1961,6 +1961,7 @@ fail:

if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1972,6 +1973,7 @@ fail:

if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");


+ 2
- 0
sys/dev/cxgbe/t4_main.c Bestand weergeven

@@ -1914,6 +1914,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)

if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1925,6 +1926,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)

if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");


+ 7
- 3
sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Bestand weergeven

@@ -852,9 +852,11 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv,
int err = 0;
u64 mcast_addr = 0;


/* Enable/disable the multicast filter according to IFF_ALLMULTI */
if (dev->if_flags & IFF_ALLMULTI) {
/*
* Enable/disable the multicast filter according to
* IFF_ALLMULTI and IFF_PROMISC:
*/
if (dev->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) {
err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
0, MLX4_MCAST_DISABLE);
if (err)
@@ -2008,6 +2010,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)

if (IFCAP_TSO4 & dev->if_capenable &&
!(IFCAP_TXCSUM & dev->if_capenable)) {
mask &= ~IFCAP_TSO4;
dev->if_capenable &= ~IFCAP_TSO4;
dev->if_hwassist &= ~CSUM_IP_TSO;
if_printf(dev,
@@ -2020,6 +2023,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data)

if (IFCAP_TSO6 & dev->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
mask &= ~IFCAP_TSO6;
dev->if_capenable &= ~IFCAP_TSO6;
dev->if_hwassist &= ~CSUM_IP6_TSO;
if_printf(dev,


+ 2
- 0
sys/dev/mlx5/mlx5_en/mlx5_en_main.c Bestand weergeven

@@ -3285,6 +3285,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)

if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
ifp->if_hwassist &= ~CSUM_IP_TSO;
mlx5_en_err(ifp,
@@ -3297,6 +3298,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)

if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
ifp->if_hwassist &= ~CSUM_IP6_TSO;
mlx5_en_err(ifp,


+ 6
- 2
sys/dev/mxge/if_mxge.c Bestand weergeven

@@ -4246,13 +4246,15 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
mask = ifr->ifr_reqcap ^ ifp->if_capenable;
if (mask & IFCAP_TXCSUM) {
if (IFCAP_TXCSUM & ifp->if_capenable) {
mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~(IFCAP_TXCSUM|IFCAP_TSO4);
ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP);
} else {
ifp->if_capenable |= IFCAP_TXCSUM;
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
}
} else if (mask & IFCAP_RXCSUM) {
}
if (mask & IFCAP_RXCSUM) {
if (IFCAP_RXCSUM & ifp->if_capenable) {
ifp->if_capenable &= ~IFCAP_RXCSUM;
} else {
@@ -4274,6 +4276,7 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#if IFCAP_TSO6
if (mask & IFCAP_TXCSUM_IPV6) {
if (IFCAP_TXCSUM_IPV6 & ifp->if_capenable) {
mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~(IFCAP_TXCSUM_IPV6
| IFCAP_TSO6);
ifp->if_hwassist &= ~(CSUM_TCP_IPV6
@@ -4283,7 +4286,8 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ifp->if_hwassist |= (CSUM_TCP_IPV6
| CSUM_UDP_IPV6);
}
} else if (mask & IFCAP_RXCSUM_IPV6) {
}
if (mask & IFCAP_RXCSUM_IPV6) {
if (IFCAP_RXCSUM_IPV6 & ifp->if_capenable) {
ifp->if_capenable &= ~IFCAP_RXCSUM_IPV6;
} else {


+ 11
- 47
sys/dev/netmap/if_vtnet_netmap.h Bestand weergeven

@@ -39,52 +39,18 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state)
{
struct ifnet *ifp = na->ifp;
struct vtnet_softc *sc = ifp->if_softc;
int success;
int i;

/* Drain the taskqueues to make sure that there are no worker threads
* accessing the virtqueues. */
vtnet_drain_taskqueues(sc);

/*
* Trigger a device reinit, asking vtnet_init_locked() to
* also enter or exit netmap mode.
*/
VTNET_CORE_LOCK(sc);

/* We need nm_netmap_on() to return true when called by
* vtnet_init_locked() below. */
if (state)
nm_set_native_flags(na);

/* We need to trigger a device reset in order to unexpose guest buffers
* published to the host. */
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
/* Get pending used buffers. The way they are freed depends on whether
* they are netmap buffer or they are mbufs. We can tell apart the two
* cases by looking at kring->nr_mode, before this is possibly updated
* in the loop below. */
for (i = 0; i < sc->vtnet_act_vq_pairs; i++) {
struct vtnet_txq *txq = &sc->vtnet_txqs[i];
struct vtnet_rxq *rxq = &sc->vtnet_rxqs[i];

VTNET_TXQ_LOCK(txq);
vtnet_txq_free_mbufs(txq);
VTNET_TXQ_UNLOCK(txq);

VTNET_RXQ_LOCK(rxq);
vtnet_rxq_free_mbufs(rxq);
VTNET_RXQ_UNLOCK(rxq);
}
vtnet_init_locked(sc);
success = (ifp->if_drv_flags & IFF_DRV_RUNNING) ? 0 : ENXIO;

if (state) {
netmap_krings_mode_commit(na, state);
} else {
nm_clear_native_flags(na);
netmap_krings_mode_commit(na, state);
}

ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
vtnet_init_locked(sc, state ? VTNET_INIT_NETMAP_ENTER
: VTNET_INIT_NETMAP_EXIT);
VTNET_CORE_UNLOCK(sc);

return success;
return 0;
}


@@ -245,15 +211,13 @@ vtnet_netmap_rxq_populate(struct vtnet_rxq *rxq)
{
struct netmap_adapter *na = NA(rxq->vtnrx_sc->vtnet_ifp);
struct netmap_kring *kring;
struct netmap_slot *slot;
int error;

if (!nm_native_on(na) || rxq->vtnrx_id >= na->num_rx_rings)
slot = netmap_reset(na, NR_RX, rxq->vtnrx_id, 0);
if (slot == NULL)
return -1;

kring = na->rx_rings[rxq->vtnrx_id];
if (!(nm_kring_pending_on(kring) ||
kring->nr_pending_mode == NKR_NETMAP_ON))
return -1;

/* Expose all the RX netmap buffers we can. In case of no indirect
* buffers, the number of netmap slots in the RX ring matches the


+ 1
- 0
sys/dev/oce/oce_if.c Bestand weergeven

@@ -539,6 +539,7 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if (IFCAP_TSO & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
u &= ~IFCAP_TSO;
ifp->if_capenable &= ~IFCAP_TSO;
ifp->if_hwassist &= ~CSUM_TSO;
if_printf(ifp,


+ 23
- 8
sys/dev/virtio/network/if_vtnet.c Bestand weergeven

@@ -180,7 +180,7 @@ static int vtnet_init_tx_queues(struct vtnet_softc *);
static int vtnet_init_rxtx_queues(struct vtnet_softc *);
static void vtnet_set_active_vq_pairs(struct vtnet_softc *);
static int vtnet_reinit(struct vtnet_softc *);
static void vtnet_init_locked(struct vtnet_softc *);
static void vtnet_init_locked(struct vtnet_softc *, int);
static void vtnet_init(void *);

static void vtnet_free_ctrl_vq(struct vtnet_softc *);
@@ -512,7 +512,7 @@ vtnet_resume(device_t dev)

VTNET_CORE_LOCK(sc);
if (ifp->if_flags & IFF_UP)
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);
sc->vtnet_flags &= ~VTNET_FLAG_SUSPENDED;
VTNET_CORE_UNLOCK(sc);

@@ -1065,7 +1065,7 @@ vtnet_change_mtu(struct vtnet_softc *sc, int new_mtu)

if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);
}

return (0);
@@ -1109,7 +1109,7 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
}
} else
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);

if (error == 0)
sc->vtnet_if_flags = ifp->if_flags;
@@ -1167,7 +1167,7 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)

if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);
}

VTNET_CORE_UNLOCK(sc);
@@ -2716,7 +2716,7 @@ vtnet_tick(void *xsc)

if (timedout != 0) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);
} else
callout_schedule(&sc->vtnet_tick_ch, hz);
}
@@ -3001,6 +3001,9 @@ vtnet_init_tx_queues(struct vtnet_softc *sc)
for (i = 0; i < sc->vtnet_act_vq_pairs; i++) {
txq = &sc->vtnet_txqs[i];
txq->vtntx_watchdog = 0;
#ifdef DEV_NETMAP
netmap_reset(NA(sc->vtnet_ifp), NR_TX, i, 0);
#endif /* DEV_NETMAP */
}

return (0);
@@ -3084,7 +3087,7 @@ vtnet_reinit(struct vtnet_softc *sc)
}

static void
vtnet_init_locked(struct vtnet_softc *sc)
vtnet_init_locked(struct vtnet_softc *sc, int init_mode)
{
device_t dev;
struct ifnet *ifp;
@@ -3099,6 +3102,18 @@ vtnet_init_locked(struct vtnet_softc *sc)

vtnet_stop(sc);

#ifdef DEV_NETMAP
/* Once stopped we can update the netmap flags, if necessary. */
switch (init_mode) {
case VTNET_INIT_NETMAP_ENTER:
nm_set_native_flags(NA(ifp));
break;
case VTNET_INIT_NETMAP_EXIT:
nm_clear_native_flags(NA(ifp));
break;
}
#endif /* DEV_NETMAP */

/* Reinitialize with the host. */
if (vtnet_virtio_reinit(sc) != 0)
goto fail;
@@ -3125,7 +3140,7 @@ vtnet_init(void *xsc)
sc = xsc;

VTNET_CORE_LOCK(sc);
vtnet_init_locked(sc);
vtnet_init_locked(sc, 0);
VTNET_CORE_UNLOCK(sc);
}



+ 6
- 0
sys/dev/virtio/network/if_vtnetvar.h Bestand weergeven

@@ -365,4 +365,10 @@ CTASSERT(((VTNET_MAX_TX_SEGS - 1) * MCLBYTES) >= VTNET_MAX_MTU);
"VTNET Core Lock", MTX_DEF); \
} while (0)

/*
* Values for the init_mode argument of vtnet_init_locked().
*/
#define VTNET_INIT_NETMAP_ENTER 1
#define VTNET_INIT_NETMAP_EXIT 2

#endif /* _IF_VTNETVAR_H */

+ 18
- 8
sys/i386/i386/pmap.c Bestand weergeven

@@ -1164,6 +1164,13 @@ invltlb_glob(void)


#ifdef SMP

static void
pmap_curcpu_cb_dummy(pmap_t pmap __unused, vm_offset_t addr1 __unused,
vm_offset_t addr2 __unused)
{
}

/*
* For SMP, these functions have to use the IPI mechanism for coherence.
*
@@ -1202,7 +1209,7 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
CPU_AND(&other_cpus, &pmap->pm_active);
mask = &other_cpus;
}
smp_masked_invlpg(*mask, va, pmap);
smp_masked_invlpg(*mask, va, pmap, pmap_curcpu_cb_dummy);
sched_unpin();
}

@@ -1235,7 +1242,7 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
CPU_AND(&other_cpus, &pmap->pm_active);
mask = &other_cpus;
}
smp_masked_invlpg_range(*mask, sva, eva, pmap);
smp_masked_invlpg_range(*mask, sva, eva, pmap, pmap_curcpu_cb_dummy);
sched_unpin();
}

@@ -1258,18 +1265,21 @@ pmap_invalidate_all(pmap_t pmap)
CPU_AND(&other_cpus, &pmap->pm_active);
mask = &other_cpus;
}
smp_masked_invltlb(*mask, pmap);
smp_masked_invltlb(*mask, pmap, pmap_curcpu_cb_dummy);
sched_unpin();
}

static void
pmap_invalidate_cache_curcpu_cb(pmap_t pmap __unused,
vm_offset_t addr1 __unused, vm_offset_t addr2 __unused)
{
wbinvd();
}

void
pmap_invalidate_cache(void)
{

sched_pin();
wbinvd();
smp_cache_flush();
sched_unpin();
smp_cache_flush(pmap_invalidate_cache_curcpu_cb);
}

struct pde_action {


+ 8
- 1
sys/i386/i386/vm_machdep.c Bestand weergeven

@@ -615,6 +615,12 @@ sf_buf_map(struct sf_buf *sf, int flags)
}

#ifdef SMP
static void
sf_buf_shootdown_curcpu_cb(pmap_t pmap __unused,
vm_offset_t addr1 __unused, vm_offset_t addr2 __unused)
{
}

void
sf_buf_shootdown(struct sf_buf *sf, int flags)
{
@@ -633,7 +639,8 @@ sf_buf_shootdown(struct sf_buf *sf, int flags)
CPU_NAND(&other_cpus, &sf->cpumask);
if (!CPU_EMPTY(&other_cpus)) {
CPU_OR(&sf->cpumask, &other_cpus);
smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap);
smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap,
sf_buf_shootdown_curcpu_cb);
}
}
sched_unpin();


+ 16
- 8
sys/net/iflib.c Bestand weergeven

@@ -793,13 +793,19 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff)
if (!CTX_IS_VF(ctx))
IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip);

/* enable or disable flags and callbacks in na and ifp */
iflib_stop(ctx);

/*
* Enable (or disable) netmap flags, and intercept (or restore)
* ifp->if_transmit. This is done once the device has been stopped
* to prevent race conditions.
*/
if (onoff) {
nm_set_native_flags(na);
} else {
nm_clear_native_flags(na);
}
iflib_stop(ctx);
iflib_init_locked(ctx);
IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); // XXX why twice ?
status = ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1;
@@ -3779,6 +3785,10 @@ _task_fn_rx(void *context)
if_ctx_t ctx = rxq->ifr_ctx;
uint8_t more;
uint16_t budget;
#ifdef DEV_NETMAP
u_int work = 0;
int nmirq;
#endif

#ifdef IFLIB_DIAGNOSTICS
rxq->ifr_cpu_exec_count[curcpu]++;
@@ -3787,12 +3797,10 @@ _task_fn_rx(void *context)
if (__predict_false(!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)))
return;
#ifdef DEV_NETMAP
if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) {
u_int work = 0;
if (netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work)) {
more = 0;
goto skip_rxeof;
}
nmirq = netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work);
if (nmirq != NM_IRQ_PASS) {
more = (nmirq == NM_IRQ_RESCHED) ? IFLIB_RXEOF_MORE : 0;
goto skip_rxeof;
}
#endif
budget = ctx->ifc_sysctl_rx_budget;


+ 1
- 1
sys/netinet/ip_mroute.c Bestand weergeven

@@ -739,7 +739,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
}
bzero((caddr_t)V_viftable, sizeof(V_viftable));
bzero((caddr_t)V_viftable, sizeof(*V_viftable) * MAXVIFS);
V_numvifs = 0;
V_pim_assert_enabled = 0;


+ 9
- 4
sys/x86/include/x86_smp.h Bestand weergeven

@@ -80,6 +80,9 @@ inthand_t
IDTVEC(cpususpend), /* CPU suspends & waits to be resumed */
IDTVEC(rendezvous); /* handle CPU rendezvous */

typedef void (*smp_invl_cb_t)(struct pmap *, vm_offset_t addr1,
vm_offset_t addr2);

/* functions in x86_mp.c */
void assign_cpu_ids(void);
void cpu_add(u_int apic_id, char boot_cpu);
@@ -99,11 +102,13 @@ void ipi_cpu(int cpu, u_int ipi);
int ipi_nmi_handler(void);
void ipi_selected(cpuset_t cpus, u_int ipi);
void set_interrupt_apic_ids(void);
void smp_cache_flush(void);
void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap);
void smp_cache_flush(smp_invl_cb_t curcpu_cb);
void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap,
smp_invl_cb_t curcpu_cb);
void smp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva,
vm_offset_t endva, struct pmap *pmap);
void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap);
vm_offset_t endva, struct pmap *pmap, smp_invl_cb_t curcpu_cb);
void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap,
smp_invl_cb_t curcpu_cb);
void mem_range_AP_init(void);
void topo_probe(void);
void ipi_send_cpu(int cpu, u_int ipi);


+ 46
- 27
sys/x86/x86/mp_x86.c Bestand weergeven

@@ -1618,29 +1618,48 @@ volatile uint32_t smp_tlb_generation;
#define read_eflags() read_rflags()
#endif

/*
* Used by pmap to request invalidation of TLB or cache on local and
* remote processors. Mask provides the set of remote CPUs which are
* to be signalled with the IPI specified by vector. The curcpu_cb
* callback is invoked on the calling CPU while waiting for remote
* CPUs to complete the operation.
*
* The callback function is called unconditionally on the caller's
* underlying processor, even when this processor is not set in the
* mask. So, the callback function must be prepared to handle such
* spurious invocations.
*/
static void
smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap,
vm_offset_t addr1, vm_offset_t addr2)
vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb)
{
cpuset_t other_cpus;
volatile uint32_t *p_cpudone;
uint32_t generation;
int cpu;

/* It is not necessary to signal other CPUs while in the debugger. */
if (kdb_active || panicstr != NULL)
/*
* It is not necessary to signal other CPUs while booting or
* when in the debugger.
*/
if (kdb_active || panicstr != NULL || !smp_started) {
curcpu_cb(pmap, addr1, addr2);
return;
}

sched_pin();

/*
* Check for other cpus. Return if none.
*/
if (CPU_ISFULLSET(&mask)) {
if (mp_ncpus <= 1)
return;
goto nospinexit;
} else {
CPU_CLR(PCPU_GET(cpuid), &mask);
if (CPU_EMPTY(&mask))
return;
goto nospinexit;
}

if (!(read_eflags() & PSL_I))
@@ -1664,6 +1683,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap,
ipi_send_cpu(cpu, vector);
}
}
curcpu_cb(pmap, addr1, addr2);
while ((cpu = CPU_FFS(&other_cpus)) != 0) {
cpu--;
CPU_CLR(cpu, &other_cpus);
@@ -1672,55 +1692,54 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap,
ia32_pause();
}
mtx_unlock_spin(&smp_ipi_mtx);
sched_unpin();
return;

nospinexit:
curcpu_cb(pmap, addr1, addr2);
sched_unpin();
}

void
smp_masked_invltlb(cpuset_t mask, pmap_t pmap)
smp_masked_invltlb(cpuset_t mask, pmap_t pmap, smp_invl_cb_t curcpu_cb)
{

if (smp_started) {
smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0);
smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0, curcpu_cb);
#ifdef COUNT_XINVLTLB_HITS
ipi_global++;
ipi_global++;
#endif
}
}

void
smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap)
smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap,
smp_invl_cb_t curcpu_cb)
{

if (smp_started) {
smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0);
smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0, curcpu_cb);
#ifdef COUNT_XINVLTLB_HITS
ipi_page++;
ipi_page++;
#endif
}
}

void
smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2,
pmap_t pmap)
pmap_t pmap, smp_invl_cb_t curcpu_cb)
{

if (smp_started) {
smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap,
addr1, addr2);
smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, addr1, addr2,
curcpu_cb);
#ifdef COUNT_XINVLTLB_HITS
ipi_range++;
ipi_range_size += (addr2 - addr1) / PAGE_SIZE;
ipi_range++;
ipi_range_size += (addr2 - addr1) / PAGE_SIZE;
#endif
}
}

void
smp_cache_flush(void)
smp_cache_flush(smp_invl_cb_t curcpu_cb)
{

if (smp_started) {
smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL,
0, 0);
}
smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL, 0, 0,
curcpu_cb);
}

/*


+ 6
- 0
usr.bin/top/display.c Bestand weergeven

@@ -675,6 +675,9 @@ i_swap(int *stats)
{
swap_buffer = setup_buffer(swap_buffer, 0);

if (swap_names == NULL)
return;

fputs("\nSwap: ", stdout);
lastline++;

@@ -690,6 +693,9 @@ u_swap(int *stats)

new = setup_buffer(new, 0);

if (swap_names == NULL)
return;

/* format the new line */
summary_format(new, stats, swap_names);
line_update(swap_buffer, new, x_swap, y_swap);


+ 17
- 8
usr.bin/top/machine.c Bestand weergeven

@@ -150,6 +150,7 @@ static const char *swapnames[] = {
};
static int swap_stats[nitems(swapnames)];

static int has_swap;

/* these are for keeping track of the proc array */

@@ -248,12 +249,12 @@ update_layout(void)
y_mem = 3;
y_arc = 4;
y_carc = 5;
y_swap = 4 + arc_enabled + carc_enabled;
y_idlecursor = 5 + arc_enabled + carc_enabled;
y_message = 5 + arc_enabled + carc_enabled;
y_header = 6 + arc_enabled + carc_enabled;
y_procs = 7 + arc_enabled + carc_enabled;
Header_lines = 7 + arc_enabled + carc_enabled;
y_swap = 3 + arc_enabled + carc_enabled + has_swap;
y_idlecursor = 4 + arc_enabled + carc_enabled + has_swap;
y_message = 4 + arc_enabled + carc_enabled + has_swap;
y_header = 5 + arc_enabled + carc_enabled + has_swap;
y_procs = 6 + arc_enabled + carc_enabled + has_swap;
Header_lines = 6 + arc_enabled + carc_enabled + has_swap;

if (pcpu_stats) {
y_mem += ncpus - 1;
@@ -273,7 +274,7 @@ machine_init(struct statics *statics)
{
int i, j, empty, pagesize;
uint64_t arc_size;
int carc_en;
int carc_en, nswapdev;
size_t size;

size = sizeof(smpmode);
@@ -298,6 +299,11 @@ machine_init(struct statics *statics)
if (kd == NULL)
return (-1);

size = sizeof(nswapdev);
if (sysctlbyname("vm.nswapdev", &nswapdev, &size, NULL,
0) == 0 && nswapdev != 0)
has_swap = 1;

GETSYSCTL("kern.ccpu", ccpu);

/* this is used in calculating WCPU -- calculate it ahead of time */
@@ -332,7 +338,10 @@ machine_init(struct statics *statics)
statics->carc_names = carcnames;
else
statics->carc_names = NULL;
statics->swap_names = swapnames;
if (has_swap)
statics->swap_names = swapnames;
else
statics->swap_names = NULL;
statics->order_names = ordernames;

/* Allocate state for per-CPU stats. */


Laden…
Annuleren
Opslaan