All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v4 19/27] x86: assembly, make some functions local
Date: Fri, 6 Oct 2017 14:21:21 +0100	[thread overview]
Message-ID: <20171006132121.GC14023@leverpostej> (raw)
In-Reply-To: <9dfcee94-2058-8986-526c-f7ef9ebada66@suse.cz>

Hi Jiri,

I can see that these serve a useful purpose (as they are necessary for
asm validation encessary for livepatching), and I am not personally
averse to the new annotations.

However, I am concerned that as-is, this is going to create more
problems for !x86 architectures. More on that below.

On Fri, Oct 06, 2017 at 02:53:08PM +0200, Jiri Slaby wrote:
> On 10/04/2017, 09:33 AM, Ard Biesheuvel wrote:
> > On 4 October 2017 at 08:22, Jiri Slaby <jslaby@suse.cz> wrote:
> >> On 10/02/2017, 02:48 PM, Ard Biesheuvel wrote:
> >>> On 2 October 2017 at 10:12, Jiri Slaby <jslaby@suse.cz> wrote:
> >>>> There is a couple of assembly functions, which are invoked only locally
> >>>> in the file they are defined. In C, we mark them "static". In assembly,
> >>>> annotate them using SYM_{FUNC,CODE}_START_LOCAL (and switch their
> >>>> ENDPROC to SYM_{FUNC,CODE}_END too). Whether FUNC or CODE depends on
> >>>> ENDPROC/END for a particular function (C or non-C).
> >>>
> >>> I wasn't cc'ed on the cover letter, so I am missing the rationale of
> >>> replacing ENTRY/ENDPROC with other macros.
> >>
> >> There was no cover letter. I am attaching what is in PATCH 1/27 instead:
> >> Introduce new C macros for annotations of functions and data in
> >> assembly. There is a long-standing mess in macros like ENTRY, END,
> >> ENDPROC and similar. They are used in different manners and sometimes
> >> incorrectly.
> > 
> > I must say, I don't share this sentiment.
> > 
> > In arm64, we use ENTRY/ENDPROC for functions with external linkage,
> > and the bare symbol name/ENDPROC for functions with local linkage. I
> > guess we could add ENDOBJECT if we wanted to, but we never really felt
> > the need.
> 
> Yes and this is exactly the reason for the new macros. Now, it's a
> complete mess. One arch does this, another does that. 

If the aim of this series is to introduce something that architectures
use consistently, then can we please actually poke other architectures
about it? e.g. send this to linux-arch, with a cover letter explaining
the idea and asking maintainers to take a look.

I think one reason that ENTRY/END/ENDPROC are used inconsistently is
that they're insufficiently documented. So people assume (inconsistent)
semantics, and often cargo-cult usage without thinking. To avoid that,
could we please document how these new macros should (and should not) be
used?

That way, we have a much better chance of consistency, and it's easier
to figure out if the intended semantics are necessary/sufficient.

Otherwise, I'm worried that bits of this will be inconsistently and
incorrectly cargo-culted into other architectures, making matters worse.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Jiri Slaby <jslaby-AlSwsSmVLrQ@public.gmane.org>
Cc: Ard Biesheuvel
	<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org"
	<tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	"hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org"
	<hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	"x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Matt Fleming
	<matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>,
	"linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	xen-devel
	<xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH v4 19/27] x86: assembly, make some functions local
Date: Fri, 6 Oct 2017 14:21:21 +0100	[thread overview]
Message-ID: <20171006132121.GC14023@leverpostej> (raw)
In-Reply-To: <9dfcee94-2058-8986-526c-f7ef9ebada66-AlSwsSmVLrQ@public.gmane.org>

Hi Jiri,

I can see that these serve a useful purpose (as they are necessary for
asm validation encessary for livepatching), and I am not personally
averse to the new annotations.

However, I am concerned that as-is, this is going to create more
problems for !x86 architectures. More on that below.

