generic hardirq handling for uml
hoi :)
I just ported arch/um to generic hardirq handling. It works for me on a 2.6.9-rc4-mm1 kernel.
Without this patch, ARCH=um does not build as it tries to use arch/hardirq.h which is already ported to generic hardirq on i386.
arch/um/Kconfig +7 -0
@@ -7,6 +7,13 @@ bool default y +# +# Use the generic interrupt handling code in kernel/irq/: +# +config GENERIC_HARDIRQS + bool + default y + mainmenu "Linux/Usermode Kernel Configuration" config ISA
arch/um/kernel/irq.c +33 -596
672 lines not on this page · raw message
Signature · 1 line
Martin Waitz
Quoted 1 line · Martin Waitz
I just ported
arch/umto generic hardirq handling.
heh, i posted something similat too
Quoted 1 line
-void
free_irq(unsigned int irq, void *dev_id)
[...]
arch/um/kernel/irq.c line 550
Quoted 1 line
arch/um/kernel/irq.c +0
-1-free_irq_by_irq_and_dev (irq, dev_id);
that is actually needed and missing from the generic code, if you run w/o this you will get funnies won't you?
hoi :)
Quoted 6 lines · Chris Wedgwood
Quoted 1 line
-void
free_irq(unsigned int irq, void *dev_id)[...]
arch/um/kernel/irq.c line 550
Quoted 1 line
arch/um/kernel/irq.c +0
-1-free_irq_by_irq_and_dev (irq, dev_id);that is actually needed and missing from the generic code, if you run w/o this you will get funnies won't you?
ups, I must have missed that.
Well the system booted but I haven't done stress tests yet.
I guess I'll use your patch for further tests :)
Signature · 1 line
Martin Waitz
Quoted 1 line · Martin Waitz
I guess I'll use your patch for further tests :)
it's as clean as it could be yet --- i wanted to make the smallest diff possible until more of the UML gets merged then i'll do another pass trimming lots of cruft out
Quoted 2 lines · Martin Waitz
I just ported
arch/umto generic hardirq handling.
OK, I'll add this to 2.6.9-mm1 (which appears to be a few days off yet). If nobody complains, it goes in. Thanks.
Quoted 2 lines · [email protected] said:
I just ported
arch/umto generic hardirq handling. It works for me on a 2.6.9-rc4-mm1 kernel.
Thanks. I already had most of this in my tree, but you caught a few things I missed, especially the #include cleanup. However, the removal of config.h was a bit much since there are still references to CONFIG_SMP.
Jeff
Quoted 2 lines · [email protected] said:
OK, I'll add this to 2.6.9-mm1 (which appears to be a few days off yet). If nobody complains, it goes in. Thanks.
It's pretty good. I've got it in my tree with a few changes which I'll send you when I start dealing with -mm again.
Jeff
PATCH 1/1 (another!) generic irq handling for UML
Quoted 2 lines · Jeff Dike
It's pretty good. I've got it in my tree with a few changes which I'll send you when I start dealing with -mm again.
I ended with the following patch as a compromise for now. As has been discussed this entire area needs rewriting at some point but for now I think this should suffice.
===== arch/um/Kconfig 1.18 vs edited =====
arch/um/Kconfig +5 -0
@@ -1,3 +1,8 @@ +# UML uses the generic IRQ sugsystem +config GENERIC_HARDIRQS + bool + default y + config USERMODE bool default y
===== arch/um/drivers/line.c 1.23 vs edited =====
arch/um/drivers/line.c +6 -4
@@ -110,7 +110,6 @@ static int flush_buffer(struct line *linint line_write (struct line *lines,struct tty_struct *tty,const char *buf,int len) {struct line *line; -char *new;unsigned long flags;int n, err, i, ret =0 ;
@@ -143,7 +142,6 @@ int line_write(struct line *lines, struc } out_up:up (&line->sem); - out_free:return (ret); }
@@ -203,13 +201,17 @@ void line_disable(struct line *line, intif (line->driver->read_irq == current_irq)free_irq_later (line->driver->read_irq, line); -else +else { +free_irq_by_irq_and_dev (line->driver->read_irq, line);free_irq (line->driver->read_irq, line); + }if (line->driver->write_irq == current_irq)free_irq_later (line->driver->write_irq, line); -else +else { +free_irq_by_irq_and_dev (line->driver->write_irq, line);free_irq (line->driver->write_irq, line); + } line->have_irq =0 ; }
===== arch/um/drivers/net_kern.c 1.19 vs edited =====
arch/um/drivers/net_kern.c +1 -0
@@ -148,6 +148,7 @@ static int uml_net_close(struct net_devinetif_stop_queue (dev);spin_lock (&lp->lock); +free_irq_by_irq_and_dev (dev->irq, dev);free_irq (dev->irq, dev);if (lp->close !=NULL ) (*lp->close)(lp->fd, &lp->user); lp->fd =-1 ;
===== arch/um/drivers/port_kern.c 1.16 vs edited =====
arch/um/drivers/port_kern.c +1 -0
@@ -242,6 +242,7 @@ int port_wait(void *data)* connection. Then we loop here throwing out failed * connections until a good one is found. */ +free_irq_by_irq_and_dev (TELNETD_IRQ , conn);free_irq (TELNETD_IRQ , conn);if (conn->fd >=0 )break ;
===== arch/um/drivers/xterm_kern.c 1.5 vs edited =====
arch/um/drivers/xterm_kern.c +1 -0
@@ -63,6 +63,7 @@ int xterm_fd(int socket, int *pid_out) }down (&data->sem); +free_irq_by_irq_and_dev (XTERM_IRQ , data);free_irq (XTERM_IRQ , data); ret = data->new_fd;
===== arch/um/include/irq_user.h 1.4 vs edited =====
arch/um/include/irq_user.h +1 -1
@@ -10,7 +10,7 @@ enum { IRQ_READ, IRQ_WRITE };extern void sigio_handler (int sig,union uml_pt_regs *regs);extern int activate_fd (int irq,int fd,int type,void *dev_id); -extern void free_irq_by_irq_and_dev (int irq,void *dev_id); +extern void free_irq_by_irq_and_dev (unsigned int irq,void *dev_id);extern void free_irq_by_fd (int fd);extern void reactivate_fd (int fd,int irqnum);extern void deactivate_fd (int fd,int irqnum);
===== arch/um/kernel/irq.c 1.21 vs edited =====
arch/um/kernel/irq.c +18 -630
693 lines not on this page · raw message
===== arch/um/kernel/irq_user.c 1.11 vs edited =====
arch/um/kernel/irq_user.c +1 -1
@@ -263,7 +263,7 @@ static int same_irq_and_dev(struct irq_freturn ((irq->irq == data->irq) && (irq->id == data->dev)); } -void free_irq_by_irq_and_dev (int irq,void *dev) +void free_irq_by_irq_and_dev (unsigned int irq,void *dev) {struct irq_and_dev data = ((struct irq_and_dev ) { .irq = irq, .dev = dev });
===== arch/um/kernel/process_kern.c 1.23 vs edited =====
arch/um/kernel/process_kern.c +0 -1
@@ -206,7 +206,6 @@ void default_idle(void)* although we are an idle CPU, we do not want to * get into the scheduler unnecessarily. */ - irq_stat[smp_processor_id ()].idle_timestamp = jiffies;if (need_resched ())schedule ();
===== include/asm-um/hardirq.h 1.1 vs edited =====
include/asm-um/hardirq.h +24 -4
@@ -1,6 +1,26 @@ -#ifndef __UM_HARDIRQ_H -#define __UM_HARDIRQ_H +/* (c) 2004 [email protected], GPLv2 blah blah */ -#include "asm/arch/hardirq.h" +#ifndef __ASM_UM_HARDIRQ_H +#define __ASM_UM_HARDIRQ_H -#endif +#include <linux/config.h> +#include <linux/threads.h> +#include <linux/irq.h> + +/* NOTE: When SMP works again we might want to make this +* ____cacheline_aligned or maybe use per_cpu state? --cw */ +typedef struct { +unsigned int __softirq_pending; +}irq_cpustat_t ; + +#include <linux/irq_cpustat.h> + +/* As this would be very strange for UML to get we BUG() after the +* printk. */ +static inline void ack_bad_irq (unsigned int irq) +{ +printk (KERN_ERR "unexpected IRQ %02x\n" , irq); +BUG (); +} + +#endif /* __ASM_UM_HARDIRQ_H */