All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 05/27] PPC: Split context init/destroy functions
Date: Fri, 16 Apr 2010 06:46:45 +0000	[thread overview]
Message-ID: <1271400405.13059.177.camel@pasglop> (raw)
In-Reply-To: <1271369518-11247-6-git-send-email-agraf@suse.de>

On Fri, 2010-04-16 at 00:11 +0200, Alexander Graf wrote:
> We need to reserve a context from KVM to make sure we have our own
> segment space. While we did that split for Book3S_64 already, 32 bit
> is still outstanding.
> 
> So let's split it now.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


> ---
>  arch/powerpc/include/asm/mmu_context.h |    2 ++
>  arch/powerpc/mm/mmu_context_hash32.c   |   29 ++++++++++++++++++++++-------
>  2 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
> index 26383e0..81fb412 100644
> --- a/arch/powerpc/include/asm/mmu_context.h
> +++ b/arch/powerpc/include/asm/mmu_context.h
> @@ -27,6 +27,8 @@ extern int __init_new_context(void);
>  extern void __destroy_context(int context_id);
>  static inline void mmu_context_init(void) { }
>  #else
> +extern unsigned long __init_new_context(void);
> +extern void __destroy_context(unsigned long context_id);
>  extern void mmu_context_init(void);
>  #endif
>  
> diff --git a/arch/powerpc/mm/mmu_context_hash32.c b/arch/powerpc/mm/mmu_context_hash32.c
> index 0dfba2b..d0ee554 100644
> --- a/arch/powerpc/mm/mmu_context_hash32.c
> +++ b/arch/powerpc/mm/mmu_context_hash32.c
> @@ -60,11 +60,7 @@
>  static unsigned long next_mmu_context;
>  static unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
>  
> -
> -/*
> - * Set up the context for a new address space.
> - */
> -int init_new_context(struct task_struct *t, struct mm_struct *mm)
> +unsigned long __init_new_context(void)
>  {
>  	unsigned long ctx = next_mmu_context;
>  
> @@ -74,19 +70,38 @@ int init_new_context(struct task_struct *t, struct mm_struct *mm)
>  			ctx = 0;
>  	}
>  	next_mmu_context = (ctx + 1) & LAST_CONTEXT;
> -	mm->context.id = ctx;
> +
> +	return ctx;
> +}
> +EXPORT_SYMBOL_GPL(__init_new_context);
> +
> +/*
> + * Set up the context for a new address space.
> + */
> +int init_new_context(struct task_struct *t, struct mm_struct *mm)
> +{
> +	mm->context.id = __init_new_context();
>  
>  	return 0;
>  }
>  
>  /*
> + * Free a context ID. Make sure to call this with preempt disabled!
> + */
> +void __destroy_context(unsigned long ctx)
> +{
> +	clear_bit(ctx, context_map);
> +}
> +EXPORT_SYMBOL_GPL(__destroy_context);
> +
> +/*
>   * We're finished using the context for an address space.
>   */
>  void destroy_context(struct mm_struct *mm)
>  {
>  	preempt_disable();
>  	if (mm->context.id != NO_CONTEXT) {
> -		clear_bit(mm->context.id, context_map);
> +		__destroy_context(mm->context.id);
>  		mm->context.id = NO_CONTEXT;
>  	}
>  	preempt_enable();



WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 05/27] PPC: Split context init/destroy functions
Date: Fri, 16 Apr 2010 16:46:45 +1000	[thread overview]
Message-ID: <1271400405.13059.177.camel@pasglop> (raw)
In-Reply-To: <1271369518-11247-6-git-send-email-agraf@suse.de>

On Fri, 2010-04-16 at 00:11 +0200, Alexander Graf wrote:
> We need to reserve a context from KVM to make sure we have our own
> segment space. While we did that split for Book3S_64 already, 32 bit
> is still outstanding.
> 
> So let's split it now.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


