iwannarest
iwannarest

Reputation: 1

is there any way get access persistent memory in linux?

i'm working with persistent memory in linux(debian 10)

i'm using linux kernel 5.0.3 and i have a question.

what i understand is right, linux vitualize persistent memory as a disk and memory mapping it virt_addr.

thus, OS access to persistent memory via file system through kernel. but i think this is a kind of overhead. if persistent memory was already memory mapped, it is much efficient that access it through virt_addr directly.

so i want to know is there any way to get start virt_addr of Persistent Memory in kernel.

thanks.

Upvotes: 0

Views: 718

Answers (2)

grayxu
grayxu

Reputation: 144

"OS access to persistent memory via file system", but this is not the only way.

You can config your persistent memory as devdax mode, and operate it without the help of filesystem.

$ndctl create-namespace -m dax -e namespace0.0 -f

You should check libpmem2 to know more.

ps: @Brendan just made me think I was in 2015...

Upvotes: 0

Brendan
Brendan

Reputation: 37214

Currently (as far as I know) non-volatile memory is too new and too rare/exotic, and nobody really knows what to do with it (other than treating it like a fast SSD).

Note that (for general purpose use, outside of HPC) there's a few serious problems. Namely:

a) There's no guarantee some other OS (or utility) won't be booted and trash anything left in non-volatile memory; so you can't assume its non-volatile at all. Note: I'm still hoping that one day someone that is in a position to influence all operating system vendors (e.g. Intel themselves, or the UEFI consortium) has the intelligence to say "Hey, all non-volatile memory must be formatted with GPT partitioning so that areas used by one OS aren't trampled by another OS; and this specific GUID shall be used for areas reserved for volatile things that any OS can trash".

b) Without encryption it significantly increases the risk of "cold boot attacks". Specifically, for sensitive information (passwords, keys, etc) you desperately want to store it somewhere that's volatile, and non-volatile memory just makes everything worse. Note: Recent AMD and Intel CPUs do support (physical memory) encryption; but I don't know how well it's supported in various kernels, and I fully expect that (if it's supported at all) it's supported very badly (e.g. in an "always pay the price of encryption even for data that simply doesn't need it" way, which encourages everyone to disable it to get better performance).

Upvotes: 2

Related Questions