Thread (38 messages) 38 messages, 5 authors, 2023-09-01

Re: [PATCH RESEND v3 13/17] EDAC/mc: Add MC unique index allocation procedure

From: Serge Semin <hidden>
Date: 2022-10-12 21:32:13
Also in: linux-devicetree, linux-edac, lkml

On Wed, Oct 12, 2022 at 01:44:59PM -0700, Tony Luck wrote:
On Wed, Oct 12, 2022 at 10:33:35PM +0200, Borislav Petkov wrote:
quoted
On Wed, Oct 12, 2022 at 11:01:54PM +0300, Serge Semin wrote:
quoted
"A new special MC index is introduced here. It's defined by the
EDAC_AUTO_MC_NUM macro with a value specifically chosen as the least
probable value used for the real MC index. In case if the EDAC_AUTO_MC_NUM
index is specified by the EDAC LLDD, the MC index will be either retrieved
from the MC device OF-node alias index ("mc[:number:]") or automatically
generated as the next-free MC index found by the ID allocation procedure."
Just curious.If I have an EDAC driver using EDAC_AUTO_MC_NUM, and I
unload and reload the driver a bunch of times. Do I get the same memory
controller numbers each reload, or get an ever increasing set each time?
You'll get the same numbers if no other device-driver allocated them
(which we already established isn't relevant to EDAC since only one
driver per system is supposed to work). In order to implement what you
said I should have called idr_alloc_cyclic() instead.

Here is what the suggested implementation implies:

1. If there is a particular ID assigned in the framework of the dts aliases
(i.e. mcX = &ddr0) then that value will be selected for the controller.
2. If no particular ID is assigned but there are mcX-like aliases
defined in DTS, then the next free id greater than the last mcX value
will be assigned.
3. If none if the above is relevant the first free ID in the pool will be
allocated.
4. On the driver unload the driver remove method will be called thus
the allocated ID will be freed on the MC-controller de-registration.
Thus on the next driver loading the freed IDs will be reused by the
idr_alloc() method design.

-Sergey
-Tony
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help