* [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
@ 2018-10-22 18:16 Richard Henderson
2018-10-22 18:21 ` Richard Henderson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Richard Henderson @ 2018-10-22 18:16 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
In several places we use assert(FEATURE), and assume that if FEATURE
is disabled, all following code is removed as unreachable. Which allows
us to compile-out functions that are only present with FEATURE, and
have a link-time failure if the functions remain used.
MinGW does not mark its internal function _assert() as noreturn, so the
compiler cannot see when code is unreachable, which leads to link errors
for this host that are not present elsewhere.
The current build-time failure concerns 62823083b8a2, but I remember
having seen this same error before. Fix it once and for all for MinGW.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/osdep.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 4f8559e550..0c1e335a43 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -122,6 +122,18 @@ extern int daemon(int, int);
#include "glib-compat.h"
#include "qemu/typedefs.h"
+/*
+ * For mingw, as of v6.0.0, the function implementing the assert macro is
+ * not marked a noreturn, so the compiler cannot delete code following an
+ * assert(false) as unused. We rely on this within the code base to delete
+ * code that is unreachable when features are disabled.
+ * All supported versions of Glib's g_assert() satisfy this requirement.
+ */
+#ifdef __MINGW32__
+#undef assert
+#define assert(x) g_assert(x)
+#endif
+
/*
* According to waitpid man page:
* WCOREDUMP
--
2.17.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
2018-10-22 18:16 [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
@ 2018-10-22 18:21 ` Richard Henderson
2018-10-22 18:25 ` Philippe Mathieu-Daudé
2018-10-23 11:19 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2018-10-22 18:21 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
On 10/22/18 7:16 PM, Richard Henderson wrote:
> + * not marked a noreturn, so the compiler cannot delete code following an
Bah. Peter, if you apply this directly, can you please fix the grammar around
"marked a return" (either s/a/as/ or s/a// sound equally plausible for me).
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
2018-10-22 18:16 [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
2018-10-22 18:21 ` Richard Henderson
@ 2018-10-22 18:25 ` Philippe Mathieu-Daudé
2018-10-23 11:19 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-22 18:25 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: peter.maydell
On 22/10/18 20:16, Richard Henderson wrote:
> In several places we use assert(FEATURE), and assume that if FEATURE
> is disabled, all following code is removed as unreachable. Which allows
> us to compile-out functions that are only present with FEATURE, and
> have a link-time failure if the functions remain used.
>
> MinGW does not mark its internal function _assert() as noreturn, so the
> compiler cannot see when code is unreachable, which leads to link errors
> for this host that are not present elsewhere.
>
> The current build-time failure concerns 62823083b8a2, but I remember
> having seen this same error before. Fix it once and for all for MinGW.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> include/qemu/osdep.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 4f8559e550..0c1e335a43 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -122,6 +122,18 @@ extern int daemon(int, int);
> #include "glib-compat.h"
> #include "qemu/typedefs.h"
>
> +/*
> + * For mingw, as of v6.0.0, the function implementing the assert macro is
> + * not marked a noreturn, so the compiler cannot delete code following an
> + * assert(false) as unused. We rely on this within the code base to delete
> + * code that is unreachable when features are disabled.
> + * All supported versions of Glib's g_assert() satisfy this requirement.
> + */
> +#ifdef __MINGW32__
> +#undef assert
> +#define assert(x) g_assert(x)
> +#endif
> +
> /*
> * According to waitpid man page:
> * WCOREDUMP
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
2018-10-22 18:16 [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
2018-10-22 18:21 ` Richard Henderson
2018-10-22 18:25 ` Philippe Mathieu-Daudé
@ 2018-10-23 11:19 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-10-23 11:19 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers
On 22 October 2018 at 19:16, Richard Henderson
<richard.henderson@linaro.org> wrote:
> In several places we use assert(FEATURE), and assume that if FEATURE
> is disabled, all following code is removed as unreachable. Which allows
> us to compile-out functions that are only present with FEATURE, and
> have a link-time failure if the functions remain used.
>
> MinGW does not mark its internal function _assert() as noreturn, so the
> compiler cannot see when code is unreachable, which leads to link errors
> for this host that are not present elsewhere.
>
> The current build-time failure concerns 62823083b8a2, but I remember
> having seen this same error before. Fix it once and for all for MinGW.
>
Applied to master (with the typo fixed), thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 00/10] cputlb: track dirty tlbs and general cleanup
@ 2018-10-23 7:02 Richard Henderson
2018-10-23 7:02 ` [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2018-10-23 7:02 UTC (permalink / raw)
To: qemu-devel; +Cc: cota
The motivation here is reducing the total overhead.
Before a few patches went into target-arm.next, I measured total
tlb flush overhead for aarch64 at 25%. This appears to reduce the
total overhead to about 5% (I do need to re-run the control tests,
not just watch perf top as I'm doing now).
The final patch is somewhat of an RFC. I'd like to know what
benchmark was used when putting in pending_tlb_flushes, and I
have not done any archaeology to find out. I suspect that it
does make any measurable difference beyond tlb_c.dirty, and I
think the code is a bit cleaner without it.
r~
Richard Henderson (10):
cputlb: Move tlb_lock to CPUTLBCommon
cputlb: Remove tcg_enabled hack from tlb_flush_nocheck
cputlb: Move cpu->pending_tlb_flush to env->tlb_c.pending_flush
cputlb: Split large page tracking per mmu_idx
cputlb: Move env->vtlb_index to env->tlb_d.vindex
cputlb: Merge tlb_flush_nocheck into tlb_flush_by_mmuidx_async_work
cputlb: Merge tlb_flush_page into tlb_flush_page_by_mmuidx
cputlb: Count "partial" and "elided" tlb flushes
cputlb: Filter flushes on already clean tlbs
cputlb: Remove tlb_c.pending_flushes
include/exec/cpu-defs.h | 51 +++++-
include/exec/cputlb.h | 2 +-
include/qom/cpu.h | 6 -
accel/tcg/cputlb.c | 354 +++++++++++++++-----------------------
accel/tcg/translate-all.c | 8 +-
5 files changed, 184 insertions(+), 237 deletions(-)
--
2.17.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
2018-10-23 7:02 [Qemu-devel] [PATCH 00/10] cputlb: track dirty tlbs and general cleanup Richard Henderson
@ 2018-10-23 7:02 ` Richard Henderson
2018-10-23 11:02 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2018-10-23 7:02 UTC (permalink / raw)
To: qemu-devel; +Cc: cota
In several places we use assert(FEATURE), and assume that if FEATURE
is disabled, all following code is removed as unreachable. Which allows
us to compile-out functions that are only present with FEATURE, and
have a link-time failure if the functions remain used.
MinGW does not mark its internal function _assert() as noreturn, so the
compiler cannot see when code is unreachable, which leads to link errors
for this host that are not present elsewhere.
The current build-time failure concerns 62823083b8a2, but I remember
having seen this same error before. Fix it once and for all for MinGW.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/osdep.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 4f8559e550..0c1e335a43 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -122,6 +122,18 @@ extern int daemon(int, int);
#include "glib-compat.h"
#include "qemu/typedefs.h"
+/*
+ * For mingw, as of v6.0.0, the function implementing the assert macro is
+ * not marked a noreturn, so the compiler cannot delete code following an
+ * assert(false) as unused. We rely on this within the code base to delete
+ * code that is unreachable when features are disabled.
+ * All supported versions of Glib's g_assert() satisfy this requirement.
+ */
+#ifdef __MINGW32__
+#undef assert
+#define assert(x) g_assert(x)
+#endif
+
/*
* According to waitpid man page:
* WCOREDUMP
--
2.17.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert
2018-10-23 7:02 ` [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
@ 2018-10-23 11:02 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-23 11:02 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: cota
On 23/10/18 9:02, Richard Henderson wrote:
> In several places we use assert(FEATURE), and assume that if FEATURE
> is disabled, all following code is removed as unreachable. Which allows
> us to compile-out functions that are only present with FEATURE, and
> have a link-time failure if the functions remain used.
>
> MinGW does not mark its internal function _assert() as noreturn, so the
> compiler cannot see when code is unreachable, which leads to link errors
> for this host that are not present elsewhere.
>
> The current build-time failure concerns 62823083b8a2, but I remember
> having seen this same error before. Fix it once and for all for MinGW.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> include/qemu/osdep.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 4f8559e550..0c1e335a43 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -122,6 +122,18 @@ extern int daemon(int, int);
> #include "glib-compat.h"
> #include "qemu/typedefs.h"
>
> +/*
> + * For mingw, as of v6.0.0, the function implementing the assert macro is
> + * not marked a noreturn, so the compiler cannot delete code following an
> + * assert(false) as unused. We rely on this within the code base to delete
> + * code that is unreachable when features are disabled.
> + * All supported versions of Glib's g_assert() satisfy this requirement.
> + */
> +#ifdef __MINGW32__
> +#undef assert
> +#define assert(x) g_assert(x)
> +#endif
> +
> /*
> * According to waitpid man page:
> * WCOREDUMP
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-10-23 11:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 18:16 [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
2018-10-22 18:21 ` Richard Henderson
2018-10-22 18:25 ` Philippe Mathieu-Daudé
2018-10-23 11:19 ` Peter Maydell
2018-10-23 7:02 [Qemu-devel] [PATCH 00/10] cputlb: track dirty tlbs and general cleanup Richard Henderson
2018-10-23 7:02 ` [Qemu-devel] [PATCH, build fix] osdep: Work around MinGW assert Richard Henderson
2018-10-23 11:02 ` Philippe Mathieu-Daudé
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.