1
The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e:
1
The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def:
2
2
3
Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000)
3
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700)
4
4
5
are available in the git repository at:
5
are available in the Git repository at:
6
6
7
git://github.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 9dc44aa5829eb3131a01378a738dee28a382bbc1:
9
for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514:
10
10
11
os: don't corrupt pre-existing memory-backend data with prealloc (2017-03-15 11:55:41 +0800)
11
iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100)
12
13
----------------------------------------------------------------
14
Pull request
12
15
13
----------------------------------------------------------------
16
----------------------------------------------------------------
14
17
15
----------------------------------------------------------------
18
Stefano Garzarella (2):
19
iothread: rename PollParamInfo to IOThreadParamInfo
20
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
16
21
17
Daniel P. Berrange (1):
22
iothread.c | 28 +++++++++++++++-------------
18
os: don't corrupt pre-existing memory-backend data with prealloc
23
1 file changed, 15 insertions(+), 13 deletions(-)
19
20
util/oslib-posix.c | 14 +++++++++++++-
21
1 file changed, 13 insertions(+), 1 deletion(-)
22
24
23
--
25
--
24
2.9.3
26
2.31.1
25
27
26
28
29
diff view generated by jsdifflib
New patch
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
2
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: "Daniel P. Berrange" <berrange@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
When using a memory-backend object with prealloc turned on, QEMU
3
Commit 0445409d74 ("iothread: generalize
4
will memset() the first byte in every memory page to zero. While
4
iothread_set_param/iothread_get_param") moved common code to set and
5
this might have been acceptable for memory backends associated
5
get IOThread parameters in two new functions.
6
with RAM, this corrupts application data for NVDIMMs.
7
6
8
Instead of setting every page to zero, read the current byte
7
These functions are called inside callbacks, so we don't need to use an
9
value and then just write that same value back, so we are not
8
opaque pointer. Let's replace `void *opaque` parameter with
10
corrupting the original data. Directly write the value instead
9
`IOThreadParamInfo *info`.
11
of memset()ing it, since there's no benefit to memset for a
12
single byte write.
13
10
14
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11
Suggested-by: Kevin Wolf <kwolf@redhat.com>
15
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
12
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
16
Message-id: 20170303113255.28262-1-berrange@redhat.com
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
17
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
18
---
16
---
19
util/oslib-posix.c | 14 +++++++++++++-
17
iothread.c | 18 ++++++++++--------
20
1 file changed, 13 insertions(+), 1 deletion(-)
18
1 file changed, 10 insertions(+), 8 deletions(-)
21
19
22
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
20
diff --git a/iothread.c b/iothread.c
23
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
24
--- a/util/oslib-posix.c
22
--- a/iothread.c
25
+++ b/util/oslib-posix.c
23
+++ b/iothread.c
26
@@ -XXX,XX +XXX,XX @@ static void *do_touch_pages(void *arg)
24
@@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = {
27
memset_thread_failed = true;
25
};
28
} else {
26
29
for (i = 0; i < numpages; i++) {
27
static void iothread_get_param(Object *obj, Visitor *v,
30
- memset(addr, 0, 1);
28
- const char *name, void *opaque, Error **errp)
31
+ /*
29
+ const char *name, IOThreadParamInfo *info, Error **errp)
32
+ * Read & write back the same value, so we don't
30
{
33
+ * corrupt existing user/app data that might be
31
IOThread *iothread = IOTHREAD(obj);
34
+ * stored.
32
- IOThreadParamInfo *info = opaque;
35
+ *
33
int64_t *field = (void *)iothread + info->offset;
36
+ * 'volatile' to stop compiler optimizing this away
34
37
+ * to a no-op
35
visit_type_int64(v, name, field, errp);
38
+ *
36
}
39
+ * TODO: get a better solution from kernel so we
37
40
+ * don't need to write at all so we don't cause
38
static bool iothread_set_param(Object *obj, Visitor *v,
41
+ * wear on the storage backing the region...
39
- const char *name, void *opaque, Error **errp)
42
+ */
40
+ const char *name, IOThreadParamInfo *info, Error **errp)
43
+ *(volatile char *)addr = *addr;
41
{
44
addr += hpagesize;
42
IOThread *iothread = IOTHREAD(obj);
45
}
43
- IOThreadParamInfo *info = opaque;
44
int64_t *field = (void *)iothread + info->offset;
45
int64_t value;
46
47
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
48
static void iothread_get_poll_param(Object *obj, Visitor *v,
49
const char *name, void *opaque, Error **errp)
50
{
51
+ IOThreadParamInfo *info = opaque;
52
53
- iothread_get_param(obj, v, name, opaque, errp);
54
+ iothread_get_param(obj, v, name, info, errp);
55
}
56
57
static void iothread_set_poll_param(Object *obj, Visitor *v,
58
const char *name, void *opaque, Error **errp)
59
{
60
IOThread *iothread = IOTHREAD(obj);
61
+ IOThreadParamInfo *info = opaque;
62
63
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
64
+ if (!iothread_set_param(obj, v, name, info, errp)) {
65
return;
46
}
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
69
static void iothread_get_aio_param(Object *obj, Visitor *v,
70
const char *name, void *opaque, Error **errp)
71
{
72
+ IOThreadParamInfo *info = opaque;
73
74
- iothread_get_param(obj, v, name, opaque, errp);
75
+ iothread_get_param(obj, v, name, info, errp);
76
}
77
78
static void iothread_set_aio_param(Object *obj, Visitor *v,
79
const char *name, void *opaque, Error **errp)
80
{
81
IOThread *iothread = IOTHREAD(obj);
82
+ IOThreadParamInfo *info = opaque;
83
84
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
85
+ if (!iothread_set_param(obj, v, name, info, errp)) {
86
return;
87
}
88
47
--
89
--
48
2.9.3
90
2.31.1
49
91
50
92
diff view generated by jsdifflib