x86_64: charge clock cycles to threads when handling IRQs

Clock cycles that are used to handle the IRQ itself are *not*
charged to the thread.
This commit is contained in:
2023-04-28 21:06:57 +01:00
parent e2131b08ac
commit f349e4963c

View File

@@ -2,6 +2,7 @@
#include <arch/ports.h> #include <arch/ports.h>
#include <arch/acpi.h> #include <arch/acpi.h>
#include <socks/printk.h> #include <socks/printk.h>
#include <socks/sched.h>
#include <socks/libc/string.h> #include <socks/libc/string.h>
#include <socks/machine/irq.h> #include <socks/machine/irq.h>
#include <socks/machine/cpu.h> #include <socks/machine/cpu.h>
@@ -232,11 +233,15 @@ void isr_dispatch(struct cpu_context *regs)
void irq_dispatch(struct cpu_context *regs) void irq_dispatch(struct cpu_context *regs)
{ {
end_charge_period();
irq_ack(regs->int_no); irq_ack(regs->int_no);
struct queue *hooks = &irq_hooks[regs->int_no - IRQ0]; struct queue *hooks = &irq_hooks[regs->int_no - IRQ0];
queue_foreach(struct irq_hook, hook, hooks, irq_entry) { queue_foreach(struct irq_hook, hook, hooks, irq_entry) {
hook->irq_callback(); hook->irq_callback();
} }
start_charge_period();
} }
void syscall_dispatch(struct cpu_context *regs) void syscall_dispatch(struct cpu_context *regs)