Re: Kexec, DMA, and SMP

Eric W. Biederman
2003-02-12T04:19:09Z

Corey Minyard <cminyard@mvista.com> writes:

> Suparna Bhattacharya wrote:
>
> |On Tue, Feb 11, 2003 at 08:06:44AM -0600, Corey Minyard wrote:
> |
> |>|
> |>|We could just reserve a memory area of reasonable size (how
> |>|much ?) which would be used by the new kernel for all its
> |>|allocations. We already have the infrastructure to tell the
> |>|new kernel which memory areas not to use, so its simple
> |>|enough to ask it exclude all but the reserved area.
> |>|By issuing the i/o as early as possible during bootup
> |>|(for lkcd all we need is the block device to be setup for
> |>|i/o requests), we can minimize the amount of memory to
> |>|reserve in this manner.
> |>
> |>DMA can occur almost anywhere. If you restrict the area of DMA, that
> |>means you have to copy the contents to the final destination. I don't think
> |>we want to do that in many cases.
> |
> |
> |The scope here was just the case that Eric seemed to be
> |trying to address, the way I understood it, and hence a much
> |simpler subset of the problem at hand, since it is not really
> |tackling the rouge/buggy cases. There is no restriction on
> |where DMA can happen, just a block of memory area set aside
> |for the dormant kernel to use when it is instantiated.
> |So this is an area that the current kernel will not use or
> |touch and not specify as a DMA target during "regular"
> |operation.
>
> You don't understand. You don't *want* to set aside a block of memory that's
> reserved for DMA. You want to be able to DMA directly into any user address.
> Consider demand paging. The performance would suck if you DMA into some
> fixed region then copied to the user address. Plus you then have another
> resource you have to manage in the kernel. And you still have to change all
> the drivers, buffer management, etc. to add a flag that says "I'm going to use
> this for DMA" to allocations. You might as well add the quiesce function, it's
> probably easier to do. And it doesn't help if you DMA to static memory
> addresses.
>
> I, too, would like a simpler solution. I just don't think this is it.

You have it backwards. It is not about reserving a block of memory
for DMA. It is about reserving a block of memory to not do DMA in.
Something like 4MB or so.

The idea is not to let the original kernel touch the reserved block at all.
We just put the kernel that kexec will start in that block of memory.

Eric