All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, alex.bennee@linaro.org,
	qemu-devel@nongnu.org, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v2 3/3] target-ppc: tlbie should have global effect
Date: Mon, 12 Sep 2016 13:02:58 +1000	[thread overview]
Message-ID: <20160912030258.GA15077@voom.fritz.box> (raw)
In-Reply-To: <1473462236.8689.197.camel@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 2164 bytes --]

On Sat, Sep 10, 2016 at 09:03:56AM +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2016-09-09 at 18:44 +0530, Nikunj A Dadhania wrote:
> > +static inline void tlb_clear_flag(CPUState *cs)
> > +{
> > +    PowerPCCPU *cpu = POWERPC_CPU(cs);
> > +    CPUPPCState *env = &cpu->env;
> > +
> > +    env->tlb_need_flush = 0;
> > +}
> 
> What is the point of making this a separate function ?
> 
> Also I'm not 100% certain about the correctness of clearing
> TLB_NEED_GLOBAL_FLUSH on the "other" guy.
> 
> We could have the situation where:
> 
> 	cpu 1:					cpu 2:
> 	sets both				..
> 	isync (clears local flush)		..
> 	<insert new translation>
> 	..					set both
> 	..					..
> 	..					..
> 	ptesync (clears global flush)		.. (both gets cleared)
> 
> Now here, you can see that cpu2 never does a global flush and so the
> new translation inserted by cpu 1 is not cleared while architecturally
> it should be.
> 
> That being said, I doubt the above scenario can happen in practice,
> but I think it's safer if you only clear the local bit on the "other"
> CPUs.

I'll wait for a respin addressing these comments.

Please also add a cover letter on the next version.

> 
> >  static inline void check_tlb_flush(CPUPPCState *env, uint32_t
> > global)
> >  {
> >      CPUState *cs = CPU(ppc_env_get_cpu(env));
> > @@ -161,6 +169,17 @@ static inline void check_tlb_flush(CPUPPCState
> > *env, uint32_t global)
> >          tlb_flush(cs, 1);
> >          env->tlb_need_flush &= ~TLB_NEED_LOCAL_FLUSH;
> >      }
> > +
> > +    if (global && (env->tlb_need_flush & TLB_NEED_GLOBAL_FLUSH)) {
> > +        CPUState *other_cs;
> > +        CPU_FOREACH(other_cs) {
> > +            if (other_cs != cs) {
> > +                tlb_clear_flag(other_cs);
> > +                tlb_flush(other_cs, 1);
> > +            }
> > +        }
> > +        env->tlb_need_flush &= ~TLB_NEED_GLOBAL_FLUSH;
> > +    }
> >  }
> >  #else
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-09-12  3:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 13:14 [Qemu-devel] [PATCH v2 1/3] target-ppc: add TLB_NEED_LOCAL_FLUSH flag Nikunj A Dadhania
2016-09-09 13:14 ` [Qemu-devel] [PATCH v2 2/3] target-ppc: add flag in chech_tlb_flush() Nikunj A Dadhania
2016-09-09 13:14 ` [Qemu-devel] [PATCH v2 3/3] target-ppc: tlbie should have global effect Nikunj A Dadhania
2016-09-09 23:03   ` Benjamin Herrenschmidt
2016-09-12  3:02     ` David Gibson [this message]
2016-09-12  4:43     ` Nikunj A Dadhania

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=20160912030258.GA15077@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=alex.bennee@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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.