linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: David Brazdil <dbrazdil@google.com>
To: Jamie Iles <jamie@nuviainc.com>
Cc: Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] kvm: arm64: correctly align nVHE percpu data
Date: Fri, 13 Nov 2020 10:12:27 +0000	[thread overview]
Message-ID: <20201113101227.zb6ckyriobjrlkc5@google.com> (raw)
In-Reply-To: <20201113003143.3057-1-jamie@nuviainc.com>

Hi Jamie,

On Fri, Nov 13, 2020 at 12:31:43AM +0000, Jamie Iles wrote:
> The nVHE percpu data is partially linked but the nVHE linker script did
> not align the percpu section.  The PERCPU_INPUT macro would then align
> the data to a page boundary:
> 
>   #define PERCPU_INPUT(cacheline)					\
>   	__per_cpu_start = .;						\
>   	*(.data..percpu..first)						\
>   	. = ALIGN(PAGE_SIZE);						\
>   	*(.data..percpu..page_aligned)					\
>   	. = ALIGN(cacheline);						\
>   	*(.data..percpu..read_mostly)					\
>   	. = ALIGN(cacheline);						\
>   	*(.data..percpu)						\
>   	*(.data..percpu..shared_aligned)				\
>   	PERCPU_DECRYPTED_SECTION					\
>   	__per_cpu_end = .;
> 
> but then when the final vmlinux linking happens the hypervisor percpu
> data is included after page alignment and so the offsets potentially
> don't match.  This manifests as one of the CPUs getting lost when
> running kvm-unit-tests on EL2 entry and subsequent soft lockup.

You're right - the internal alignment of these subsections can be off after
linking into vmlinux. Could you just elaborate on how you managed to trigger
this? Which offsets don't match?

> 
> Fixes: 30c953911c43 ("kvm: arm64: Set up hyp percpu data for nVHE")
> Cc: David Brazdil <dbrazdil@google.com>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Jamie Iles <jamie@nuviainc.com>
> ---
>  arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp.lds.S b/arch/arm64/kvm/hyp/nvhe/hyp.lds.S
> index bb2d986ff696..84edca959893 100644
> --- a/arch/arm64/kvm/hyp/nvhe/hyp.lds.S
> +++ b/arch/arm64/kvm/hyp/nvhe/hyp.lds.S
> @@ -13,6 +13,7 @@
>  
>  SECTIONS {
>  	HYP_SECTION(.text)
> +	. = ALIGN(PAGE_SIZE);

Could you add a comment so that we don't forget why it was needed?

Thanks,
David

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-11-13 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  0:31 [PATCH] kvm: arm64: correctly align nVHE percpu data Jamie Iles
2020-11-13 10:12 ` David Brazdil [this message]
2020-11-13 15:04   ` Jamie Iles
2020-11-16  9:24     ` David Brazdil
2020-11-16  9:42     ` Marc Zyngier

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=20201113101227.zb6ckyriobjrlkc5@google.com \
    --to=dbrazdil@google.com \
    --cc=jamie@nuviainc.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).