qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vasilev Oleg via <qemu-devel@nongnu.org>
To: Richard Henderson <richard.henderson@linaro.org>,
	Oleg Vasilev <me@svin.in>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [RFC PATCH 2/2] accel/tcg: replace phys_pc with asid in TB htable key
Date: Fri, 24 Dec 2021 13:02:51 +0000	[thread overview]
Message-ID: <e05dd835e5ad4cb9aec3ccf0c7369c30@huawei.com> (raw)
In-Reply-To: 3f3440c3-4a1b-a272-c445-58ff7341bfd3@linaro.org

On 12/23/2021 7:31 PM, Richard Henderson wrote:
> On 12/22/21 8:50 AM, Oleg Vasilev wrote:
>> From: Oleg Vasilev <vasilev.oleg@huawei.com>
>>
>> Using a physical pc requires to translate address every time next block
>> needs to be found and executed. This also contaminates TLB with code-related
>> records.
>>
>> Instead, I suggest we introduce an architecture-specific address space
>> identifier, and use it to distinguish between different AS's
>> translation blocks.
> 
> Why do you believe that asid is sufficient here?  You're not invalidating any more TBs 
> that I can see.  What happens when the kernel re-uses an asid?

Hi,

Sorry, I had some comments for the patch, but forgot to put it in.

So, I think I interpret the term "asid" in some other sense, namely, an
identifier, which is constant during whole lifespan of an address space.
Same as PID in that sense. Do you think this is a viable approach?

If we assume translation table wouldn't change during process life,
after the death of the process, all it address space would be anyway
unmapped and corresponding translation blocks would be invalidated.


> 
> I believe this patch to be fundamentally flawed.

Maybe it is, I just wanted to get feedback from you guys. Do you think
maybe exists some other way, which would not require translating va->pa
every time to look up next block?

More context is in:

 Subject: Suggestions for TCG performance improvements
 Date: Thu, 2 Dec 2021 09:47:13 +0000
 Message-ID: <c76bde31-8f3b-2d03-b7c7-9e026d4b5873@huawei.com>

> 
> All that said,
> 
>> +/* Returns the identifier for a current address space. */
>> +static uint64_t arm_get_asid(CPUState *cs)
>> +{
>> +    ARMCPU *cpu = ARM_CPU(cs);
>> +    CPUARMState *env = &cpu->env;
>> +    ARMMMUIdx mmu_idx = arm_mmu_idx(env);
>> +    uint64_t tcr = regime_tcr(env, mmu_idx)->raw_tcr;
>> +
>> +#define TCR_A1     (1U << 22)
>> +    return regime_ttbr(env, mmu_idx, (tcr&TCR_A1)>0);
>> +}
> 
> Why are you returning the entire ttbr, and not the asid in the top 16 bits?

Actually, for my particular case I seem to need to return the lowest 40
bits, which is actual base for TT.

Thanks,
Oleg

> 
> 
> r~
> 



  reply	other threads:[~2021-12-24 13:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 16:50 [RFC PATCH 0/2] accel/tcg: replace phys_pc with asid in TB htable key Oleg Vasilev
2021-12-22 16:50 ` [RFC PATCH 1/2] target/arm: move regime_ttbr helper Oleg Vasilev
2022-01-31 20:13   ` Vasilev Oleg via
2021-12-22 16:50 ` [RFC PATCH 2/2] accel/tcg: replace phys_pc with asid in TB htable key Oleg Vasilev
2021-12-23 16:31   ` Richard Henderson
2021-12-24 13:02     ` Vasilev Oleg via [this message]
2021-12-24 19:56       ` Richard Henderson

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=e05dd835e5ad4cb9aec3ccf0c7369c30@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=alex.bennee@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=me@svin.in \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vasilev.oleg@huawei.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;
as well as URLs for NNTP newsgroup(s).