Skip to contentSkip to conversation

User question about memory scrubbing

PATCH Applied Anders Andersson 2 participants 7 messages Jun 18, 2020 – Jun 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi! I realize that this is more of a developer-to-developer list, but I'm a hobbyist who recently bought my first system with ECC RAM (Opteron 6386 SE) and I can't get memory scrubbing to work. It's hard to find people who know anything about it.

Preliminary research led me to the EDAC documentation on
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-edac
and in particular the "sdram_scrub_rate" file, but had no luck manipulating it.

Before I'm getting too lost: Is that the right way to configure it?

I have amd64_edac_mod and edac_mce_amd loaded. I briefly looked at amd64_edac.c and it appears to have the necessary code and matches the documentation from AMD so there's something I'm not doing right. I did post a more elaborate question on
https://unix.stackexchange.com/questions/593060/how-do-i-enable-and-verify-ecc-ram-scrubbing-in-linux
but I'm afraid it's too technical for most users (too technical for me too apparently!)

Hints and pointers welcome,
Anders

maintainer
#1 lore raw
Quoted 9 lines · Anders Andersson

Hi! I realize that this is more of a developer-to-developer list, but I'm a hobbyist who recently bought my first system with ECC RAM (Opteron 6386 SE) and I can't get memory scrubbing to work. It's hard to find people who know anything about it.

Preliminary research led me to the EDAC documentation on
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-edac
and in particular the "sdram_scrub_rate" file, but had no luck manipulating it.

Oh, you're manipulating it alright but there's a bug in reporting it. Wanna test a patch?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer
#2 lore raw

PATCH 1/1 EDAC/amd64: Read back the scrub rate PCI register on F15h

Quoted 2 lines · Borislav Petkov

Oh, you're manipulating it alright but there's a bug in reporting it. Wanna test a patch?

Here it is:

---
From: Borislav Petkov <[email protected]>

Commit:

da92110dfdfa ("EDAC, amd64_edac: Extend scrub rate support to F15hM60h")

added support for F15h, model 0x60 CPUs but in doing so, missed to read back SCRCTRL PCI config register on F15h CPUs which are *not* model 0x60. Add that read so that doing

  $ cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate

can show the previously set DRAM scrub rate.

---
 drivers/edac/amd64_edac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/edac/amd64_edac.c +2 -0
index ef90070a9194..6262f6370c5d 100644
@@ -269,6 +269,8 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
 
 		if (pvt->model == 0x60)
 			amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
+		else
+			amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
 	} else {
 		amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
 	}
Signature · 7 lines
2.21.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer Applied
#3 lore raw

Re: [PATCH] EDAC/amd64: Read back the scrub rate PCI register on F15h

Quoted 36 lines · Borislav Petkov
Quoted 2 lines · Borislav Petkov

Oh, you're manipulating it alright but there's a bug in reporting it. Wanna test a patch?

Here it is:

---
From: Borislav Petkov <[email protected]>

Commit:

da92110dfdfa ("EDAC, amd64_edac: Extend scrub rate support to F15hM60h")

added support for F15h, model 0x60 CPUs but in doing so, missed to read back SCRCTRL PCI config register on F15h CPUs which are *not* model 0x60. Add that read so that doing

  $ cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate

can show the previously set DRAM scrub rate.

---
 drivers/edac/amd64_edac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/edac/amd64_edac.c +0 -0
index ef90070a9194..6262f6370c5d 100644

drivers/edac/amd64_edac.c static int get_scrub_rate(struct mem_ctl_info *mci) · line 276

Quoted 8 lines
drivers/edac/amd64_edac.c +2 -0
@@ -269,6 +269,8 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
 
 		if (pvt->model == 0x60)
 			amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
+		else
+			amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
 	} else {
 		amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
 	}

Queued into edac-urgent.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#4 lore raw

Re: [PATCH] EDAC/amd64: Read back the scrub rate PCI register on F15h

Quoted 49 lines · Borislav Petkov
Quoted 35 lines · Borislav Petkov
Quoted 2 lines · Borislav Petkov

Oh, you're manipulating it alright but there's a bug in reporting it. Wanna test a patch?

Here it is:

---
From: Borislav Petkov <[email protected]>

Commit:

da92110dfdfa ("EDAC, amd64_edac: Extend scrub rate support to F15hM60h")

added support for F15h, model 0x60 CPUs but in doing so, missed to read back SCRCTRL PCI config register on F15h CPUs which are *not* model 0x60. Add that read so that doing

  $ cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate

can show the previously set DRAM scrub rate.

---
 drivers/edac/amd64_edac.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/edac/amd64_edac.c +0 -0
index ef90070a9194..6262f6370c5d 100644

drivers/edac/amd64_edac.c static int get_scrub_rate(struct mem_ctl_info *mci)

Quoted 9 lines
drivers/edac/amd64_edac.c +2 -1
@@ -269,6 +269,8 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
 
              if (pvt->model == 0x60)
                      amd64_read_pci_cfg(pvt->F2, F15H_M60H_SCRCTRL, &scrubval);
+             else
+                     amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
      } else {
              amd64_read_pci_cfg(pvt->F3, SCRCTRL, &scrubval);
      }
--

Queued into edac-urgent.

Quoted 7 lines

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Ok, finally tested the patch on my machine, and (no surprise) everything now works as expected, thanks!

// Anders

maintainer
#5 lore raw

Re: [PATCH] EDAC/amd64: Read back the scrub rate PCI register on F15h

Quoted 2 lines · Anders Andersson

Ok, finally tested the patch on my machine, and (no surprise) everything now works as expected, thanks!

Thanks for testing, patch will appear upstream and in stable soon.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#6 lore raw
In reply to Borislav Petkov
Quoted 7 lines · Borislav Petkov
Quoted 5 lines · Anders Andersson

Hi! I realize that this is more of a developer-to-developer list, but I'm a hobbyist who recently bought my first system with ECC RAM (Opteron 6386 SE) and I can't get memory scrubbing to work. It's hard to find people who know anything about it.

Quoted 7 lines
Quoted 4 lines

Preliminary research led me to the EDAC documentation on
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-edac
and in particular the "sdram_scrub_rate" file, but had no luck manipulating it.

Oh, you're manipulating it alright but there's a bug in reporting it. Wanna test a patch?

Wow, nice to see that I'm not crazy, and thanks for the quick fix! I saw the patch and I will try it out after I've re-learnt how to build a kernel again. It's been well over 10 years since I last had to...

// Anders