monitor_init: Use ihk_mc_cpu_info()

Its call site is moved before numa_init() as well because
monitor_init() defines ihk_os_monitor that was used in
rusage_total_memory_add() called from numa_init().
I didn't revert this modification because I don't want to touch the
working code.

Change-Id: I602467284581ce45989dd071cfe59d3fc4827e29
Fujitsu: POSTK_DEBUG_TEMP_FIX_73
This commit is contained in:
Masamichi Takagi
2019-01-28 11:06:58 +09:00
committed by Dominique Martinet
parent 8db2d3beec
commit 39b21e7ba9
2 changed files with 0 additions and 24 deletions

View File

@ -207,15 +207,10 @@ static void time_init(void)
return;
}
#ifdef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
void monitor_init(void)
#else /* POSTK_DEBUG_TEMP_FIX_73 */
static void monitor_init()
#endif /* POSTK_DEBUG_TEMP_FIX_73 */
{
int z;
unsigned long phys;
#ifdef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
const struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
if (!cpu_info) {
@ -233,18 +228,6 @@ static void monitor_init()
ihk_set_monitor(phys, sizeof(struct ihk_os_monitor) +
sizeof(struct ihk_os_cpu_monitor) * cpu_info->ncpus);
return;
#else /* POSTK_DEBUG_TEMP_FIX_73 */
z = sizeof(struct ihk_os_monitor) +
sizeof(struct ihk_os_cpu_monitor) * num_processors;
z = (z + PAGE_SIZE -1) >> PAGE_SHIFT;
monitor = ihk_mc_alloc_pages(z, IHK_MC_AP_CRITICAL);
memset(monitor, 0, z * PAGE_SIZE);
monitor->num_processors = num_processors;
phys = virt_to_phys(monitor);
ihk_set_monitor(phys, sizeof(struct ihk_os_monitor) +
sizeof(struct ihk_os_cpu_monitor) * num_processors);
#endif /* POSTK_DEBUG_TEMP_FIX_73 */
}
int nmi_mode;
@ -272,9 +255,6 @@ static void rest_init(void)
#endif
ap_init();
#ifndef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
monitor_init();
#endif /* !POSTK_DEBUG_TEMP_FIX_73 */
cpu_local_var_init();
nmi_init();
uti_init();

View File

@ -1755,14 +1755,10 @@ static void rusage_init()
dkprintf("%s: rusage->total_memory=%ld\n", __FUNCTION__, rusage->total_memory);
}
#ifdef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
extern void monitor_init(void);
#endif /* POSTK_DEBUG_TEMP_FIX_73 */
void mem_init(void)
{
#ifdef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
monitor_init();
#endif /* !POSTK_DEBUG_TEMP_FIX_73 */
/* It must precedes numa_init() because rusage->total_memory is initialized in numa_init() */
rusage_init();