public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: tiejun.chen <tiejun.chen@windriver.com>
Cc: linuxppc-dev@lists.ozlabs.org, agraf@suse.de,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [v1][PATCH 1/1] KVM: PPC: disable preemption when using hard_irq_disable()
Date: Thu, 11 Jul 2013 09:13:36 -0500	[thread overview]
Message-ID: <1373552016.8183.242@snotra> (raw)
In-Reply-To: <51DE1FD1.90609@windriver.com> (from tiejun.chen@windriver.com on Wed Jul 10 22:00:33 2013)

On 07/10/2013 10:00:33 PM, tiejun.chen wrote:
> On 07/11/2013 03:15 AM, Scott Wood wrote:
>> On 07/10/2013 01:02:19 AM, Tiejun Chen wrote:
>>> We should ensure the preemption cannot occur while calling  
>>> get_paca()
>>> insdide hard_irq_disable(), otherwise the paca_struct may be the
>>> wrong one just after. And btw, we may update timing stats in this  
>>> case.
>> 
>> The soft-ee mechanism depends on accessing the PACA directly via r13  
>> to avoid
>> this.  We probably should be using inline asm to read was_enabled  
>> rather than
> 
> Yes.
> 
>> hoping the compiler doesn't do anything silly.
> 
> Do you recommend I should directly replace get_paca() with local_paca  
> inside hard_irq_disable()?
> 
> #define hard_irq_disable()      do {                    \
>         u8 _was_enabled = get_paca()->soft_enabled;     \
> 
> ->	u8 _was_enabled = local_paca->soft_enabled;
> 
> But is this safe for all scenarios?

get_paca() is just a #define for local_paca.  It won't make a  
difference, other than to evade the debug check.

In practice, it's unlikely that GCC would do anything other than a load  
directly from r13, but to be sure we should use inline asm to do the  
load, just like arch_local_save_flags and arch_local_irq_disable do.

-Scott

  reply	other threads:[~2013-07-11 14:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  6:02 [v1][PATCH 1/1] KVM: PPC: disable preemption when using hard_irq_disable() Tiejun Chen
2013-07-10  9:49 ` Alexander Graf
2013-07-11  2:48   ` tiejun.chen
2013-07-11  9:49     ` Alexander Graf
2013-07-11 12:28       ` Benjamin Herrenschmidt
2013-07-11 12:47         ` Alexander Graf
2013-07-11 12:54           ` Benjamin Herrenschmidt
2013-07-11 13:07             ` Alexander Graf
2013-07-12  0:19               ` Benjamin Herrenschmidt
2013-07-12  2:13                 ` tiejun.chen
2013-07-12  3:57                   ` Benjamin Herrenschmidt
2013-07-12  4:54                     ` tiejun.chen
2013-07-14  4:13                       ` Benjamin Herrenschmidt
2013-07-15  3:04                         ` tiejun.chen
2013-07-10 19:15 ` Scott Wood
2013-07-11  3:00   ` tiejun.chen
2013-07-11 14:13     ` Scott Wood [this message]
     [not found] <1373559480.8183.258@snotra>
2013-07-12  0:30 ` Benjamin Herrenschmidt
     [not found] ` <FB21594A-C233-4A97-8503-E2A1275F8F17@suse.de>
     [not found]   ` <1373560585.8183.261@snotra>
2013-07-12  3:22     ` tiejun.chen
     [not found] <1373651433.8183.276@snotra>
2013-07-12 23:05 ` Benjamin Herrenschmidt
2013-07-15  2:20   ` tiejun.chen
2013-07-15  2:47     ` Benjamin Herrenschmidt
2013-07-15  3:03       ` tiejun.chen
     [not found]     ` <1373909248.8183.303@snotra>
2013-07-16  2:15       ` tiejun.chen
2013-07-15  2:25 ` tiejun.chen

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=1373552016.8183.242@snotra \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tiejun.chen@windriver.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