Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern entropy(9): Call entropy_softintr while bound to CPU.
details: https://anonhg.NetBSD.org/src/rev/122a7a91a27c
branches: trunk
changeset: 364433:122a7a91a27c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 24 12:58:56 2022 +0000
description:
entropy(9): Call entropy_softintr while bound to CPU.
It looks like We tripped on the new assertion in entropy_account_cpu
when there was pending entropy on cpu0 running lwp0 when xc_broadcast
ran -- since xc_broadcast calls the function directly rather than
calling it through softint_schedule, it's not called via the softint
lwp which would satisfy the assertion.
diffstat:
sys/kern/kern_entropy.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r a9b566a8576b -r 122a7a91a27c sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c Thu Mar 24 12:12:00 2022 +0000
+++ b/sys/kern/kern_entropy.c Thu Mar 24 12:58:56 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_entropy.c,v 1.53 2022/03/23 23:20:52 riastradh Exp $ */
+/* $NetBSD: kern_entropy.c,v 1.54 2022/03/24 12:58:56 riastradh Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.53 2022/03/23 23:20:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.54 2022/03/24 12:58:56 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -413,8 +413,20 @@
static void
entropy_init_late_cpu(void *a, void *b)
{
+ int bound;
+ /*
+ * We're not necessarily in a softint lwp here (xc_broadcast
+ * triggers softint on other CPUs, but calls directly on this
+ * CPU), so explicitly bind to the current CPU to invoke the
+ * softintr -- this lets us have a simpler assertion in
+ * entropy_account_cpu. Not necessary to avoid migration
+ * because xc_broadcast disables kpreemption anyway, but it
+ * doesn't hurt.
+ */
+ bound = curlwp_bind();
entropy_softintr(NULL);
+ curlwp_bindx(bound);
}
/*
Home |
Main Index |
Thread Index |
Old Index