diff mbox

powerpc/kvm/booke: Fix build break due to stack frame size warning

Message ID 1385157149-22233-1-git-send-email-scottwood@freescale.com
State New, archived
Headers show

Commit Message

Scott Wood Nov. 22, 2013, 9:52 p.m. UTC
Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
userspace debug stub support") added "struct thread_struct" to the
stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
compared to 48 bytes for the recently-introduced "struct debug_reg".
Use the latter instead.

This fixes the following error:

cc1: warnings being treated as errors
arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger than 1024 bytes
make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
make[1]: *** [arch/powerpc/kvm] Error 2
make[1]: *** Waiting for unfinished jobs....

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Bharat Bhushan <r65777@freescale.com>
---
Build tested only.  Bharat, please test.

 arch/powerpc/include/asm/switch_to.h |  2 +-
 arch/powerpc/kernel/process.c        | 32 ++++++++++++++++----------------
 arch/powerpc/kvm/booke.c             | 12 ++++++------
 3 files changed, 23 insertions(+), 23 deletions(-)

Comments

Bharat Bhushan Nov. 25, 2013, 10:26 a.m. UTC | #1
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Saturday, November 23, 2013 3:22 AM
> To: Alexander Graf
> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
> Bharat-R65777
> Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
> warning
> 
> Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
> userspace debug stub support") added "struct thread_struct" to the
> stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
> compared to 48 bytes for the recently-introduced "struct debug_reg".
> Use the latter instead.
> 
> This fixes the following error:
> 
> cc1: warnings being treated as errors
> arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
> arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
> than 1024 bytes
> make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
> make[1]: *** [arch/powerpc/kvm] Error 2
> make[1]: *** Waiting for unfinished jobs....
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Cc: Bharat Bhushan <r65777@freescale.com>
> ---
> Build tested only.  Bharat, please test.

Tested with qemu debug stub; It works fine

-Bharat