On Fri, Oct 06, 2017 at 02:53:08PM +0200, Jiri Slaby wrote:
> On 10/04/2017, 09:33 AM, Ard Biesheuvel wrote:
> > On 4 October 2017 at 08:22, Jiri Slaby <jslaby-AlSwsSmVLrQ@public.gmane.org> wrote:
> >> On 10/02/2017, 02:48 PM, Ard Biesheuvel wrote:
> >>> On 2 October 2017 at 10:12, Jiri Slaby <jslaby-AlSwsSmVLrQ@public.gmane.org> wrote:
> >>>> There is a couple of assembly functions, which are invoked only locally
> >>>> in the file they are defined. In C, we mark them "static". In assembly,
> >>>> annotate them using SYM_{FUNC,CODE}_START_LOCAL (and switch their
> >>>> ENDPROC to SYM_{FUNC,CODE}_END too). Whether FUNC or CODE depends on
> >>>> ENDPROC/END for a particular function (C or non-C).
> >>>
> >>> I wasn't cc'ed on the cover letter, so I am missing the rationale of
> >>> replacing ENTRY/ENDPROC with other macros.
> >>
> >> There was no cover letter. I am attaching what is in PATCH 1/27 instead:
> >> Introduce new C macros for annotations of functions and data in
> >> assembly. There is a long-standing mess in macros like ENTRY, END,
> >> ENDPROC and similar. They are used in different manners and sometimes
> >> incorrectly.
> > 
> > I must say, I don't share this sentiment.
> > 
> > In arm64, we use ENTRY/ENDPROC for functions with external linkage,
> > and the bare symbol name/ENDPROC for functions with local linkage. I
> > guess we could add ENDOBJECT if we wanted to, but we never really felt
> > the need.
> 
> Yes and this is exactly the reason for the new macros. Now, it's a
> complete mess. One arch does this, another does that. 

If the aim of this series is to introduce something that architectures
use consistently, then can we please actually poke other architectures
about it? e.g. send this to linux-arch, with a cover letter explaining
the idea and asking maintainers to take a look.

I think one reason that ENTRY/END/ENDPROC are used inconsistently is
that they're insufficiently documented. So people assume (inconsistent)
semantics, and often cargo-cult usage without thinking. To avoid that,
could we please document how these new macros should (and should not) be
used?

That way, we have a much better chance of consistency, and it's easier
to figure out if the intended semantics are necessary/sufficient.

Otherwise, I'm worried that bits of this will be inconsistently and
incorrectly cargo-culted into other architectures, making matters worse.

