mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Colin Cross <ccross@android.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Russell King <linux@arm.linux.org.uk>, Barry Song <bs14@csr.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ido Yariv <ido@wizery.com>, Daniel Drake <dsd@laptop.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6] ARM: vfp: Always save VFP state in vfp_pm_suspend on UP
Date: Mon, 16 Jul 2012 14:34:17 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.02.1207161433420.14068@xanadu.home> (raw)
In-Reply-To: <1342462640-18410-1-git-send-email-ccross@android.com>

On Mon, 16 Jul 2012, Colin Cross wrote:

> vfp_pm_suspend should save the VFP state in suspend after
> any lazy context switch.  If it only saves when the VFP is enabled,
> the state can get lost when, on a UP system:
>   Thread 1 uses the VFP
>   Context switch occurs to thread 2, VFP is disabled but the
>      VFP context is not saved
>   Thread 2 initiates suspend
>   vfp_pm_suspend is called with the VFP disabled, and the unsaved
>      VFP context of Thread 1 in the registers
> 
> Modify vfp_pm_suspend to save the VFP context whenever
> vfp_current_hw_state is not NULL.
> 
> Includes a fix from Ido Yariv <ido@wizery.com>, who pointed out that on
> SMP systems, the state pointer can be pointing to a freed task struct if
> a task exited on another cpu, fixed by using #ifdef CONFIG_SMP in the
> new if clause.
> 
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Barry Song <bs14@csr.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Ido Yariv <ido@wizery.com>
> Cc: Daniel Drake <dsd@laptop.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Colin Cross <ccross@android.com>
> ---
>  arch/arm/vfp/vfpmodule.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
> index 58696192..ce55f05 100644
> --- a/arch/arm/vfp/vfpmodule.c
> +++ b/arch/arm/vfp/vfpmodule.c
> @@ -457,6 +457,12 @@ static int vfp_pm_suspend(void)
>  
>  		/* disable, just in case */
>  		fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> +	} else if (vfp_current_hw_state[ti->cpu]) {
> +#ifndef CONFIG_SMP
> +		fmxr(FPEXC, fpexc | FPEXC_EN);
> +		vfp_save_state(vfp_current_hw_state[ti->cpu], fpexc);
> +		fmxr(FPEXC, fpexc);
> +#endif
>  	}

Couldn't vfp_sync_hwstate() be used here instead?


Nicolas

  reply	other threads:[~2012-07-16 18:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 18:17 Colin Cross
2012-07-16 18:34 ` Nicolas Pitre [this message]
2012-07-16 19:42   ` Colin Cross

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=alpine.LFD.2.02.1207161433420.14068@xanadu.home \
    --to=nicolas.pitre@linaro.org \
    --cc=Catalin.Marinas@arm.com \
    --cc=bs14@csr.com \
    --cc=ccross@android.com \
    --cc=dsd@laptop.org \
    --cc=ido@wizery.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=will.deacon@arm.com \
    /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

all inboxes | Powered by JetHome®