Do not allow disabling interrupts on the primary CPU. Fixes PR kern/45117.
This commit is contained in:
parent
ed7ad91bbf
commit
0a95079b4a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_cpu.c,v 1.91 2020/05/28 20:29:18 ad Exp $ */
|
||||
/* $NetBSD: kern_cpu.c,v 1.92 2020/07/13 13:16:07 jruoho Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019 The NetBSD Foundation, Inc.
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.91 2020/05/28 20:29:18 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.92 2020/07/13 13:16:07 jruoho Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_cpu_ucode.h"
|
||||
@ -212,7 +212,9 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
|
||||
error = ESRCH;
|
||||
break;
|
||||
}
|
||||
cpu_setintr(ci, cs->cs_intr);
|
||||
error = cpu_setintr(ci, cs->cs_intr);
|
||||
if (error)
|
||||
break;
|
||||
error = cpu_setstate(ci, cs->cs_online);
|
||||
break;
|
||||
|
||||
@ -490,6 +492,8 @@ cpu_setintr(struct cpu_info *ci, bool intr)
|
||||
return 0;
|
||||
func = (xcfunc_t)cpu_xc_intr;
|
||||
} else {
|
||||
if (CPU_IS_PRIMARY(ci))
|
||||
return EINVAL;
|
||||
if ((spc->spc_flags & SPCF_NOINTR) != 0)
|
||||
return 0;
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: t_cpuctl.sh,v 1.3 2020/06/25 15:43:26 jruoho Exp $
|
||||
# $NetBSD: t_cpuctl.sh,v 1.4 2020/07/13 13:16:07 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2020 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@ -37,9 +37,6 @@ setcpu() {
|
||||
atf_pass
|
||||
fi
|
||||
|
||||
# Skip the boot processor. Disabling interrupts
|
||||
# on it will hang the system (PR kern/45117).
|
||||
#
|
||||
while [ $ncpu -gt 1 ]; do
|
||||
|
||||
cpuid=$(expr $ncpu - 1)
|
||||
@ -51,6 +48,15 @@ setcpu() {
|
||||
|
||||
ncpu=$(expr $ncpu - 1)
|
||||
done
|
||||
|
||||
# Additional check that interrupts cannot be
|
||||
# disabled for the primary CPU (PR kern/45117).
|
||||
#
|
||||
cpuctl nointr 0 >/dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
$2 $3
|
||||
fi
|
||||
}
|
||||
|
||||
clean() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user