[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221116235455.74nqyfdcqe72mhbi@box.shutemov.name>
Date: Thu, 17 Nov 2022 02:54:55 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Vishal Verma <vishal.l.verma@...el.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-kernel@...r.kernel.org,
Chris Piper <chris.d.piper@...el.com>, nvdimm@...ts.linux.dev,
linux-acpi@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>,
Liu Shixin <liushixin2@...wei.com>, stable@...r.kernel.org
Subject: Re: [PATCH v2 2/2] ACPI: HMAT: Fix initiator registration for
single-initiator systems
On Wed, Nov 16, 2022 at 04:37:37PM -0700, Vishal Verma wrote:
> 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: <stable@...r.kernel.org>
> Cc: Rafael J. Wysocki <rafael@...nel.org>
> Cc: Liu Shixin <liushixin2@...wei.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Reported-by: Chris Piper <chris.d.piper@...el.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@...el.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists