Pull driver core fixes from Greg KH: "Here are two small driver core cacheinfo fixes for 6.4-rc5 that resolve a number of reported issues with that file. These changes have been in linux-next this past week with no reported problems" * tag 'driver-core-6.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: drivers: base: cacheinfo: Update cpu_map_populated during CPU Hotplug drivers: base: cacheinfo: Fix shared_cpu_map changes in event of CPU hotplug
Unified · Split
| @@ -388,6 +388,16 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) · 387 unmodified lines | |||
| 388 | continue;/* skip if itself or no cacheinfo */ | 388 | continue;/* skip if itself or no cacheinfo */ |
| 389 | for (sib_index = 0; sib_index < cache_leaves(i); sib_index++) { | 389 | for (sib_index = 0; sib_index < cache_leaves(i); sib_index++) { |
| 390 | sib_leaf = per_cpu_cacheinfo_idx(i, sib_index); | 390 | sib_leaf = per_cpu_cacheinfo_idx(i, sib_index); |
| 391 | |||
| 392 | /* | ||
| 393 | * Comparing cache IDs only makes sense if the leaves | ||
| 394 | * belong to the same cache level of same type. Skip | ||
| 395 | * the check if level and type do not match. | ||
| 396 | */ | ||
| 397 | if (sib_leaf->level != this_leaf->level || | ||
| 398 | sib_leaf->type != this_leaf->type) | ||
| 399 | continue; | ||
| 400 | |||
| 391 | if (cache_leaves_are_shared(this_leaf, sib_leaf)) { | 401 | if (cache_leaves_are_shared(this_leaf, sib_leaf)) { |
| 392 | cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); | 402 | cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); |
| 393 | cpumask_set_cpu(i, &this_leaf->shared_cpu_map); | 403 | cpumask_set_cpu(i, &this_leaf->shared_cpu_map); |
| @@ -400,11 +410,14 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) · 6 unmodified lines | |||
| 400 | coherency_max_size = this_leaf->coherency_line_size; | 410 | coherency_max_size = this_leaf->coherency_line_size; |
| 401 | } | 411 | } |
| 402 | 412 | ||
| 413 | /* shared_cpu_map is now populated for the cpu */ | ||
| 414 | this_cpu_ci->cpu_map_populated = true; | ||
| 403 | return 0; | 415 | return 0; |
| 404 | } | 416 | } |
| 405 | 417 | ||
| 406 | static void cache_shared_cpu_map_remove(unsigned int cpu) | 418 | static void cache_shared_cpu_map_remove(unsigned int cpu) |
| 407 | { | 419 | { |
| 420 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
| 408 | struct cacheinfo *this_leaf, *sib_leaf; | 421 | struct cacheinfo *this_leaf, *sib_leaf; |
| 409 | unsigned int sibling, index, sib_index; | 422 | unsigned int sibling, index, sib_index; |
| 410 | 423 | ||
| @@ -419,6 +432,16 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 8 unmodified lines | |||
| 419 | 432 | ||
| 420 | for (sib_index = 0; sib_index < cache_leaves(sibling); sib_index++) { | 433 | for (sib_index = 0; sib_index < cache_leaves(sibling); sib_index++) { |
| 421 | sib_leaf = per_cpu_cacheinfo_idx(sibling, sib_index); | 434 | sib_leaf = per_cpu_cacheinfo_idx(sibling, sib_index); |
| 435 | |||
| 436 | /* | ||
| 437 | * Comparing cache IDs only makes sense if the leaves | ||
| 438 | * belong to the same cache level of same type. Skip | ||
| 439 | * the check if level and type do not match. | ||
| 440 | */ | ||
| 441 | if (sib_leaf->level != this_leaf->level || | ||
| 442 | sib_leaf->type != this_leaf->type) | ||
| 443 | continue; | ||
| 444 | |||
| 422 | if (cache_leaves_are_shared(this_leaf, sib_leaf)) { | 445 | if (cache_leaves_are_shared(this_leaf, sib_leaf)) { |
| 423 | cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); | 446 | cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); |
| 424 | cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map); | 447 | cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map); |
| @@ -427,6 +450,9 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 2 unmodified lines | |||
| 427 | } | 450 | } |
| 428 | } | 451 | } |
| 429 | } | 452 | } |
| 453 | |||
| 454 | /* cpu is no longer populated in the shared map */ | ||
| 455 | this_cpu_ci->cpu_map_populated = false; | ||
| 430 | } | 456 | } |
| 431 | 457 | ||
| 432 | static void free_cache_attributes(unsigned int cpu) | 458 | static void free_cache_attributes(unsigned int cpu) |