Skip to contentSkip to conversation

tools/tests/x86_emulate: #define unlikely in x86 emulator test harness

PATCH In review Ian Jackson 3 participants 5 messages Dec 22, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/tests/x86_emulate: #define unlikely in x86 emulator test harness

"x86emul: in_longmode() should not ignore ->read_msr() errors" aka c/s 122dd9575c7a introduced a use of unlikely() in xen/arch/x86/x86_emulate/x86_emulate.c.

I think this is probably intentional and fine. However, there is no definition of unlikely in the x86 emulator test harness, under tools.

The result is this error:
x86_emulate/x86_emulate.c: In function 'in_longmode':
x86_emulate/x86_emulate.c:1300:10: error: implicit declaration of function 'unlikely' [-Werror=implicit-function-declaration]

            unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
            ^~~~~~~~

Fix this by providing a boring definition of unlikely().

CC Andrew Cooper <[email protected]>
CC Jan Beulich <[email protected]>
---
 tools/tests/x86_emulator/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)
tools/tests/x86_emulator/x86_emulate.c +1 -0
index c46b7fc..e8f26fe 100644
@@ -49,5 +49,6 @@ typedef bool bool_t;
 
 #define __init
 #define __maybe_unused __attribute__((__unused__))
+#define unlikely(x) (x)
 
 #include "x86_emulate/x86_emulate.c"
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 9 lines · Ian Jackson

"x86emul: in_longmode() should not ignore ->read_msr() errors" aka c/s 122dd9575c7a introduced a use of unlikely() in xen/arch/x86/x86_emulate/x86_emulate.c.

I think this is probably intentional and fine. However, there is no definition of unlikely in the x86 emulator test harness, under tools.

The result is this error:
x86_emulate/x86_emulate.c: In function 'in_longmode':

Quoted 7 lines
   x86_emulate/x86_emulate.c:1300:10: error: implicit declaration of function 'unlikely' [-Werror=implicit-function-declaration]
             unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
             ^~~~~~~~

Fix this by providing a boring definition of unlikely().

This was fixed by 3e84c8da7d2c5442a12789dae7163dca6c0e154f

Part of that should backported to 4.8, where it is still broken.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw

Andrew Cooper writes ("Re: [PATCH] tools/tests/x86_emulate: #define unlikely in x86 emulator test harness"):

Quoted 14 lines · Ian Jackson
Quoted 13 lines

"x86emul: in_longmode() should not ignore ->read_msr() errors" aka c/s 122dd9575c7a introduced a use of unlikely() in xen/arch/x86/x86_emulate/x86_emulate.c.

I think this is probably intentional and fine. However, there is no definition of unlikely in the x86 emulator test harness, under tools.

The result is this error:
x86_emulate/x86_emulate.c: In function 'in_longmode':

   x86_emulate/x86_emulate.c:1300:10: error: implicit declaration of function 'unlikely' [-Werror=implicit-function-declaration]
             unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
             ^~~~~~~~
Quoted 5 lines
Quoted 3 lines

Fix this by providing a boring definition of unlikely().

This was fixed by 3e84c8da7d2c5442a12789dae7163dca6c0e154f

I did not find this important build fix for a regression in 4.8.0 because:

* this commit contains a mixture of the build fix and other changes
* `git log -G unlikely' produced a lot of output: too much to read the whole message for each commit through looking for this fix
* the commit message did not contain a copy of the error message
* once I had dug into the code myself and found 122dd9575c7a it didn't occur to me to `git log --grep 122dd9'.

Quoted 1 line

Part of that should backported to 4.8, where it is still broken.

Backporting this is made more awkward by the decision to make the fix a portmanteau. Do the x86 maintainers intend to provide a ready-to-use backport or shall I try to prepare one ?

For now, is there any reason why I should not use my change
+#define unlikely(x) (x)
in an upload to Debian ?

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 22.12.16 at 16:10, <[email protected]> wrote:

I did not find this important build fix for a regression in 4.8.0 because:

I wonder why you consider this important - the harness doesn't get built by default, and is of little use for other than smoke testing a limited set of changes to the insn emulator.

Quoted 3 lines

Backporting this is made more awkward by the decision to make the fix a portmanteau. Do the x86 maintainers intend to provide a ready-to-use backport or shall I try to prepare one ?

I've pushed one a minute ago to 4.8-staging.

Quoted 3 lines

For now, is there any reason why I should not use my change
+#define unlikely(x) (x)
in an upload to Debian ?

I don't see anything speaking against that.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Jan Beulich writes ("Re: [PATCH] tools/tests/x86_emulate: #define unlikely in x86 emulator test harness"):

Quoted 7 lines · On 22.12.16 at 16:10, <[email protected]> wrote:
Quoted 2 lines

I did not find this important build fix for a regression in 4.8.0 because:

I wonder why you consider this important - the harness doesn't get built by default, and is of little use for other than smoke testing a limited set of changes to the insn emulator.

I think this must be being enabled by something in the Debian package build.

Quoted 5 lines
Quoted 3 lines

Backporting this is made more awkward by the decision to make the fix a portmanteau. Do the x86 maintainers intend to provide a ready-to-use backport or shall I try to prepare one ?

I've pushed one a minute ago to 4.8-staging.

Ah, great, thanks.

Quoted 5 lines
Quoted 3 lines

For now, is there any reason why I should not use my change
+#define unlikely(x) (x)
in an upload to Debian ?

I don't see anything speaking against that.

OK, thanks. I think now there's a fix in 4.8-staging I will cherry pick that instead.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel