numa.c (9b12dfa03a94d7f7a4b54eb67229a31e58193384) | numa.c (c412a48d4d91e8f8b89aae02de0f44f1f0b729e5) |
---|---|
1/* 2 * NUMA parameter parsing routines 3 * 4 * Copyright (c) 2014 Fujitsu Ltd. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 365 unchanged lines hidden (view full) --- 374 lb_data.data = node->bandwidth; 375 } else { 376 assert(0); 377 } 378 379 g_array_append_val(hmat_lb->list, lb_data); 380} 381 | 1/* 2 * NUMA parameter parsing routines 3 * 4 * Copyright (c) 2014 Fujitsu Ltd. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 365 unchanged lines hidden (view full) --- 374 lb_data.data = node->bandwidth; 375 } else { 376 assert(0); 377 } 378 379 g_array_append_val(hmat_lb->list, lb_data); 380} 381 |
382void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node, 383 Error **errp) 384{ 385 int nb_numa_nodes = ms->numa_state->num_nodes; 386 NodeInfo *numa_info = ms->numa_state->nodes; 387 NumaHmatCacheOptions *hmat_cache = NULL; 388 389 if (node->node_id >= nb_numa_nodes) { 390 error_setg(errp, "Invalid node-id=%" PRIu32 ", it should be less " 391 "than %d", node->node_id, nb_numa_nodes); 392 return; 393 } 394 395 if (numa_info[node->node_id].lb_info_provided != (BIT(0) | BIT(1))) { 396 error_setg(errp, "The latency and bandwidth information of " 397 "node-id=%" PRIu32 " should be provided before memory side " 398 "cache attributes", node->node_id); 399 return; 400 } 401 402 if (node->level < 1 || node->level >= HMAT_LB_LEVELS) { 403 error_setg(errp, "Invalid level=%" PRIu8 ", it should be larger than 0 " 404 "and less than or equal to %d", node->level, 405 HMAT_LB_LEVELS - 1); 406 return; 407 } 408 409 assert(node->associativity < HMAT_CACHE_ASSOCIATIVITY__MAX); 410 assert(node->policy < HMAT_CACHE_WRITE_POLICY__MAX); 411 if (ms->numa_state->hmat_cache[node->node_id][node->level]) { 412 error_setg(errp, "Duplicate configuration of the side cache for " 413 "node-id=%" PRIu32 " and level=%" PRIu8, 414 node->node_id, node->level); 415 return; 416 } 417 418 if ((node->level > 1) && 419 ms->numa_state->hmat_cache[node->node_id][node->level - 1] && 420 (node->size >= 421 ms->numa_state->hmat_cache[node->node_id][node->level - 1]->size)) { 422 error_setg(errp, "Invalid size=%" PRIu64 ", the size of level=%" PRIu8 423 " should be less than the size(%" PRIu64 ") of " 424 "level=%u", node->size, node->level, 425 ms->numa_state->hmat_cache[node->node_id] 426 [node->level - 1]->size, 427 node->level - 1); 428 return; 429 } 430 431 if ((node->level < HMAT_LB_LEVELS - 1) && 432 ms->numa_state->hmat_cache[node->node_id][node->level + 1] && 433 (node->size <= 434 ms->numa_state->hmat_cache[node->node_id][node->level + 1]->size)) { 435 error_setg(errp, "Invalid size=%" PRIu64 ", the size of level=%" PRIu8 436 " should be larger than the size(%" PRIu64 ") of " 437 "level=%u", node->size, node->level, 438 ms->numa_state->hmat_cache[node->node_id] 439 [node->level + 1]->size, 440 node->level + 1); 441 return; 442 } 443 444 hmat_cache = g_malloc0(sizeof(*hmat_cache)); 445 memcpy(hmat_cache, node, sizeof(*hmat_cache)); 446 ms->numa_state->hmat_cache[node->node_id][node->level] = hmat_cache; 447} 448 |
|
382void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) 383{ 384 Error *err = NULL; 385 MachineClass *mc = MACHINE_GET_CLASS(ms); 386 387 if (!mc->numa_mem_supported) { 388 error_setg(errp, "NUMA is not supported by this machine-type"); 389 goto end; --- 35 unchanged lines hidden (view full) --- 425 return; 426 } 427 428 parse_numa_hmat_lb(ms->numa_state, &object->u.hmat_lb, &err); 429 if (err) { 430 goto end; 431 } 432 break; | 449void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) 450{ 451 Error *err = NULL; 452 MachineClass *mc = MACHINE_GET_CLASS(ms); 453 454 if (!mc->numa_mem_supported) { 455 error_setg(errp, "NUMA is not supported by this machine-type"); 456 goto end; --- 35 unchanged lines hidden (view full) --- 492 return; 493 } 494 495 parse_numa_hmat_lb(ms->numa_state, &object->u.hmat_lb, &err); 496 if (err) { 497 goto end; 498 } 499 break; |
500 case NUMA_OPTIONS_TYPE_HMAT_CACHE: 501 if (!ms->numa_state->hmat_enabled) { 502 error_setg(errp, "ACPI Heterogeneous Memory Attribute Table " 503 "(HMAT) is disabled, enable it with -machine hmat=on " 504 "before using any of hmat specific options"); 505 return; 506 } 507 508 parse_numa_hmat_cache(ms, &object->u.hmat_cache, &err); 509 if (err) { 510 goto end; 511 } 512 break; |
|
433 default: 434 abort(); 435 } 436 437end: 438 error_propagate(errp, err); 439} 440 --- 413 unchanged lines hidden --- | 513 default: 514 abort(); 515 } 516 517end: 518 error_propagate(errp, err); 519} 520 --- 413 unchanged lines hidden --- |