mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] EDAC/ie31200: Give each DIMM two chip selects again
@ 2026-11-19 18:33 Ahmed Abdelfattah via B4 Relay
  2026-11-22 16:02 ` Qiuxu (Leo) Zhuo
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Abdelfattah via B4 Relay @ 2026-11-19 18:33 UTC (permalink / raw)
  To: Jason Baron, Borislav Petkov, Tony Luck, Qiuxu Zhuo
  Cc: linux-edac, linux-kernel, stable, Ahmed Abdelfattah

From: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>

Since commit afdbc3655556 ("EDAC/ie31200: Make struct dimm_data
contain decoded information"), ie31200_get_dimm_config() puts rank k
of DIMM j at chip select j * ranks + k, where ranks is that DIMM's own
rank count. In a channel with a dual-rank DIMM 0 and a single-rank
DIMM 1, both DIMMs then use chip select 1: DIMM 1 overwrites the entry
for DIMM 0's second rank, mc0/size_mb is short by that rank, and errors
in it are reported against DIMM 1.

Before that commit the stride was a fixed 2, so DIMM 0 had chip
selects 0-1 and DIMM 1 had 2-3, and the commit did not mean to change
that. The error path still passes the two-bit rank field of ECCERRLOG
to edac_mc_handle_error() as the chip select. If the controller reports
DIMM 1's first rank as 2, as the old layout assumed, those errors now
land on an empty entry when DIMM 1 is single-rank (or when both DIMMs
are, as DIMM 1 has moved to chip select 1). That trips
WARN_ON_ONCE(!e->grain) in edac_raw_mc_handle_error() and the error is
logged against "unknown memory".

Go back to a fixed stride of 2.

Fixes: afdbc3655556 ("EDAC/ie31200: Make struct dimm_data contain decoded information")
Cc: stable@vger.kernel.org
Signed-off-by: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
---
I ran into this with a QEMU model of the Kaby Lake host bridge (0x5918,
skl_cfg) that I wrote to exercise ie31200_edac; it is not part of
upstream QEMU. It fills MAD_DIMM in from the configured DIMMs and
reports errors on DIMM S (the driver's DIMM 1) with ECCERRLOG rank 2 or
3, which is the layout the driver used up to v6.14. I have no machine
with two DIMMs per channel to check what real controllers put in that
field, so the "unknown memory" part rests on the old layout. The size_mb
part only depends on MAD_DIMM.

Tested on v7.4-rc3+ (4405c18c95d2) with both slots of both channels
populated, injecting corrected errors on DIMM L's ranks and on DIMM S in
both channels, and an uncorrected error on DIMM S:

  ranks L + S  without the patch                 with it
  2R + 1R      mc0/size_mb 3072 instead of 4096; mc0/size_mb 4096;
               DIMM S errors on "unknown         DIMM S errors on
               memory", WARN in edac_mc.c        csrow 2
  1R + 1R      mc0/size_mb 4096; DIMM S errors   mc0/size_mb 4096;
               on "unknown memory", WARN         DIMM S errors on
                                                 csrow 2
  2R + 2R      correct                           unchanged

On RPL-S, MAD_DIMM can describe up to four ranks per DIMM, so this also
moves DIMM 1 there: a 1R + 1R channel goes from chip selects 0 and 1 to
0 and 2. ECCERRLOG has the same two-bit rank field on RPL-S, so I think
two chip selects per DIMM is still the right split, but I could not
test it. Qiuxu, do you know how the RPL-S controller numbers the ranks
of the second DIMM in ECCERRLOG?
---
 drivers/edac/ie31200_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c
index 88af77ee07fe..1ef91cbda291 100644
--- a/drivers/edac/ie31200_edac.c
+++ b/drivers/edac/ie31200_edac.c
@@ -461,7 +461,7 @@ static void ie31200_get_dimm_config(struct mem_ctl_info *mci, void __iomem *wind
 
 			nr_pages = nr_pages / dimm_info.ranks;
 			for (k = 0; k < dimm_info.ranks; k++) {
-				dimm = edac_get_dimm(mci, (j * dimm_info.ranks) + k, i, 0);
+				dimm = edac_get_dimm(mci, (j * 2) + k, i, 0);
 				dimm->nr_pages = nr_pages;
 				edac_dbg(0, "set nr pages: 0x%lx\n", nr_pages);
 				dimm->grain = 8; /* just a guess */

---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261119-edac-ie31200-rank-stride-adb314e6d656

Best regards,
--  
Ahmed Abdelfattah <me@ahmedabdelfattah.dev>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] EDAC/ie31200: Give each DIMM two chip selects again
  2026-11-19 18:33 [PATCH] EDAC/ie31200: Give each DIMM two chip selects again Ahmed Abdelfattah via B4 Relay
@ 2026-11-22 16:02 ` Qiuxu (Leo) Zhuo
  2026-11-22 16:28   ` Ahmed Abdelfattah
  0 siblings, 1 reply; 3+ messages in thread
From: Qiuxu (Leo) Zhuo @ 2026-11-22 16:02 UTC (permalink / raw)
  To: me, Jason Baron, Borislav Petkov, Tony Luck
  Cc: linux-edac, linux-kernel, stable

> From: Ahmed Abdelfattah via B4 Relay
> <devnull+me.ahmedabdelfattah.dev@kernel.org>
> Sent: Friday, November 20, 2026 2:33 AM
> To: Jason Baron <jbaron@akamai.com>; Borislav Petkov <bp@alien8.de>; Tony
> Luck <tony.luck@intel.com>; Qiuxu Zhuo <qiuxu.zhuo@intel.com>
> Cc: linux-edac@vger.kernel.org; linux-kernel@vger.kernel.org;
> stable@vger.kernel.org; Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
> Subject: [PATCH] EDAC/ie31200: Give each DIMM two chip selects again
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
> 
> Since commit afdbc3655556 ("EDAC/ie31200: Make struct dimm_data contain
> decoded information"), ie31200_get_dimm_config() puts rank k of DIMM j at chip
> select j * ranks + k, where ranks is that DIMM's own rank count. In a channel with a
> dual-rank DIMM 0 and a single-rank DIMM 1, both DIMMs then use chip select 1:
> DIMM 1 overwrites the entry for DIMM 0's second rank, mc0/size_mb is short by
> that rank, and errors in it are reported against DIMM 1.
> 
> Before that commit the stride was a fixed 2, so DIMM 0 had chip selects 0-1 and
> DIMM 1 had 2-3, and the commit did not mean to change that. The error path still
> passes the two-bit rank field of ECCERRLOG to edac_mc_handle_error() as the chip
> select. If the controller reports DIMM 1's first rank as 2, as the old layout assumed,
> those errors now land on an empty entry when DIMM 1 is single-rank (or when
> both DIMMs are, as DIMM 1 has moved to chip select 1). That trips
> WARN_ON_ONCE(!e->grain) in edac_raw_mc_handle_error() and the error is
> logged against "unknown memory".
> 
> Go back to a fixed stride of 2.
> 
> Fixes: afdbc3655556 ("EDAC/ie31200: Make struct dimm_data contain decoded
> information")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ahmed Abdelfattah <me@ahmedabdelfattah.dev>
> ---
> I ran into this with a QEMU model of the Kaby Lake host bridge (0x5918,
> skl_cfg) that I wrote to exercise ie31200_edac; it is not part of upstream QEMU. It
> fills MAD_DIMM in from the configured DIMMs and reports errors on DIMM S (the
> driver's DIMM 1) with ECCERRLOG rank 2 or 3, which is the layout the driver used
> up to v6.14. I have no machine with two DIMMs per channel to check what real
> controllers put in that field, so the "unknown memory" part rests on the old layout.
> The size_mb part only depends on MAD_DIMM.
> 
> Tested on v7.4-rc3+ (4405c18c95d2) with both slots of both channels populated,
> injecting corrected errors on DIMM L's ranks and on DIMM S in both channels, and
> an uncorrected error on DIMM S:
> 
>   ranks L + S  without the patch                 with it
>   2R + 1R      mc0/size_mb 3072 instead of 4096; mc0/size_mb 4096;
>                DIMM S errors on "unknown         DIMM S errors on
>                memory", WARN in edac_mc.c        csrow 2
>   1R + 1R      mc0/size_mb 4096; DIMM S errors   mc0/size_mb 4096;
>                on "unknown memory", WARN         DIMM S errors on
>                                                  csrow 2
>   2R + 2R      correct                           unchanged
> 
> On RPL-S, MAD_DIMM can describe up to four ranks per DIMM, so this also moves
> DIMM 1 there: a 1R + 1R channel goes from chip selects 0 and 1 to
> 0 and 2. ECCERRLOG has the same two-bit rank field on RPL-S, so I think two chip
> selects per DIMM is still the right split, but I could not test it. Qiuxu, do you know
> how the RPL-S controller numbers the ranks of the second DIMM in ECCERRLOG?

I no long work at Intel, so I can't confirm the RPL-S ECCERRLOG rank encoding. 

For comparison, Intel Ice Lake servers decode the per-channel rank ID from MCi_MISC as

  DIMM 0: ranks 0, 1, 2, 3 
  DIMM 1: ranks 4, 5, 6, 7 

See i10nm_mc_decode() (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/edac/i10nm_base.c#n415).

A similar fixed allocation of ranks 0–1 and 2–3 on RPL-S looks reasonable, although I have not 
verified that ECCERRLOG uses this mapping.

Your patch restores the previous fixed stride and fixes the demonstrated overlap with mixed-rank DIMMs. 
The change looks good to me.

Reviewed-by: Qiuxu Zhuo qzhuo@nvidia.com (qzhuo@nvidia.com)

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EDAC/ie31200: Give each DIMM two chip selects again
  2026-11-22 16:02 ` Qiuxu (Leo) Zhuo
