Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/pic pic: avoid pic_do_pending_ints if pic_mark_...
details: https://anonhg.NetBSD.org/src/rev/115b2056261e
branches: trunk
changeset: 952775:115b2056261e
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Feb 16 22:12:49 2021 +0000
description:
pic: avoid pic_do_pending_ints if pic_mark_pending_* has never been called
diffstat:
sys/arch/arm/pic/pic.c | 13 ++++++++-
sys/arch/arm/pic/pic_splfuncs.c | 54 +++++++++++++++++++++++++---------------
2 files changed, 45 insertions(+), 22 deletions(-)
diffs (140 lines):
diff -r 9cdda0ff875e -r 115b2056261e sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c Tue Feb 16 19:46:15 2021 +0000
+++ b/sys/arch/arm/pic/pic.c Tue Feb 16 22:12:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic.c,v 1.64 2021/02/15 16:32:07 jmcneill Exp $ */
+/* $NetBSD: pic.c,v 1.65 2021/02/16 22:12:49 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,7 +33,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.64 2021/02/15 16:32:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.65 2021/02/16 22:12:49 jmcneill Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -59,6 +59,9 @@
#include <arm/pic/picvar.h>
#if defined(__HAVE_PIC_PENDING_INTRS)
+
+bool pic_pending_used __read_mostly = false;
+
/*
* This implementation of pending interrupts on a MULTIPROCESSOR system makes
* the assumption that a PIC (pic_softc) shall only have all its interrupts
@@ -279,6 +282,9 @@
{
const uint32_t ipl_mask = __BIT(is->is_ipl);
+ if (!pic_pending_used)
+ pic_pending_used = true;
+
atomic_or_32(&pic->pic_pending_irqs[is->is_irq >> 5],
__BIT(is->is_irq & 0x1f));
@@ -309,6 +315,9 @@
volatile uint32_t *ipending = &pic->pic_pending_irqs[irq_base >> 5];
uint32_t ipl_mask = 0;
+ if (!pic_pending_used)
+ pic_pending_used = true;
+
if (pending == 0)
return ipl_mask;
diff -r 9cdda0ff875e -r 115b2056261e sys/arch/arm/pic/pic_splfuncs.c
--- a/sys/arch/arm/pic/pic_splfuncs.c Tue Feb 16 19:46:15 2021 +0000
+++ b/sys/arch/arm/pic/pic_splfuncs.c Tue Feb 16 22:12:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_splfuncs.c,v 1.12 2021/02/15 16:32:07 jmcneill Exp $ */
+/* $NetBSD: pic_splfuncs.c,v 1.13 2021/02/16 22:12:50 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.12 2021/02/15 16:32:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.13 2021/02/16 22:12:50 jmcneill Exp $");
#define _INTR_PRIVATE
#include <sys/param.h>
@@ -46,6 +46,11 @@
#include <arm/pic/picvar.h>
+#if defined(__HAVE_PIC_PENDING_INTRS)
+extern bool pic_pending_used;
+#else
+#define pic_pending_used false
+#endif
int
_splraise(int newipl)
@@ -65,12 +70,16 @@
const int oldipl = ci->ci_cpl;
KASSERT(panicstr || newipl <= ci->ci_cpl);
if (newipl < ci->ci_cpl) {
- register_t psw = cpsid(I32_bit);
- ci->ci_intr_depth++;
- pic_do_pending_ints(psw, newipl, NULL);
- ci->ci_intr_depth--;
- if ((psw & I32_bit) == 0 || newipl == IPL_NONE)
- cpsie(I32_bit);
+ if (__predict_false(pic_pending_used)) {
+ register_t psw = cpsid(I32_bit);
+ ci->ci_intr_depth++;
+ pic_do_pending_ints(psw, newipl, NULL);
+ ci->ci_intr_depth--;
+ if ((psw & I32_bit) == 0 || newipl == IPL_NONE)
+ cpsie(I32_bit);
+ } else {
+ pic_set_priority(ci, newipl);
+ }
cpu_dosoftints();
}
return oldipl;
@@ -86,21 +95,26 @@
return;
}
- register_t psw = cpsid(I32_bit);
- KASSERTMSG(panicstr != NULL || savedipl < ci->ci_cpl,
- "splx(%d) to a higher ipl than %d", savedipl, ci->ci_cpl);
+ if (__predict_false(pic_pending_used)) {
+ register_t psw = cpsid(I32_bit);
+ KASSERTMSG(panicstr != NULL || savedipl < ci->ci_cpl,
+ "splx(%d) to a higher ipl than %d", savedipl, ci->ci_cpl);
- if ((psw & I32_bit) == 0) {
- ci->ci_intr_depth++;
- pic_do_pending_ints(psw, savedipl, NULL);
- ci->ci_intr_depth--;
- KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
- ci->ci_cpl, savedipl);
+ if ((psw & I32_bit) == 0) {
+ ci->ci_intr_depth++;
+ pic_do_pending_ints(psw, savedipl, NULL);
+ ci->ci_intr_depth--;
+ KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
+ ci->ci_cpl, savedipl);
- cpsie(I32_bit);
+ cpsie(I32_bit);
+ cpu_dosoftints();
+ } else {
+ pic_set_priority_psw(ci, psw, savedipl);
+ }
+ } else {
+ pic_set_priority(ci, savedipl);
cpu_dosoftints();
- } else {
- pic_set_priority_psw(ci, psw, savedipl);
}
KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
Home |
Main Index |
Thread Index |
Old Index