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

Re: [PATCH] xen: Use asm inline when available for alternatives



On Tue, 22 Apr 2025, Andrew Cooper wrote:
> On 22/04/2025 8:46 pm, Stefano Stabellini wrote:
> > On Tue, 22 Apr 2025, Andrew Cooper wrote:
> >> Compilers estimate the size of an asm() block for inlining purposes.
> >>
> >> Constructs such as ALTERNATIVE appear large due to the metadata, depsite 
> >> often
> >> only being a handful of instructions.  asm inline() overrides the 
> >> estimation
> >> to identify the block as being small.
> >>
> >> This has a substantial impact on inlining decisions, expected to be for the
> >> better given that the compiler has a more accurate picture to work with.
> >>
> >> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > Hi Andrew,
> >
> > If we are going to use asm_inline, please add a note to
> > docs/misra/C-language-toolchain.rst where we keep record of all the
> > language extensions we use.
> 
> It's just asm(), and that's already discussed.
> 
> I'm not sure what else you think is warranted.


If it is just asm() then there is nothing to do. We only need to
document extensions to the language, nothing else. Many of them are
already documented under docs/misra/C-language-toolchain.rst (see for
instance asm and __asm__).

I see the critical part of the patch for this question is:

> +#if CONFIG_CC_HAS_ASM_INLINE
> +# define asm_inline asm __inline
> +#else
> +# define asm_inline asm
> +#endif

it looks like __inline is an extension ?



 


Rackspace

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