kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 4/4] arm/arm64: make stack creation user friendly
Date: Tue, 19 Jan 2016 15:29:56 +0100	[thread overview]
Message-ID: <569E4864.3090000@redhat.com> (raw)
In-Reply-To: <1452879690-14493-5-git-send-email-drjones@redhat.com>

Changing subject to: "arm/arm64: wrap thread stack creation in a
function that returns SP".

Paolo

On 15/01/2016 18:41, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  arm/selftest.c            | 3 +--
>  lib/arm/asm/thread_info.h | 7 +++++++
>  lib/arm/smp.c             | 4 +---
>  3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/arm/selftest.c b/arm/selftest.c
> index 3e13296410fc1..aad7eecd529ad 100644
> --- a/arm/selftest.c
> +++ b/arm/selftest.c
> @@ -356,9 +356,8 @@ int main(int argc, char **argv)
>  
>  	} else if (strcmp(argv[0], "vectors-user") == 0) {
>  
> -		void *sp = memalign(THREAD_SIZE, THREAD_SIZE);
>  		start_usr(check_vectors, NULL,
> -				(unsigned long)sp + THREAD_START_SP);
> +				(unsigned long)thread_stack_alloc());
>  
>  	} else if (strcmp(argv[0], "smp") == 0) {
>  
> diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h
> index 95058bff9d857..7eaac7c32953b 100644
> --- a/lib/arm/asm/thread_info.h
> +++ b/lib/arm/asm/thread_info.h
> @@ -22,6 +22,7 @@
>  
>  #ifndef __ASSEMBLY__
>  #include <asm/processor.h>
> +#include <alloc.h>
>  
>  #ifdef __arm__
>  #include <asm/ptrace.h>
> @@ -35,6 +36,12 @@
>  #define THREAD_START_SP		(THREAD_SIZE - 16)
>  #endif
>  
> +static inline void *thread_stack_alloc(void)
> +{
> +	void *sp = memalign(THREAD_SIZE, THREAD_SIZE);
> +	return sp + THREAD_START_SP;
> +}
> +
>  #define TIF_USER_MODE		(1U << 0)
>  
>  struct thread_info {
> diff --git a/lib/arm/smp.c b/lib/arm/smp.c
> index 390c53b5d84c3..bbaf9e60e9506 100644
> --- a/lib/arm/smp.c
> +++ b/lib/arm/smp.c
> @@ -6,7 +6,6 @@
>   * This work is licensed under the terms of the GNU LGPL, version 2.
>   */
>  #include <libcflat.h>
> -#include <alloc.h>
>  #include <asm/thread_info.h>
>  #include <asm/cpumask.h>
>  #include <asm/barrier.h>
> @@ -43,10 +42,9 @@ secondary_entry_fn secondary_cinit(void)
>  
>  void smp_boot_secondary(int cpu, secondary_entry_fn entry)
>  {
> -	void *stack_base = memalign(THREAD_SIZE, THREAD_SIZE);
>  	int ret;
>  
> -	secondary_data.stack = stack_base + THREAD_START_SP;
> +	secondary_data.stack = thread_stack_alloc();
>  	secondary_data.entry = entry;
>  	mmu_mark_disabled(cpu);
>  	ret = cpu_psci_cpu_boot(cpu);
> 

  reply	other threads:[~2016-01-19 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 17:41 [kvm-unit-tests PATCH 0/4] arm/arm64: fixes and convenience Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 1/4] arm64: irq handlers don't use esr Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 2/4] arm64: start_usr: no default vectors Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 3/4] arm64: include esr.h from processor.h Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 4/4] arm/arm64: make stack creation user friendly Andrew Jones
2016-01-19 14:29   ` Paolo Bonzini [this message]
2016-01-19 14:30 ` [kvm-unit-tests PATCH 0/4] arm/arm64: fixes and convenience Paolo Bonzini

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=569E4864.3090000@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.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).