> ---
>  arch/powerpc/include/asm/mmu_context.h |    2 ++
>  arch/powerpc/mm/mmu_context_hash32.c   |   29 ++++++++++++++++++++++-------
>  2 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
> index 26383e0..81fb412 100644
> --- a/arch/powerpc/include/asm/mmu_context.h
> +++ b/arch/powerpc/include/asm/mmu_context.h
> @@ -27,6 +27,8 @@ extern int __init_new_context(void);
>  extern void __destroy_context(int context_id);
>  static inline void mmu_context_init(void) { }
>  #else
> +extern unsigned long __init_new_context(void);
> +extern void __destroy_context(unsigned long context_id);
>  extern void mmu_context_init(void);
>  #endif
>  
> diff --git a/arch/powerpc/mm/mmu_context_hash32.c b/arch/powerpc/mm/mmu_context_hash32.c
> index 0dfba2b..d0ee554 100644
> --- a/arch/powerpc/mm/mmu_context_hash32.c
> +++ b/arch/powerpc/mm/mmu_context_hash32.c
> @@ -60,11 +60,7 @@
>  static unsigned long next_mmu_context;
>  static unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
>  
> -
> -/*
> - * Set up the context for a new address space.
> - */
> -int init_new_context(struct task_struct *t, struct mm_struct *mm)
> +unsigned long __init_new_context(void)
>  {
>  	unsigned long ctx = next_mmu_context;
>  
> @@ -74,19 +70,38 @@ int init_new_context(struct task_struct *t, struct mm_struct *mm)
>  			ctx = 0;
>  	}
>  	next_mmu_context = (ctx + 1) & LAST_CONTEXT;
> -	mm->context.id = ctx;
> +
> +	return ctx;
> +}
> +EXPORT_SYMBOL_GPL(__init_new_context);
> +
> +/*
> + * Set up the context for a new address space.
> + */
> +int init_new_context(struct task_struct *t, struct mm_struct *mm)
> +{
> +	mm->context.id = __init_new_context();
>  
>  	return 0;
>  }
>  
>  /*
> + * Free a context ID. Make sure to call this with preempt disabled!
> + */
> +void __destroy_context(unsigned long ctx)
> +{
> +	clear_bit(ctx, context_map);
> +}
> +EXPORT_SYMBOL_GPL(__destroy_context);
> +
> +/*
>   * We're finished using the context for an address space.
>   */
>  void destroy_context(struct mm_struct *mm)
>  {
>  	preempt_disable();
>  	if (mm->context.id != NO_CONTEXT) {
> -		clear_bit(mm->context.id, context_map);
> +		__destroy_context(mm->context.id);
>  		mm->context.id = NO_CONTEXT;
>  	}
>  	preempt_enable();



  reply	other threads:[~2010-04-16  6:46 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 22:11 [PATCH 00/27] Book3S_32 (PPC32) KVM support Alexander Graf
2010-04-15 22:11 ` Alexander Graf
2010-04-15 22:11 ` [PATCH 05/27] PPC: Split context init/destroy functions Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-16  6:46   ` Benjamin Herrenschmidt [this message]
2010-04-16  6:46     ` Benjamin Herrenschmidt
2010-04-15 22:11 ` [PATCH 06/27] KVM: PPC: Add kvm_book3s_64.h Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 07/27] KVM: PPC: Add kvm_book3s_32.h Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 08/27] KVM: PPC: Add fields to shadow vcpu Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 12/27] PPC: Add STLU Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-16  6:47   ` Benjamin Herrenschmidt
2010-04-16  6:47     ` Benjamin Herrenschmidt
2010-04-15 22:11 ` [PATCH 19/27] KVM: PPC: Remove fetch fail code Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 20/27] KVM: PPC: Add SVCPU to Book3S_32 Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 21/27] KVM: PPC: Emulate segment fault Alexander Graf
2010-04-15 22:11   ` Alexander Graf
2010-04-15 22:11 ` [PATCH 22/27] KVM: PPC: Add Book3S compatibility code Alexander Graf
2010-04-15 22:11   ` Alexander Graf
     [not found] ` <1271369518-11247-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-15 22:11   ` [PATCH 01/27] KVM: PPC: Name generic 64-bit code generic Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-21  9:29     ` Avi Kivity
2010-04-21  9:29       ` Avi Kivity
2010-04-15 22:11   ` [PATCH 02/27] KVM: PPC: Add host MMU Support Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 03/27] KVM: PPC: Add SR swapping code Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 04/27] KVM: PPC: Add generic segment switching code Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 09/27] KVM: PPC: Improve indirect svcpu accessors Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 10/27] KVM: PPC: Use KVM_BOOK3S_HANDLER Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 11/27] KVM: PPC: Use CONFIG_PPC_BOOK3S define Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 13/27] KVM: PPC: Use now shadowed vcpu fields Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 14/27] KVM: PPC: Extract MMU init Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 15/27] KVM: PPC: Make real mode handler generic Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 16/27] KVM: PPC: Make highmem code generic Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 17/27] KVM: PPC: Make SLB switching code the new segment framework Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 18/27] KVM: PPC: Release clean pages as clean Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 23/27] KVM: PPC: Export MMU variables Alexander Graf
2010-04-15 22:11     ` Alexander Graf
     [not found]     ` <1271369518-11247-24-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-16  6:47       ` Benjamin Herrenschmidt
2010-04-16  6:47         ` Benjamin Herrenschmidt
2010-04-16  9:07         ` Alexander Graf
2010-04-16  9:07           ` Alexander Graf
     [not found]           ` <41F9F369-9F53-43E8-AC1F-1C67DD918991-l3A5Bk7waGM@public.gmane.org>
2010-04-16  9:22             ` Benjamin Herrenschmidt
2010-04-16  9:22               ` Benjamin Herrenschmidt
2010-04-16  9:25               ` Alexander Graf
2010-04-16  9:25                 ` Alexander Graf
2010-04-16  9:31                 ` Alexander Graf
2010-04-16  9:31                   ` Alexander Graf
     [not found]                   ` <8EEEAFCF-CB31-4BD9-A917-08B5B6E40400-l3A5Bk7waGM@public.gmane.org>
2010-04-16 11:18                     ` Alexander Graf
2010-04-16 11:18                       ` Alexander Graf
2010-04-15 22:11   ` [PATCH 24/27] PPC: Export SWITCH_FRAME_SIZE Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-16  6:48     ` Benjamin Herrenschmidt
2010-04-16  6:48       ` Benjamin Herrenschmidt
2010-04-15 22:11   ` [PATCH 25/27] KVM: PPC: Check max IRQ prio Alexander Graf
2010-04-15 22:11     ` Alexander Graf
2010-04-21  9:42   ` [PATCH 00/27] Book3S_32 (PPC32) KVM support Avi Kivity
2010-04-21  9:42     ` Avi Kivity
2010-04-15 22:11 ` [PATCH 26/27] KVM: PPC: Add KVM intercept handlers Alexander Graf
2010-04-15 22:11   ` Alexander Graf
     [not found]   ` <1271369518-11247-27-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-16  6:48     ` Benjamin Herrenschmidt
2010-04-16  6:48       ` Benjamin Herrenschmidt
2010-04-15 22:11 ` [PATCH 27/27] KVM: PPC: Enable Book3S_32 KVM building Alexander Graf
2010-04-15 22:11   ` Alexander Graf

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=1271400405.13059.177.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.