Commit 48d4180
ACPI: HMAT: Fix initiator registration for single-initiator systems
In a system with a single initiator node, and one or more memory-only
'target' nodes, the memory-only node(s) would fail to register their
initiator node correctly. i.e. in sysfs:
# ls /sys/devices/system/node/node0/access0/targets/
node0
Where as the correct behavior should be:
# ls /sys/devices/system/node/node0/access0/targets/
node0 node1
This happened because hmat_register_target_initiators() uses list_sort()
to sort the initiator list, but the sort comparision function
(initiator_cmp()) is overloaded to also set the node mask's bits.
In a system with a single initiator, the list is singular, and list_sort
elides the comparision helper call. Thus the node mask never gets set,
and the subsequent search for the best initiator comes up empty.
Add a new helper to consume the sorted initiator list, and generate the
nodemask, decoupling it from the overloaded initiator_cmp() comparision
callback. This prevents the singular list corner case naturally, and
makes the code easier to follow as well.
Cc: <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Liu Shixin <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Reported-by: Chris Piper <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dan Williams <[email protected]>1 parent 14f16d4 commit 48d4180
1 file changed
+20
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
566 | 565 | | |
567 | 566 | | |
568 | 567 | | |
569 | 568 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | 569 | | |
574 | 570 | | |
575 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
576 | 585 | | |
577 | 586 | | |
578 | 587 | | |
| |||
609 | 618 | | |
610 | 619 | | |
611 | 620 | | |
612 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
613 | 625 | | |
614 | 626 | | |
615 | 627 | | |
| |||
643 | 655 | | |
644 | 656 | | |
645 | 657 | | |
646 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
647 | 661 | | |
648 | 662 | | |
649 | 663 | | |
| |||
0 commit comments