linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Linton <jeremy.linton@arm.com>
To: Robert Richter <rric@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, lorenzo.pieralisi@arm.com,
	catalin.marinas@arm.com, rjw@rjwysocki.net,
	linux-acpi@vger.kernel.org, sudeep.holla@arm.com,
	will@kernel.org, lenb@kernel.org
Subject: Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
Date: Fri, 2 Aug 2019 11:04:59 -0500	[thread overview]
Message-ID: <f481feb9-faa9-ca7f-89b9-e23141129561@arm.com> (raw)
In-Reply-To: <20190802134427.dmclik66zcgxapy3@rric.localdomain>

Hi,


On 8/2/19 8:44 AM, Robert Richter wrote:
> On 31.07.19 22:46:34, Jeremy Linton wrote:
> 
>> @@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
>>   		if (topology_id < 0)
>>   			return topology_id;
>>   
>> +		is_threaded = acpi_pptt_cpu_is_thread(cpu);
>> +		if (is_threaded < 0)
>> +			is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
>> +
> 
> I think the return code handling is error-prone, as in the kernel such
> functions are typically used like:
> 
> 	if (something_is_thread) { ... }

I don't really understand why this keeps getting repeated. The negative 
error code return is used by huge swaths of the kernel API. A couple 
lines up the exact same paradigm is used in get_cpu_for_node() and a few 
other places.

> 
> I see this is due to acpi and arch code separation so we cannot simply
> move the fallback to pptt code.

Right, the PPTT->arch data structure translation is arch specific. 
During the initial PPTT drop a lot of discussion when into how arm64 was 
doing that translation, as well as the corresponding translation to the 
core scheduler/etc.

> 
> So maybe we have a static function cpu_is_thread() in this file that
> handles all the logic and directly use check_acpi_cpu_flag() from
> there. However, code may change here in case of a rework as I
> suggested in patch #1. In both cases the acpi api is more straight
> then.

I'm ok with that, it effectively only moves those three lines to a 
standalone single call-site function. To be clear, that isn't a generic 
routine for anyone to call. Functions that need to know if the core is a 
threaded should be checking the topology thread_id directly rather than 
re-coding the acpi/dt/mpidr logic which populates it.


> 
> -Robert
> 
>>   		if (is_threaded) {
>>   			cpu_topology[cpu].thread_id = topology_id;
>>   			topology_id = find_acpi_cpu_topology(cpu, 1);


  reply	other threads:[~2019-08-02 16:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01  3:46 [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton
2019-08-01  3:46 ` [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Jeremy Linton
2019-08-01 15:57   ` Sudeep Holla
2019-08-01 16:10     ` Jeremy Linton
2019-08-02 13:05   ` Robert Richter
2019-08-02 15:36     ` Jeremy Linton
2019-08-01  3:46 ` [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread Jeremy Linton
2019-08-01 15:58   ` Sudeep Holla
2019-08-02 13:44   ` Robert Richter
2019-08-02 16:04     ` Jeremy Linton [this message]
2019-08-08 20:40 [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton
2019-08-08 20:40 ` [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread Jeremy Linton
2019-08-08 22:23   ` Robert Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f481feb9-faa9-ca7f-89b9-e23141129561@arm.com \
    --to=jeremy.linton@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=rric@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).