@ 2026-11-22 16:28   ` Ahmed Abdelfattah
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmed Abdelfattah @ 2026-11-22 16:28 UTC (permalink / raw)
  To: Qiuxu (Leo) Zhuo
  Cc: Jason Baron, Borislav Petkov, Tony Luck, linux-edac,
	linux-kernel, stable

On Sun, Nov 22, 2026 at 04:02:12PM +0000, Qiuxu (Leo) Zhuo wrote:
> For comparison, Intel Ice Lake servers decode the per-channel rank ID
> from MCi_MISC as
>
>   DIMM 0: ranks 0, 1, 2, 3
>   DIMM 1: ranks 4, 5, 6, 7

Thanks, that is a useful comparison. With a fixed block per DIMM on the
server side, 0-1 and 2-3 looks like the natural layout here too, even
with the RPL-S encoding unconfirmed.

> The change looks good to me.
>
> Reviewed-by: Qiuxu Zhuo qzhuo@nvidia.com (qzhuo@nvidia.com)

Thank you for the review. The angle brackets got lost from the tag on
the way, so b4 does not pick it up. If I send a v2 I will carry it as

  Reviewed-by: Qiuxu Zhuo <qzhuo@nvidia.com>

Thanks,
Ahmed

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-22 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 18:33 [PATCH] EDAC/ie31200: Give each DIMM two chip selects again Ahmed Abdelfattah via B4 Relay
2026-11-22 16:02 ` Qiuxu (Leo) Zhuo
2026-11-22 16:28   ` Ahmed Abdelfattah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®