From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] powerpc: Inline setup_kup()
Date: Tue, 15 Dec 2020 12:42:15 +1100 [thread overview]
Message-ID: <87czzbzvyg.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <09e673ec-6d4e-2e8d-b843-018ce94142a4@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 14/12/2020 à 13:30, Michael Ellerman a écrit :
>> setup_kup() is used by both 64-bit and 32-bit code. However on 64-bit
>> it must not be __init, because it's used for CPU hotplug, whereas on
>> 32-bit it should be __init because it calls setup_kuap/kuep() which
>> are __init.
>>
>> We worked around that problem in the past by marking it __ref, see
>> commit 67d53f30e23e ("powerpc/mm: fix section mismatch for
>> setup_kup()").
>>
>> Marking it __ref basically just omits it from section mismatch
>> checking, which can lead to bugs, and in fact it did, see commit
>> 44b4c4450f8d ("powerpc/64s: Mark the kuap/kuep functions non __init")
>>
>> We can avoid all these problems by just making it static inline.
>> Because all it does is call other functions, making it inline actually
>> shrinks the 32-bit vmlinux by ~76 bytes.
>>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> ---
>> arch/powerpc/include/asm/kup.h | 8 ++++++--
>> arch/powerpc/mm/init-common.c | 6 ------
>> 2 files changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h
>> index 5a9820c54da9..46b12c6dc728 100644
>> --- a/arch/powerpc/include/asm/kup.h
>> +++ b/arch/powerpc/include/asm/kup.h
>> @@ -49,8 +49,6 @@ extern bool disable_kuap;
>>
>> #include <linux/pgtable.h>
>>
>> -void setup_kup(void);
>> -
>> #ifdef CONFIG_PPC_KUEP
>> void setup_kuep(bool disabled);
>> #else
>> @@ -85,6 +83,12 @@ static inline void restore_user_access(unsigned long flags) { }
>> #endif /* CONFIG_PPC_BOOK3S_64 */
>> #endif /* CONFIG_PPC_KUAP */
>>
>> +static inline void setup_kup(void)
>
> Should it be __always_inline ?
Yes I guess so, will fix. Thanks for reviewing.
cheers
next prev parent reply other threads:[~2020-12-15 1:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 12:30 [PATCH] powerpc: Inline setup_kup() Michael Ellerman
2020-12-14 13:30 ` Christophe Leroy
2020-12-15 1:42 ` Michael Ellerman [this message]
2020-12-15 5:41 ` Christophe Leroy
2020-12-15 10:20 ` Michael Ellerman
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=87czzbzvyg.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@ozlabs.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