On Thu 10-09-20 15:51:07, Michal Hocko wrote: > On Thu 10-09-20 15:39:00, Oscar Salvador wrote: > > On Thu, Sep 10, 2020 at 02:48:47PM +0200, Michal Hocko wrote: [...] > > > Forgot to ask one more thing. Who is going to online that memory when > > > userspace is not running yet? > > > > Depends, if you have CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE set or you specify > > memhp_default_online_type=[online,online_*], memory will get onlined right > > after hot-adding stage: > > > > /* online pages if requested */ > > if (memhp_default_online_type != MMOP_OFFLINE) > > walk_memory_blocks(start, size, NULL, online_memory_block); > > > > If not, systemd-udev will do the magic once the system is up. > > Does that imply that we need udev to scan all existing devices and > reprobe them? I've checked the sysfs side of things and it seems that the KOBJ_ADD event gets lost because there are no listeners (create_memory_block_devices -> .... -> device_register -> ... -> device_add -> kobject_uevent(&dev->kobj, KOBJ_ADD) -> kobject_uevent_net_broadcast). So the only way to find out about those devices once the init is up and something than intercept those events is to rescan devices. This is really unfortunate because this solution really doesn't scale with most usecases which do not do early boot hotplug and this can get more than interesting on machines like ppc which have gazillions of memory block devices because they use insanly small blocks and just imagine a multi TB machine how that scales. Sigh... -- Michal Hocko SUSE Labs