diff mbox

m68k: Build the opcode table only once to avoid multithreading issues

Message ID 1454494453-20738-2-git-send-email-glaubitz@physik.fu-berlin.de (mailing list archive)
State New, archived
Headers show

Commit Message

John Paul Adrian Glaubitz Feb. 3, 2016, 10:14 a.m. UTC
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 target-m68k/translate.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Eric Blake Feb. 3, 2016, 3:16 p.m. UTC | #1
On 02/03/2016 03:14 AM, John Paul Adrian Glaubitz wrote:
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> ---
>  target-m68k/translate.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target-m68k/translate.c b/target-m68k/translate.c
> index 535d7f9..a989961 100644
> --- a/target-m68k/translate.c
> +++ b/target-m68k/translate.c
> @@ -2828,6 +2828,10 @@ register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask)
>     Later insn override earlier ones.  */
>  void register_m68k_insns (CPUM68KState *env)
>  {
> +    /* Build the opcode table only once to avoid
> +       multithreading issues. */
> +    if (opcode_table[0] != NULL)
> +        return;

Missing {}.  Are you sure this is the version that passed checkpatch.pl?

>  #define INSN(name, opcode, mask, feature) do { \
>      if (m68k_feature(env, M68K_FEATURE_##feature)) \
>          register_opcode(disas_##name, 0x##opcode, 0x##mask); \
>
Laurent Vivier Feb. 3, 2016, 3:19 p.m. UTC | #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



Le 03/02/2016 16:16, Eric Blake a écrit :
> On 02/03/2016 03:14 AM, John Paul Adrian Glaubitz wrote:
>> Signed-off-by: John Paul Adrian Glaubitz
>> <glaubitz@physik.fu-berlin.de> --- target-m68k/translate.c | 4
>> ++++ 1 file changed, 4 insertions(+)
>> 
>> diff --git a/target-m68k/translate.c b/target-m68k/translate.c 
>> index 535d7f9..a989961 100644 --- a/target-m68k/translate.c +++
>> b/target-m68k/translate.c @@ -2828,6 +2828,10 @@ register_opcode
>> (disas_proc proc, uint16_t opcode, uint16_t mask) Later insn
>> override earlier ones.  */ void register_m68k_insns (CPUM68KState
>> *env) { +    /* Build the opcode table only once to avoid +
>> multithreading issues. */ +    if (opcode_table[0] != NULL) +
>> return;
> 
> Missing {}.  Are you sure this is the version that passed
> checkpatch.pl?

It seems checkpatch.pl doesn't ask for this anymore.

> 
>> #define INSN(name, opcode, mask, feature) do { \ if
>> (m68k_feature(env, M68K_FEATURE_##feature)) \ 
>> register_opcode(disas_##name, 0x##opcode, 0x##mask); \
>> 
> 
Laurent
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWshqdAAoJEPMMOL0/L748AQUP/jKv0x4FC8MSqRKJjiL27O1O
rQ98JqbZPaykz+wXRvRM6ZD5NEUE/PdDXQbzq3iVAJZFMXzMjv1RgOXVAVhhZRCr
3P6qv9hTzWoqrBDXHGEI0ACiTZwtWOd630SMr1Xz91WKkM9Iet7ULazmg+GinRv/
5fzn0YoJ9f8WBahkAW1NYZk1dlJKKab2N8hYcbOiWj0PiwyGd4mGJZrpPrbNYzCL
cnuRqSbJvBB+hyzWNYdLRdAcvLbpuYcKUltPDry3aYdkpTw7zS+iFQBe4E69j70h
7qtEyv2sIqQ2cgidWKAZPJ8l/jtUST82qfD0bGigELBKIaSE3+FVzim87WDpnB46
joeglUTU+TEBrY+FDyhNZtOB+XIfOoG2YVUQEVyDnFeBZP+XQWprrI1D318sAv/a
P0Huv3Fije52SUGLSHfP03Z6CYmYV4Gp113XVX6qOJoqSq/2P0ML3sWpwb/fppwF
VSykpdxUPGtHi+fh8o9VSVW5wwY3LrbfNriGs0bB8XDas6EdhpFmgXO07TC4OosI
aCy3OT56rM4FdmbcdSL7nzD9IG4e0GRGcNEzKOlBDcGt8/NGxIEOyKz/gv7piSLB
zLpKnyMFVn2FEUldhf6AmEl6L3huUzjlbWWylu8YPkjIqVOjSi5qZLH6j9C3a4zk
R9OOqSJXGKW7xelPgYpP
=zXmA
-----END PGP SIGNATURE-----
John Paul Adrian Glaubitz Feb. 3, 2016, 3:20 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 02/03/2016 04:16 PM, Eric Blake wrote:
> Missing {}.  Are you sure this is the version that passed
> checkpatch.pl?

Yes:

glaubitz@z6:..qemu/target-m68k> ../scripts/checkpatch.pl
0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch
total: 0 errors, 0 warnings, 10 lines checked

0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch has no
obvious style problems and is ready for submission.
glaubitz@z6:..qemu/target-m68k> cat
0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch
- From 2d8ef8d0244db95e41e04ff909560f12676e1dec Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Wed, 3 Feb 2016 10:22:35 +0100
Subject: [PATCH 2/2] m68k: Build the opcode table only once to avoid
 multithreading issues

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
- ---
 target-m68k/translate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 535d7f9..a989961 100644
- --- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2828,6 +2828,10 @@ register_opcode (disas_proc proc, uint16_t
opcode, uint16_t mask)
    Later insn override earlier ones.  */
 void register_m68k_insns (CPUM68KState *env)
 {
+    /* Build the opcode table only once to avoid
+       multithreading issues. */
+    if (opcode_table[0] != NULL)
+        return;
 #define INSN(name, opcode, mask, feature) do { \
     if (m68k_feature(env, M68K_FEATURE_##feature)) \
         register_opcode(disas_##name, 0x##opcode, 0x##mask); \
- -- 
2.7.0

glaubitz@z6:..qemu/target-m68k>

- -- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWshrHAAoJEHQmOzf1tfkT9V0P/1cMCHys6vImaJZtGOzQyaf2
PgsAw0fpgaOuL6u8ypxVHo++7QRI4lbZMTBx5PPuZQsc1iRhN27bAcxIzsoDPDeg
KVHx5Jc7JcvDNQiCTArOW1FVQeFFVYkQlAoTWzOqr+DYje8flU3OmKzbVoU+MXTN
Vv7P5CQk90mSxYMLzaggM+BpPMtVGvhxuVy0wOQKnMgTyF0U0r/G+/PmUBcidwDv
w7v7EcUSzzEXp6vZR6W0qBP6QBRqJyG3lrxWjZBl1K9lWfEv4gd4IQxWbf/A6P22
3GQjtEiiIEgppP1YFl0ah0VY/7uEtsx5sxo5vEOiWgaRm1Th8Y3rctFEyfT8Y73K
da1ro7KLFqRSut2tzuQ+ebsTujLY+XTs0y5Sxg3K8LfuMIs6fjzPN0hpx+8Z0hjD
7wqXoINLxIuCPz66cLkVFdtJTl7Z2uXGwGplel7wGTgLaIJHY8ZlOowmwELivVTh
ZhoVM3vaF3bHAx5g5CgsJ3X9EaJoxu268hJoMLwaOVte8lgOr48acGZPWPrMwdHp
hi9lJtnKzfMN09WFmYWiAeB0sx6TpniK48o2URwLX+UVMnkQz2qIEjFeAfmz//IR
vRQtLGqZg1Cjw76TpIPVd7hJPeklZXqt1rd4NoWn3CML0xIlWOYGSBNi7CTboPyr
MyBXXeWItvj6kwO4pm7f
=L8Yn
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 535d7f9..a989961 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2828,6 +2828,10 @@  register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask)
    Later insn override earlier ones.  */
 void register_m68k_insns (CPUM68KState *env)
 {
+    /* Build the opcode table only once to avoid
+       multithreading issues. */
+    if (opcode_table[0] != NULL)
+        return;
 #define INSN(name, opcode, mask, feature) do { \
     if (m68k_feature(env, M68K_FEATURE_##feature)) \
         register_opcode(disas_##name, 0x##opcode, 0x##mask); \