[foreign-memaccess+abi] RFR: 8264763: Add support for extended map modes in mapped segments
mkaeufler
github.com+82040674+mkaeufler at openjdk.java.net
Tue Apr 6 15:14:21 UTC 2021
On Tue, 6 Apr 2021 10:52:19 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This simple fix add support for mapping segments using the extended map modes added by JEP 352.
>
> I tried testing the support but, to do that properly you need specific setup (as described in JEP 352).
>
> Anyway, I have been able to verify that now there's no exception in the memory segment code,
> the failure I get is deep into the native map0 method, which throws "operation not supported", presumably because the file I'm mapping is not from NVM device.
>
> Any extra help in testing this would be appreciated.
Regarding the testing and "operation not supported": As you assumed you need an (emulated) NVM device to map in the SYNC mode.
If you're willing to mess with your boot config (or do this in a VM), I think this article by Intel describes the emulation pretty well:
https://software.intel.com/content/www/us/en/develop/articles/how-to-emulate-persistent-memory-on-an-intel-architecture-server.html (the whole kernel building part is probably not needed with a current kernel).
As I already had this summarized for myself I'll just post my summary below:
### 1. Kernel
**Requires DAX-capable kernel**. Modern kernels will probably have this enabled by default, otherwise refer to: https://pmem.io/2016/02/22/pm-emulation.html
### 2. PMEM device
Define pmem device in `/etc/default/grub` via linux cmd line parameters.
GRUB_CMDLINE_LINUX="memmap=1G!4G"
This defines a 1GB emulated pmem devices starting at address of 4GB.
Build configuration with
sudo grub-mkconfig -o /boot/grub/grub.cfg
and reboot (might differ depending on Linux distribution).
This should give a pmem device `/dev/pmem0`
### 3. PMEM Aware File System
Create ext4 file system on pmem device (ext4 supports DAX)
sudo mkfs.ext4 /dev/pmem0
### 4. Mount PMEM Devices
1. Create folders to mount devices
sudo mkdir /mnt/nvm
2. Mount device in DAX mode
sudo mount -o dax=always /dev/pmem0 /mnt/nvm
3. Give ownership to current user
sudo chown -R "$USER":"$USER" /mnt/nvm
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/489
More information about the panama-dev
mailing list