[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv+Gu-bL0neh61=1B=Dja7+tsH_ong731t2Xp17h4E1fjavjA@mail.gmail.com>
Date: Thu, 28 Jun 2018 11:29:40 +0200
From: Ard Biesheuvel <ard.biesheuvel@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 2/5] kernel/jump_label: implement generic support for
relative references
On 28 June 2018 at 11:25, Peter Zijlstra <peterz@...radead.org> wrote:
> On Thu, Jun 28, 2018 at 11:04:45AM +0200, Ard Biesheuvel wrote:
>> On 28 June 2018 at 11:02, Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote:
>> >>> @@ -56,7 +72,9 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop)
>> >>>
>> >>> size = (((unsigned long)stop - (unsigned long)start)
>> >>> / sizeof(struct jump_entry));
>> >>> - sort(start, size, sizeof(struct jump_entry), jump_label_cmp, NULL);
>> >>> + sort(start, size, sizeof(struct jump_entry), jump_label_cmp,
>> >>> + IS_ENABLED(CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE) ? jump_label_swap
>> >>> + : NULL);
>> >>> }
>> >>
>> >> That will result in jump_label_swap being an unused symbol for some
>> >> compile options.
>> >
>> > No, and isn't that the point of IS_ENABLED()? The compiler sees a
>> > reference to jump_label_swap(), so it won't complain about it being
>> > unused.
>
> Ah, ok. I hadn't figured it was quite that smart about it.
>
Yeah. I could use a temp variable to make the indentation less
obnoxious, but since this is an opt-in feature, I'd like to preserve
the NULL (*swap)() argument for the existing users.
>> > Meh. I thought IS_ENABLED() was preferred over #ifdef, no?
>
> Dunno, I just reacted to the proposed code's uglyness :-)
>
I will try to come up with something that rhymes, ok? :-)
>> ... and it means the sort() routine will unconditionally perform an
>> indirect function call even if the arch does not require it.
>
> Yeah, not sure I care about that here, this is a one time affair, very
> far away from any fast paths.
>
Fair enough.
Powered by blists - more mailing lists