mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: any chance of 2.6.0-test*?
Date: Mon, 13 Jan 2003 14:33:30 +1100	[thread overview]
Message-ID: <15906.13194.169834.758112@argo.ozlabs.ibm.com> (raw)
In-Reply-To: <1042312710.2952.6.camel@irongate.swansea.linux.org.uk>

Alan Cox writes:

> The pcmcia stuff crashes erratically with the old IDE the bugs have not
> changed but the problem now shows up far more often. With a 2Gb type II
> PCMCIA IDE disk I get a crash about 1 in 3 ejects now.

I'm using the patch below, which makes sure that ide_release (in
ide-cs.c) runs in process context not interrupt context.  The specific
problem I saw was that ide_unregister calls various devfs routines
that don't like being called in interrupt context, but there may well
be other thing ide_unregister does that aren't safe in interrupt
context.

I am also hitting another problem on my powerbook that I would like
your advice on.  The thing is that my powerbook (a 500MHz G4 titanium
powerbook) has 3 IDE interfaces, but only the first two have anything
attached.  The pmac IDE driver goes through and initializes all three,
including setting hwif->selectproc for each one.  Then, when I plug in
a CF card in the pcmcia/cardbus slot, ide_register_hw goes and looks
for a free ide_hwifs[] entry.  Slot 2 appears to be available because
there are no devices attached, and so it uses that.  In the process of
setting up ide_hwifs[2], it sets hwif->io_ports but it doesn't reset
selectproc (or hwif->OUTB etc., AFAICS).  The result is that it calls
the pmac IDE selectproc, which crashes (since we munged hwif->io_ports
without telling it).

I have "fixed" the problem for now by adding a call to
init_hwif_data(index) in ide_register_hw just before the first
memcpy.  I'd be interested to know what the right fix is. :)

Regards,
Paul.

diff -urN linux-2.4/drivers/ide/legacy/ide-cs.c pmac/drivers/ide/legacy/ide-cs.c
--- linux-2.4/drivers/ide/legacy/ide-cs.c	2002-12-19 11:50:35.000000000 +1100
+++ pmac/drivers/ide/legacy/ide-cs.c	2003-01-13 14:02:31.000000000 +1100
@@ -92,10 +92,11 @@
     int		ndev;
     dev_node_t	node;
     int		hd;
+    struct tq_struct rel_task;
 } ide_info_t;
 
 static void ide_config(dev_link_t *link);
-static void ide_release(u_long arg);
+static void ide_release(void *arg);
 static int ide_event(event_t event, int priority,
 		     event_callback_args_t *args);
 
@@ -136,9 +137,8 @@
     if (!info) return NULL;
     memset(info, 0, sizeof(*info));
     link = &info->link; link->priv = info;
+    INIT_TQUEUE(&info->rel_task, ide_release, link);
 
-    link->release.function = &ide_release;
-    link->release.data = (u_long)link;
     link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
     link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
     link->io.IOAddrLines = 3;
@@ -187,6 +187,7 @@
 static void ide_detach(dev_link_t *link)
 {
     dev_link_t **linkp;
+    ide_info_t *info = link->priv;
     int ret;
 
     DEBUG(0, "ide_detach(0x%p)\n", link);
@@ -197,9 +198,10 @@
     if (*linkp == NULL)
 	return;
 
-    del_timer(&link->release);
-    if (link->state & DEV_CONFIG)
-	ide_release((u_long)link);
+    if (link->state & DEV_CONFIG) {
+	schedule_task(&info->rel_task);
+	flush_scheduled_tasks();
+    }
     
     if (link->handle) {
 	ret = CardServices(DeregisterClient, link->handle);
@@ -209,7 +211,7 @@
     
     /* Unlink, free device structure */
     *linkp = link->next;
-    kfree(link->priv);
+    kfree(info);
     
 } /* ide_detach */
 
@@ -381,7 +383,7 @@
 cs_failed:
     cs_error(link->handle, last_fn, last_ret);
 failed:
-    ide_release((u_long)link);
+    ide_release(link);
 
 } /* ide_config */
 
@@ -393,12 +395,15 @@
     
 ======================================================================*/
 
