devicetree-org / dt-schema

Devicetree schema tools
http://www.devicetree.org
BSD 2-Clause "Simplified" License
67 stars 64 forks source link

Automatically allow OSs to create dedicated memory allocators #138

Open mripard opened 4 months ago

mripard commented 4 months ago

Here's a draft series to add the ability for the OS to create dedicated memory allocators from carved-out memory regions with memory attributes or parameters different from the rest of the system.

This is useful, for example, on systems with ECC enabled to create dedicated memory regions where ECC is disabled so the system is protected by default, but we can still opt-out of that protection for usage specific buffers. For example, framebuffers are usually fairly big, and a bitflip would marginally affect the color of a pixel. This doesn't justify the downsides of enabling ECC on some platforms (increased memory usage, lower performance).

Thanks for looking into it!

robherring commented 3 months ago

The existing properties we have and the combinations of them already makes handling reserved-memory a challenge. I don't think we need more generic stuff and more combinations. If you need a region allocated to something in particular, then add a compatible for it.

For ECC, that seems like OS policy on what to do with errors. AFAIK, there's not per region ECC support in any h/w. The Linux kernel can do per region handling already. For example, if an ECC error is in a user process memory, then it can just kill the process. If you want to ignore errors in framebuffers, then the framebuffer driver should register that memory and handle the errors itself.

mripard commented 3 months ago

The existing properties we have and the combinations of them already makes handling reserved-memory a challenge. I don't think we need more generic stuff and more combinations. If you need a region allocated to something in particular, then add a compatible for it.

So you would prefer to have something like an 'exported-region' compatible?

For ECC, that seems like OS policy on what to do with errors. AFAIK, there's not per region ECC support in any h/w. The Linux kernel can do per region handling already. For example, if an ECC error is in a user process memory, then it can just kill the process. If you want to ignore errors in framebuffers, then the framebuffer driver should register that memory and handle the errors itself.

It's not so much about ignoring the errors, it's about disabling it outright. Some platforms have the ECC data in-band so you're wasting memory for something useless in that context. And there's a performance penalty too. Ignoring the ECC errors will still have the memory usage and performance penalties.