linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: Change the return type of acpi_map_cpu2node to void
@ 2022-06-10 10:44 Li kunyu
  2022-06-10 12:35 ` Dave Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Li kunyu @ 2022-06-10 10:44 UTC (permalink / raw)
  To: chenhuacai, rafael, len.brown, pavel, mingo, bp
  Cc: tglx, dave.hansen, x86, hpa, linux-ia64, linux-kernel, linux-pm,
	Li kunyu

Reduce eax register calls by removing unused return values.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 arch/ia64/kernel/acpi.c      | 3 +--
 arch/loongarch/kernel/acpi.c | 3 +--
 arch/x86/kernel/acpi/boot.c  | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 96d13cb7c19f..2665cc873f0a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -712,7 +712,7 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
  *  ACPI based hotplug CPU support
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	/*
@@ -725,7 +725,6 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	node_cpuid[cpu].phys_id = physid;
 	node_cpuid[cpu].nid = acpi_get_node(handle);
 #endif
-	return 0;
 }
 
 int additional_cpus __initdata = -1;
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index b16c3dea5eeb..369b49343563 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -282,7 +282,7 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
 
 #include <acpi/processor.h>
 
-static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -295,7 +295,6 @@ static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		cpumask_set_cpu(cpu, cpumask_of_node(nid));
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 907cc98b1938..d63ec3ea3be3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -799,7 +799,7 @@ static void __init acpi_set_irq_model_ioapic(void)
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 #include <acpi/processor.h>
 
-static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -810,7 +810,6 @@ static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		numa_set_node(cpu, nid);
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Change the return type of acpi_map_cpu2node to void
  2022-06-10 10:44 [PATCH] x86: Change the return type of acpi_map_cpu2node to void Li kunyu
@ 2022-06-10 12:35 ` Dave Hansen
  2022-06-10 14:21   ` Peter Zijlstra
  2022-06-10 15:17   ` Li kunyu
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Hansen @ 2022-06-10 12:35 UTC (permalink / raw)
  To: Li kunyu, chenhuacai, rafael, len.brown, pavel, mingo, bp
  Cc: tglx, dave.hansen, x86, hpa, linux-ia64, linux-kernel, linux-pm

On 6/10/22 03:44, Li kunyu wrote:
> Reduce eax register calls by removing unused return values.

Please stop sending these patches, at least with these repetitive,
inaccurate descriptions.

This patch has *ZERO* to do with EAX.  For one, it's patching two
architectures that might not even have an EAX.  (I'm blissfully unaware
of what the ia64 calling conventions are and I want to keep it that way.)

Second, (and this is important), look carefully at the function in question:

static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)

See the "static"?  That tells the compiler that acpi_map_cpu2node() is
only used locally.  It lets the compiler do all kinds of fancy things,
like inline the function which allows the compiler to do all kinds of
fun optimizations.  Now, armed with that knowledge, please take a look
at what effect your patch has in practice.

Take your patch, and disassemble acpi_map_cpu() before and after
applying it.  First of all, even before your patch, do you see a:

	call ffffffff81d0000d <acpi_map_cpu2node>

?

Do you see a call to numa_set_node()?  That's odd considering that
acpi_map_cpu() doesn't directly call numa_set_node().  Right?  Do you
see unnecessary manipulation of EAX?  Now, apply your patch.
Disassemble the function again.  What changed?

Now, armed with the knowledge of what your patch actually does to the
code, would you like to try and write a better changelog?  Or, better
yet, maybe it will dissuade you from sending this again.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Change the return type of acpi_map_cpu2node to void
  2022-06-10 12:35 ` Dave Hansen
@ 2022-06-10 14:21   ` Peter Zijlstra
  2022-06-10 15:17   ` Li kunyu
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2022-06-10 14:21 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Li kunyu, chenhuacai, rafael, len.brown, pavel, mingo, bp, tglx,
	dave.hansen, x86, hpa, linux-ia64, linux-kernel, linux-pm

On Fri, Jun 10, 2022 at 05:35:29AM -0700, Dave Hansen wrote:
> On 6/10/22 03:44, Li kunyu wrote:
> > Reduce eax register calls by removing unused return values.
> 
> Please stop sending these patches, at least with these repetitive,
> inaccurate descriptions.

Dave, just add them to the /dev/null mailbox.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: Change the return type of acpi_map_cpu2node to void
  2022-06-10 12:35 ` Dave Hansen
  2022-06-10 14:21   ` Peter Zijlstra
@ 2022-06-10 15:17   ` Li kunyu
  1 sibling, 0 replies; 6+ messages in thread
