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: reduce the number of daif accesses in ...



details:   https://anonhg.NetBSD.org/src/rev/a2aa6e56e9e7
branches:  trunk
changeset: 1018732:a2aa6e56e9e7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Feb 15 13:03:52 2021 +0000

description:
pic: reduce the number of daif accesses in pic_do_pending_ints

The caller has already provided daif state. No need to keep updating
daif via pic_set_priority if it's already in the state we need (interrupts
disabled).

diffstat:

 sys/arch/arm/pic/pic.c |  25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 52fdafe0f1d3 -r a2aa6e56e9e7 sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Mon Feb 15 10:13:45 2021 +0000
+++ b/sys/arch/arm/pic/pic.c    Mon Feb 15 13:03:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic.c,v 1.62 2021/02/07 21:18:37 jmcneill Exp $        */
+/*     $NetBSD: pic.c,v 1.63 2021/02/15 13:03:52 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.62 2021/02/07 21:18:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.63 2021/02/15 13:03:52 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -129,6 +129,21 @@
        if ((psw & I32_bit) == 0)
                cpsie(I32_bit);
 }
+
+static void
+pic_set_priority_psw(struct cpu_info *ci, register_t psw, int newipl)
+{
+       if ((psw & I32_bit) == 0) {
+               DISABLE_INTERRUPT();
+       }
+       if (pic_list[0] != NULL) {
+               (pic_list[0]->pic_ops->pic_set_priority)(pic_list[0], newipl);
+       }
+       ci->ci_cpl = newipl;
+       if ((psw & I32_bit) == 0) {
+               ENABLE_INTERRUPT();
+       }
+}
 #endif
 
 #ifdef MULTIPROCESSOR
@@ -573,7 +588,7 @@
                        if (ipl <= newipl)
                                break;
 
-                       pic_set_priority(ci, ipl);
+                       pic_set_priority_psw(ci, psw, ipl);
                        pic_list_deliver_irqs(pend, psw, ipl, frame);
                        pic_list_unblock_irqs(pend);
                }
@@ -582,12 +597,12 @@
 #endif /* __HAVE_PIC_PENDING_INTRS */
 #ifdef __HAVE_PREEMPTION
        if (newipl == IPL_NONE && (ci->ci_astpending & __BIT(1))) {
-               pic_set_priority(ci, IPL_SCHED);
+               pic_set_priority_psw(ci, psw, IPL_SCHED);
                kpreempt(0);
        }
 #endif
        if (ci->ci_cpl != newipl)
-               pic_set_priority(ci, newipl);
+               pic_set_priority_psw(ci, psw, newipl);
 }
 
 static void



Home | Main Index | Thread Index | Old Index