From: Michael Ellerman <mpe@ellerman.id.au>
To: Daniel Axtens <dja@axtens.net>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/3] powerpc: Define swapper_pg_dir[] in C
Date: Wed, 23 Jun 2021 22:38:58 +1000 [thread overview]
Message-ID: <87czsc21st.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <871r8siyqm.fsf@dja-thinkpad.axtens.net>
Daniel Axtens <dja@axtens.net> writes:
> Hi Christophe,
>
> This breaks booting a radix KVM guest with 4k pages for me:
>
> make pseries_le_defconfig
> scripts/config -d CONFIG_PPC_64K_PAGES
> scripts/config -e CONFIG_PPC_4K_PAGES
> make vmlinux
> sudo qemu-system-ppc64 -enable-kvm -M pseries -m 1G -nographic -vga none -smp 4 -cpu host -kernel vmlinux
>
> Boot hangs after printing 'Booting Linux via __start()' and qemu's 'info
> registers' reports that it's stuck at the instruction fetch exception.
>
> My host is Power9, 64k page size radix, and
> gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34
>
...
>> diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
>> index 730838c7ca39..79f2d1e61abd 100644
>> --- a/arch/powerpc/kernel/head_64.S
>> +++ b/arch/powerpc/kernel/head_64.S
>> @@ -997,18 +997,3 @@ start_here_common:
>> 0: trap
>> EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0
>> .previous
>> -
>> -/*
>> - * We put a few things here that have to be page-aligned.
>> - * This stuff goes at the beginning of the bss, which is page-aligned.
>> - */
>> - .section ".bss"
>> -/*
>> - * pgd dir should be aligned to PGD_TABLE_SIZE which is 64K.
>> - * We will need to find a better way to fix this
>> - */
>> - .align 16
>> -
>> - .globl swapper_pg_dir
>> -swapper_pg_dir:
>> - .space PGD_TABLE_SIZE
This is now 4K aligned whereas it used to be 64K.
This fixes it and is not completely ugly?
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 1707ab580ee2..298469beaa90 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -28,7 +28,13 @@
#include <asm/hugetlb.h>
#include <asm/pte-walk.h>
-pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __page_aligned_bss;
+#ifdef CONFIG_PPC64
+#define PGD_ALIGN 0x10000
+#else
+#define PGD_ALIGN PAGE_SIZE
+#endif
+
+pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __section(".bss..page_aligned") __aligned(PGD_ALIGN);
static inline int is_exec_fault(void)
{
cheers
next prev parent reply other threads:[~2021-06-23 12:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 10:56 [PATCH 1/3] powerpc: Define empty_zero_page[] in C Christophe Leroy
2021-06-07 10:56 ` [PATCH 2/3] powerpc: Define swapper_pg_dir[] " Christophe Leroy
2021-06-23 11:53 ` Daniel Axtens
2021-06-23 12:38 ` Michael Ellerman [this message]
2021-06-24 2:36 ` Daniel Axtens
2021-06-07 10:56 ` [PATCH 3/3] powerpc/32s: Rename PTE_SIZE to PTE_T_SIZE Christophe Leroy
2021-06-18 3:51 ` [PATCH 1/3] powerpc: Define empty_zero_page[] in C 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=87czsc21st.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dja@axtens.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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