On Sun, Nov 20, 2022 at 3:41 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote: > > On Thu, Nov 17, 2022 at 10:36:43AM -0800, Song Liu wrote: > > On Thu, Nov 17, 2022 at 12:50 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote: > > > > > > On Mon, Nov 14, 2022 at 12:30:49PM -0800, Song Liu wrote: > > > > On Sun, Nov 13, 2022 at 2:35 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote: > > > > > > > > > > My concern is that the proposed execmem_alloc() cannot be used for > > > > > centralized handling of loading text. I'm not familiar enough with > > > > > modules/ftrace/kprobes/BPF to clearly identify the potential caveats, but > > > > > my gut feeling is that the proposed execmem_alloc() won't be an improvement > > > > > but rather a hindrance for moving to centralized handling of loading text. > > > > > > > > I don't follow why this could ever be a hindrance. Luis is very excited about > > > > this, and I am very sure it works for ftrace, kprobe, and BPF. > > > > > > Again, it's a gut feeling. But for execmem_alloc() to be a unified place of > > > code allocation, it has to work for all architectures. If architectures > > > have to override it, then where is the unification? > > > > > > The implementation you propose if great for x86, but to see it as unified > > > solution it should be good at least for the major architectures. > > > > As I mentioned earlier, folks are working on using bpf_prog_pack for BPF > > JIT on powerpc. We will also work on something similar for ARM. > > Does "something similar" mean that it won't use execmem_alloc() as is? "Something similar" means it will use execmem_alloc as is. We still need changes to the ARM JIT code, just like we need it for powerpc and x86. > > > I guess these are good enough for major architectures? > > Sorry if I wasn't clear, I referred for unified solution for all code > allocations, not only BPF, so that execmem_alloc() will eventually replace > module_alloc(). And that means it has to be able to deal with with > architecture specific requirements at least on ARM and powerpc, probably > others as well. > > > > > > It feels to me that a lot of ground work is needed to get to the point > > > > > where we can use centralized handling of loading text. > > > > > > > > Could you please be more specific on what is needed? > > > > > > The most obvious one to implement Peter's suggestion with VM_TOPDOWN_VMAP > > > so that execmem_alloc() can be actually used by modules. > > > > Current implementation is an alternative to VM_TOPDOWN_VMAP. I am > > very sure it works for modules just like VM_TOPDOWN_VMAP solution. > > It might, but it still does not. And until they do I consider these > patches as an optimization for BFP rather than unification of code > allocations. We haven't got module to use execmem_alloc yet, that's true. But this has nothing to do with VM_TOPDOWN_VMAP at all. Thanks, Song