> 
>  arch/powerpc/include/asm/switch_to.h |  2 +-
>  arch/powerpc/kernel/process.c        | 32 ++++++++++++++++----------------
>  arch/powerpc/kvm/booke.c             | 12 ++++++------
>  3 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/switch_to.h
> b/arch/powerpc/include/asm/switch_to.h
> index 9ee1261..aace905 100644
> --- a/arch/powerpc/include/asm/switch_to.h
> +++ b/arch/powerpc/include/asm/switch_to.h
> @@ -35,7 +35,7 @@ extern void giveup_vsx(struct task_struct *);
>  extern void enable_kernel_spe(void);
>  extern void giveup_spe(struct task_struct *);
>  extern void load_up_spe(struct task_struct *);
> -extern void switch_booke_debug_regs(struct thread_struct *new_thread);
> +extern void switch_booke_debug_regs(struct debug_reg *new_debug);
> 
>  #ifndef CONFIG_SMP
>  extern void discard_lazy_cpu_state(void);
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 3386d8a..4a96556 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -339,7 +339,7 @@ static void set_debug_reg_defaults(struct thread_struct
> *thread)
>  #endif
>  }
> 
> -static void prime_debug_regs(struct thread_struct *thread)
> +static void prime_debug_regs(struct debug_reg *debug)
>  {
>  	/*
>  	 * We could have inherited MSR_DE from userspace, since
> @@ -348,22 +348,22 @@ static void prime_debug_regs(struct thread_struct *thread)
>  	 */
>  	mtmsr(mfmsr() & ~MSR_DE);
> 
> -	mtspr(SPRN_IAC1, thread->debug.iac1);
> -	mtspr(SPRN_IAC2, thread->debug.iac2);
> +	mtspr(SPRN_IAC1, debug->iac1);
> +	mtspr(SPRN_IAC2, debug->iac2);
>  #if CONFIG_PPC_ADV_DEBUG_IACS > 2
> -	mtspr(SPRN_IAC3, thread->debug.iac3);
> -	mtspr(SPRN_IAC4, thread->debug.iac4);
> +	mtspr(SPRN_IAC3, debug->iac3);
> +	mtspr(SPRN_IAC4, debug->iac4);
>  #endif
> -	mtspr(SPRN_DAC1, thread->debug.dac1);
> -	mtspr(SPRN_DAC2, thread->debug.dac2);
> +	mtspr(SPRN_DAC1, debug->dac1);
> +	mtspr(SPRN_DAC2, debug->dac2);
>  #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
> -	mtspr(SPRN_DVC1, thread->debug.dvc1);
> -	mtspr(SPRN_DVC2, thread->debug.dvc2);
> +	mtspr(SPRN_DVC1, debug->dvc1);
> +	mtspr(SPRN_DVC2, debug->dvc2);
>  #endif
> -	mtspr(SPRN_DBCR0, thread->debug.dbcr0);
> -	mtspr(SPRN_DBCR1, thread->debug.dbcr1);
> +	mtspr(SPRN_DBCR0, debug->dbcr0);
> +	mtspr(SPRN_DBCR1, debug->dbcr1);
>  #ifdef CONFIG_BOOKE
> -	mtspr(SPRN_DBCR2, thread->debug.dbcr2);
> +	mtspr(SPRN_DBCR2, debug->dbcr2);
>  #endif
>  }
>  /*
> @@ -371,11 +371,11 @@ static void prime_debug_regs(struct thread_struct *thread)
>   * debug registers, set the debug registers from the values
>   * stored in the new thread.
>   */
> -void switch_booke_debug_regs(struct thread_struct *new_thread)
> +void switch_booke_debug_regs(struct debug_reg *new_debug)
>  {
>  	if ((current->thread.debug.dbcr0 & DBCR0_IDM)
> -		|| (new_thread->debug.dbcr0 & DBCR0_IDM))
> -			prime_debug_regs(new_thread);
> +		|| (new_debug->dbcr0 & DBCR0_IDM))
> +			prime_debug_regs(new_debug);
>  }
>  EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
>  #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
> @@ -683,7 +683,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
>  #endif /* CONFIG_SMP */
> 
>  #ifdef CONFIG_PPC_ADV_DEBUG_REGS
> -	switch_booke_debug_regs(&new->thread);
> +	switch_booke_debug_regs(&new->thread.debug);
>  #else
>  /*
>   * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 53e65a2..0591e05 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -681,7 +681,7 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
>  int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  {
>  	int ret, s;
> -	struct thread_struct thread;
> +	struct debug_reg debug;
>  #ifdef CONFIG_PPC_FPU
>  	struct thread_fp_state fp;
>  	int fpexc_mode;
> @@ -723,9 +723,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu
> *vcpu)
>  #endif
> 
>  	/* Switch to guest debug context */
> -	thread.debug = vcpu->arch.shadow_dbg_reg;
> -	switch_booke_debug_regs(&thread);
> -	thread.debug = current->thread.debug;
> +	debug = vcpu->arch.shadow_dbg_reg;
> +	switch_booke_debug_regs(&debug);
> +	debug = current->thread.debug;
>  	current->thread.debug = vcpu->arch.shadow_dbg_reg;
> 
>  	kvmppc_fix_ee_before_entry();
> @@ -736,8 +736,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu
> *vcpu)
>  	   We also get here with interrupts enabled. */
> 
>  	/* Switch back to user space debug context */
> -	switch_booke_debug_regs(&thread);
> -	current->thread.debug = thread.debug;
> +	switch_booke_debug_regs(&debug);
> +	current->thread.debug = debug;
> 
>  #ifdef CONFIG_PPC_FPU
>  	kvmppc_save_guest_fp(vcpu);
> --
> 1.8.1.2


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Wood Dec. 9, 2013, 9:18 p.m. UTC | #2
On Mon, 2013-11-25 at 04:26 -0600, Bharat Bhushan wrote:
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Saturday, November 23, 2013 3:22 AM
> > To: Alexander Graf
> > Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
> > Bharat-R65777
> > Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
> > warning
> >
> > Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
> > userspace debug stub support") added "struct thread_struct" to the
> > stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
> > compared to 48 bytes for the recently-introduced "struct debug_reg".
> > Use the latter instead.
> >
> > This fixes the following error:
> >
> > cc1: warnings being treated as errors
> > arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
> > arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
> > than 1024 bytes
> > make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
> > make[1]: *** [arch/powerpc/kvm] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> >
> > Signed-off-by: Scott Wood <scottwood@freescale.com>
> > Cc: Bharat Bhushan <r65777@freescale.com>
> > ---
> > Build tested only.  Bharat, please test.
> 
> Tested with qemu debug stub; It works fine
> 
> -Bharat

