Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533808

Re: linker-tables v5 testing

From Nicholas Piggin <npiggin@gmail.com>
Newsgroups linux.kernel
Subject Re: linker-tables v5 testing
Date 2016-12-01 06:10 +0100
Message-ID <sJrN7-7LO-5@gated-at.bofh.it> (permalink)
References (2 earlier) <sJ22m-7Nz-15@gated-at.bofh.it> <sJ3B8-wi-15@gated-at.bofh.it> <sJh1n-BB-23@gated-at.bofh.it> <sJpLj-6dA-1@gated-at.bofh.it> <sJq4F-6F6-7@gated-at.bofh.it>
Organization IBM

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-11-30 02:40 +0100
  Re: linker-tables v5 testing Nicholas Piggin <npiggin@gmail.com> - 2016-11-30 04:20 +0100
    Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-11-30 18:40 +0100
      Re: linker-tables v5 testing Nicholas Piggin <npiggin@gmail.com> - 2016-12-01 04:00 +0100
        Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-12-01 04:20 +0100
          Re: linker-tables v5 testing Nicholas Piggin <npiggin@gmail.com> - 2016-12-01 06:10 +0100
            Re: linker-tables v5 testing Nicholas Piggin <npiggin@gmail.com> - 2016-12-01 06:30 +0100
              Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-12-01 17:40 +0100
                Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-12-02 17:00 +0100
                Re: linker-tables v5 testing Nicholas Piggin <nicholas.piggin@gmail.com> - 2016-12-09 03:20 +0100
          Re: linker-tables v5 testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-12-02 21:30 +0100
  Re: linker-tables v5 testing Guenter Roeck <linux@roeck-us.net> - 2016-11-30 05:20 +0100

csiph-web