From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Cc: 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: Sat, 10 Sep 2016 09:03:56 +1000 [thread overview]
Message-ID: <1473462236.8689.197.camel@kernel.crashing.org> (raw)
In-Reply-To: <1473426865-14191-3-git-send-email-nikunj@linux.vnet.ibm.com>
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.
> 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
next prev parent reply other threads:[~2016-09-09 23:04 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 [this message]
2016-09-12 3:02 ` David Gibson
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=1473462236.8689.197.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=alex.bennee@linaro.org \
--cc=david@gibson.dropbear.id.au \
--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.