Re: [PATCH 2/2] bulk: Prefer fast cpu_env() over slower CPU QOM cast macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/1/24 18:09, Thomas Huth wrote:
On 25/01/2024 17.56, Philippe Mathieu-Daudé wrote:
Mechanical patch produced running the command documented
in scripts/coccinelle/cpu_env.cocci_template header.

Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
---

  114 files changed, 273 insertions(+), 548 deletions(-)

A huge patch ... I wonder whether it would make sense to split it up by target architecture to ease the review?

...
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index a8d014d09a..eb0613bfbe 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -74,8 +74,7 @@ struct VMMouseState {
  static void vmmouse_get_data(uint32_t *data)
  {
-    X86CPU *cpu = X86_CPU(current_cpu);
-    CPUX86State *env = &cpu->env;
+    CPUX86State *env = cpu_env(CPU(current_cpu));

No need for the CPU() cast here, current_cpu is already
of type "CPUState *".

Yes, Paolo noticed and I fixed for v2.

I'll stop here, please respin with the cpu_env(CPU(current_cpu)) fixed to
cpu_env(current_cpu), and please split the patch by target CPU types.

Well I don't know, this is an reproducible mechanical patch..
But indeed as Paolo you found an optimization so worth not making
human review a pain.

I was about to post v2 but I'll see how to split.

Thanks for the review!

Phil.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux