#asahi-dev · 2022-09-08 13:16
marcannot really, but MEMORY MANAGEMENT in MAINTAINERS will get you a name and a special purpose mailing list ;)#asahi-dev · 2022-09-08 13:15
marcantalking to the mm folks would be a good idea to figure out what is meaningful ;)#asahi-dev · 2022-09-08 13:13
marcan(thus: you need to talk to mm folks)#asahi-dev · 2022-09-08 13:13
marcanbecause I am not qualified to evaluate a deep VM change like this for security impact, and I am not risking that#asahi-dev · 2022-09-08 13:13
marcanI'm not going to stop you from doing whatever you want with the kernel, but don't expect us to merge it either even in our tree unless it's seriously beautiful and clearly correct :p#asahi-dev · 2022-09-08 13:12
marcanwell, thing is here we actually want things upstream so... "for the lulz" isn't really useful unless it's actually a good solution that convinces upstream to change their opinion#asahi-dev · 2022-09-08 13:11
marcanyeah lol#asahi-dev · 2022-09-08 13:11
marcanbefore trying anything#asahi-dev · 2022-09-08 13:11
marcanabout what is practical and what isn't#asahi-dev · 2022-09-08 13:11
marcanso I would highly suggest having a long discussion with the mm folks about this#asahi-dev · 2022-09-08 13:11
marcanI'm saying you should be scared given the current state of affairs :)#asahi-dev · 2022-09-08 13:11
marcanI'm not saying it's the best state of affairs#asahi-dev · 2022-09-08 13:11
marcanI mean given the reality of how Linux is developed#asahi-dev · 2022-09-08 13:10
marcanyou should be#asahi-dev · 2022-09-08 13:10
marcanthat's definitely another aspect, you're going to spend a lot more time in politics and a lot less time writing code on the kernel side#asahi-dev · 2022-09-08 13:09
marcanbut hey, if you think it will be easy to teach Linux multiple page sizes, go for it!#asahi-dev · 2022-09-08 13:09
marcan8573 instances of "struct page", all of which could assume pages are fixed size :)#asahi-dev · 2022-09-08 13:08
marcan:)#asahi-dev · 2022-09-08 13:08
marcanhave you seen what is involved in the kernel side?#asahi-dev · 2022-09-08 13:08
marcanI still think you are vastly underestimating how hard this is on the kernel side#asahi-dev · 2022-09-08 13:08
marcan"easy" kernel work lol#asahi-dev · 2022-09-08 13:08
marcanif it gets you 90% of the way there now it's worth it over being 0% of the way for years while someone figures out how to do this in the kernel, if it's even practical#asahi-dev · 2022-09-08 13:07
marcanif that's unsatisfactory, we can start talking about kernel changes, but any reasonable approach there will likely take a very long time to settle on and be implemented, if practical at all#asahi-dev · 2022-09-08 13:07
marcanit will be a lot easier and get you results much faster than any attempt at messing with the kernel#asahi-dev · 2022-09-08 13:07
marcanI say just fake 4K in userspace first, see how far that gets you#asahi-dev · 2022-09-08 13:05
marcanit is much easier to teach the kernel to allocate 16K pages for DMA than it is to teach it mixed page sizes with userspace involved#asahi-dev · 2022-09-08 13:05
marcanit is a strict hardware limit, but DMA is special anyway#asahi-dev · 2022-09-08 13:04
marcanskmp__: no, that's what the 4K support patch is for, working around that#asahi-dev · 2022-09-08 13:03
marcan(and it could still be a stepping stone towards mixed page sizes)#asahi-dev · 2022-09-08 13:03
marcanand then maybe we can have multi-pagesize kernels and distros just ship that#asahi-dev · 2022-09-08 13:03
marcanit's going to involve making a huge amount of changes to compile-time constants but at least it wouldn't require a massive rework of the VM subsystem#asahi-dev · 2022-09-08 13:03
marcana more practical thing might be to teach linux how to decide on the page size at *boot time*#asahi-dev · 2022-09-08 13:01
marcanso :)#asahi-dev · 2022-09-08 13:01
marcanwell, linux is already 10% faster than osx because osx is bad#asahi-dev · 2022-09-08 13:01
marcanit's going to be harder to convince them to have 16K kernels as an alter- yeah what jannau said#asahi-dev · 2022-09-08 13:01
marcanthey are already doing that#asahi-dev · 2022-09-08 13:00
marcanif anything I expect some corner cases with, like, pulseaudio and/or pipewire, that kind of thing#asahi-dev · 2022-09-08 13:00
marcanopengl and vulkan don't care, that all goes through GEM/whatever on the kernel side and the driver there would allocate things using the right page size#asahi-dev · 2022-09-08 12:59
marcanskmp__: I don't think that's going to be a common problem, realistically, and it would probably be something that those upstream libraries would accept fixes for (e.g. some way of determining the system *max* page size, not the *current* page size, and using that)#asahi-dev · 2022-09-08 09:05
marcanI personally don't think userspace paging makes any sense, since getting it right involves as much complexity in the kernel as just supporting 4K pages, and getting it wrong means massive security vulnerabilities.#asahi-dev · 2022-09-08 09:04
marcanso really there's two approaches here, just run in 16K mode and play around with syscalls/loader stuff to fake-support 4K as much as possible, or do the hard work of making the kernel support mixed page sizes and just run every FEX process in 4K mode (which is what Rosetta does).#asahi-dev · 2022-09-08 09:02
marcanbut that can probably be dealt with on a case by case basis#asahi-dev · 2022-09-08 09:02
marcanyou'd only have an interworking problem if those system libraries for some reason used shared memory / protocols that depend on the page size#asahi-dev · 2022-09-08 09:02
marcanskmp__: for 4K apps running with native kernel support the whole process would be 4K. system libraries built to support 16K systems can run fine on 4K kernels.#asahi-dev · 2022-09-08 06:38
marcanit's a difficult problem#asahi-dev · 2022-09-08 06:38
marcanAll approaches to this problem are going to be either incomplete or very difficult to cover all the cases :)#asahi-dev · 2022-09-08 06:33
marcanIf you just want to add support to FEX for 16K systems without kernel changes, then it's mostly just about playing with the mmap/etc wrappers and doing some ugly tricks when you get unaligned ELF sections#asahi-dev · 2022-09-08 04:40
marcanmaybe the ticket is to go the other way and start from a nominally 4K kernel, then change the allocation/tracking to always use 16K page folios by default, then figure out how to turn the kernel address space and a subset of process address spaces into 16K mode#asahi-dev · 2022-09-08 04:07
marcanone thing that did get merged semi recently is page folios, which are used in the other direction (higher order pages), but might be of use here?#asahi-dev · 2022-09-08 04:06
marcanskmp__: I honestly have no idea if you're looking to add "real" 4K support to the kernel. I imagine it won't be easy, but probably not much better resource than reading the code itself.