diff mbox series

[v3,3/3] s390x: optimization of the check for CPU topology change

Message ID 1627979206-32663-4-git-send-email-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: KVM: CPU Topology | expand

Commit Message

Pierre Morel Aug. 3, 2021, 8:26 a.m. UTC
Now that the PTF instruction is interpreted by the SIE we can optimize
the arch_update_cpu_topology callback to check if there is a real need
to update the topology by using the PTF instruction.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 arch/s390/kernel/topology.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Heiko Carstens Aug. 3, 2021, 8:42 a.m. UTC | #1
On Tue, Aug 03, 2021 at 10:26:46AM +0200, Pierre Morel wrote:
> Now that the PTF instruction is interpreted by the SIE we can optimize
> the arch_update_cpu_topology callback to check if there is a real need
> to update the topology by using the PTF instruction.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  arch/s390/kernel/topology.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
> index 26aa2614ee35..741cb447e78e 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -322,6 +322,9 @@ int arch_update_cpu_topology(void)
>  	struct device *dev;
>  	int cpu, rc;
>  
> +	if (!ptf(PTF_CHECK))
> +		return 0;
> +

We have a timer which checks if topology changed and then triggers a
call to arch_update_cpu_topology() via rebuild_sched_domains().
With this change topology changes would get lost.
Pierre Morel Aug. 3, 2021, 8:57 a.m. UTC | #2
On 8/3/21 10:42 AM, Heiko Carstens wrote:
> On Tue, Aug 03, 2021 at 10:26:46AM +0200, Pierre Morel wrote:
>> Now that the PTF instruction is interpreted by the SIE we can optimize
>> the arch_update_cpu_topology callback to check if there is a real need
>> to update the topology by using the PTF instruction.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   arch/s390/kernel/topology.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
>> index 26aa2614ee35..741cb447e78e 100644
>> --- a/arch/s390/kernel/topology.c
>> +++ b/arch/s390/kernel/topology.c
>> @@ -322,6 +322,9 @@ int arch_update_cpu_topology(void)
>>   	struct device *dev;
>>   	int cpu, rc;
>>   
>> +	if (!ptf(PTF_CHECK))
>> +		return 0;
>> +
> 
> We have a timer which checks if topology changed and then triggers a
> call to arch_update_cpu_topology() via rebuild_sched_domains().
> With this change topology changes would get lost.

For my understanding, if PTF check return 0 it means that there are no 
topology changes.
So they could not get lost.

What did I miss?
Pierre Morel Aug. 3, 2021, 9:28 a.m. UTC | #3
On 8/3/21 10:57 AM, Pierre Morel wrote:
> 
> 
> On 8/3/21 10:42 AM, Heiko Carstens wrote:
>> On Tue, Aug 03, 2021 at 10:26:46AM +0200, Pierre Morel wrote:
>>> Now that the PTF instruction is interpreted by the SIE we can optimize
>>> the arch_update_cpu_topology callback to check if there is a real need
>>> to update the topology by using the PTF instruction.
>>>
>>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>>> ---
>>>   arch/s390/kernel/topology.c | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
>>> index 26aa2614ee35..741cb447e78e 100644
>>> --- a/arch/s390/kernel/topology.c
>>> +++ b/arch/s390/kernel/topology.c
>>> @@ -322,6 +322,9 @@ int arch_update_cpu_topology(void)
>>>       struct device *dev;
>>>       int cpu, rc;
>>> +    if (!ptf(PTF_CHECK))
>>> +        return 0;
>>> +
>>
>> We have a timer which checks if topology changed and then triggers a
>> call to arch_update_cpu_topology() via rebuild_sched_domains().
>> With this change topology changes would get lost.
> 
> For my understanding, if PTF check return 0 it means that there are no 
> topology changes.
> So they could not get lost.
> 
> What did I miss?
> 
> 
I missed that PTF clears the MCTR... and only one of the two calls will 
return 1 while we need both to return 1...
diff mbox series

Patch

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 26aa2614ee35..741cb447e78e 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -322,6 +322,9 @@  int arch_update_cpu_topology(void)
 	struct device *dev;
 	int cpu, rc;
 
+	if (!ptf(PTF_CHECK))
+		return 0;
+
 	rc = __arch_update_cpu_topology();
 	on_each_cpu(__arch_update_dedicated_flag, NULL, 0);
 	for_each_online_cpu(cpu) {