From: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: laurent.desnogues@gmail.com, e.voevodin@samsung.com,
qemu-devel@nongnu.org, chenwj@iis.sinica.edu.tw
Subject: Re: [Qemu-devel] [RFC][PATCH v2 3/4] tcg: add optimized TCG qemu_ld/st generation
Date: Fri, 06 Jul 2012 20:20:52 +0900 [thread overview]
Message-ID: <4FF6CA14.6020506@samsung.com> (raw)
In-Reply-To: <CAFEAcA8qTHq5eXt5bwZmiZ8Jm7CqFyobNRHeE_kOR1-xe0CsRw@mail.gmail.com>
> Is it really worth having this as a CONFIG_ switch? If we think
> it's better to do this out of line we should just switch to
> always generating the out of line code, I think. There's not much
> point in retaining the old code path if it's disabled -- it will
> just bitrot.
I agree.
However, it is just a safe guard because I have not test all the targets
of qemu.
I've only tested x86 and ARM targets on x86 and x86-64 hosts.
If agreed to remove conditional macro, then I'll fix it.
>> +#ifdef CONFIG_QEMU_LDST_OPTIMIZATION
>> + /* jne slow_path */
>> + tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0);
>> + if (!label_ptr) {
>> + tcg_abort();
>> + }
> There's no point in this check and abort -- label_ptr will always be
> non-NULL (it would be an internal error if it wasn't), and if it is by
> some future bug NULL, we'll just crash on the next line, which is just
> as good. The existing code didn't feel the need to make this check, we
> don't need to do it in the new code.
It cannot be happened now as you said. It is just for a possible future bug.
But I cannot understand "we'll just crash on the next line" you
mentioned above.
>> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
>> + /* helper stub will be jumped back here */
> "will jump back here".
Ok.
>
>> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
>> + /* helper stub will be jumped back here */
> ditto.
Ok.
>> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
>> +/* optimization to reduce jump overheads for qemu_ld/st IRs */
>> +
>> +/*
>> + * qemu_ld/st code generator call add_qemu_ldst_label,
>> + * so that slow case(TLB miss or I/O rw) is handled at the end of TB
>> + */
> This comment isn't really describing the purpose of this function,
> which is something more along the lines of "Record the context of
> a call to the out of line helper code for the slow path for a
> load or store, so that we can later generate the correct helper
> code".
I agree. Your description looks better.
>
>> + if (s->nb_qemu_ldst_labels >= TCG_MAX_QEMU_LDST)
>> + tcg_abort();
> QEMU coding style requires braces. Please use checkpatch.pl.
Ok.
>
>> +
>> + idx = s->nb_qemu_ldst_labels++;
>> + label = (TCGLabelQemuLdst *)&s->qemu_ldst_labels[idx];
>> + label->opc_ext = opc_ext;
>> + label->datalo_reg = data_reg;
>> + label->datahi_reg = data_reg2;
>> + label->addrlo_reg = addrlo_reg;
>> + label->addrhi_reg = addrhi_reg;
>> + label->mem_index = mem_index;
>> + label->raddr = raddr;
>> + if (!label_ptr) {
>> + tcg_abort();
>> + }
> Another pointless abort.
ditto.
>
>> diff --git a/tcg/tcg.c b/tcg/tcg.c
>> index 8386b70..8009069 100644
>> --- a/tcg/tcg.c
>> +++ b/tcg/tcg.c
>> @@ -301,6 +301,14 @@ void tcg_func_start(TCGContext *s)
>>
>> gen_opc_ptr = gen_opc_buf;
>> gen_opparam_ptr = gen_opparam_buf;
>> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
>> + /* initialize qemu_ld/st labels which help to generate TLB miss case codes at the end of TB */
>> + s->qemu_ldst_labels = tcg_malloc(sizeof(TCGLabelQemuLdst) * TCG_MAX_QEMU_LDST);
>> + if (!s->qemu_ldst_labels) {
>> + tcg_abort();
>> + }
> Unnecessary check -- tcg_malloc() can never return 0.
Ok.
>> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION)
>> +/* Macros and structures for qemu_ld/st IR code optimization:
>> + It looks good for TCG_MAX_HELPER_LABELS to be half of OPC_BUF_SIZE in exec-all.h. */
>> +#define TCG_MAX_QEMU_LDST 320
> Is that true even if you have a huge block with nothing but simple
> guest load instructions in it?
I agree. It needs to be set as same size with OPC_BUF_SIZE for covering
extreme cases.
next prev parent reply other threads:[~2012-07-06 11:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-05 13:23 [Qemu-devel] [RFC][PATCH v2 0/4] tcg: enhance code generation quality for qemu_ld/st IRs Yeongkyoon Lee
2012-07-05 13:23 ` [Qemu-devel] [RFC][PATCH v2 1/4] tcg: add declarations and templates of extended MMU helpers Yeongkyoon Lee
2012-07-05 13:40 ` Peter Maydell
2012-07-06 10:30 ` Yeongkyoon Lee
2012-07-06 10:35 ` 陳韋任 (Wei-Ren Chen)
2012-07-05 13:23 ` [Qemu-devel] [RFC][PATCH v2 2/4] tcg: add extended MMU helpers to softmmu targets Yeongkyoon Lee
2012-07-05 13:43 ` Peter Maydell
2012-07-05 18:49 ` Blue Swirl
2012-07-06 12:16 ` Yeongkyoon Lee
2012-07-05 13:23 ` [Qemu-devel] [RFC][PATCH v2 3/4] tcg: add optimized TCG qemu_ld/st generation Yeongkyoon Lee
2012-07-05 14:04 ` Peter Maydell
2012-07-06 11:20 ` Yeongkyoon Lee [this message]
2012-07-06 11:28 ` Peter Maydell
2012-07-05 13:23 ` [Qemu-devel] [RFC][PATCH v2 4/4] configure: add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization Yeongkyoon Lee
2012-07-05 13:55 ` Andreas Färber
2012-07-06 3:13 ` Evgeny Voevodin
2012-07-05 14:06 ` Peter Maydell
2012-07-05 14:26 ` Laurent Desnogues
2012-07-06 11:43 ` Yeongkyoon Lee
2012-07-07 7:51 ` Blue Swirl
2012-07-08 8:35 ` Yeongkyoon Lee
2012-07-10 9:12 ` [Qemu-devel] [RFC][PATCH v2 0/4] tcg: enhance code generation quality for qemu_ld/st IRs Yeongkyoon Lee
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=4FF6CA14.6020506@samsung.com \
--to=yeongkyoon.lee@samsung.com \
--cc=chenwj@iis.sinica.edu.tw \
--cc=e.voevodin@samsung.com \
--cc=laurent.desnogues@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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.