From: Li kunyu @ 2022-06-10 15:17 UTC (permalink / raw)
  To: dave.hansen
  Cc: bp, chenhuacai, dave.hansen, hpa, kunyu, len.brown, linux-ia64,
	linux-kernel, linux-pm, mingo, pavel, rafael, tglx, x86


I'm really sorry, Dave. My email prompted abnormal sending (when I sent patch before), so I sent it three times, but there was no abnormal message for the third time.

Static functions are called from the current source file, and their basic functions are similar to global functions (perhaps I don't fully understand).

In addition, the x86 architecture is EAX in the IA64 architecture did not pay much attention, which is my oversight.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] x86: Change the return type of acpi_map_cpu2node to void
@ 2022-06-10 10:43 Li kunyu
  0 siblings, 0 replies; 6+ messages in thread
From: Li kunyu @ 2022-06-10 10:43 UTC (permalink / raw)
  To: chenhuacai, rafael, len.brown, pavel, mingo, bp
  Cc: kernel, tglx, dave.hansen, x86, hpa, linux-ia64, linux-kernel,
	linux-pm, Li kunyu

Reduce eax register calls by removing unused return values.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 arch/ia64/kernel/acpi.c      | 3 +--
 arch/loongarch/kernel/acpi.c | 3 +--
 arch/x86/kernel/acpi/boot.c  | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 96d13cb7c19f..2665cc873f0a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -712,7 +712,7 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
  *  ACPI based hotplug CPU support
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	/*
@@ -725,7 +725,6 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	node_cpuid[cpu].phys_id = physid;
 	node_cpuid[cpu].nid = acpi_get_node(handle);
 #endif
-	return 0;
 }
 
 int additional_cpus __initdata = -1;
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index b16c3dea5eeb..369b49343563 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -282,7 +282,7 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
 
 #include <acpi/processor.h>
 
-static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -295,7 +295,6 @@ static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		cpumask_set_cpu(cpu, cpumask_of_node(nid));
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 907cc98b1938..d63ec3ea3be3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -799,7 +799,7 @@ static void __init acpi_set_irq_model_ioapic(void)
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 #include <acpi/processor.h>
 
-static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -810,7 +810,6 @@ static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		numa_set_node(cpu, nid);
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] x86: Change the return type of acpi_map_cpu2node to void
@ 2022-06-10 10:36 Li kunyu
  0 siblings, 0 replies; 6+ messages in thread
From: Li kunyu @ 2022-06-10 10:36 UTC (permalink / raw)
  To: chenhuacai, kernel, rafael, len.brown, pavel, tglx, mingo, bp,
	dave.hansen, x86, hpa
  Cc: linux-ia64, linux-kernel, linux-pm, Li kunyu

Reduce eax register calls by removing unused return values.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
 arch/ia64/kernel/acpi.c      | 3 +--
 arch/loongarch/kernel/acpi.c | 3 +--
 arch/x86/kernel/acpi/boot.c  | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 96d13cb7c19f..2665cc873f0a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -712,7 +712,7 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
  *  ACPI based hotplug CPU support
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	/*
@@ -725,7 +725,6 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	node_cpuid[cpu].phys_id = physid;
 	node_cpuid[cpu].nid = acpi_get_node(handle);
 #endif
-	return 0;
 }
 
 int additional_cpus __initdata = -1;
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index b16c3dea5eeb..369b49343563 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -282,7 +282,7 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
 
 #include <acpi/processor.h>
 
-static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -295,7 +295,6 @@ static int __ref acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		cpumask_set_cpu(cpu, cpumask_of_node(nid));
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 907cc98b1938..d63ec3ea3be3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -799,7 +799,7 @@ static void __init acpi_set_irq_model_ioapic(void)
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 #include <acpi/processor.h>
 
-static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
 	int nid;
@@ -810,7 +810,6 @@ static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 		numa_set_node(cpu, nid);
 	}
 #endif
-	return 0;
 }
 
 int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-10 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 10:44 [PATCH] x86: Change the return type of acpi_map_cpu2node to void Li kunyu
2022-06-10 12:35 ` Dave Hansen
2022-06-10 14:21   ` Peter Zijlstra
2022-06-10 15:17   ` Li kunyu
  -- strict thread matches above, loose matches on Subject: below --
2022-06-10 10:43 Li kunyu
2022-06-10 10:36 Li kunyu

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).