Re: New kernel/resource.c

Linus Torvalds (torvalds@transmeta.com)
Thu, 15 Jul 1999 11:14:54 -0700 (PDT)


On Thu, 15 Jul 1999, David Hinds wrote:
>
> My suggestion to have two resource trees requires no changes to your
> resource allocator code.

That's fine.

You can have an arbitrary number of trees inside the PCMCIA code. One of
the goals I had was to never EVER care about what the resoruce allocators
were actually used for, and you can have "private" resources inside
PCMCIA.

But the PCI subsystem is not going to know about them. Because, by
definition, they are private. If that's ok with you, then you're golden.

My point is that there is one PCI resource, and that implies that there is
just one resource tree for PCI. Simple logic.

If you want to pre-allocate, then just allocate the area. If you want to
further show in the /proc/iomem file what kind of allocation it is, that
can be done multiple ways. I can see the "flags" being used (or just
different names) - you have a flag that says "pre-allocated, not in use".

That's all a syntactic issue, though, because the allocator won't really
care: the area is allocated, and won't be allowed to be used for anything
else as far as the allocator is concerned.

The allocator considers the "flags" and the "name" field to be completely
under the control of the entity that actually controls the allocation, so
it doesn't preclude you changing the flags of the pre-allocated
allocation. Or the name.

But by then it is no longer a resource allocation issue, and as such it's
not something that the resource allocator will (or SHOULD) care about. At
that point it is a simple "move the allocated resource from one bin
(pre-allocated) to another (in use)". But that's akin to passing the
pointer around, NOT actually changing the allocation tree itself.

> Maybe I'm confused, but wasn't the original motivation for updating
> the resource code to make hot plug support easier, not harder??

Maybe I'm confused, but I don't see the relevance of ANY of your
arguments.

If you want to pre-allocate, you can do that TODAY. Just do it. It's as
simple as

region = request_region(start, n, "pre-alloc");

and then you maintain your own list of pre-allocated (and not yet in-use)
regions for the hot-swap use or whatever.

If you want to sub-allocate pre-allocations, you can do that too - so a
hot-swappable device can more cleanly actually tell what it is using in
the pre-allocated area.

If you want to scan what has been allocated, you can go wild. All the
information is right there in the resource tree.

NONE of this is hard. I don't see why you're trying to make it hard.

If you want to change the serial driver to instead of allocating the
resources at open time, allocate them at load time, then just do it. Same
for parallel ports etc. You have to be more careful about the region
allocations as they become more long-lived, but that's really only a
problem for ISA cards where we sometimes just guess at the regions and say
that they only really take effect once really opened. And it's a problem
that you would have to have solved even with your two-tree approach.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/