/*
😄 哈哈,
该总线下挂载的都是每个 cpu device 了
这样,就可以在 /sys/devices/system/cpu/ 下看到每一个 cpu device的信息了,比如 online 、offline
它有 MAJOR、MINOR吗 ?
当然没有,所以 在 device driver mode 中有下面的判断
device_add(...) {
....
if (MAJOR(dev->devt)) {
.....
}
}
*/
struct bus_type cpu_subsys = {
.name = "cpu",
.dev_name = "cpu",
.match = cpu_subsys_match,
#ifdef CONFIG_HOTPLUG_CPU
.online = cpu_subsys_online,
.offline = cpu_subsys_offline,
#endif
};
static int __ref _cpu_down(...)
{
....
/*
可调度cpu数量
*/
if (num_online_cpus() == 1)
return -EBUSY;
看一下 cpu offline 通路:
看一下 online cpu 的通路:
int device_offline(struct device *dev)
{
}