mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Michael Matz <matz@suse.de>,
	Arnd Bergmann <arnd@arndb.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Joerg Roedel <joro@8bytes.org>
Subject: Re: linker-tables v5 testing
Date: Thu, 1 Dec 2016 16:04:30 +1100	[thread overview]
Message-ID: <20161201160430.6e95710a@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <CAB=NE6URuz6rGa4jD9xQ4z4ZoJW6Rurk=xQAphoT-D5VWE-tow@mail.gmail.com>

On Wed, 30 Nov 2016 19:15:27 -0800
"Luis R. Rodriguez" <mcgrof@kernel.org> wrote:

> On Wed, Nov 30, 2016 at 6:51 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> > On Wed, 30 Nov 2016 18:38:16 +0100
> > "Luis R. Rodriguez" <mcgrof@kernel.org> wrote:
> >  
> >> On Wed, Nov 30, 2016 at 02:09:47PM +1100, Nicholas Piggin wrote:

> >> What is wrong with that ? Separating linker table and section ranges is  
> >
> > It's not that you separate those, of course you need that. It's that
> > you also separate other sections from the input section descriptions:
> >
> > -               *(.text.hot .text .text.fixup .text.unlikely)           \
> > +               *(.text.hot .text)                                      \
> > +               *(SORT(.text.rng.*))                                    \
> > +               *(.text.fixup .text.unlikely)                           \
> >
> > [snip]  
> 
> And ?

Umm.. don't remember :)


> >> >   If we have an array of pointers and size, it's trivial C code to iterate over
> >> >   it. If it needs to have a set of LINKTABLE accessors over the top of it
> >> >   for this use case, then that would seem to be a failure of the underlying
> >> >   API, no?  
> >>
> >> Still did not get it.  
> >
> > Well fundamentally the linker table is just a way to declare some type of
> > array that any code can add some elements to, right?  
> 
> Well in particular to a special section, and we're providing standard
> easy way to do this without any hacky linker script or assembly.

Right.

> > The non-C aspect of it
> > is this ability of producers to be decentralized.  
> 
> Not sure what you mean here, we only do a little bit of linker table
> magic, tweaks and then provide helpers.

I mean that you don't need some LINKTABLE_FOREACH accessor for it,
because from the consumer point of view, it's a simple array. It can
easily be handled by plain C. All we need is to get the array base
and size.


> > The consumer is not really different from any other array though. They just
> > want to know the address and the number of elements, and that's all. You can
> > provide that with two macros and don't really need macros like for each, run
> > all, etc because it's just simple C iteration over an array.  
> 
> I added those at the request of hpa, and one of the reasons was that
> we tend to historically use these "arrays" in special ways all over
> the kernel. But these arrays are very special, they are not typical
> arrays. This makes emphasis on its use. They are also needed given the
> special formatting we have for start / end of these in a generic form.
> This should all help consolidate this and make it easier to use in a
> generic form. It should also help avoid mismatch use when the intent
> was a section range and we're on a linker table, or the other way
> around.

I disagree. Making a simple iterator for array, or hiding a simple
function call behind it, really doesn't buy you anything. It's not
like linked list for example, where the result of the iterators is
much nicer than the open coded C.


> >> > - Is it really important to be able to add new allocators without modifying
> >> >   a central file for the linker script? Yes it's a benefit, but is it enough
> >> >   to justify the complexity?  
> >>
> >> If by allocators you mean the ability to add new entries into sections easily
> >> without having to modify the linker script -- then my answer is:  
> >
> > Yes, but after reading a little closer it may not really be a problem I
> > first thought. Thanks for providing the detailed points.  
> 
> OK. So just a bit of bike shedding ?

No I just misread how a part of it was implemented.

Thanks,
Nick

  reply	other threads:[~2016-12-01  5:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24  4:11 Luis R. Rodriguez
2016-11-24  4:57 ` Guenter Roeck
2016-11-24 16:18 ` Guenter Roeck
2016-11-30  1:33   ` Luis R. Rodriguez
2016-11-30  3:09     ` Nicholas Piggin
2016-11-30 17:38       ` Luis R. Rodriguez
2016-12-01  2:51         ` Nicholas Piggin
2016-12-01  3:15           ` Luis R. Rodriguez
2016-12-01  5:04             ` Nicholas Piggin [this message]
2016-12-01  5:20               ` Nicholas Piggin
2016-12-01 16:34                 ` Luis R. Rodriguez
     [not found]                   ` <CANashXMF3jWNgxaSQLRg2b88fSo1xEw-CDFQ6D94eoNn=mYuHQ@mail.gmail.com>
     [not found]                     ` <CANashXOkLvy6BHupz8r-yNvihbohoXdrSQ38uq3jg2q3bGjX_w@mail.gmail.com>
     [not found]                       ` <CANashXOb2jGtXr3BmxVKERPDp-DAHtZXYneZDEf07YpMmoqb-w@mail.gmail.com>
2016-12-02 15:49                         ` Luis R. Rodriguez
2016-12-09  2:11                           ` Nicholas Piggin
2016-12-02 20:20             ` Luis R. Rodriguez
2016-11-30  4:17     ` Guenter Roeck

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=20161201160430.6e95710a@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dsahern@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=joro@8bytes.org \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matz@suse.de \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    /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

Powered by JetHome