Alex, are you going to take this through your tree?

-Scott



--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Dec. 10, 2013, 2:05 a.m. UTC | #3
On 09.12.2013, at 22:18, Scott Wood <scottwood@freescale.com> wrote:

> On Mon, 2013-11-25 at 04:26 -0600, Bharat Bhushan wrote:
>> 
>>> -----Original Message-----
>>> From: Wood Scott-B07421
>>> Sent: Saturday, November 23, 2013 3:22 AM
>>> To: Alexander Graf
>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
>>> Bharat-R65777
>>> Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
>>> warning
>>> 
>>> Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
>>> userspace debug stub support") added "struct thread_struct" to the
>>> stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
>>> compared to 48 bytes for the recently-introduced "struct debug_reg".
>>> Use the latter instead.
>>> 
>>> This fixes the following error:
>>> 
>>> cc1: warnings being treated as errors
>>> arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
>>> arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
>>> than 1024 bytes
>>> make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
>>> make[1]: *** [arch/powerpc/kvm] Error 2
>>> make[1]: *** Waiting for unfinished jobs....
>>> 
>>> Signed-off-by: Scott Wood <scottwood@freescale.com>
>>> Cc: Bharat Bhushan <r65777@freescale.com>
>>> ---
>>> Build tested only.  Bharat, please test.
>> 
>> Tested with qemu debug stub; It works fine
>> 
>> -Bharat
> 
> Alex, are you going to take this through your tree?

Sure. Do you want this for 3.13 or 3.14? Since I don't see the breakage with my compilers I'd queue it for 3.14, but whatever works for you works for me.

Also Bharat, could you please make that a real "Tested-by" line?


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Wood Dec. 10, 2013, 11:11 p.m. UTC | #4
On Tue, 2013-12-10 at 03:05 +0100, Alexander Graf wrote:
> On 09.12.2013, at 22:18, Scott Wood <scottwood@freescale.com> wrote:
> 
> > On Mon, 2013-11-25 at 04:26 -0600, Bharat Bhushan wrote:
> >> 
> >>> -----Original Message-----
> >>> From: Wood Scott-B07421
> >>> Sent: Saturday, November 23, 2013 3:22 AM
> >>> To: Alexander Graf
> >>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
> >>> Bharat-R65777
> >>> Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
> >>> warning
> >>> 
> >>> Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
> >>> userspace debug stub support") added "struct thread_struct" to the
> >>> stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
> >>> compared to 48 bytes for the recently-introduced "struct debug_reg".
> >>> Use the latter instead.
> >>> 
> >>> This fixes the following error:
> >>> 
> >>> cc1: warnings being treated as errors
> >>> arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
> >>> arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
> >>> than 1024 bytes
> >>> make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
> >>> make[1]: *** [arch/powerpc/kvm] Error 2
> >>> make[1]: *** Waiting for unfinished jobs....
> >>> 
> >>> Signed-off-by: Scott Wood <scottwood@freescale.com>
> >>> Cc: Bharat Bhushan <r65777@freescale.com>
> >>> ---
> >>> Build tested only.  Bharat, please test.
> >> 
> >> Tested with qemu debug stub; It works fine
> >> 
> >> -Bharat
> > 
> > Alex, are you going to take this through your tree?
> 
> Sure. Do you want this for 3.13 or 3.14? Since I don't see the breakage
> with my compilers I'd queue it for 3.14, but whatever works for you
> works for me.

3.13 please.  All I need to do to trigger the build break is enable KVM
with corenet64_smp_defconfig with GCC 4.5.

Oddly, I don't see it with newer GCCs (4.7.3 or 4.8.0).  It looks like
it may be a bug in the stack frame warning in those newer versions.
This is the code from 4.8.0:

0000000000000e8c <.kvmppc_vcpu_run>:
.kvmppc_vcpu_run():
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:682
     e8c:       7c 08 02 a6     mflr    r0
     e90:       fb 41 ff d0     std     r26,-48(r1)
     e94:       7c 7a 1b 78     mr      r26,r3
     e98:       fb a1 ff e8     std     r29,-24(r1)
     e9c:       fb c1 ff f0     std     r30,-16(r1)
     ea0:       7c 9e 23 78     mr      r30,r4
     ea4:       fb e1 ff f8     std     r31,-8(r1)
     ea8:       f8 01 00 10     std     r0,16(r1)
     eac:       fb 21 ff c8     std     r25,-56(r1)
     eb0:       fb 61 ff d8     std     r27,-40(r1)
     eb4:       fb 81 ff e0     std     r28,-32(r1)
     eb8:       f8 21 fe 41     stdu    r1,-448(r1)
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:690
     ebc:       89 44 08 a9     lbz     r10,2217(r4)
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:682
     ec0:       7c 3f 0b 78     mr      r31,r1
     ec4:       e9 21 00 00     ld      r9,0(r1)
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:690
     ec8:       2f 8a 00 00     cmpwi   cr7,r10,0
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:682
     ecc:       f9 21 fb 41     stdu    r9,-1216(r1)
     ed0:       3b a1 00 af     addi    r29,r1,175  
     ed4:       7b bd 06 64     rldicr  r29,r29,0,57

The instruction at 0xecc expands the stack by 1216 bytes, on top of the
already allocated stack frame of 448 bytes.  I'm not sure why it's
creating a secondary stack frame in this odd way.

GCC 4.5, which produces the warning, does this instead:

0000000000000eb8 <.kvmppc_vcpu_run>:
kvmppc_vcpu_run():
/home/scott/fsl/git/linux/upstream/arch/powerpc/kvm/booke.c:682
     eb8:       7c 08 02 a6     mflr    r0
     ebc:       fb 61 ff d8     std     r27,-40(r1)
     ec0:       7c 7b 1b 78     mr      r27,r3
     ec4:       fb e1 ff f8     std     r31,-8(r1)
     ec8:       7c 9f 23 78     mr      r31,r4
     ecc:       f8 01 00 10     std     r0,16(r1)
     ed0:       fb 41 ff d0     std     r26,-48(r1)
     ed4:       fb 81 ff e0     std     r28,-32(r1)
     ed8:       fb a1 ff e8     std     r29,-24(r1)
     edc:       f8 21 f9 d1     stdu    r1,-1584(r1)

-Scott



--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Dec. 10, 2013, 11:16 p.m. UTC | #5
On 11.12.2013, at 00:11, Scott Wood <scottwood@freescale.com> wrote:

> On Tue, 2013-12-10 at 03:05 +0100, Alexander Graf wrote:
>> On 09.12.2013, at 22:18, Scott Wood <scottwood@freescale.com> wrote:
>> 
>>> On Mon, 2013-11-25 at 04:26 -0600, Bharat Bhushan wrote:
>>>> 
>>>>> -----Original Message-----
>>>>> From: Wood Scott-B07421
>>>>> Sent: Saturday, November 23, 2013 3:22 AM
>>>>> To: Alexander Graf
>>>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
>>>>> Bharat-R65777
>>>>> Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
>>>>> warning
>>>>> 
>>>>> Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
>>>>> userspace debug stub support") added "struct thread_struct" to the
>>>>> stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
>>>>> compared to 48 bytes for the recently-introduced "struct debug_reg".
>>>>> Use the latter instead.
>>>>> 
>>>>> This fixes the following error:
>>>>> 
>>>>> cc1: warnings being treated as errors
>>>>> arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
>>>>> arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
>>>>> than 1024 bytes
>>>>> make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
>>>>> make[1]: *** [arch/powerpc/kvm] Error 2
>>>>> make[1]: *** Waiting for unfinished jobs....
>>>>> 
>>>>> Signed-off-by: Scott Wood <scottwood@freescale.com>
>>>>> Cc: Bharat Bhushan <r65777@freescale.com>
>>>>> ---
>>>>> Build tested only.  Bharat, please test.
>>>> 
>>>> Tested with qemu debug stub; It works fine
>>>> 
>>>> -Bharat
>>> 
>>> Alex, are you going to take this through your tree?
>> 
>> Sure. Do you want this for 3.13 or 3.14? Since I don't see the breakage
>> with my compilers I'd queue it for 3.14, but whatever works for you
>> works for me.
> 
> 3.13 please.  All I need to do to trigger the build break is enable KVM
> with corenet64_smp_defconfig with GCC 4.5.