Thanks,
Mark.

  parent reply	other threads:[~2017-10-06 13:22 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02  9:12 [PATCH v4 01/27] linkage: new macros for assembler symbols Jiri Slaby
2017-10-02  9:12 ` Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 02/27] x86: assembly, use DATA_SIMPLE for data Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 03/27] x86: assembly, annotate relocate_kernel Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 04/27] x86: entry, annotate THUNKs Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 05/27] x86: assembly, annotate local pseudo-functions Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 06/27] x86: crypto, annotate local functions Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 07/27] x86: boot, " Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 08/27] x86: assembly, annotate aliases Jiri Slaby
2017-10-02  9:12   ` Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 09/27] x86: entry, annotate interrupt symbols properly Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 10/27] x86: head, annotate data appropriatelly Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 11/27] x86: boot, " Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 12/27] x86: um, " Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 13/27] x86: xen-pvh, " Jiri Slaby
2017-10-02  9:12   ` Jiri Slaby
2017-10-02 16:49   ` Boris Ostrovsky
2017-10-02 16:49   ` Boris Ostrovsky
2017-10-02  9:12 ` [PATCH v4 14/27] x86: purgatory, start using annotations Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 15/27] x86: assembly, do not annotate functions by GLOBAL Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 16/27] x86: assembly, use SYM_CODE_INNER_LABEL_NOALIGN instead of GLOBAL Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 17/27] x86: realmode, use SYM_DATA_* " Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 18/27] x86: assembly, remove GLOBAL macro Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 19/27] x86: assembly, make some functions local Jiri Slaby
2017-10-02  9:12   ` Jiri Slaby
2017-10-02 12:48   ` Ard Biesheuvel
2017-10-02 12:48     ` Ard Biesheuvel
2017-10-04  7:22     ` Jiri Slaby
2017-10-04  7:22     ` Jiri Slaby
2017-10-04  7:22       ` Jiri Slaby
2017-10-04  7:33       ` Ard Biesheuvel
2017-10-04  7:33       ` Ard Biesheuvel
2017-10-06 12:53         ` Jiri Slaby
2017-10-06 12:53         ` Jiri Slaby
2017-10-06 12:53           ` Jiri Slaby
2017-10-06 13:21           ` Mark Rutland
2017-10-06 13:21           ` Mark Rutland [this message]
2017-10-06 13:21             ` Mark Rutland
2017-10-25 14:21             ` Jiri Slaby
2017-10-25 14:21               ` Jiri Slaby
2017-10-25 14:46               ` Mark Rutland
2017-10-25 14:46                 ` Mark Rutland
2017-10-25 14:46               ` Mark Rutland
2017-10-25 14:21             ` Jiri Slaby
2017-10-06 14:01           ` Ard Biesheuvel
2017-10-06 14:01           ` Ard Biesheuvel
2017-10-06 14:01             ` Ard Biesheuvel
2017-10-25 14:18             ` Jiri Slaby
2017-10-25 14:18             ` Jiri Slaby
2017-10-02 12:48   ` Ard Biesheuvel
2017-10-02  9:12 ` [PATCH v4 20/27] x86: ftrace, mark function_hook as function Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 21/27] x86_64: assembly, add ENDs to some functions and relabel with SYM_CODE_* Jiri Slaby
2017-10-02  9:12   ` Jiri Slaby
2017-10-02 16:59   ` Boris Ostrovsky
2017-10-02 16:59   ` Boris Ostrovsky
2017-10-02  9:12 ` [PATCH v4 22/27] x86_64: assembly, change all ENTRY+END to SYM_CODE_* Jiri Slaby
2017-10-02 18:13   ` Boris Ostrovsky
2017-10-02 18:13   ` Boris Ostrovsky
2017-10-02  9:12 ` Jiri Slaby
     [not found] ` <20171002091246.28432-1-jslaby-AlSwsSmVLrQ@public.gmane.org>
2017-10-02  9:12   ` [PATCH v4 23/27] x86_64: assembly, change all ENTRY+ENDPROC to SYM_FUNC_* Jiri Slaby
2017-10-02  9:12     ` Jiri Slaby
2017-10-02 12:30     ` Rafael J. Wysocki
2017-10-02 12:30     ` Rafael J. Wysocki
2017-10-02 18:16     ` Boris Ostrovsky
2017-10-02 18:16     ` Boris Ostrovsky
2017-10-02  9:12 ` Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 24/27] x86_32: assembly, add ENDs to some functions and relabel with SYM_CODE_* Jiri Slaby
2017-10-02  9:12 ` Jiri Slaby
2017-10-02 18:16   ` Boris Ostrovsky
2017-10-02 18:16   ` Boris Ostrovsky
2017-10-03  0:26   ` Rafael J. Wysocki
2017-10-03  0:26   ` Rafael J. Wysocki
2017-10-02  9:12 ` [PATCH v4 25/27] x86_32: assembly, change all ENTRY+END to SYM_CODE_* Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 26/27] x86_32: assembly, change all ENTRY+ENDPROC to SYM_FUNC_* Jiri Slaby
2017-10-02  9:12 ` [PATCH v4 27/27] x86: assembly, replace WEAK uses Jiri Slaby
2017-10-06 15:23 ` [PATCH v4 01/27] linkage: new macros for assembler symbols Josh Poimboeuf
2017-10-25 14:20   ` Jiri Slaby
2017-10-25 14:20   ` Jiri Slaby
2017-10-06 15:23 ` Josh Poimboeuf

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=20171006132121.GC14023@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hpa@zytor.com \
    --cc=jslaby@suse.cz \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.