While cleaning up the various places in trap handling code where IRQs
are enabled, I noticed we were enabling it before calling
proc_destroy().

Thanks to git-blame and a good commit message, it turns out that we
don't need this any more (and haven't for quite a while).  This was
originally done in commit 850e1a46dbe8 ("Ensures IRQs are enabled when
proc_destroy()ing"), and this commit mostly undoes that commit.

Signed-off-by: Barret Rhoden <[email protected]>
---
 kern/arch/riscv/trap.c |  1 -
 kern/arch/x86/trap.c   |  1 -
 kern/src/manager.c     |  1 -
 kern/src/monitor.c     | 10 +---------
 kern/src/process.c     |  5 +----
 kern/src/syscall.c     |  1 -
 kern/src/trap.c        |  1 -
 7 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/kern/arch/riscv/trap.c b/kern/arch/riscv/trap.c
index 9a115eb8533e..6141ae23c8bb 100644
--- a/kern/arch/riscv/trap.c
+++ b/kern/arch/riscv/trap.c
@@ -182,7 +182,6 @@ unhandled_trap(struct hw_trapframe *state, const char* name)
                spin_unlock(&screwup_lock);
 
                assert(current);
-               enable_irq();
                proc_destroy(current);
        }
 }
diff --git a/kern/arch/x86/trap.c b/kern/arch/x86/trap.c
index 6326290e8392..01abe923b6fc 100644
--- a/kern/arch/x86/trap.c
+++ b/kern/arch/x86/trap.c
@@ -232,7 +232,6 @@ static void handle_fperr(struct hw_trapframe *hw_tf)
        if (fpsw & ~fpcw & FP_EXCP_PE)
                printk("\tInexact result (precision)\n");
        printk("Killing the process.\n");
-       enable_irq();
        proc_destroy(current);
 }
 
diff --git a/kern/src/manager.c b/kern/src/manager.c
index e87cc0dd428e..92f5612b39d2 100644
--- a/kern/src/manager.c
+++ b/kern/src/manager.c
@@ -181,7 +181,6 @@ void manager_brho(void)
                                spin_unlock(&p->proc_lock);
                                udelay(5000000);
                                printk("Killing p\n");
-                               enable_irq();
                                proc_destroy(p);
                                printk("Killed p\n");
                        panic("This is okay");
diff --git a/kern/src/monitor.c b/kern/src/monitor.c
index 2b2a075a9b57..33ea8dfdefe9 100644
--- a/kern/src/monitor.c
+++ b/kern/src/monitor.c
@@ -341,7 +341,6 @@ int mon_bin_run(int argc, char **argv, struct hw_trapframe 
*hw_tf)
 
 int mon_procinfo(int argc, char **argv, struct hw_trapframe *hw_tf)
 {
-       int8_t irq_state = 0;
        if (argc < 2) {
                printk("Usage: procinfo OPTION\n");
                printk("\tall: show all active pids\n");
@@ -379,9 +378,7 @@ int mon_procinfo(int argc, char **argv, struct hw_trapframe 
*hw_tf)
                        printk("No such proc\n");
                        return 1;
                }
-               enable_irqsave(&irq_state);
                proc_destroy(p);
-               disable_irqsave(&irq_state);
                proc_decref(p);
        } else {
                printk("Bad option\n");
@@ -403,7 +400,7 @@ int mon_pip(int argc, char **argv, struct hw_trapframe 
*hw_tf)
 int mon_kill(int argc, char **argv, struct hw_trapframe *hw_tf)
 {
        struct proc *p;
-       int8_t irq_state = 0;
+
        if (argc < 2) {
                printk("Usage: kill PID\n");
                return 1;
@@ -413,9 +410,7 @@ int mon_kill(int argc, char **argv, struct hw_trapframe 
*hw_tf)
                printk("No such proc\n");
                return 1;
        }
-       enable_irqsave(&irq_state);
        proc_destroy(p);
-       disable_irqsave(&irq_state);
        proc_decref(p);
        return 0;
 }
@@ -521,7 +516,6 @@ int mon_measure(int argc, char **argv, struct hw_trapframe 
*hw_tf)
 {
        uint64_t begin = 0, diff = 0;
        uint32_t end_refcnt = 0;
-       int8_t irq_state = 0;
 
        if (argc < 2) {
                printk("Usage: measure OPTION\n");
@@ -549,9 +543,7 @@ int mon_measure(int argc, char **argv, struct hw_trapframe 
*hw_tf)
                printk("Warning: this will be inaccurate due to the 
appserver.\n");
                end_refcnt = kref_refcnt(&p->p_kref) - p->procinfo->num_vcores 
- 1;
 #endif /* CONFIG_APPSERVER */
-               enable_irqsave(&irq_state);
                proc_destroy(p);
-               disable_irqsave(&irq_state);
                proc_decref(p);
 #ifdef CONFIG_APPSERVER
                /* Won't be that accurate, since it's not actually going 
through the
diff --git a/kern/src/process.c b/kern/src/process.c
index 1e7f103e3817..85de77a78594 100644
--- a/kern/src/process.c
+++ b/kern/src/process.c
@@ -807,10 +807,7 @@ void proc_destroy(struct proc *p)
        uint32_t nr_cores_revoked = 0;
        struct kthread *sleeper;
        struct proc *child_i, *temp;
-       /* Can't spin on the proc lock with irq disabled.  This is a problem 
for all
-        * places where we grab the lock, but it is particularly bad for 
destroy,
-        * since we tend to call this from trap and irq handlers */
-       assert(irq_is_enabled());
+
        spin_lock(&p->proc_lock);
        /* storage for pc_arr is alloced at decl, which is after grabbing the 
lock*/
        uint32_t pc_arr[p->procinfo->num_vcores];
diff --git a/kern/src/syscall.c b/kern/src/syscall.c
index 5677f5e72ef9..61af1a868080 100644
--- a/kern/src/syscall.c
+++ b/kern/src/syscall.c
@@ -2518,7 +2518,6 @@ void run_local_syscall(struct syscall *sysc)
 {
        struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
 
-       assert(irq_is_enabled());       /* in case we proc destroy */
        /* In lieu of pinning, we just check the sysc and will PF on the user 
addr
         * later (if the addr was unmapped).  Which is the plan for all UMEM. */
        if (!is_user_rwaddr(sysc, sizeof(struct syscall))) {
diff --git a/kern/src/trap.c b/kern/src/trap.c
index 56e5c0f01b51..e3eabfe19b85 100644
--- a/kern/src/trap.c
+++ b/kern/src/trap.c
@@ -73,7 +73,6 @@ void reflect_unhandled_trap(unsigned int trap_nr, unsigned 
int err,
        return;
 error_out:
        print_unhandled_trap(p, pcpui->cur_ctx, trap_nr, err, aux);
-       enable_irq();
        proc_destroy(p);
 }
 
-- 
2.6.0.rc2.230.g3dd15c0

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to