qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Updated patch for the opcode table
@ 2016-02-03 10:14 John Paul Adrian Glaubitz
  2016-02-03 10:14 ` [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues John Paul Adrian Glaubitz
  0 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2016-02-03 10:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

Hi Laurent!

Here's the second patch again, this time checked with ./scripts/checkpatch.pl.

Thanks for the heads-up!

Adrian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 10:14 [Qemu-devel] Updated patch for the opcode table John Paul Adrian Glaubitz
@ 2016-02-03 10:14 ` John Paul Adrian Glaubitz
  2016-02-03 15:16   ` Eric Blake
  0 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2016-02-03 10:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, John Paul Adrian Glaubitz

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 10:14 ` [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues John Paul Adrian Glaubitz
@ 2016-02-03 15:16   ` Eric Blake
  2016-02-03 15:19     ` Laurent Vivier
  2016-02-03 15:20     ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Blake @ 2016-02-03 15:16 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, qemu-devel; +Cc: laurent

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

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); \
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 15:16   ` Eric Blake
@ 2016-02-03 15:19     ` Laurent Vivier
  2016-02-03 15:20     ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2016-02-03 15:19 UTC (permalink / raw)
  To: Eric Blake, John Paul Adrian Glaubitz, qemu-devel

-----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-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 15:16   ` Eric Blake
  2016-02-03 15:19     ` Laurent Vivier
@ 2016-02-03 15:20     ` John Paul Adrian Glaubitz
  2016-02-03 16:11       ` Eric Blake
  1 sibling, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2016-02-03 15:20 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: laurent

-----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-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 15:20     ` John Paul Adrian Glaubitz
@ 2016-02-03 16:11       ` Eric Blake
  2016-02-04 15:18         ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Blake @ 2016-02-03 16:11 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, qemu-devel; +Cc: laurent

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

On 02/03/2016 08:20 AM, John Paul Adrian Glaubitz wrote:
> 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

Weird. Wonder why it doesn't complain on that file?  I'm guessing that
it is due to the #define on the next line.  Because rearranging things
to put the code after the #define changes the situation (but not the
semantics):

diff --git i/target-m68k/translate.c w/target-m68k/translate.c
index 342c040..587c44f 100644
--- i/target-m68k/translate.c
+++ w/target-m68k/translate.c
@@ -2832,6 +2832,10 @@ void register_m68k_insns (CPUM68KState *env)
     if (m68k_feature(env, M68K_FEATURE_##feature)) \
         register_opcode(disas_##name, 0x##opcode, 0x##mask); \
     } while(0)
+
+    if (0)
+        return;
+
     INSN(undef,     0000, 0000, CF_ISA_A);
     INSN(arith_im,  0080, fff8, CF_ISA_A);
     INSN(bitrev,    00c0, fff8, CF_ISA_APLUSC);


properly warns:

$ git commit -a -m tmp
WARNING: braces {} are necessary for all arms of this statement
#10: FILE: target-m68k/translate.c:2836:
+    if (opcode_table[0])
[...]

total: 0 errors, 1 warnings, 10 lines checked

(yes, I've hooked up git to have a pre-commit check to run checkpatch.pl).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-03 16:11       ` Eric Blake
@ 2016-02-04 15:18         ` John Paul Adrian Glaubitz
  2016-02-08 23:15           ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2016-02-04 15:18 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: laurent

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 02/03/2016 05:11 PM, Eric Blake wrote:
> Weird. Wonder why it doesn't complain on that file?  I'm guessing
> that it is due to the #define on the next line.  Because
> rearranging things to put the code after the #define changes the
> situation (but not the semantics):

Alright, this should do the trick then.

Adrian

- -- 
 .''`.  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

iQIcBAEBCAAGBQJWs2vKAAoJEHQmOzf1tfkTR6MQAJWRekJIKOcxgdpFWWenL5c2
LmLPFtnFN+d4mvrSRuha7onRt/IFQ514oakur93gi45uholK0zR1/KVQPaLN/0ED
jnDUf9z2orJQjn36RnP2HJa4uoTEHQyXfmZ++nKWRlqvxeMNjSiLFzw/NycZapmd
CGllQ9mHX1UKFwbsZJWrrKfDN/jlqMp9Ph8t9pTyehUPsMP5fe+anZWG9cdiUtJI
C/rQUIdzIRi2dAntcVoWOeX6sx+uXfxtHanRdxl5gDv1e53fD9tuSVGnkpqwd0fU
2QKeSvPFh+OTDT4UPLr6ljukzwx2dTEYujtmZPgOz2d4KZg/XMS71vuE9Rjye+O+
y7LXAfamW/gtKAY2QdYSsvxsua7UsitlqOqC4BQ0TCvrdRZufRm6ruL+K45F6zag
brRc//20GYqunS67uw2qo4zh3hJCgv9z8Cah3W4KIRM1T+WhNIiunHQkte5gCkKD
MBZ9JisxNMAK2DnUElHIcY83LDCdfDe3M4T8ndk+4OyBw8SIPGAOO3KEhJ7Q132B
dFpL0zJ/VBPgUCRYedX5+c3YxKJLfFrXv1UZWE4Gt/lbBNqet/Ayv5dHIh48BU1D
u09tCUXjobOK2+H6vKiW60/b/IcNPKSsz35xpJXc91TmMBuYTnUap4ppy2jCTXpY
VBFmKPRgI3q8lhzrkUgh
=SFbP
-----END PGP SIGNATURE-----

[-- Attachment #2: 0002-m68k-Build-the-opcode-table-only-once-to-avoid-multi.patch --]
[-- Type: text/x-diff, Size: 1069 bytes --]

>From 9a78a2f7f8a9063c2ef4dd9b52ffc061d045886b 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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 535d7f9..015e220 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2828,6 +2828,12 @@ 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues
  2016-02-04 15:18         ` John Paul Adrian Glaubitz
@ 2016-02-08 23:15           ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2016-02-08 23:15 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel

On 02/04/2016 04:18 PM, John Paul Adrian Glaubitz wrote:
> On 02/03/2016 05:11 PM, Eric Blake wrote:
>> Weird. Wonder why it doesn't complain on that file?  I'm
>> guessing that it is due to the #define on the next line.
>> Because rearranging things to put the code after the #define
>> changes the situation (but not the semantics):
> 
> Alright, this should do the trick then.

And this one :).

-- 
 .''`.  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-08 23:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03 10:14 [Qemu-devel] Updated patch for the opcode table John Paul Adrian Glaubitz
2016-02-03 10:14 ` [Qemu-devel] [PATCH] m68k: Build the opcode table only once to avoid multithreading issues John Paul Adrian Glaubitz
2016-02-03 15:16   ` Eric Blake
2016-02-03 15:19     ` Laurent Vivier
2016-02-03 15:20     ` John Paul Adrian Glaubitz
2016-02-03 16:11       ` Eric Blake
2016-02-04 15:18         ` John Paul Adrian Glaubitz
2016-02-08 23:15           ` John Paul Adrian Glaubitz

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).