【问题标题】:Writing per-cpu variables physical address during kernel initialization在内核初始化期间写入每个 cpu 变量的物理地址
【发布时间】:2018-03-26 07:03:55
【问题描述】:

我有以下代码:

static DEFINE_PER_CPU_ALIGNED(cpu_clock_t, cpu_clock);

static void func(void *info)
{
        uint64_t cpu_clock_pa = per_cpu_ptr_to_phys(get_cpu_ptr(&cpu_clock));
        __asm__ __volatile__ ... //Giving the PA to VMware kernel which is supposed to write something to there
        put_cpu_ptr(cpu_clock);
}

问题是,当此代码作为内核初始化的一部分运行时,我在 VMware 工作站中收到一条消息“客户操作系统上的 CPU 已禁用”,这意味着发生了一些内核恐慌,并且当我在内核启动(将其称为模块初始化的一部分)它工作正常......

【问题讨论】:

  • 您是否检查过内核初始化在您的func 之前到达setup_per_cpu_areas
  • 呵呵,不知道需要特殊设置,谢谢!

标签: linux-kernel kernel


【解决方案1】:

正如 a3f 指出的那样,我的代码在 setup_per_cpu_areas 之前运行。

【讨论】:

    猜你喜欢
    • 2018-06-23
    • 2013-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 2012-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多