Author Topic: kernel config: page size 4k vs 64k  (Read 559 times)

pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
kernel config: page size 4k vs 64k
« on: September 14, 2020, 05:19:55 am »
Most distributions have chosen the 4k page size for their kernels on Intel architectures.

On powerpc64le, Debian (since 2014) and Fedora are using 64k

This may be good for HPC environments but troublesome for workstation users

Here are some specific observations:

Nouveau driver apparaently won't work at all on anything other than 4k

btrfs filesystems have a sectorsize that corresponds to the page size on the host where the filesystem was created.  The filesystems can't be mounted on any host with a different page size.

Example problems:

  • you have a 6TB drive with btrfs from an x86 workstation, you want to move it to a Blackbird running the default Debian or Fedora kernel but it won't mount.
  • you install Fedora 33 with the default kernel (64k page size) and default filesystem (btrfs from Fedora 33) and later you want to recompile your kernel for 4k.  Now you can't mount your root filesystem because mkfs was run for 64k

As Fedora is going to use btrfs by default now, btrfs volumes will be more common and users are more likely to encounter frustration from time to time.

The btrfs developers recently started a patch that allows the systems with 64k page size to read a btrfs volume with 4k sectorsize.  It only works in one direction and it is read-only.

Does anybody feel that distributions should offer different permutations of their kernel and installer based on the 4k page size?

From the perspective of workstation users, are there any other strong reasons, other than Nouveau and btrfs, for distributions to consider this?
« Last Edit: September 19, 2020, 04:09:09 am by pocock »
Debian Developer

ClassicHasClass

  • Full Member
  • ***
  • Posts: 164
  • Karma: +11/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: kernel config: page size 4k vs 64k
« Reply #1 on: September 14, 2020, 08:47:48 pm »
Some emulation and virtualization tools have dependencies on page size. We had some page size issues in Firefox initially, though I think we smoked most of those out.

I'd certainly prefer a 4K page size as it's more "typical" but given RHEL's prominence on HPC POWER I can understand why Fedora ppc64le defaults to 64K as well. I certainly wouldn't expect them to do two flavours, especially since they don't even support big-endian ppc64 anymore, which I think would be more significant architecturally than page size.

FlyingBlackbird

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +0/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #2 on: September 15, 2020, 01:16:15 am »
Most distributions have chosen the 4k page size for their kernels on Intel architectures.

The btrfs developers recently started a patch that allows the systems with 64k page size to read a btrfs volume with 4k sectorsize.  It only works in one direction and it is read-only.

You are mentioning the kernel "memory" page size (`getconf PAGESIZE") and the `btrfs` file system page size.

Just to understand this issue right:

How is this related? Does `btrfs` by default (or always?) use the same file system page size as the kernel does for the memory page size?

pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #3 on: September 15, 2020, 06:29:43 am »

Yes, that is correct, the sectorsize parameter for a btrfs filesystem must be the same as PAGESIZE for the kernel

Therefore, btrfs filesystems created on systems with a 4k page size can only be used on systems with a 4k page size

btrfs filesystems created on systems with a 64k page size can only be used on systems with a 64k page size
Debian Developer

pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #4 on: September 15, 2020, 06:40:26 am »
Some emulation and virtualization tools have dependencies on page size. We had some page size issues in Firefox initially, though I think we smoked most of those out.

Maybe that is why Thunderbird is not working at all either.

Simply running a 4k kernel doesn't always fix the issues.  Sometimes it is necessary to rebuild each broken application on the host running a 4k kernel.  This is because the build scripts of some applications look at the page size during compile time and assume it will be the same for run-time and they hardcode it into the binary.

I will probably try building both the Firefox and Thunderbird packages from source on a Debian buster host running with the 4k page size.

I tried Firefox for a WebRTC call yesterday and the video was missing, I'll see if that works with the 4k page size too, with and without recompiling Firefox itself.

The two biggest concerns I heard from people about this platform are not being able to use Firefox reliably and the noise issues.  Developers are reluctant to embrace any platform that might sidetrack us from the things we are supposed to be working on.  If the noise issues can be fixed with Vikings' water cooling solution and the Firefox issues can be reined in by a 4k page size then it could make a crucial difference to the success of the platform.  It is therefore quite important to look at how to engage distributions in that solution.
Debian Developer

surf

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #5 on: September 15, 2020, 08:52:49 am »
There were pictures of water cooled IBM hardware a while back.  It seems like the CPU block would be the only non-standard part.  Can Raptor get these from IBM?


pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #6 on: September 15, 2020, 05:22:39 pm »
(I modified the code last night, now it builds 64k and 4k kernels as two different flavours so you can install both on the same system and choose between them in the petitboot menu, the 4k kernel file has 4k in the filename and ABI string)

Here is my patch for building a Debian kernel package with the 4k page size, like other architectures

To use it:

Code: [Select]
mkdir -p ~/ws/kernel
cd ~/ws/kernel
wget http://deb.debian.org/debian/pool/main/l/linux/linux_4.19.132.orig.tar.xz
xzcat linux_4.19.132.orig.tar.xz | tar xf -
git clone https://gitlab.com/dpocock/linux-kernel-debian
cd linux-kernel-debian
git checkout pocock/buster-ppc64el-4k
cd ../linux-4.19.132
ln -s ../linux-kernel-debian/debian .
dpkg-buildpackage -rfakeroot -i.* --no-sign -b -j`grep -c ^processor /proc/cpuinfo`
cd ..

You should find the packages *.deb in ~/ws/kernel

You can just install it with dpkg and reboot into the kernel with 4k page size

Beware: if you have a btrfs root filesystem with sectorsize=64, the kernel with 4k page size can't mount it.  If your root filesystem is ext4 it will just work.

If people are comfortable with this change then it will be a good idea to open bug reports for the kernel packaging teams in each of the relevant distributions.
« Last Edit: September 17, 2020, 01:50:05 am by pocock »
Debian Developer

pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #7 on: September 16, 2020, 02:17:02 am »
Today I made some tests comparing Firefox WebRTC on 64k and 4k page size

With a Logitech webcam, I found both 64k and 4k worked

With Elgato Camlink 4k, v4l2-loopback and my gstreamer script, I found it only worked on 4k.  With 64k, Firefox displayed the local monitor / self-view from the Camlink but the remote host wasn't receiving the picture.  Firefox was receiving the picture from the remote host, so this was a one-way video problem.

The gstreamer script is a very simple chroma-key example, it is not OBS but then it is less than 10 lines of code.
Debian Developer

ClassicHasClass

  • Full Member
  • ***
  • Posts: 164
  • Karma: +11/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: kernel config: page size 4k vs 64k
« Reply #8 on: September 16, 2020, 07:02:22 pm »
Maybe that is why Thunderbird is not working at all either.

These were pretty low-level changes, so I don't know if they're what's blocking Thunderbird. But I run and test Firefox all the time. Perhaps, if there's interest, I can provide my binaries (I already provide my .mozconfigs).

pocock

  • Full Member
  • ***
  • Posts: 168
  • Karma: +19/-0
    • View Profile
Re: kernel config: page size 4k vs 64k
« Reply #9 on: September 17, 2020, 11:58:07 am »
Debian Developer