Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	linux-arm-kernel@lists.infradead.org, jslaby@suse.com
Subject: Re: [PATCH 2/3] arm64: lib: Use modern annotations for assembly functions
Date: Wed, 8 Jan 2020 12:29:58 +0000	[thread overview]
Message-ID: <20200108122957.GA16658@willie-the-truck> (raw)
In-Reply-To: <20200107174741.GG4877@sirena.org.uk>

On Tue, Jan 07, 2020 at 05:47:41PM +0000, Mark Brown wrote:
> On Tue, Jan 07, 2020 at 02:44:46PM +0000, Will Deacon wrote:
> > On Mon, Jan 06, 2020 at 07:58:17PM +0000, Mark Brown wrote:
> 
> > > -ENTRY(clear_page)
> > > +SYM_FUNC_START(clear_page)
> > >  	mrs	x1, dczid_el0
> > >  	and	w1, w1, #0xf
> > >  	mov	x2, #4
> 
> > Since this doesn't change behaviour, I think the patch is fine, however
> > on reading Documentation/asm-annotations.rst it's not completely clear to
> > me when SYM_FUNC_START() should be used. In this case, for example, we are
> > *not* pushing a stackframe and that would appear to be at odds with the
> > documentation.
> 
> > Jiri -- is it ok to omit the stack frame for leaf functions annotated with
> > SYM_FUNC_START? I'm guessing it should be, since the link register isn't
> > going to be clobbered. Could we update the documentation to reflect that?
> 
> Yeah, the documentation isn't great on that.  I was going on the basis
> of both trying to minimize changes to the generated output as part of
> the bulk change and looking at it from the point of view of the caller -
> if as in this case the caller thinks it's a regular C function it seems
> sensible to annotate it as such.

Maybe a small tweak to the documentation as per below, indicating that the
stack stuff is just an x86-specific example?

Jiri?

diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
index f55c2bb74d00..32ea57483378 100644
--- a/Documentation/asm-annotations.rst
+++ b/Documentation/asm-annotations.rst
@@ -73,10 +73,11 @@ The new macros are prefixed with the ``SYM_`` prefix and can be divided into
 three main groups:
 
 1. ``SYM_FUNC_*`` -- to annotate C-like functions. This means functions with
-   standard C calling conventions, i.e. the stack contains a return address at
-   the predefined place and a return from the function can happen in a
-   standard way. When frame pointers are enabled, save/restore of frame
-   pointer shall happen at the start/end of a function, respectively, too.
+   standard C calling conventions. For example, on x86, this means that the
+   stack contains a return address at the predefined place and a return from
+   the function can happen in a standard way. When frame pointers are enabled,
+   save/restore of frame pointer shall happen at the start/end of a function,
+   respectively, too.
 
    Checking tools like ``objtool`` should ensure such marked functions conform
    to these rules. The tools can also easily annotate these functions with

> > > --- a/arch/arm64/lib/memcpy.S
> > > +++ b/arch/arm64/lib/memcpy.S
> > > @@ -57,11 +57,11 @@
> > >  	.endm
> > >  
> > >  	.weak memcpy
> 
> > Hmm, any idea why we use .weak explicitly here? Maybe better off using
> > the proper macros now? (same applies to many of the other lib/ functions
> > you're touching)
> 
> Nope, there's a whole bunch of stuff where what we're currently doing is
> a bit interesting and I'm a bit worried that we might be relying on some
> of it.  My theory here was to do the bulk of the changes as a 1:1
> replacement so the generated output is as close as possible for any big
> changes and then do anything more detailed that isn't actually *needed*
> on top of that.  It's looking like there'll also be some stuff that
> definitely changes the output going in as well, I was going to do those
> as individual patches so that it's easier to find any breakages that get
> introduced and so the big, repetitive changes don't have other stuff
> mixed in.

Fair enough, I'll queue these three with the minor naming change and you can
send extra stuff on top of that.

Cheers,

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-01-08 12:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 19:58 [PATCH 0/3] arm64: Conversions to modern assembly annotations Mark Brown
2020-01-06 19:58 ` [PATCH 1/3] arm64: asm: Add new-style position independent function annotations Mark Brown
2020-01-07 14:44   ` Will Deacon
2020-01-07 16:45     ` Mark Brown
2020-01-06 19:58 ` [PATCH 2/3] arm64: lib: Use modern annotations for assembly functions Mark Brown
2020-01-07 14:44   ` Will Deacon
2020-01-07 17:47     ` Mark Brown
2020-01-08 12:29       ` Will Deacon [this message]
2020-01-10 16:56         ` Jiri Slaby
2020-01-15 18:43           ` Will Deacon
2020-01-06 19:58 ` [PATCH 3/3] arm64: mm: " Mark Brown
2020-01-07 14:43   ` Will Deacon
2020-01-07 16:42     ` Mark Brown
2020-01-08 12:17       ` Will Deacon
2020-01-08 13:50         ` Mark Brown
2020-01-08 14:56           ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200108122957.GA16658@willie-the-truck \
    --to=will@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jslaby@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox