Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace MTD flash drives with PMEM drives #32

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configs/default-linux-config
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CONFIG_VIRTIO_NET=y
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
CONFIG_HVC_RISCV_SBI=y
# CONFIG_HW_RANDOM is not set
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
CONFIG_RANDOM_TRUST_BOOTLOADER=y
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
CONFIG_VIRTIO_MMIO=y
Expand All @@ -55,6 +55,7 @@ CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT4_FS=y
# CONFIG_PROC_PAGE_MONITOR is not set
CONFIG_TMPFS=y
CONFIG_HUGETLBFS=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this screw with our TLB implementation?

Copy link
Contributor Author

@edubart edubart Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problems with this, we can use 2MB pages without problems even while only supporting 4KB pages in our TLB, because we have a conservative implementation of TLB that shootdown more than it could. And I already have tested this for a while now.

Actually this config is orthogonal to this PR and the init system, but it is used in World Arcade, and other dapps I am coding. I think we should enable this by default because it enables a way to map fixed physical pages to virtual memory in userspace with minimal overhead, useful for some advanced dapps that needs to write/read to programs in userspace from outside.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using huge pages for this feels like a hack. You could use UIO for this instead.

  • You can have physically mapped memory into you dapp, emulator defines to where (via dtb).
  • Optionally have multiple separate regions.
  • Of arbitrary sizes.

It requires a dtb entry and the CONFIG_UIO and CONFIG_UIO_PDRV_GENIRQ kernel configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a hack until we have a better way to do this, could be with custom DTB entries like you said, but this will require a new emulator feature to insert custom entries in DTB.

# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity"
Expand Down