All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, benh@kernel.crashing.org,
	alex.bennee@linaro.org, qemu-devel@nongnu.org, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v4 2/3] target-ppc: add flag in chech_tlb_flush()
Date: Thu, 15 Sep 2016 11:32:39 +0530	[thread overview]
Message-ID: <8760pxzon4.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <20160915002035.GD15077@voom.fritz.box>

David Gibson <david@gibson.dropbear.id.au> writes:
> [ Unknown signature status ]
> On Wed, Sep 14, 2016 at 11:24:01AM +0530, Nikunj A Dadhania wrote:
>> We flush the qemu TLB lazily. check_tlb_flush is called whenever we hit
>> a context synchronizing event or instruction that requires a pending
>> flush to be performed.
>> 
>> However, we fail to handle broadcast TLB flush operations. In order to
>> fix that efficiently, we want to differenciate whether check_tlb_flush()
>> needs to only apply pending local flushes (isync instructions,
>> interrupts, ...) or also global pending flush operations. The latter is
>> only needed when executing instructions that are defined architecturally
>> as synchronizing global TLB flush operations. This in our case is
>> ptesync on BookS and tlbsync on BookE along with the paravirtualized
>> hypervisor calls.
>
> Much better description, thank you.
>
>> 
>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> ---

>> diff --git a/target-ppc/helper.h b/target-ppc/helper.h
>> index e75d070..5ececf1 100644
>> --- a/target-ppc/helper.h
>> +++ b/target-ppc/helper.h
>> @@ -18,7 +18,7 @@ DEF_HELPER_1(rfid, void, env)
>>  DEF_HELPER_1(hrfid, void, env)
>>  DEF_HELPER_2(store_lpcr, void, env, tl)
>>  #endif
>> -DEF_HELPER_1(check_tlb_flush, void, env)
>> +DEF_HELPER_2(check_tlb_flush, void, env, i32)

Not sure if I can use bool here, maybe I can use target_ulong.

>> -void helper_check_tlb_flush(CPUPPCState *env)
>> +void helper_check_tlb_flush(CPUPPCState *env, unsigned int global)
>
> You're using an unsigned int for the flag here, but uint32_t for
> check_tlb_flush(), which is a needless inconsistency.

I can make this as uint32_t for consistency.

> You might as well make them both bools, since that's how it's actually
> being used.
>
> As a general rule don't use fixed width types unless you
> actually *need* the fixed width - the type choices are part of the
> interface documentation and using a fixed width type when you don't
> need it sends a misleading message.

I optimized it because to avoid a new variable, and re-used "t":

-static inline void gen_check_tlb_flush(DisasContext *ctx)
+static inline void gen_check_tlb_flush(DisasContext *ctx, uint32_t global)
 {
     TCGv_i32 t;
     TCGLabel *l;
@@ -3078,12 +3078,13 @@ static inline void gen_check_tlb_flush(DisasContext *ctx)
     t = tcg_temp_new_i32();
     tcg_gen_ld_i32(t, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
     tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, l);
-    gen_helper_check_tlb_flush(cpu_env);
+    tcg_gen_movi_i32(t, global);
+    gen_helper_check_tlb_flush(cpu_env, t);
     gen_set_label(l);
     tcg_temp_free_i32(t);
 }


Regards
Nikunj

  reply	other threads:[~2016-09-15  6:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  5:53 [Qemu-devel] [PATCH v4 0/3] ppc: handle broadcast tlb flush Nikunj A Dadhania
2016-09-14  5:54 ` [Qemu-devel] [PATCH v4 1/3] target-ppc: add TLB_NEED_LOCAL_FLUSH flag Nikunj A Dadhania
2016-09-15  0:15   ` David Gibson
2016-09-14  5:54 ` [Qemu-devel] [PATCH v4 2/3] target-ppc: add flag in chech_tlb_flush() Nikunj A Dadhania
2016-09-15  0:20   ` David Gibson
2016-09-15  6:02     ` Nikunj A Dadhania [this message]
2016-09-15  6:16       ` David Gibson
2016-09-15  6:22         ` Benjamin Herrenschmidt
2016-09-15  6:25           ` David Gibson
2016-09-14  5:54 ` [Qemu-devel] [PATCH v4 3/3] target-ppc: tlbie/tlbivax should have global effect Nikunj A Dadhania
2016-09-15  0:25   ` David Gibson
2016-09-15  1:41     ` Benjamin Herrenschmidt
2016-09-15  1:48       ` David Gibson

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=8760pxzon4.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me \
    --to=nikunj@linux.vnet.ibm.com \
    --cc=alex.bennee@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=david@gibson.dropbear.id.au \
    --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.