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

Re: [PATCH 2/2] xen/arm: Skip loops in init_pdx() when no PDX compression is used



Hi Michal,

On 14/07/2025 13:37, Orzel, Michal wrote:


On 14/07/2025 12:09, Julien Grall wrote:
Hi Michal,

On 14/07/2025 10:50, Orzel, Michal wrote:


On 14/07/2025 11:45, Julien Grall wrote:
Hi Michal,

On 14/07/2025 08:37, Orzel, Michal wrote:


On 12/07/2025 12:29, Julien Grall wrote:
Hi Michal,

On 04/07/2025 08:54, Michal Orzel wrote:
When CONFIG_PDX_COMPRESSION=n, pdx_init_mask(), pdx_region_mask() and
pfn_pdx_hole_setup() are just stubs doing nothing. It does not make
sense to keep the two loops iterating over all the memory banks.

I saw this was already committed. But I have a question. Wouldn't the
compiler be able to optimize and remove the loops? Asking because we are
trying to limit the number of #ifdef in the code hence why we have stubs.
Before submitting a patch I did disassembled init_pdx() with and without my
patch and in the latter case the compiler did not optimize out the loops.

One more question. Was this in debug or non-debug build?
It was in debug build.

Ok. I would be interested to know if this change in non-debug build
because we have quite a few places in Xen relying on code elimination.
I did a test and with -O2 (non-debug), the loops are removed as oppose to -O1
(debug). That said, -fdce is part of -O1, so it's difficult to say what option
made impact here.

Ok. If the compiler is able to remove the code in non-debug build, then I think we should avoid using #ifdef. This is matching the policy we have for the rest of the code base.

IIRC, the idea was to be able to catch compile error in advance (we had some cases where we forgot to update code within the #ifdef).

Cheers,

--
Julien Grall




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.