From: Paolo Bonzini <pbonzini@redhat.com>
To: Sergey Fedorov <serge.fdrv@gmail.com>
Cc: qemu-devel@nongnu.org, sergey fedorov <sergey.fedorov@linaro.org>,
alex bennee <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 05/10] tcg: Prepare TB invalidation for lockless TB lookup
Date: Thu, 21 Jul 2016 07:25:44 -0400 (EDT) [thread overview]
Message-ID: <1521389053.9427118.1469100344429.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <57908993.50100@gmail.com>
----- Original Message -----
> From: "Sergey Fedorov" <serge.fdrv@gmail.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: qemu-devel@nongnu.org, "sergey fedorov" <sergey.fedorov@linaro.org>, "alex bennee" <alex.bennee@linaro.org>
> Sent: Thursday, July 21, 2016 10:36:35 AM
> Subject: Re: [PATCH 05/10] tcg: Prepare TB invalidation for lockless TB lookup
>
> On 20/07/16 01:27, Paolo Bonzini wrote:
> >
> > ----- Original Message -----
> >> From: "Sergey Fedorov" <serge.fdrv@gmail.com>
> >> To: "Paolo Bonzini" <pbonzini@redhat.com>, qemu-devel@nongnu.org
> >> Cc: "sergey fedorov" <sergey.fedorov@linaro.org>, "alex bennee"
> >> <alex.bennee@linaro.org>
> >> Sent: Tuesday, July 19, 2016 9:56:49 PM
> >> Subject: Re: [PATCH 05/10] tcg: Prepare TB invalidation for lockless TB
> >> lookup
> >>
> >> On 19/07/16 11:32, Paolo Bonzini wrote:
> >> It looks much better now :)
> >>
> >>> When invalidating a translation block, set an invalid flag into the
> >>> TranslationBlock structure first. It is also necessary to check whether
> >>> the target TB is still valid after acquiring 'tb_lock' but before calling
> >>> tb_add_jump() since TB lookup is to be performed out of 'tb_lock' in
> >>> future. Note that we don't have to check 'last_tb'; an already
> >>> invalidated
> >>> TB will not be executed anyway and it is thus safe to patch it.
> >>>
> >>> Suggested-by: Sergey Fedorov <serge.fdrv@gmail.com>
> >>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >>> ---
> >>> cpu-exec.c | 5 +++--
> >>> include/exec/exec-all.h | 2 ++
> >>> translate-all.c | 3 +++
> >>> 3 files changed, 8 insertions(+), 2 deletions(-)
> >> (snip)
> >>> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> >>> index acda7b6..bc0bcc5 100644
> >>> --- a/include/exec/exec-all.h
> >>> +++ b/include/exec/exec-all.h
> >>> @@ -213,6 +213,8 @@ struct TranslationBlock {
> >>> #define CF_USE_ICOUNT 0x20000
> >>> #define CF_IGNORE_ICOUNT 0x40000 /* Do not generate icount code */
> >>>
> >>> + uint16_t invalid;
> >> Why not "int"?
> > There's a hole there, we may want to move something else so I
> > used a smaller data type. Even uint8_t would do.
>
> But could simple "bool" work as well here?
>
> >
> > Paolo
> >>> +
> >>> void *tc_ptr; /* pointer to the translated code */
> >>> uint8_t *tc_search; /* pointer to search data */
>
> Are you sure that the hole is over there, not here?
Yes, all pointers have the same size. For 32-bit hosts, my
patch introduces a 2-byte hole. For 64-bit hosts, it reduces
a 4-byte hole to 2-byte.
Before:
target_ulong pc; /* 0 */
target_ulong cs_base; /* 4 */
uint32_t flags; /* 8 */
uint16_t size; /* 12 */
uint16_t icount; /* 14 */
uint32_t cflags; /* 16 */
/* 4 byte padding ** 20 on 64-bit systems */
void *tc_ptr; /* 24 on 64-bit systems, 20 on 32-bit */
After:
target_ulong pc; /* 0 */
target_ulong cs_base; /* 4 */
uint32_t flags; /* 8 */
uint16_t size; /* 12 */
uint16_t icount; /* 14 */
uint32_t cflags; /* 16 */
uint16_t invalid; /* 20 */
/* 2 byte padding ** 22 */
void *tc_ptr; /* 24 */
BTW, another reason to use uint16_t is that I suspect tb->icount can
be made redundant with cflags, so we might move tb->invalid up if
tb->icount is removed.
Thanks,
Paolo
next prev parent reply other threads:[~2016-07-21 11:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-19 8:32 [Qemu-devel] [PATCH v5 00/10] Reduce lock contention on TCG hot-path Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 01/10] util/qht: Document memory ordering assumptions Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 02/10] tcg: Pass last_tb by value to tb_find_fast() Paolo Bonzini
2016-09-08 12:44 ` Alex Bennée
2016-09-08 13:28 ` Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 03/10] tcg: Prepare safe tb_jmp_cache lookup out of tb_lock Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 04/10] tcg: Prepare safe access to tb_flushed " Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 05/10] tcg: Prepare TB invalidation for lockless TB lookup Paolo Bonzini
2016-07-19 19:56 ` Sergey Fedorov
2016-07-19 22:27 ` Paolo Bonzini
2016-07-21 8:36 ` Sergey Fedorov
2016-07-21 9:04 ` Paolo Bonzini
2016-07-21 11:25 ` Paolo Bonzini [this message]
2016-07-21 17:42 ` Sergey Fedorov
2016-07-19 8:32 ` [Qemu-devel] [PATCH 06/10] tcg: set up tb->page_addr before insertion Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 07/10] tcg: cpu-exec: remove tb_lock from the hot-path Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 08/10] tcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump() Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 09/10] tcg: Merge tb_find_slow() and tb_find_fast() Paolo Bonzini
2016-07-19 8:32 ` [Qemu-devel] [PATCH 10/10] tcg: rename tb_find_physical() Paolo Bonzini
2016-09-08 12:39 ` Alex Bennée
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=1521389053.9427118.1469100344429.JavaMail.zimbra@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=serge.fdrv@gmail.com \
--cc=sergey.fedorov@linaro.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 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).