Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Apr 2023 19:09:50 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c7e5e9dc41ad - main - arm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()
Message-ID:  <202304261909.33QJ9oTK066324@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7e5e9dc41ad619c14601fe01ec749e475415fe0

commit c7e5e9dc41ad619c14601fe01ec749e475415fe0
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-12-14 20:36:47 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-04-26 19:08:30 +0000

    arm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()
    
    This was needed when intr_ipi_dispatch() was called by hardware-specific
    IPI interrupt routines which didn't save the trap frame.  Now all ARM
    interrupts pass through INTRNG which will have already saved the trap
    frame and disabled preemption.
    
    Remove the conditional trapframe/argument passing to the handlers.
    
    Reviewed by: andrew
    Differential Revision: https://reviews.freebsd.org/D37938
---
 sys/arm/arm/machdep_intr.c   |  8 +-------
 sys/arm/arm/mp_machdep.c     | 26 +-------------------------
 sys/arm64/arm64/mp_machdep.c |  8 +-------
 3 files changed, 3 insertions(+), 39 deletions(-)

diff --git a/sys/arm/arm/machdep_intr.c b/sys/arm/arm/machdep_intr.c
index cc2e67a6211e..cd92dd5f79ad 100644
--- a/sys/arm/arm/machdep_intr.c
+++ b/sys/arm/arm/machdep_intr.c
@@ -143,7 +143,6 @@ intr_ipi_lookup(u_int ipi)
 void
 intr_ipi_dispatch(u_int ipi, struct trapframe *tf)
 {
-	void *arg;
 	struct intr_ipi *ii;
 
 	ii = intr_ipi_lookup(ipi);
@@ -152,12 +151,7 @@ intr_ipi_dispatch(u_int ipi, struct trapframe *tf)
 
 	intr_ipi_increment_count(ii->ii_count, PCPU_GET(cpuid));
 
-	/*
-	 * Supply ipi filter with trapframe argument
-	 * if none is registered.
-	 */
-	arg = ii->ii_handler_arg != NULL ? ii->ii_handler_arg : tf;
-	ii->ii_handler(arg);
+	ii->ii_handler(ii->ii_handler_arg);
 }
 
 void
diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c
index 4b70869db52d..fa401ff5c6aa 100644
--- a/sys/arm/arm/mp_machdep.c
+++ b/sys/arm/arm/mp_machdep.c
@@ -282,41 +282,17 @@ ipi_stop(void *dummy __unused)
 static void
 ipi_preempt(void *arg)
 {
-	struct trapframe *oldframe;
-	struct thread *td;
-
-	critical_enter();
-	td = curthread;
-	td->td_intr_nesting_level++;
-	oldframe = td->td_intr_frame;
-	td->td_intr_frame = (struct trapframe *)arg;
 
 	CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__);
-	sched_preempt(td);
-
-	td->td_intr_frame = oldframe;
-	td->td_intr_nesting_level--;
-	critical_exit();
+	sched_preempt(curthread);
 }
 
 static void
 ipi_hardclock(void *arg)
 {
-	struct trapframe *oldframe;
-	struct thread *td;
-
-	critical_enter();
-	td = curthread;
-	td->td_intr_nesting_level++;
-	oldframe = td->td_intr_frame;
-	td->td_intr_frame = (struct trapframe *)arg;
 
 	CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__);
 	hardclockintr();
-
-	td->td_intr_frame = oldframe;
-	td->td_intr_nesting_level--;
-	critical_exit();
 }
 
 static void
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index 24dca3b21d54..0e39b27557ea 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -917,7 +917,6 @@ intr_ipi_lookup(u_int ipi)
 void
 intr_ipi_dispatch(u_int ipi, struct trapframe *tf)
 {
-	void *arg;
 	struct intr_ipi *ii;
 
 	ii = intr_ipi_lookup(ipi);
@@ -926,12 +925,7 @@ intr_ipi_dispatch(u_int ipi, struct trapframe *tf)
 
 	intr_ipi_increment_count(ii->ii_count, PCPU_GET(cpuid));
 
-	/*
-	 * Supply ipi filter with trapframe argument
-	 * if none is registered.
-	 */
-	arg = ii->ii_handler_arg != NULL ? ii->ii_handler_arg : tf;
-	ii->ii_handler(arg);
+	ii->ii_handler(ii->ii_handler_arg);
 }
 
 #ifdef notyet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304261909.33QJ9oTK066324>