-void ide_release(u_long arg)
+static void ide_release(void *arg)
 {
-    dev_link_t *link = (dev_link_t *)arg;
+    dev_link_t *link = arg;
     ide_info_t *info = link->priv;
     
-    DEBUG(0, "ide_release(0x%p)\n", link);
+    if (!(link->state & DEV_CONFIG))
+	return;
+
+    DEBUG(0, "ide_do_release(0x%p)\n", link);
 
     if (info->ndev) {
         /* FIXME: if this fails we need to queue the cleanup somehow
@@ -435,6 +440,7 @@
 	      event_callback_args_t *args)
 {
     dev_link_t *link = args->client_data;
+    ide_info_t *info = link->priv;
 
     DEBUG(1, "ide_event(0x%06x)\n", event);
     
@@ -442,7 +448,7 @@
     case CS_EVENT_CARD_REMOVAL:
 	link->state &= ~DEV_PRESENT;
 	if (link->state & DEV_CONFIG)
-	    mod_timer(&link->release, jiffies + HZ/20);
+	    schedule_task(&info->rel_task);
 	break;
     case CS_EVENT_CARD_INSERTION:
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;

  reply	other threads:[~2003-01-13  3:27 UTC|newest]

Thread overview: 196+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030110165441$1a8a@gated-at.bofh.it>
     [not found] ` <20030110165505$38d9@gated-at.bofh.it>
2003-01-11 12:27   ` Andi Kleen
2003-01-11 13:01     ` Russell King
2003-01-11 13:13       ` Andi Kleen
2003-01-11 14:39     ` Alan Cox
2003-01-11 14:06       ` Andi Kleen
2003-01-11 15:31         ` Alan Cox
2003-01-11 15:25           ` Andi Kleen
2003-01-11 19:18             ` Alan Cox
2003-01-13  3:33               ` Paul Mackerras [this message]
2003-01-13 14:59                 ` Alan Cox
2003-01-13 18:36                   ` Benjamin Herrenschmidt
2003-01-14  2:32                   ` ide-cs problem (was Re: any chance of 2.6.0-test*?) Paul Mackerras
2003-01-19 16:05         ` any chance of 2.6.0-test*? Pavel Machek
     [not found]   ` <20030112094007$1647@gated-at.bofh.it>
2003-01-12  9:56     ` Fixing the tty layer was " Andi Kleen
2003-01-13  6:41       ` Dipankar Sarma
2003-01-13  7:25         ` Andi Kleen
2003-01-13  8:12           ` Dipankar Sarma
2003-01-13  9:15             ` Russell King
2003-01-13  9:36               ` Dipankar Sarma
2003-01-13  6:45       ` Greg KH
     [not found] <20030113001006$005c@gated-at.bofh.it>
     [not found] ` <20030113005007$4766@gated-at.bofh.it>
     [not found]   ` <20030113170014$20a1@gated-at.bofh.it>
2003-01-18 10:21     ` Kai Henningsen
     [not found] <20030112193012$71b2@gated-at.bofh.it>
     [not found] ` <20030113020015$6883@gated-at.bofh.it>
     [not found]   ` <20030113023015$66a6@gated-at.bofh.it>
     [not found]     ` <20030113030011$6563@gated-at.bofh.it>
     [not found]       ` <20030113035007$451e@gated-at.bofh.it>
2003-01-14 20:18         ` Kai Henningsen
     [not found] <20030112205008$7a5d@gated-at.bofh.it>
     [not found] ` <20030113112009$52fd@gated-at.bofh.it>
     [not found]   ` <20030113144017$68de@gated-at.bofh.it>
2003-01-14 20:01     ` Kai Henningsen
     [not found] <20030112201009$1534@gated-at.bofh.it>
     [not found] ` <20030112204005$7287@gated-at.bofh.it>
2003-01-14 19:53   ` Kai Henningsen
2003-01-15 15:07     ` Scott Robert Ladd
2003-01-15 15:18       ` Marcelo Pacheco
2003-01-18 10:12       ` Kai Henningsen
2003-01-15 19:44     ` Werner Almesberger
2003-01-13 22:37 Albert D. Cahalan
  -- strict thread matches above, loose matches on Subject: below --
2003-01-13 20:37 Manfred Spraul
     [not found] <3C6BEE8B5E1BAC42905A93F13004E8AB017DE60F@mailse01.axis.se>
2003-01-12 20:58 ` Rob Wilkens
2003-01-12 18:02 David Truog
     [not found] <20030110144325.T26554@parcelfarce.linux.theplanet.co.uk>
     [not found] ` <20030110.130023.08256524.davem@redhat.com>
2003-01-10 21:48   ` Matthew Wilcox
2003-01-10 16:39 Shawn Starr
2003-01-10 17:00 ` Dave Jones
2003-01-11 20:10 ` Horst von Brand
2003-01-10 16:10 William Lee Irwin III
2003-01-10 16:28 ` Dave Jones
2003-01-10 16:41   ` Zwane Mwaikambo
2003-01-10 17:08     ` Dave Jones
2003-01-10 17:19 ` Alan Cox
2003-01-10 16:40   ` Jeff Garzik
2003-01-10 17:06   ` Dave Jones
2003-01-10 17:25     ` Jeff Garzik
2003-01-10 17:29     ` Linus Torvalds
2003-01-10 18:47       ` J.A. Magallon
2003-01-10 19:37         ` Matthew D. Pitts
2003-01-10 19:51         ` Jeff Garzik
2003-01-14  1:39       ` James H. Cloos Jr.
2003-01-10 18:16     ` Alan Cox
2003-01-10 17:37   ` Jochen Friedrich
2003-01-10 17:38     ` Linus Torvalds
2003-01-12  9:27   ` Greg KH
2003-01-12 16:55     ` Alan Cox
2003-01-12 17:05     ` Linus Torvalds
2003-01-12 17:17       ` Christoph Hellwig
2003-01-12 19:15         ` Linus Torvalds
2003-01-12 19:34           ` Rob Wilkens
2003-01-12 19:37             ` Rob Wilkens
2003-01-12 19:53               ` Tomas Szepe
2003-01-12 20:03                 ` Rob Wilkens
2003-01-13 15:43                   ` Terje Eggestad
2003-01-13 15:49                     ` Jens Axboe
2003-01-13 16:25                       ` Terje Eggestad
2003-01-13 16:26                         ` Jens Axboe
2003-01-13 16:41                           ` Terje Eggestad
2003-01-13 16:43                             ` Jens Axboe
2003-01-13 17:00                               ` Zwane Mwaikambo
2003-01-13 18:48                                 ` Jens Axboe
2003-01-13 22:14                                   ` Keith Owens
2003-01-13 22:42                                     ` John Levon
2003-01-13 22:49                                   ` Zwane Mwaikambo
2003-01-13 23:32                                     ` Valdis.Kletnieks
2003-01-13 23:43                                       ` Zwane Mwaikambo
2003-01-12 20:44                 ` Alan Cox
2003-01-12 20:45                 ` William Lee Irwin III
2003-01-13 13:14                   ` Bernd Schmidt
2003-01-12 21:22                 ` David Woodhouse
2003-01-18 13:04                 ` Folkert van Heusden
2003-01-12 19:38             ` Linus Torvalds
2003-01-12 19:59               ` Rob Wilkens
2003-01-12 20:18                 ` Valdis.Kletnieks
2003-01-12 20:23                   ` yodaiken
2003-01-12 20:26                   ` Tomas Szepe
2003-01-12 20:32                   ` Sean Neakums
2003-01-12 20:51                     ` Valdis.Kletnieks
2003-01-13  0:54                     ` Randy Dunlap
2003-01-12 20:46                   ` Kevin Puetz
2003-01-13  0:48                   ` Randy Dunlap
2003-01-18 13:07                   ` Folkert van Heusden
2003-01-12 20:20                 ` David Ford
2003-01-12 20:22                 ` Linus Torvalds
2003-01-12 20:33                   ` Robert Love
2003-01-12 20:33                     ` Linus Torvalds
2003-01-13 10:54                       ` Horst von Brand
2003-01-13 11:09                       ` Eric W. Biederman
2003-01-13 14:34                         ` Terje Eggestad
2003-01-13 23:23                         ` Bob Taylor
2003-01-12 20:48                   ` Rob Wilkens
2003-01-12 20:59                     ` Dimitrie O. Paun
2003-01-13 11:07                     ` Helge Hafting
2003-01-13  3:30                   ` yodaiken
2003-01-12 21:29                 ` Rik van Riel
2003-01-13  0:03                 ` Scott Robert Ladd
2003-01-13  0:38                   ` Rob Wilkens
2003-01-13 16:51                     ` Emiliano Gabrielli
2003-01-13  0:38                 ` Randy Dunlap
2003-01-12 19:41             ` Christoph Hellwig
2003-01-12 19:41               ` Rob Wilkens
2003-01-12 19:58                 ` David Ford
2003-01-12 20:07                   ` Rob Wilkens
2003-01-12 20:31                     ` Oliver Neukum
2003-01-12 20:34                     ` David Ford
2003-01-12 20:31             ` Robert Love
2003-01-12 21:02               ` Rob Wilkens
2003-01-12 21:15             ` Matti Aarnio
2003-01-12 21:27               ` Rob Wilkens
2003-01-12 21:40                 ` Rik van Riel
2003-01-12 21:44                   ` Rob Wilkens
2003-01-12 21:49                     ` Aaron Lehmann
2003-01-12 22:07                       ` Rob Wilkens
2003-01-12 22:18                         ` Aaron Lehmann
2003-01-12 22:34                           ` Rob Wilkens
2003-01-12 22:52                             ` Aaron Lehmann
2003-01-12 23:11                               ` Rob Wilkens
2003-01-12 23:31                                 ` Oliver Neukum
2003-01-12 23:39                                 ` Emiliano Gabrielli
2003-01-12 23:46                                   ` Rob Wilkens
2003-01-12 23:57                                     ` Emiliano Gabrielli
2003-01-13  0:08                                       ` Rob Wilkens
2003-01-13 16:02                                         ` Terje Eggestad
2003-01-12 22:53                             ` Sean Neakums
2003-01-12 23:06                             ` Oliver Neukum
2003-01-12 23:48                             ` Rik van Riel
2003-01-12 21:58                     ` Emiliano Gabrielli
2003-01-12 22:12                       ` Rob Wilkens
2003-01-12 22:29                         ` Olivier Galibert
2003-01-12 23:21                         ` Alan Cox
2003-01-12 22:12                     ` Oliver Neukum
2003-01-12 22:18                       ` Aaron Lehmann
2003-01-12 22:35                         ` Rob Wilkens
2003-01-13  8:15                     ` Jens Axboe
2003-01-12 21:49                 ` David Ford
2003-01-12 21:59                 ` Adam Kropelin
2003-01-12 22:21                   ` Rob Wilkens
2003-01-12 22:33                     ` Tomas Szepe
2003-01-12 22:36                     ` Emiliano Gabrielli
2003-01-12 22:38                     ` Oliver Neukum
2003-01-12 22:42                     ` romieu
2003-01-13  1:06                     ` Randy Dunlap
2003-01-13  1:21                       ` Rob Wilkens
2003-01-13  1:51                         ` Nuno Monteiro
2003-01-13  2:19                           ` Rob Wilkens
2003-01-13  2:51                             ` Marcelo Pacheco
2003-01-13  3:37                               ` Rob Wilkens
2003-01-13  4:53                               ` Billy Rose
2003-01-13  3:06                             ` Jochen Striepe
2003-01-13  3:40                               ` Rob Wilkens
2003-01-13  9:45                             ` Matti Aarnio
2003-01-13  3:48                         ` Ryan Anderson
2003-01-13  4:37                   ` Billy Rose
2003-01-12 22:06                 ` Oliver Neukum
2003-01-12 22:22                   ` Rob Wilkens
2003-01-12 22:43                     ` Oliver Neukum
2003-01-12 22:51                       ` Rob Wilkens
2003-01-12 23:00                         ` Robert Love
2003-01-12 23:16                           ` Rob Wilkens
2003-01-12 23:16                           ` Nicolas Pitre
2003-01-12 23:05                         ` Emiliano Gabrielli
2003-01-12 23:23                           ` Oliver Neukum
2003-01-12 23:45                             ` Emiliano Gabrielli
2003-01-12 23:45                             ` Emiliano Gabrielli
2003-01-13 20:01                             ` Horst von Brand
2003-01-12 23:16                         ` Oliver Neukum
2003-01-13  2:00                         ` Ryan Anderson
2003-01-13  3:09                           ` Rob Wilkens
2003-01-14  2:13                             ` Rik van Riel
2003-01-12 22:58                     ` Robert Love
2003-01-12 22:28                 ` Matti Aarnio
2003-01-13  1:26                 ` David Lang
2003-01-13  2:00                   ` William Lee Irwin III
2003-01-13 22:02                 ` Val Henson
2003-01-13 13:08             ` Dave Jones
2003-01-13 13:40               ` Andrew Walrond
2003-01-13 13:49               ` Oliver Neukum
2003-01-14  6:52               ` Bruce Harada
2003-01-14  7:12                 ` Brian Tinsley
2003-01-13 15:23             ` Richard B. Johnson
2003-01-13  6:23           ` Greg KH
2003-01-13 16:35             ` Linus Torvalds
2003-01-13 18:33               ` Alan Cox
2003-01-13 18:01                 ` Linus Torvalds
2003-01-13 19:17                 ` Andrew McGregor
2003-01-12 17:37       ` Russell King
2003-01-13  1:08 ` Michael Kingsbury
2003-01-13  1:52   ` William Lee Irwin III

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=15906.13194.169834.758112@argo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®