Re: SS_CAP_STATIC_MAP and I/O resources manipulation in ide-cs and PCMCIA core

Russell King <[email protected]> Thu, 13 Mar 2003 17:31:51 +0000
Newsgroups gmane.linux.pcmcia.devel
Message-ID <[email protected]>
On Thu, Mar 13, 2003 at 09:21:29AM -0800, David Hinds wrote:
> On Thu, Mar 13, 2003 at 04:50:56PM +0300, Dmitry Antipov wrote:
> >  Looks clear, but if SS_CAP_STATIC_MAP is set, no real resource 
> > allocation/freeing is performed by PCMCIA core, isn't it ? And, ide-cs 
> > knows nothing about it, and will try to free non-allocated resource in 
> > ide_config(). And, after unloading IDE stuff, PCMCIA core doesn't 
> > attempts to free resource re-allocated at ide-cs exit. As a result,
> > I have "lost" ("owned" by unloaded module) resource. This is obviously 
> > wrong, and causes kernel panic while 'cat /proc/ioports'.
> 
> Yes this is a bug; the PCMCIA core should have consistent resource
> behavior with socket controllers using SS_CAP_STATIC_MAP, and it does
> not.  The current code takes a short cut because resource management
> is less critical with these controllers, since conflicts can't happen.
> But I think it is misguided and this is one of several problems that
> result.  It surprises me that it has not caused more complaints
> because this seriously impacts use of several card types.

The only side effect is we see a complaint about freeing a non-existant
resource.

I've fixed this up mostly for memory regions in 2.5 - there are a few
areas which need more work for this to work correctly in all cases.

As for IO regions, PCMCIA does some rather nasty hacks, trying to extend
the windows.  This doesn't lend well to the Linux resource subsystem,
so making this IO-region based will take more time.

Linus has also expressed an interest in making PCMCIA allocate resources
for regions it uses, but not marking them busy.  It would be the
responsibility of the drivers involved to use request_region() and
request_mem_region() for this.

However, this is all 2.5 stuff, definitely not for 2.4, which is probably
where Dmitry is looking.  For 2.4, I'd say the best thing is to live with
the quirks as they currently stand - yes it's noisy, and isn't correct,
but it doesn't actively break anything.

Note that I think Dmitry's panic occurs because something is successfully
requesting a resource, but not freeing it.  I don't think that's related
to the PCMCIA core though, but probably ide-cs.  If ide-cs itself requests
a resource, it is responsible for freeing that resource.

-- 
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en