Thanks, applied to the for-3.13 branch.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Dec. 10, 2013, 11:16 p.m. UTC | #6
On 11.12.2013, at 00:11, Scott Wood <scottwood@freescale.com> wrote:

> On Tue, 2013-12-10 at 03:05 +0100, Alexander Graf wrote:
>> On 09.12.2013, at 22:18, Scott Wood <scottwood@freescale.com> wrote:
>> 
>>> On Mon, 2013-11-25 at 04:26 -0600, Bharat Bhushan wrote:
>>>> 
>>>>> -----Original Message-----
>>>>> From: Wood Scott-B07421
>>>>> Sent: Saturday, November 23, 2013 3:22 AM
>>>>> To: Alexander Graf
>>>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; Bhushan
>>>>> Bharat-R65777
>>>>> Subject: [PATCH] powerpc/kvm/booke: Fix build break due to stack frame size
>>>>> warning
>>>>> 
>>>>> Commit ce11e48b7fdd256ec68b932a89b397a790566031 ("KVM: PPC: E500: Add
>>>>> userspace debug stub support") added "struct thread_struct" to the
>>>>> stack of kvmppc_vcpu_run().  thread_struct is 1152 bytes on my build,
>>>>> compared to 48 bytes for the recently-introduced "struct debug_reg".
>>>>> Use the latter instead.
>>>>> 
>>>>> This fixes the following error:
>>>>> 
>>>>> cc1: warnings being treated as errors
>>>>> arch/powerpc/kvm/booke.c: In function 'kvmppc_vcpu_run':
>>>>> arch/powerpc/kvm/booke.c:760:1: error: the frame size of 1424 bytes is larger
>>>>> than 1024 bytes
>>>>> make[2]: *** [arch/powerpc/kvm/booke.o] Error 1
>>>>> make[1]: *** [arch/powerpc/kvm] Error 2
>>>>> make[1]: *** Waiting for unfinished jobs....
>>>>> 
>>>>> Signed-off-by: Scott Wood <scottwood@freescale.com>
>>>>> Cc: Bharat Bhushan <r65777@freescale.com>
>>>>> ---
>>>>> Build tested only.  Bharat, please test.
>>>> 
>>>> Tested with qemu debug stub; It works fine
>>>> 
>>>> -Bharat
>>> 
>>> Alex, are you going to take this through your tree?
>> 
>> Sure. Do you want this for 3.13 or 3.14? Since I don't see the breakage
>> with my compilers I'd queue it for 3.14, but whatever works for you
>> works for me.
> 
> 3.13 please.  All I need to do to trigger the build break is enable KVM
> with corenet64_smp_defconfig with GCC 4.5.

Thanks, applied to the for-3.13 branch.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 9ee1261..aace905 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -35,7 +35,7 @@  extern void giveup_vsx(struct task_struct *);
 extern void enable_kernel_spe(void);
 extern void giveup_spe(struct task_struct *);
 extern void load_up_spe(struct task_struct *);
-extern void switch_booke_debug_regs(struct thread_struct *new_thread);
+extern void switch_booke_debug_regs(struct debug_reg *new_debug);
 
 #ifndef CONFIG_SMP
 extern void discard_lazy_cpu_state(void);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 3386d8a..4a96556 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -339,7 +339,7 @@  static void set_debug_reg_defaults(struct thread_struct *thread)
 #endif
 }
 
