Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

badmem static allocation of memory hole

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

badmem static allocation of memory hole

  • Quote

Post by dimko » Sat Sep 16, 2023 11:11 am

Hello Gentoids,

For years I was struggling with bad ram.(usually compilation issues, and usually with only big apps like chromium, so I reduced amount of threads from 32 to 6 at compile time)
There is one specific area that was causing me trouble which I did not understand:
[ 20.573439] 5555555555555555 bad mem addr 0x0000000f6cf22598 - 0x0000000f6cf225a0 reserved

One of reasons for whatever reasons i had problems with installed version of memtest86+ for whatever reason.
Yesterday I noticed that it worked, and found a faulty area in RAM. Only one. Which makes me believe this is not gonna get worse.(used that ram for many years now)
First I tried disabling using address and mask in grub, whichI immedeatelly failed and made my grub unbootable.(changes reverted, thanks god i had some ubuntu usb flash somewhere)
I used "GRUB_BADRAM=' 0x0000000f6cf22598,0xffffffffffffffff'" in default grub config file. Grub failed to start, i just see "welcome to grub" and nothing else, no kernel choices i have had before.
So I enabled memory testing in kernel for now. memtest=4

Now the question, how can I permanently add ram area it to my current ONLY last kernel in grub?(before I add it somehow to /etc/default/grub for all kernel)?

with 64gig of ram boot times increased by quite a lot.

bonus question: how do I add this ram mask into /etc/default/grub so all kernels I compile in the future can benefit from it?
Just a user.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56104
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Sep 16, 2023 11:38 am

dimko,

Code: Select all

GRUB_BADRAM=' 0x0000000f6cf22598,0xffffffffffffffff'
That fails as its not all RAM.
It covers the firmware and PCI address space too.

Save your good grub.cfg so you can get it back.

Put the GRUB_BADRAM= back and generate a new (broken) grub.cfg.
Look on the kernel command line, in the new (broken) grub.cfg and see what mas added.
Make a note of it.
Restore your good working grub.cfg and undo the damage to the default grub config file.

Now you as back as you were but with you know what command to add to the kernel command line.
Use grubs boot time editor to practice, using the notes from what grub did.

Choose a kernel to boot but press 'e' for edit. Not enter.
Find the linux line and append your new kernel parameter.
Now boot.
This edits the in RAM copy of grub.cnf only, so if horrible things happen, don't do it again :)
A reboot will drop out the in RAM edit.

This lets you test to see if the proposed change has the desired effect.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

I think i get the gist of it

  • Quote

Post by dimko » Sat Sep 16, 2023 12:16 pm

NeddySeagoon wrote: Choose a kernel to boot but press 'e' for edit. Not enter.
Find the linux line and append your new kernel parameter.
Now boot.
This edits the in RAM copy of grub.cnf only, so if horrible things happen, don't do it again :)
A reboot will drop out the in RAM edit.

This lets you test to see if the proposed change has the desired effect.
I think i get the gist of what you are saying.
Any idea how I can build a mask?(based on memtest=4 range? ill include it in a sec)
Just a user.
Top
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

i suspect I am doing it wrong

  • Quote

Post by dimko » Sat Sep 16, 2023 12:26 pm

OK, my initial aim was to:
tell grub to tell kernel to block area of memory that memtest86+ has found to be corrupt.

perhaps GRUB_BADRAM ONLY affects grub and not actual kernel?
Grub was never giving me issues anyway, so ram problem for GRUB is not an issue.

I just want to avoid using memtest=4 in kernel settings.(it increases kernel load times)
Just a user.
Top
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

GRUB_BADRAM is only for grub and not for kernel?

  • Quote

Post by dimko » Sat Sep 16, 2023 12:27 pm

dmesg |grep -i bad
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-6.5.3 root=/dev/nvme0n1p2 ro amd_pstate.shared_mem=1 amd_pstate=active iommu=1 amd_iommu=on iommu=calgary splash GRUB_BADRAM=0x0000000f6cf22598,0xfffffffffffffff8
[ 0.084473] Kernel command line: BOOT_IMAGE=/vmlinuz-6.5.3 root=/dev/nvme0n1p2 ro amd_pstate.shared_mem=1 amd_pstate=active iommu=1 amd_iommu=on iommu=calgary splash GRUB_BADRAM=0x0000000f6cf22598,0xfffffffffffffff8
[ 0.084520] Unknown kernel command line parameters "splash BOOT_IMAGE=/vmlinuz-6.5.3 GRUB_BADRAM=0x0000000f6cf22598,0xfffffffffffffff8", will be passed to user space.
[ 1.490516] GRUB_BADRAM=0x0000000f6cf22598,0xfffffffffffffff8
Just a user.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56104
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Sep 16, 2023 12:43 pm

dimko,

Code: Select all

16.3.6 badram

Command: badram addr,mask[,addr,mask...]

    Filter out bad RAM.

    This command notifies the memory manager that specified regions of RAM ought to be filtered out (usually, because they’re damaged). This remains in effect after a payload kernel has been loaded by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels that support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot kernels in general.

    Syntax is the same as provided by the Memtest86+ utility: a list of address/mask pairs. Given a page-aligned address and a base address / mask pair, if all the bits of the page-aligned address that are enabled by the mask match with the base address, it means this page is to be filtered. This syntax makes it easy to represent patterns that are often result of memory damage, due to physical distribution of memory cells.

    The command is similar to cutmem command.

    Note: The command is not allowed when lockdown is enforced (see Lockdown). This prevents removing EFI memory regions to potentially subvert the security mechanisms provided by the UEFI secure boot. 
I'm no a grub user.

The "as long as the loaded kernel obtains its memory map from GRUB." matters a great deal.

This Ubuntu page is worth reading too as it details how to calculate the mask.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

i give up at this time

  • Quote

Post by dimko » Sat Sep 16, 2023 1:12 pm

Overall amount of time that i will spend solving this issue is probably more than amount of time i will need to reboot infrequently enough(i "sleep" my PC), until i get new ram, plus memtest=4 does check other ram, so I will be safer from new surprises.

If someone gets similar issue and solves it - please let us know how.

What particularly confuses me, my range of bad ram:
[ 30.885799] ffffffffffffffff bad mem addr 0x0000000f6cf22598 - 0x0000000f6cf225a0 reserved

Now i have 64bit machine with 64gig of ram, but all other documentation I have seen so far has much smaller address and mask numbers.
Just a user.
Top
dimko
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Sun Feb 12, 2006 2:25 pm

with that said, NeddySeagoon, thanks

  • Quote

Post by dimko » Sat Sep 16, 2023 1:17 pm

thanks for the effort @NeddySeagoon
Just a user.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56104
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Sep 16, 2023 2:23 pm

dimko,

It looks like you need

Code: Select all

         memmap=nn[KMG]!ss[KMG]
                        [KNL,X86] Mark specific memory as protected.
                        Region of memory to be used, from ss to ss+nn.
                        The memory region may be marked as e820 type 12 (0xc)
                        and is NVDIMM or ADR memory.
Your region

Code: Select all

 bad mem addr 0x0000000f6cf22598 - 0x0000000f6cf225a0
is only 8 bytes but you probably need to protect the whole 4k page.
That will be the 4k starting at 0x0000000f6cf22000, as the kernel works with 4k pages of RAM.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Post Reply

9 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic