linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stas Sergeev <stas_orel@yahoo.com>
To: linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@suse.cz>
Subject: Re: [patch] do proper cleanups before requesting irq
Date: Thu, 14 Jun 2001 00:42:31 +0400	[thread overview]
Message-ID: <01061401021400.03960@localhost.localdomain> (raw)
In-Reply-To: <01061202405801.06615@localhost.localdomain> <20010612160643.B33@toy.ucw.cz>
In-Reply-To: <20010612160643.B33@toy.ucw.cz>

Pavel Machek wrote:
> > The problem is that there are comparisons of pointers to task_struct when
> > deciding if the task is alive. If one task dies and other one starts, it is
> > possible (is it?) that the task structure of the newly created task resides
> > at the very address where was the dead one's, so comparing pointers is not
> > reliable. This patch changes it to comparisons of task's pids.
> > Can anyone, please, atleast tell me if this patch is correct?
> it might be better but it is not correct. pids are reused, too
Many thanks for reply.
If everything can be reused then it seems that the correct approach is to do a
cleanup when the task terminates, not when other one tries to request an irq.
The following patch does exactly this.
Please, once again, is this correct now?

------------------------------------------------------
--- linux/arch/i386/kernel/irq.h	Fri May 12 21:38:59 2000
+++ linux/arch/i386/kernel/irq.h	Wed Jun 13 18:44:06 2001
@@ -85,6 +85,7 @@
 extern void init_IRQ_SMP(void);
 extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
 extern int setup_x86_irq(unsigned int, struct irqaction *);
+extern void release_x86_irqs(struct task_struct *);
 
 /*
  * Various low-level irq details needed by irq.c, process.c,
--- linux/arch/i386/kernel/process.c	Mon Dec 11 17:29:12 2000
+++ linux/arch/i386/kernel/process.c	Wed Jun 13 18:58:00 2001
@@ -544,6 +544,7 @@
 
 void release_thread(struct task_struct *dead_task)
 {
+    release_x86_irqs(dead_task);
 }
 
 /*
--- linux/arch/i386/kernel/vm86.c	Sat May  5 06:31:51 2001
+++ linux/arch/i386/kernel/vm86.c	Wed Jun 13 19:01:26 2001
@@ -618,6 +618,14 @@
 	}
 	read_unlock(&tasklist_lock);
 	return ret;
+}
+
+void release_x86_irqs(struct task_struct *task)
+{
+	int i;
+	for (i=3; i<16; i++)
+	    if (vm86_irqs[i].tsk == task)
+		free_vm86_irq(i);
 }
 
 static inline void handle_irq_zombies(void)

      reply	other threads:[~2001-06-13 21:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-11 23:53 [patch] do proper cleanups before requesting irq Stas Sergeev
2001-06-12 16:06 ` Pavel Machek
2001-06-13 20:42   ` Stas Sergeev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01061401021400.03960@localhost.localdomain \
    --to=stas_orel@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=stas.orel@mailcity.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).