1
The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def:
1
The following changes since commit da1034094d375afe9e3d8ec8980550ea0f06f7e0:
2
2
3
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700)
3
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-10-03 07:43:44 -0400)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514:
9
for you to fetch changes up to 9afa888ce0f816d0f2cfc95eebe4f49244c518af:
10
10
11
iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100)
11
osdep: set _FORTIFY_SOURCE=2 when optimization is enabled (2023-10-04 09:52:06 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
----------------------------------------------------------------
16
----------------------------------------------------------------
17
17
18
Stefano Garzarella (2):
18
Daniel P. Berrangé (1):
19
iothread: rename PollParamInfo to IOThreadParamInfo
19
osdep: set _FORTIFY_SOURCE=2 when optimization is enabled
20
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
21
20
22
iothread.c | 28 +++++++++++++++-------------
21
meson.build | 10 ----------
23
1 file changed, 15 insertions(+), 13 deletions(-)
22
include/qemu/osdep.h | 4 ++++
23
util/coroutine-sigaltstack.c | 4 ++--
24
util/coroutine-ucontext.c | 4 ++--
25
4 files changed, 8 insertions(+), 14 deletions(-)
24
26
25
--
27
--
26
2.31.1
28
2.41.0
27
29
28
30
29
diff view generated by jsdifflib
Deleted patch
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
1
3
Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added
4
a new parameter (aio-max-batch) to IOThread and used PollParamInfo
5
structure to handle it.
6
7
Since it is not a parameter of the polling mechanism, we rename the
8
structure to a more generic IOThreadParamInfo.
9
10
Suggested-by: Kevin Wolf <kwolf@redhat.com>
11
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20210727145936.147032-2-sgarzare@redhat.com
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
---
16
iothread.c | 14 +++++++-------
17
1 file changed, 7 insertions(+), 7 deletions(-)
18
19
diff --git a/iothread.c b/iothread.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/iothread.c
22
+++ b/iothread.c
23
@@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp)
24
typedef struct {
25
const char *name;
26
ptrdiff_t offset; /* field's byte offset in IOThread struct */
27
-} PollParamInfo;
28
+} IOThreadParamInfo;
29
30
-static PollParamInfo poll_max_ns_info = {
31
+static IOThreadParamInfo poll_max_ns_info = {
32
"poll-max-ns", offsetof(IOThread, poll_max_ns),
33
};
34
-static PollParamInfo poll_grow_info = {
35
+static IOThreadParamInfo poll_grow_info = {
36
"poll-grow", offsetof(IOThread, poll_grow),
37
};
38
-static PollParamInfo poll_shrink_info = {
39
+static IOThreadParamInfo poll_shrink_info = {
40
"poll-shrink", offsetof(IOThread, poll_shrink),
41
};
42
-static PollParamInfo aio_max_batch_info = {
43
+static IOThreadParamInfo aio_max_batch_info = {
44
"aio-max-batch", offsetof(IOThread, aio_max_batch),
45
};
46
47
@@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v,
48
const char *name, void *opaque, Error **errp)
49
{
50
IOThread *iothread = IOTHREAD(obj);
51
- PollParamInfo *info = opaque;
52
+ IOThreadParamInfo *info = opaque;
53
int64_t *field = (void *)iothread + info->offset;
54
55
visit_type_int64(v, name, field, errp);
56
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
57
const char *name, void *opaque, Error **errp)
58
{
59
IOThread *iothread = IOTHREAD(obj);
60
- PollParamInfo *info = opaque;
61
+ IOThreadParamInfo *info = opaque;
62
int64_t *field = (void *)iothread + info->offset;
63
int64_t value;
64
65
--
66
2.31.1
67
68
diff view generated by jsdifflib
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
From: Daniel P. Berrangé <berrange@redhat.com>
2
2
3
Commit 0445409d74 ("iothread: generalize
3
Currently we set _FORTIFY_SOURCE=2 as a compiler argument when the
4
iothread_set_param/iothread_get_param") moved common code to set and
4
meson 'optimization' setting is non-zero, the compiler is GCC and
5
get IOThread parameters in two new functions.
5
the target is Linux.
6
6
7
These functions are called inside callbacks, so we don't need to use an
7
While the default QEMU optimization level is 2, user could override
8
opaque pointer. Let's replace `void *opaque` parameter with
8
this by setting CFLAGS="-O0" or --extra-cflags="-O0" when running
9
`IOThreadParamInfo *info`.
9
configure and this won't be reflected in the meson 'optimization'
10
setting. As a result we try to enable _FORTIFY_SOURCE=2 and then the
11
user gets compile errors as it only works with optimization.
10
12
11
Suggested-by: Kevin Wolf <kwolf@redhat.com>
13
Rather than trying to improve detection in meson, it is simpler to
12
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
14
just check the __OPTIMIZE__ define from osdep.h.
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
14
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
16
The comment about being incompatible with clang appears to be
17
outdated, as compilation works fine without excluding clang.
18
19
In the coroutine code we must set _FORTIFY_SOURCE=0 to stop the
20
logic in osdep.h then enabling it.
21
22
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
23
Message-id: 20231003091549.223020-1-berrange@redhat.com
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
24
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
16
---
25
---
17
iothread.c | 18 ++++++++++--------
26
meson.build | 10 ----------
18
1 file changed, 10 insertions(+), 8 deletions(-)
27
include/qemu/osdep.h | 4 ++++
28
util/coroutine-sigaltstack.c | 4 ++--
29
util/coroutine-ucontext.c | 4 ++--
30
4 files changed, 8 insertions(+), 14 deletions(-)
19
31
20
diff --git a/iothread.c b/iothread.c
32
diff --git a/meson.build b/meson.build
21
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
22
--- a/iothread.c
34
--- a/meson.build
23
+++ b/iothread.c
35
+++ b/meson.build
24
@@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = {
36
@@ -XXX,XX +XXX,XX @@ if 'cpp' in all_languages
25
};
37
qemu_cxxflags = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'] + qemu_cflags
26
38
endif
27
static void iothread_get_param(Object *obj, Visitor *v,
39
28
- const char *name, void *opaque, Error **errp)
40
-# clang does not support glibc + FORTIFY_SOURCE (is it still true?)
29
+ const char *name, IOThreadParamInfo *info, Error **errp)
41
-if get_option('optimization') != '0' and targetos == 'linux'
30
{
42
- if cc.get_id() == 'gcc'
31
IOThread *iothread = IOTHREAD(obj);
43
- qemu_cflags += ['-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=2']
32
- IOThreadParamInfo *info = opaque;
44
- endif
33
int64_t *field = (void *)iothread + info->offset;
45
- if 'cpp' in all_languages and cxx.get_id() == 'gcc'
34
46
- qemu_cxxflags += ['-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=2']
35
visit_type_int64(v, name, field, errp);
47
- endif
36
}
48
-endif
37
49
-
38
static bool iothread_set_param(Object *obj, Visitor *v,
50
add_project_arguments(qemu_cflags, native: false, language: 'c')
39
- const char *name, void *opaque, Error **errp)
51
add_project_arguments(cc.get_supported_arguments(warn_flags), native: false, language: 'c')
40
+ const char *name, IOThreadParamInfo *info, Error **errp)
52
if 'cpp' in all_languages
41
{
53
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
42
IOThread *iothread = IOTHREAD(obj);
54
index XXXXXXX..XXXXXXX 100644
43
- IOThreadParamInfo *info = opaque;
55
--- a/include/qemu/osdep.h
44
int64_t *field = (void *)iothread + info->offset;
56
+++ b/include/qemu/osdep.h
45
int64_t value;
57
@@ -XXX,XX +XXX,XX @@
46
58
#ifndef QEMU_OSDEP_H
47
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
59
#define QEMU_OSDEP_H
48
static void iothread_get_poll_param(Object *obj, Visitor *v,
60
49
const char *name, void *opaque, Error **errp)
61
+#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ && defined __linux__
50
{
62
+# define _FORTIFY_SOURCE 2
51
+ IOThreadParamInfo *info = opaque;
63
+#endif
52
64
+
53
- iothread_get_param(obj, v, name, opaque, errp);
65
#include "config-host.h"
54
+ iothread_get_param(obj, v, name, info, errp);
66
#ifdef NEED_CPU_H
55
}
67
#include CONFIG_TARGET
56
68
diff --git a/util/coroutine-sigaltstack.c b/util/coroutine-sigaltstack.c
57
static void iothread_set_poll_param(Object *obj, Visitor *v,
69
index XXXXXXX..XXXXXXX 100644
58
const char *name, void *opaque, Error **errp)
70
--- a/util/coroutine-sigaltstack.c
59
{
71
+++ b/util/coroutine-sigaltstack.c
60
IOThread *iothread = IOTHREAD(obj);
72
@@ -XXX,XX +XXX,XX @@
61
+ IOThreadParamInfo *info = opaque;
73
*/
62
74
63
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
75
/* XXX Is there a nicer way to disable glibc's stack check for longjmp? */
64
+ if (!iothread_set_param(obj, v, name, info, errp)) {
76
-#ifdef _FORTIFY_SOURCE
65
return;
77
#undef _FORTIFY_SOURCE
66
}
78
-#endif
67
79
+#define _FORTIFY_SOURCE 0
68
@@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
80
+
69
static void iothread_get_aio_param(Object *obj, Visitor *v,
81
#include "qemu/osdep.h"
70
const char *name, void *opaque, Error **errp)
82
#include <pthread.h>
71
{
83
#include "qemu/coroutine_int.h"
72
+ IOThreadParamInfo *info = opaque;
84
diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c
73
85
index XXXXXXX..XXXXXXX 100644
74
- iothread_get_param(obj, v, name, opaque, errp);
86
--- a/util/coroutine-ucontext.c
75
+ iothread_get_param(obj, v, name, info, errp);
87
+++ b/util/coroutine-ucontext.c
76
}
88
@@ -XXX,XX +XXX,XX @@
77
89
*/
78
static void iothread_set_aio_param(Object *obj, Visitor *v,
90
79
const char *name, void *opaque, Error **errp)
91
/* XXX Is there a nicer way to disable glibc's stack check for longjmp? */
80
{
92
-#ifdef _FORTIFY_SOURCE
81
IOThread *iothread = IOTHREAD(obj);
93
#undef _FORTIFY_SOURCE
82
+ IOThreadParamInfo *info = opaque;
94
-#endif
83
95
+#define _FORTIFY_SOURCE 0
84
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
96
+
85
+ if (!iothread_set_param(obj, v, name, info, errp)) {
97
#include "qemu/osdep.h"
86
return;
98
#include <ucontext.h>
87
}
99
#include "qemu/coroutine_int.h"
88
89
--
100
--
90
2.31.1
101
2.41.0
91
102
92
103
diff view generated by jsdifflib