-static void prime_debug_regs(struct thread_struct *thread)
+static void prime_debug_regs(struct debug_reg *debug)
 {
 	/*
 	 * We could have inherited MSR_DE from userspace, since
@@ -348,22 +348,22 @@  static void prime_debug_regs(struct thread_struct *thread)
 	 */
 	mtmsr(mfmsr() & ~MSR_DE);
 
-	mtspr(SPRN_IAC1, thread->debug.iac1);
-	mtspr(SPRN_IAC2, thread->debug.iac2);
+	mtspr(SPRN_IAC1, debug->iac1);
+	mtspr(SPRN_IAC2, debug->iac2);
 #if CONFIG_PPC_ADV_DEBUG_IACS > 2
-	mtspr(SPRN_IAC3, thread->debug.iac3);
-	mtspr(SPRN_IAC4, thread->debug.iac4);
+	mtspr(SPRN_IAC3, debug->iac3);
+	mtspr(SPRN_IAC4, debug->iac4);
 #endif
-	mtspr(SPRN_DAC1, thread->debug.dac1);
-	mtspr(SPRN_DAC2, thread->debug.dac2);
+	mtspr(SPRN_DAC1, debug->dac1);
+	mtspr(SPRN_DAC2, debug->dac2);
 #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
-	mtspr(SPRN_DVC1, thread->debug.dvc1);
-	mtspr(SPRN_DVC2, thread->debug.dvc2);
+	mtspr(SPRN_DVC1, debug->dvc1);
+	mtspr(SPRN_DVC2, debug->dvc2);
 #endif
-	mtspr(SPRN_DBCR0, thread->debug.dbcr0);
-	mtspr(SPRN_DBCR1, thread->debug.dbcr1);
+	mtspr(SPRN_DBCR0, debug->dbcr0);
+	mtspr(SPRN_DBCR1, debug->dbcr1);
 #ifdef CONFIG_BOOKE
-	mtspr(SPRN_DBCR2, thread->debug.dbcr2);
+	mtspr(SPRN_DBCR2, debug->dbcr2);
 #endif
 }
 /*
@@ -371,11 +371,11 @@  static void prime_debug_regs(struct thread_struct *thread)
  * debug registers, set the debug registers from the values
  * stored in the new thread.
  */
-void switch_booke_debug_regs(struct thread_struct *new_thread)
+void switch_booke_debug_regs(struct debug_reg *new_debug)
 {
 	if ((current->thread.debug.dbcr0 & DBCR0_IDM)
-		|| (new_thread->debug.dbcr0 & DBCR0_IDM))
-			prime_debug_regs(new_thread);
+		|| (new_debug->dbcr0 & DBCR0_IDM))
+			prime_debug_regs(new_debug);
 }
 EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
 #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
@@ -683,7 +683,7 @@  struct task_struct *__switch_to(struct task_struct *prev,
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
-	switch_booke_debug_regs(&new->thread);
+	switch_booke_debug_regs(&new->thread.debug);
 #else
 /*
  * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 53e65a2..0591e05 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -681,7 +681,7 @@  int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
 int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 {
 	int ret, s;
-	struct thread_struct thread;
+	struct debug_reg debug;
 #ifdef CONFIG_PPC_FPU
 	struct thread_fp_state fp;
 	int fpexc_mode;
@@ -723,9 +723,9 @@  int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 #endif
 
 	/* Switch to guest debug context */
-	thread.debug = vcpu->arch.shadow_dbg_reg;
-	switch_booke_debug_regs(&thread);
-	thread.debug = current->thread.debug;
+	debug = vcpu->arch.shadow_dbg_reg;
+	switch_booke_debug_regs(&debug);
+	debug = current->thread.debug;
 	current->thread.debug = vcpu->arch.shadow_dbg_reg;
 
 	kvmppc_fix_ee_before_entry();
@@ -736,8 +736,8 @@  int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 	   We also get here with interrupts enabled. */
 
 	/* Switch back to user space debug context */
-	switch_booke_debug_regs(&thread);
-	current->thread.debug = thread.debug;
+	switch_booke_debug_regs(&debug);
+	current->thread.debug = debug;
 
 #ifdef CONFIG_PPC_FPU
 	kvmppc_save_guest_fp(vcpu);