Skip to contentSkip to conversation

x86/boot: Optimise 32 bit C source code

PATCH Superseded Frediano Ziglio 2 participants 4 messages Sep 9, 2024

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/boot: Optimise 32 bit C source code

The various filters are removing all optimisations. No need to have all optimisations turned off.

---
 xen/arch/x86/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)

---
Changes since v1
- reuse optimization level from XEN_CFLAGS.

xen/arch/x86/boot/Makefile +1 -0
index 8f5bbff0cc..8352ce023b 100644
@@ -16,6 +16,7 @@ $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -O%,$(XEN_CFLAGS))
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
Signature · 1 line
2.34.1
#1 lore raw
Quoted 16 lines · Frediano Ziglio

The various filters are removing all optimisations. No need to have all optimisations turned off.

---
 xen/arch/x86/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)

---
Changes since v1
- reuse optimization level from XEN_CFLAGS.

xen/arch/x86/boot/Makefile +0 -0
index 8f5bbff0cc..8352ce023b 100644

xen/arch/x86/boot/Makefile $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) · line 19

Quoted 4 lines
xen/arch/x86/boot/Makefile +1 -0
@@ -16,6 +16,7 @@ $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -O%,$(XEN_CFLAGS))

I'm pretty sure this can be part of the prior expression,

CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))

Happy to fix on commit.

~Andrew

#2 lore raw
Quoted 21 lines · Andrew Cooper

xen/arch/x86/boot/Makefile $(call

Quoted 16 lines · Frediano Ziglio

The various filters are removing all optimisations. No need to have all optimisations turned off.

---
 xen/arch/x86/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)

---
Changes since v1
- reuse optimization level from XEN_CFLAGS.

xen/arch/x86/boot/Makefile +0 -0
index 8f5bbff0cc..8352ce023b 100644
@@ -16,6 +16,7 @@ $(call

cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))

xen/arch/x86/boot/Makefile $(call · line 17

Quoted 2 lines
xen/arch/x86/boot/Makefile +0 -0
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter

%/include/xen/config.h,$(XEN_CFLAGS))

Quoted 11 lines

xen/arch/x86/boot/Makefile $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) · line 19

Quoted 2 lines
xen/arch/x86/boot/Makefile +1 -0
 CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -O%,$(XEN_CFLAGS))

I'm pretty sure this can be part of the prior expression,

CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))

Happy to fix on commit.

No objections.

On a similar subject we don't pass -D__XEN__ to these files, this looks wrong to me, they are Xen sources.
Should I send a separate patch after this with that change?

Frediano

#3 lore raw
Quoted 35 lines · Frediano Ziglio

On Mon, Sep 9, 2024 at 11:47 AM Andrew Cooper
<[email protected]> wrote:

    On 09/09/2024 11:44 am, Frediano Ziglio wrote:
    > The various filters are removing all optimisations.
    > No need to have all optimisations turned off.
    >
    > Signed-off-by: Frediano Ziglio <[email protected]>
    > ---
    >  xen/arch/x86/boot/Makefile | 1 +
    >  1 file changed, 1 insertion(+)
    > ---
    > Changes since v1
    > - reuse optimization level from XEN_CFLAGS.
    >
    > diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
    > index 8f5bbff0cc..8352ce023b 100644
    > --- a/xen/arch/x86/boot/Makefile
    > +++ b/xen/arch/x86/boot/Makefile
    > @@ -16,6 +16,7 @@ $(call
    cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
    >  CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
    >  CFLAGS_x86_32 += -nostdinc -include $(filter
    %/include/xen/config.h,$(XEN_CFLAGS))
    >  CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
    > +CFLAGS_x86_32 += $(filter -O%,$(XEN_CFLAGS))

    I'm pretty sure this can be part of the prior expression,

    CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))

    Happy to fix on commit.
Quoted 1 line

No objections.

Ok.  Will get that sorted.

Quoted 4 lines

On a similar subject we don't pass -D__XEN__ to these files, this looks wrong to me, they are Xen sources.
Should I send a separate patch after this with that change?

Yeah, we should be retaining that.  I can fold it in too, with a minor adjustment to the commit message.

~Andrew