sync code with last improvements from OpenBSD
This commit is contained in:
parent
0c904fa153
commit
cac1167ac2
64 changed files with 491 additions and 319 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vmm_machdep.c,v 1.7 2023/09/05 14:00:40 mlarkin Exp $ */
|
||||
/* $OpenBSD: vmm_machdep.c,v 1.8 2023/09/06 03:35:57 dv Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
|
||||
*
|
||||
|
@ -3973,6 +3973,11 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
|
|||
*/
|
||||
irq = vrp->vrp_irq;
|
||||
|
||||
if (vrp->vrp_intr_pending)
|
||||
vcpu->vc_intr = 1;
|
||||
else
|
||||
vcpu->vc_intr = 0;
|
||||
|
||||
if (vrp->vrp_continue) {
|
||||
switch (vcpu->vc_gueststate.vg_exit_reason) {
|
||||
case VMX_EXIT_IO:
|
||||
|
@ -6381,6 +6386,11 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
|
|||
|
||||
irq = vrp->vrp_irq;
|
||||
|
||||
if (vrp->vrp_intr_pending)
|
||||
vcpu->vc_intr = 1;
|
||||
else
|
||||
vcpu->vc_intr = 0;
|
||||
|
||||
/*
|
||||
* If we are returning from userspace (vmd) because we exited
|
||||
* last time, fix up any needed vcpu state first. Which state
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.amd64,v 1.133 2023/07/31 04:01:07 guenther Exp $
|
||||
# $OpenBSD: Makefile.amd64,v 1.134 2023/09/06 01:47:36 jsg Exp $
|
||||
|
||||
# For instructions on building kernels consult the config(8) and options(4)
|
||||
# manual pages.
|
||||
|
@ -78,9 +78,6 @@ CMACHFLAGS+= -mretpoline-external-thunk -fcf-protection=branch
|
|||
NO_INTEGR_AS= -no-integrated-as
|
||||
CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \
|
||||
-Wno-unused-but-set-variable -Wno-gnu-folding-constant
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
.endif
|
||||
|
||||
DEBUG?= -g
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vmmvar.h,v 1.93 2023/09/05 14:00:41 mlarkin Exp $ */
|
||||
/* $OpenBSD: vmmvar.h,v 1.94 2023/09/06 03:35:57 dv Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
|
||||
*
|
||||
|
@ -456,6 +456,7 @@ struct vm_run_params {
|
|||
uint32_t vrp_vcpu_id;
|
||||
uint8_t vrp_continue; /* Continuing from an exit */
|
||||
uint16_t vrp_irq; /* IRQ to inject */
|
||||
uint8_t vrp_intr_pending; /* Additional intrs pending? */
|
||||
|
||||
/* Input/output parameter to VMM_IOC_RUN */
|
||||
struct vm_exit *vrp_exit; /* updated exit data */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.inc,v 1.21 2023/02/23 19:48:21 miod Exp $
|
||||
# $OpenBSD: Makefile.inc,v 1.22 2023/09/06 01:47:36 jsg Exp $
|
||||
|
||||
CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror
|
||||
CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY
|
||||
|
@ -25,9 +25,6 @@ SACFLAGS+=-nostdinc -fno-builtin -fpack-struct
|
|||
|
||||
.include <bsd.own.mk>
|
||||
.if ${COMPILER_VERSION:Mclang}
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
NO_INTEGR_AS= -no-integrated-as
|
||||
.endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.arm64,v 1.46 2023/04/09 19:48:37 kettenis Exp $
|
||||
# $OpenBSD: Makefile.arm64,v 1.47 2023/09/06 01:47:36 jsg Exp $
|
||||
|
||||
# For instructions on building kernels consult the config(8) and options(4)
|
||||
# manual pages.
|
||||
|
@ -55,9 +55,6 @@ CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
|
|||
-Wno-constant-conversion -Wno-address-of-packed-member \
|
||||
-Wno-unused-but-set-variable -Wno-gnu-folding-constant \
|
||||
-Wframe-larger-than=2047
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
|
||||
CMACHFLAGS= -march=armv8-a+nofp+nosimd \
|
||||
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.20 2023/03/05 16:21:52 kettenis Exp $
|
||||
# $OpenBSD: Makefile,v 1.21 2023/09/06 01:47:36 jsg Exp $
|
||||
|
||||
NOMAN= #
|
||||
|
||||
|
@ -53,9 +53,6 @@ COPTS+= -Wno-attributes -Wno-format
|
|||
COPTS+= -ffreestanding -fno-stack-protector
|
||||
COPTS+= -fshort-wchar -fPIC -fno-builtin
|
||||
COPTS+= -Wall -Werror
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
COPTS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
|
||||
PROG.elf= ${PROG:S/.EFI/.elf/}
|
||||
CLEANFILES+= ${PROG.elf} ${PROG.elf}.tmp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.armv7,v 1.53 2022/12/30 06:44:35 jca Exp $
|
||||
# $OpenBSD: Makefile.armv7,v 1.54 2023/09/06 01:47:36 jsg Exp $
|
||||
|
||||
# For instructions on building kernels consult the config(8) and options(4)
|
||||
# manual pages.
|
||||
|
@ -28,9 +28,6 @@ CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
|
|||
-Wno-constant-conversion -Wno-address-of-packed-member \
|
||||
-Wno-unused-but-set-variable -Wno-gnu-folding-constant \
|
||||
-Wframe-larger-than=2047
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
|
||||
CMACHFLAGS= -msoft-float -march=armv7a
|
||||
CMACHFLAGS+= -ffreestanding ${NOPIE_FLAGS}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.19 2023/02/23 19:48:22 miod Exp $
|
||||
# $OpenBSD: Makefile,v 1.20 2023/09/06 01:47:37 jsg Exp $
|
||||
|
||||
NOMAN= #
|
||||
|
||||
|
@ -51,9 +51,6 @@ COPTS+= -ffreestanding -fno-stack-protector
|
|||
COPTS+= -fshort-wchar -fPIC -fno-builtin
|
||||
COPTS+= -Wall -Werror
|
||||
COPTS+= -mfloat-abi=soft
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
COPTS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
|
||||
PROG.elf= ${PROG:S/.EFI/.elf/}
|
||||
CLEANFILES+= ${PROG.elf} ${PROG.elf}.tmp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.i386,v 1.143 2022/12/30 06:44:36 jca Exp $
|
||||
# $OpenBSD: Makefile.i386,v 1.144 2023/09/06 01:47:37 jsg Exp $
|
||||
|
||||
# For instructions on building kernels consult the config(8) and options(4)
|
||||
# manual pages.
|
||||
|
@ -46,9 +46,6 @@ CMACHFLAGS+= -mretpoline
|
|||
NO_INTEGR_AS= -no-integrated-as
|
||||
CWARNFLAGS+= -Wno-address-of-packed-member -Wno-constant-conversion \
|
||||
-Wno-unused-but-set-variable -Wno-gnu-folding-constant
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CWARNFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
.endif
|
||||
|
||||
DEBUG?= -g
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.inc,v 1.54 2023/02/23 19:48:22 miod Exp $
|
||||
# $OpenBSD: Makefile.inc,v 1.55 2023/09/06 01:47:37 jsg Exp $
|
||||
|
||||
CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror
|
||||
CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY
|
||||
|
@ -25,9 +25,6 @@ SACFLAGS+=-nostdinc -fno-builtin -fpack-struct
|
|||
|
||||
.include <bsd.own.mk>
|
||||
.if ${COMPILER_VERSION:Mclang}
|
||||
# XXX Workaround for zlib + clang 15
|
||||
# https://github.com/madler/zlib/issues/633
|
||||
CFLAGS+= -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||
NO_INTEGR_AS= -no-integrated-as
|
||||
.endif
|
||||
|
||||
|
|
|
@ -216,6 +216,8 @@ static const struct pci_matchid amdgpu_devices[] = {
|
|||
{0x1002, 0x7483 }, /* Radeon RX 7600M */
|
||||
{0x1002, 0x7489 }, /* Radeon Pro W7500 */
|
||||
|
||||
/* GC 11.0.3, DCN 3.2.0, dGPU */
|
||||
/* GC 11.0.3, DCN 3.2.0, dGPU, "Navi 32" */
|
||||
{0x1002, 0x747e }, /* Radeon RX 7700 XT, 7800 XT */
|
||||
|
||||
/* GC 11.0.4, DCN 3.1.4, APU */
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp $
|
||||
$OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp $
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -2102,6 +2102,7 @@ product ATI BEIGE_GOBY_6 0x743f Navi 24
|
|||
product ATI NAVI31_2 0x7448 Navi 31
|
||||
product ATI NAVI31_1 0x744c Navi 31
|
||||
product ATI NAVI31_3 0x745e Navi 31
|
||||
product ATI NAVI32_1 0x747e Navi 32
|
||||
product ATI NAVI33_1 0x7480 Navi 33
|
||||
product ATI NAVI33_2 0x7483 Navi 33
|
||||
product ATI NAVI33_3 0x7489 Navi 33
|
||||
|
@ -4566,6 +4567,7 @@ product INTEL WL_8265_1 0x24fd Dual Band Wireless-AC 8265
|
|||
product INTEL 82820_HB 0x2501 82820 Host
|
||||
product INTEL 82820_AGP 0x250f 82820 AGP
|
||||
product INTEL OPTANE 0x2522 Optane
|
||||
product INTEL P1600X 0x2525 P1600X
|
||||
product INTEL WL_9260_1 0x2526 Dual Band Wireless-AC 9260
|
||||
product INTEL 82850_HB 0x2530 82850 Host
|
||||
product INTEL 82860_HB 0x2531 82860 Host
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*
|
||||
* generated from:
|
||||
* OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp
|
||||
* OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp
|
||||
*/
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
||||
|
@ -2107,6 +2107,7 @@
|
|||
#define PCI_PRODUCT_ATI_NAVI31_2 0x7448 /* Navi 31 */
|
||||
#define PCI_PRODUCT_ATI_NAVI31_1 0x744c /* Navi 31 */
|
||||
#define PCI_PRODUCT_ATI_NAVI31_3 0x745e /* Navi 31 */
|
||||
#define PCI_PRODUCT_ATI_NAVI32_1 0x747e /* Navi 32 */
|
||||
#define PCI_PRODUCT_ATI_NAVI33_1 0x7480 /* Navi 33 */
|
||||
#define PCI_PRODUCT_ATI_NAVI33_2 0x7483 /* Navi 33 */
|
||||
#define PCI_PRODUCT_ATI_NAVI33_3 0x7489 /* Navi 33 */
|
||||
|
@ -4571,6 +4572,7 @@
|
|||
#define PCI_PRODUCT_INTEL_82820_HB 0x2501 /* 82820 Host */
|
||||
#define PCI_PRODUCT_INTEL_82820_AGP 0x250f /* 82820 AGP */
|
||||
#define PCI_PRODUCT_INTEL_OPTANE 0x2522 /* Optane */
|
||||
#define PCI_PRODUCT_INTEL_P1600X 0x2525 /* P1600X */
|
||||
#define PCI_PRODUCT_INTEL_WL_9260_1 0x2526 /* Dual Band Wireless-AC 9260 */
|
||||
#define PCI_PRODUCT_INTEL_82850_HB 0x2530 /* 82850 Host */
|
||||
#define PCI_PRODUCT_INTEL_82860_HB 0x2531 /* 82860 Host */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
*
|
||||
* generated from:
|
||||
* OpenBSD: pcidevs,v 1.2046 2023/08/30 07:11:48 kevlo Exp
|
||||
* OpenBSD: pcidevs,v 1.2048 2023/09/06 23:47:14 jsg Exp
|
||||
*/
|
||||
|
||||
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
|
||||
|
@ -6547,6 +6547,10 @@ static const struct pci_known_product pci_known_products[] = {
|
|||
PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI31_3,
|
||||
"Navi 31",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI32_1,
|
||||
"Navi 32",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_ATI, PCI_PRODUCT_ATI_NAVI33_1,
|
||||
"Navi 33",
|
||||
|
@ -15623,6 +15627,10 @@ static const struct pci_known_product pci_known_products[] = {
|
|||
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_OPTANE,
|
||||
"Optane",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_P1600X,
|
||||
"P1600X",
|
||||
},
|
||||
{
|
||||
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_WL_9260_1,
|
||||
"Dual Band Wireless-AC 9260",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_clockintr.c,v 1.33 2023/08/26 22:21:00 cheloha Exp $ */
|
||||
/* $OpenBSD: kern_clockintr.c,v 1.38 2023/09/06 02:33:18 cheloha Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
|
||||
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
|
@ -36,16 +36,15 @@
|
|||
*
|
||||
* I Immutable after initialization.
|
||||
*/
|
||||
u_int clockintr_flags; /* [I] global state + behavior flags */
|
||||
uint32_t clockintr_flags; /* [I] global state + behavior flags */
|
||||
uint32_t hardclock_period; /* [I] hardclock period (ns) */
|
||||
uint32_t statclock_avg; /* [I] average statclock period (ns) */
|
||||
uint32_t statclock_min; /* [I] minimum statclock period (ns) */
|
||||
uint32_t statclock_mask; /* [I] set of allowed offsets */
|
||||
|
||||
uint64_t clockintr_advance_random(struct clockintr *, uint64_t, uint32_t);
|
||||
void clockintr_cancel_locked(struct clockintr *);
|
||||
uint64_t clockintr_expiration(const struct clockintr *);
|
||||
void clockintr_hardclock(struct clockintr *, void *);
|
||||
uint64_t clockintr_nsecuptime(const struct clockintr *);
|
||||
void clockintr_schedule(struct clockintr *, uint64_t);
|
||||
void clockintr_schedule_locked(struct clockintr *, uint64_t);
|
||||
void clockintr_statclock(struct clockintr *, void *);
|
||||
|
@ -59,7 +58,7 @@ uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t);
|
|||
* Initialize global state. Set flags and compute intervals.
|
||||
*/
|
||||
void
|
||||
clockintr_init(u_int flags)
|
||||
clockintr_init(uint32_t flags)
|
||||
{
|
||||
uint32_t half_avg, var;
|
||||
|
||||
|
@ -113,12 +112,12 @@ clockintr_cpu_init(const struct intrclock *ic)
|
|||
|
||||
/* TODO: Remove these from struct clockintr_queue. */
|
||||
if (cq->cq_hardclock == NULL) {
|
||||
cq->cq_hardclock = clockintr_establish(cq, clockintr_hardclock);
|
||||
cq->cq_hardclock = clockintr_establish(ci, clockintr_hardclock);
|
||||
if (cq->cq_hardclock == NULL)
|
||||
panic("%s: failed to establish hardclock", __func__);
|
||||
}
|
||||
if (cq->cq_statclock == NULL) {
|
||||
cq->cq_statclock = clockintr_establish(cq, clockintr_statclock);
|
||||
cq->cq_statclock = clockintr_establish(ci, clockintr_statclock);
|
||||
if (cq->cq_statclock == NULL)
|
||||
panic("%s: failed to establish statclock", __func__);
|
||||
}
|
||||
|
@ -220,7 +219,7 @@ clockintr_dispatch(void *frame)
|
|||
struct cpu_info *ci = curcpu();
|
||||
struct clockintr *cl;
|
||||
struct clockintr_queue *cq = &ci->ci_queue;
|
||||
u_int ogen;
|
||||
uint32_t ogen;
|
||||
|
||||
if (cq->cq_dispatch != 0)
|
||||
panic("%s: recursive dispatch", __func__);
|
||||
|
@ -345,6 +344,25 @@ clockintr_advance(struct clockintr *cl, uint64_t period)
|
|||
return count;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
clockintr_advance_random(struct clockintr *cl, uint64_t min, uint32_t mask)
|
||||
{
|
||||
uint64_t count = 0;
|
||||
struct clockintr_queue *cq = cl->cl_queue;
|
||||
uint32_t off;
|
||||
|
||||
KASSERT(cl == &cq->cq_shadow);
|
||||
|
||||
while (cl->cl_expiration <= cq->cq_uptime) {
|
||||
while ((off = (random() & mask)) == 0)
|
||||
continue;
|
||||
cl->cl_expiration += min + off;
|
||||
count++;
|
||||
}
|
||||
SET(cl->cl_flags, CLST_SHADOW_PENDING);
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
clockintr_cancel(struct clockintr *cl)
|
||||
{
|
||||
|
@ -385,10 +403,11 @@ clockintr_cancel_locked(struct clockintr *cl)
|
|||
}
|
||||
|
||||
struct clockintr *
|
||||
clockintr_establish(struct clockintr_queue *cq,
|
||||
clockintr_establish(struct cpu_info *ci,
|
||||
void (*func)(struct clockintr *, void *))
|
||||
{
|
||||
struct clockintr *cl;
|
||||
struct clockintr_queue *cq = &ci->ci_queue;
|
||||
|
||||
cl = malloc(sizeof *cl, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (cl == NULL)
|
||||
|
@ -402,21 +421,6 @@ clockintr_establish(struct clockintr_queue *cq,
|
|||
return cl;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
clockintr_expiration(const struct clockintr *cl)
|
||||
{
|
||||
uint64_t expiration;
|
||||
struct clockintr_queue *cq = cl->cl_queue;
|
||||
|
||||
if (cl == &cq->cq_shadow)
|
||||
return cl->cl_expiration;
|
||||
|
||||
mtx_enter(&cq->cq_mtx);
|
||||
expiration = cl->cl_expiration;
|
||||
mtx_leave(&cq->cq_mtx);
|
||||
return expiration;
|
||||
}
|
||||
|
||||
void
|
||||
clockintr_schedule(struct clockintr *cl, uint64_t expiration)
|
||||
{
|
||||
|
@ -465,7 +469,8 @@ clockintr_schedule_locked(struct clockintr *cl, uint64_t expiration)
|
|||
}
|
||||
|
||||
void
|
||||
clockintr_stagger(struct clockintr *cl, uint64_t period, u_int n, u_int count)
|
||||
clockintr_stagger(struct clockintr *cl, uint64_t period, uint32_t n,
|
||||
uint32_t count)
|
||||
{
|
||||
struct clockintr_queue *cq = cl->cl_queue;
|
||||
|
||||
|
@ -478,13 +483,6 @@ clockintr_stagger(struct clockintr *cl, uint64_t period, u_int n, u_int count)
|
|||
mtx_leave(&cq->cq_mtx);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
clockintr_nsecuptime(const struct clockintr *cl)
|
||||
{
|
||||
KASSERT(cl == &cl->cl_queue->cq_shadow);
|
||||
return cl->cl_queue->cq_uptime;
|
||||
}
|
||||
|
||||
void
|
||||
clockintr_hardclock(struct clockintr *cl, void *frame)
|
||||
{
|
||||
|
@ -498,20 +496,11 @@ clockintr_hardclock(struct clockintr *cl, void *frame)
|
|||
void
|
||||
clockintr_statclock(struct clockintr *cl, void *frame)
|
||||
{
|
||||
uint64_t count, expiration, i, uptime;
|
||||
uint32_t off;
|
||||
uint64_t count, i;
|
||||
|
||||
if (ISSET(clockintr_flags, CL_RNDSTAT)) {
|
||||
count = 0;
|
||||
expiration = clockintr_expiration(cl);
|
||||
uptime = clockintr_nsecuptime(cl);
|
||||
while (expiration <= uptime) {
|
||||
while ((off = (random() & statclock_mask)) == 0)
|
||||
continue;
|
||||
expiration += statclock_min + off;
|
||||
count++;
|
||||
}
|
||||
clockintr_schedule(cl, expiration);
|
||||
count = clockintr_advance_random(cl, statclock_min,
|
||||
statclock_mask);
|
||||
} else {
|
||||
count = clockintr_advance(cl, statclock_avg);
|
||||
}
|
||||
|
@ -601,7 +590,7 @@ sysctl_clockintr(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
|||
struct clockintr_queue *cq;
|
||||
struct cpu_info *ci;
|
||||
CPU_INFO_ITERATOR cii;
|
||||
u_int gen;
|
||||
uint32_t gen;
|
||||
|
||||
if (namelen != 1)
|
||||
return ENOTDIR;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: kern_sched.c,v 1.88 2023/08/31 19:29:51 cheloha Exp $ */
|
||||
/* $OpenBSD: kern_sched.c,v 1.89 2023/09/06 02:09:58 cheloha Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
|
||||
*
|
||||
|
@ -88,13 +88,13 @@ sched_init_cpu(struct cpu_info *ci)
|
|||
|
||||
spc->spc_idleproc = NULL;
|
||||
|
||||
spc->spc_itimer = clockintr_establish(&ci->ci_queue, itimer_update);
|
||||
spc->spc_itimer = clockintr_establish(ci, itimer_update);
|
||||
if (spc->spc_itimer == NULL)
|
||||
panic("%s: clockintr_establish itimer_update", __func__);
|
||||
spc->spc_profclock = clockintr_establish(&ci->ci_queue, profclock);
|
||||
spc->spc_profclock = clockintr_establish(ci, profclock);
|
||||
if (spc->spc_profclock == NULL)
|
||||
panic("%s: clockintr_establish profclock", __func__);
|
||||
spc->spc_roundrobin = clockintr_establish(&ci->ci_queue, roundrobin);
|
||||
spc->spc_roundrobin = clockintr_establish(ci, roundrobin);
|
||||
if (spc->spc_roundrobin == NULL)
|
||||
panic("%s: clockintr_establish roundrobin", __func__);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: subr_prof.c,v 1.36 2023/07/25 18:16:19 cheloha Exp $ */
|
||||
/* $OpenBSD: subr_prof.c,v 1.37 2023/09/06 02:09:58 cheloha Exp $ */
|
||||
/* $NetBSD: subr_prof.c,v 1.12 1996/04/22 01:38:50 christos Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -101,8 +101,7 @@ prof_init(void)
|
|||
|
||||
/* Allocate and initialize one profiling buffer per CPU. */
|
||||
CPU_INFO_FOREACH(cii, ci) {
|
||||
ci->ci_gmonclock = clockintr_establish(&ci->ci_queue,
|
||||
gmonclock);
|
||||
ci->ci_gmonclock = clockintr_establish(ci, gmonclock);
|
||||
if (ci->ci_gmonclock == NULL) {
|
||||
printf("%s: clockintr_establish gmonclock\n", __func__);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip_input.c,v 1.385 2023/05/18 09:59:43 mvs Exp $ */
|
||||
/* $OpenBSD: ip_input.c,v 1.386 2023/09/06 11:09:43 bluhm Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1851,7 +1851,7 @@ ip_send_do_dispatch(void *xmq, int flags)
|
|||
if (ml_empty(&ml))
|
||||
return;
|
||||
|
||||
NET_LOCK();
|
||||
NET_LOCK_SHARED();
|
||||
while ((m = ml_dequeue(&ml)) != NULL) {
|
||||
u_int32_t ipsecflowinfo = 0;
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ ip_send_do_dispatch(void *xmq, int flags)
|
|||
}
|
||||
ip_output(m, NULL, NULL, flags, NULL, NULL, ipsecflowinfo);
|
||||
}
|
||||
NET_UNLOCK();
|
||||
NET_UNLOCK_SHARED();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ip6_input.c,v 1.254 2022/08/21 14:15:55 bluhm Exp $ */
|
||||
/* $OpenBSD: ip6_input.c,v 1.255 2023/09/06 11:09:43 bluhm Exp $ */
|
||||
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1572,11 +1572,11 @@ ip6_send_dispatch(void *xmq)
|
|||
if (ml_empty(&ml))
|
||||
return;
|
||||
|
||||
NET_LOCK();
|
||||
NET_LOCK_SHARED();
|
||||
while ((m = ml_dequeue(&ml)) != NULL) {
|
||||
ip6_output(m, NULL, NULL, 0, NULL, NULL);
|
||||
}
|
||||
NET_UNLOCK();
|
||||
NET_UNLOCK_SHARED();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: clockintr.h,v 1.10 2023/08/21 17:22:04 cheloha Exp $ */
|
||||
/* $OpenBSD: clockintr.h,v 1.12 2023/09/06 02:33:18 cheloha Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020-2022 Scott Cheloha <cheloha@openbsd.org>
|
||||
*
|
||||
|
@ -72,7 +72,7 @@ struct clockintr {
|
|||
TAILQ_ENTRY(clockintr) cl_plink; /* [m] cq_pend glue */
|
||||
void (*cl_func)(struct clockintr *, void *); /* [I] callback */
|
||||
struct clockintr_queue *cl_queue; /* [I] parent queue */
|
||||
u_int cl_flags; /* [m] CLST_* flags */
|
||||
uint32_t cl_flags; /* [m] CLST_* flags */
|
||||
};
|
||||
|
||||
#define CLST_PENDING 0x00000001 /* scheduled to run */
|
||||
|
@ -100,9 +100,9 @@ struct clockintr_queue {
|
|||
struct clockintr *cq_statclock; /* [o] statclock handle */
|
||||
struct intrclock cq_intrclock; /* [I] local interrupt clock */
|
||||
struct clockintr_stat cq_stat; /* [o] dispatch statistics */
|
||||
volatile u_int cq_gen; /* [o] cq_stat update generation */
|
||||
volatile u_int cq_dispatch; /* [o] dispatch is running */
|
||||
u_int cq_flags; /* [I] CQ_* flags; see below */
|
||||
volatile uint32_t cq_gen; /* [o] cq_stat update generation */
|
||||
volatile uint32_t cq_dispatch; /* [o] dispatch is running */
|
||||
uint32_t cq_flags; /* [I] CQ_* flags; see below */
|
||||
};
|
||||
|
||||
#define CQ_INIT 0x00000001 /* clockintr_cpu_init() done */
|
||||
|
@ -119,7 +119,7 @@ struct clockintr_queue {
|
|||
|
||||
void clockintr_cpu_init(const struct intrclock *);
|
||||
int clockintr_dispatch(void *);
|
||||
void clockintr_init(u_int);
|
||||
void clockintr_init(uint32_t);
|
||||
void clockintr_trigger(void);
|
||||
|
||||
/*
|
||||
|
@ -128,9 +128,9 @@ void clockintr_trigger(void);
|
|||
|
||||
uint64_t clockintr_advance(struct clockintr *, uint64_t);
|
||||
void clockintr_cancel(struct clockintr *);
|
||||
struct clockintr *clockintr_establish(struct clockintr_queue *,
|
||||
struct clockintr *clockintr_establish(struct cpu_info *,
|
||||
void (*)(struct clockintr *, void *));
|
||||
void clockintr_stagger(struct clockintr *, uint64_t, u_int, u_int);
|
||||
void clockintr_stagger(struct clockintr *, uint64_t, uint32_t, uint32_t);
|
||||
void clockqueue_init(struct clockintr_queue *);
|
||||
int sysctl_clockintr(int *, u_int, void *, size_t *, void *, size_t);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue