Date: Wed, 01 Dec 1999 18:31:43 -0700 From: Warner Losh <imp@village.org> To: Mike Smith <msmith@FreeBSD.ORG> Cc: mobile@FreeBSD.ORG Subject: Re: cvs commit: src/sys/pccard pccard.c src/sys/isa sio.c src/sys/dev/ed if_ed_pccard.c src/sys/dev/ep if_ep_pccard.c Message-ID: <199912020131.SAA05695@harmony.village.org> In-Reply-To: Your message of "Wed, 01 Dec 1999 17:19:18 PST." <199912020119.RAA03619@mass.cdrom.com> References: <199912020119.RAA03619@mass.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199912020119.RAA03619@mass.cdrom.com> Mike Smith writes: : No. As I keep saying, the device is _not_ gone until the driver lets it : go. The child is in complete control of this, and can easily call a bus : method to verify whether it should give up on I/O even _before_ it's : notified by the parent that the hardware is gone. So long as we can do it in such a way that we don't have a race here. If detach can block, this may not be a problem. If detach runs at elevated SPL or from a non-blocked interrupt handler, then it is possible that detach gets forced upon it. However, even in the old code I think we can block the interrupts which would cause problems so that the hardware is gone properly written interrupt handlers can make sanity checks from time to time. If it spins more than 10,000 times, say, check to see if the hardware is still there. For non-removable devices, this bus method would return "it is still there" all the time, but pcccard or pcic would return its cached value or check the hardware directly, in isuch a way as to make sense.. : > : > The only other solution I could envision was one involving re-writing : > : > all of the drivers to modify them so they would have timeouts reading : > : > hardware (difficult and time consuming), but this wouldn't work in : > : > newbus due to softc going away. :( : > : : > : Again, the softc _can't_ go away until the driver lets it. The driver : > : shouldn't let it until it's finished with it. End of story. : > : > Agreed. However, the only way that it can do this currently is to : > block in detach until all references to softc have gone out of scope. : : Exactly. Now we're getting somewhere. Yes. The old pccard code won't be able to allow its children to block because it is being called from splhigh. The new code can deal since it runs a process. : You also need to consider that if the device interrupt handler is : spinning, the detach routine may never run even though the hardware is : gone. This is why it's imperative for the child to be able to determine : _for_itself_ that the hardware has gone. There's no guarantee that any : form of notification will ever be _able_ to be delivered by the parent : code, so the child has to be able to make up its own mind when to give up. This is true. Until we move to each driver has its own thread, we'll not be able to do any better. There is a small race here, but it does make the polling pcic driver working better, even in the old code. This also assumes that the outb/inb aren't blocking, which I don't think they are based on what I know about the how non pccard systems work. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912020131.SAA05695>