1 | The following changes since commit 9c125d17e9402c232c46610802e5931b3639d77b: | 1 | The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-tcg-20220420' of https://gitlab.com/rth7680/qemu into staging (2022-04-20 16:43:11 -0700) | 3 | Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000) |
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 | git://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to d45c83328feab2e4083991693160f0a417cfd9b0: | 9 | for you to fetch changes up to ef6dada8b44e1e7c4bec5c1115903af9af415b50: |
10 | 10 | ||
11 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option (2022-04-21 12:05:15 +0200) | 11 | util/async: use atomic_mb_set in qemu_bh_cancel (2017-11-08 19:09:15 +0000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | Small contrib/vhost-user-blk, contrib/vhost-user-scsi, and tools/virtiofsd | 16 | v2: |
17 | improvements. | 17 | * v1 emails 2/3 and 3/3 weren't sent due to an email failure |
18 | * Included Sergio's updated wording in the commit description | ||
18 | 19 | ||
19 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
20 | 21 | ||
21 | Liu Yiding (1): | 22 | Sergio Lopez (1): |
22 | virtiofsd: Add docs/helper for killpriv_v2/no_killpriv_v2 option | 23 | util/async: use atomic_mb_set in qemu_bh_cancel |
23 | |||
24 | Sakshi Kaushik (1): | ||
25 | Implements Backend Program conventions for vhost-user-scsi | ||
26 | 24 | ||
27 | Stefan Hajnoczi (1): | 25 | Stefan Hajnoczi (1): |
28 | contrib/vhost-user-blk: add missing GOptionEntry NULL terminator | 26 | tests-aio-multithread: fix /aio/multi/schedule race condition |
29 | 27 | ||
30 | docs/tools/virtiofsd.rst | 5 ++ | 28 | tests/test-aio-multithread.c | 5 ++--- |
31 | contrib/vhost-user-blk/vhost-user-blk.c | 3 +- | 29 | util/async.c | 2 +- |
32 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- | 30 | 2 files changed, 3 insertions(+), 4 deletions(-) |
33 | tools/virtiofsd/helper.c | 3 + | ||
34 | 4 files changed, 62 insertions(+), 26 deletions(-) | ||
35 | 31 | ||
36 | -- | 32 | -- |
37 | 2.35.1 | 33 | 2.13.6 |
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Liu Yiding <liuyd.fnst@fujitsu.com> | 1 | test_multi_co_schedule_entry() set to_schedule[id] in the final loop |
---|---|---|---|
2 | iteration before terminating the coroutine. There is a race condition | ||
3 | where the main thread attempts to enter the terminating or terminated | ||
4 | coroutine when signalling coroutines to stop: | ||
2 | 5 | ||
3 | virtiofsd has introduced killpriv_v2/no_killpriv_v2 for a while. Add | 6 | atomic_mb_set(&now_stopping, true); |
4 | description of it to docs/helper. | 7 | for (i = 0; i < NUM_CONTEXTS; i++) { |
8 | ctx_run(i, finish_cb, NULL); <--- enters dead coroutine! | ||
9 | to_schedule[i] = NULL; | ||
10 | } | ||
5 | 11 | ||
6 | Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com> | 12 | Make sure only to set to_schedule[id] if this coroutine really needs to |
7 | Message-Id: <20220421095151.2231099-1-liuyd.fnst@fujitsu.com> | 13 | be scheduled! |
8 | 14 | ||
9 | [Small documentation fixes: s/as client supports/as the client supports/ | 15 | Reported-by: "R.Nageswara Sastry" <nasastry@in.ibm.com> |
10 | and s/. /. /. | 16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
11 | --Stefan] | 17 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> |
12 | 18 | Message-id: 20171106190233.1175-1-stefanha@redhat.com | |
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 19 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | --- | 20 | --- |
15 | docs/tools/virtiofsd.rst | 5 +++++ | 21 | tests/test-aio-multithread.c | 5 ++--- |
16 | tools/virtiofsd/helper.c | 3 +++ | 22 | 1 file changed, 2 insertions(+), 3 deletions(-) |
17 | 2 files changed, 8 insertions(+) | ||
18 | 23 | ||
19 | diff --git a/docs/tools/virtiofsd.rst b/docs/tools/virtiofsd.rst | 24 | diff --git a/tests/test-aio-multithread.c b/tests/test-aio-multithread.c |
20 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/docs/tools/virtiofsd.rst | 26 | --- a/tests/test-aio-multithread.c |
22 | +++ b/docs/tools/virtiofsd.rst | 27 | +++ b/tests/test-aio-multithread.c |
23 | @@ -XXX,XX +XXX,XX @@ Options | 28 | @@ -XXX,XX +XXX,XX @@ static void finish_cb(void *opaque) |
24 | label. Server will try to set that label on newly created file | 29 | static coroutine_fn void test_multi_co_schedule_entry(void *opaque) |
25 | atomically wherever possible. | 30 | { |
26 | 31 | g_assert(to_schedule[id] == NULL); | |
27 | + * killpriv_v2|no_killpriv_v2 - | 32 | - atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); |
28 | + Enable/disable ``FUSE_HANDLE_KILLPRIV_V2`` support. KILLPRIV_V2 is enabled | 33 | |
29 | + by default as long as the client supports it. Enabling this option helps | 34 | while (!atomic_mb_read(&now_stopping)) { |
30 | + with performance in write path. | 35 | int n; |
36 | |||
37 | n = g_test_rand_int_range(0, NUM_CONTEXTS); | ||
38 | schedule_next(n); | ||
31 | + | 39 | + |
32 | .. option:: --socket-path=PATH | 40 | + atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); |
33 | 41 | qemu_coroutine_yield(); | |
34 | Listen on vhost-user UNIX domain socket at PATH. | 42 | - |
35 | diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c | 43 | g_assert(to_schedule[id] == NULL); |
36 | index XXXXXXX..XXXXXXX 100644 | 44 | - atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); |
37 | --- a/tools/virtiofsd/helper.c | 45 | } |
38 | +++ b/tools/virtiofsd/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ void fuse_cmdline_help(void) | ||
40 | " -o announce_submounts Announce sub-mount points to the guest\n" | ||
41 | " -o posix_acl/no_posix_acl Enable/Disable posix_acl. (default: disabled)\n" | ||
42 | " -o security_label/no_security_label Enable/Disable security label. (default: disabled)\n" | ||
43 | + " -o killpriv_v2/no_killpriv_v2\n" | ||
44 | + " Enable/Disable FUSE_HANDLE_KILLPRIV_V2.\n" | ||
45 | + " (default: enabled as long as client supports it)\n" | ||
46 | ); | ||
47 | } | 46 | } |
48 | 47 | ||
49 | -- | 48 | -- |
50 | 2.35.1 | 49 | 2.13.6 |
50 | |||
51 | diff view generated by jsdifflib |
1 | From: Sakshi Kaushik <sakshikaushik717@gmail.com> | 1 | From: Sergio Lopez <slp@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Sakshi Kaushik <sakshikaushik717@gmail.com> | 3 | Commit b7a745d added a qemu_bh_cancel call to the completion function |
4 | Message-id: 20220406162410.8536-1-sakshikaushik717@gmail.com | 4 | as an optimization to prevent it from unnecessarily rescheduling itself. |
5 | 5 | ||
6 | [Name the iSCSI URL long option --iscsi-uri instead of --iscsi_uri for | 6 | This completion function is scheduled from worker_thread, after setting |
7 | consistency, fix --fd which was rejected due to an outdated | 7 | the state of a ThreadPoolElement to THREAD_DONE. |
8 | --socket-path check, and add missing entries[] terminator. | 8 | |
9 | This was considered to be safe, as the completion function restarts the | ||
10 | loop just after the call to qemu_bh_cancel. But, as this loop lacks a HW | ||
11 | memory barrier, the read of req->state may actually happen _before_ the | ||
12 | call, seeing it still as THREAD_QUEUED, and ending the completion | ||
13 | function without having processed a pending TPE linked at pool->head: | ||
14 | |||
15 | worker thread | I/O thread | ||
16 | ------------------------------------------------------------------------ | ||
17 | | speculatively read req->state | ||
18 | req->state = THREAD_DONE; | | ||
19 | qemu_bh_schedule(p->completion_bh) | | ||
20 | bh->scheduled = 1; | | ||
21 | | qemu_bh_cancel(p->completion_bh) | ||
22 | | bh->scheduled = 0; | ||
23 | | if (req->state == THREAD_DONE) | ||
24 | | // sees THREAD_QUEUED | ||
25 | |||
26 | The source of the misunderstanding was that qemu_bh_cancel is now being | ||
27 | used by the _consumer_ rather than the producer, and therefore now needs | ||
28 | to have acquire semantics just like e.g. aio_bh_poll. | ||
29 | |||
30 | In some situations, if there are no other independent requests in the | ||
31 | same aio context that could eventually trigger the scheduling of the | ||
32 | completion function, the omitted TPE and all operations pending on it | ||
33 | will get stuck forever. | ||
34 | |||
35 | [Added Sergio's updated wording about the HW memory barrier. | ||
9 | --Stefan] | 36 | --Stefan] |
10 | 37 | ||
38 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
39 | Message-id: 20171108063447.2842-1-slp@redhat.com | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 40 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
12 | --- | 41 | --- |
13 | contrib/vhost-user-scsi/vhost-user-scsi.c | 77 +++++++++++++++-------- | 42 | util/async.c | 2 +- |
14 | 1 file changed, 52 insertions(+), 25 deletions(-) | 43 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 44 | ||
16 | diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c | 45 | diff --git a/util/async.c b/util/async.c |
17 | index XXXXXXX..XXXXXXX 100644 | 46 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/contrib/vhost-user-scsi/vhost-user-scsi.c | 47 | --- a/util/async.c |
19 | +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c | 48 | +++ b/util/async.c |
20 | @@ -XXX,XX +XXX,XX @@ fail: | 49 | @@ -XXX,XX +XXX,XX @@ void qemu_bh_schedule(QEMUBH *bh) |
21 | 50 | */ | |
22 | /** vhost-user-scsi **/ | 51 | void qemu_bh_cancel(QEMUBH *bh) |
23 | |||
24 | +static int opt_fdnum = -1; | ||
25 | +static char *opt_socket_path; | ||
26 | +static gboolean opt_print_caps; | ||
27 | +static char *iscsi_uri; | ||
28 | + | ||
29 | +static GOptionEntry entries[] = { | ||
30 | + { "print-capabilities", 'c', 0, G_OPTION_ARG_NONE, &opt_print_caps, | ||
31 | + "Print capabilities", NULL }, | ||
32 | + { "fd", 'f', 0, G_OPTION_ARG_INT, &opt_fdnum, | ||
33 | + "Use inherited fd socket", "FDNUM" }, | ||
34 | + { "iscsi-uri", 'i', 0, G_OPTION_ARG_FILENAME, &iscsi_uri, | ||
35 | + "iSCSI URI to connect to", "FDNUM" }, | ||
36 | + { "socket-path", 's', 0, G_OPTION_ARG_FILENAME, &opt_socket_path, | ||
37 | + "Use UNIX socket path", "PATH" }, | ||
38 | + { NULL, } | ||
39 | +}; | ||
40 | + | ||
41 | int main(int argc, char **argv) | ||
42 | { | 52 | { |
43 | VusDev *vdev_scsi = NULL; | 53 | - bh->scheduled = 0; |
44 | - char *unix_fn = NULL; | 54 | + atomic_mb_set(&bh->scheduled, 0); |
45 | - char *iscsi_uri = NULL; | 55 | } |
46 | - int lsock = -1, csock = -1, opt, err = EXIT_SUCCESS; | 56 | |
47 | + int lsock = -1, csock = -1, err = EXIT_SUCCESS; | 57 | /* This func is async.The bottom half will do the delete action at the finial |
48 | |||
49 | - while ((opt = getopt(argc, argv, "u:i:")) != -1) { | ||
50 | - switch (opt) { | ||
51 | - case 'h': | ||
52 | - goto help; | ||
53 | - case 'u': | ||
54 | - unix_fn = g_strdup(optarg); | ||
55 | - break; | ||
56 | - case 'i': | ||
57 | - iscsi_uri = g_strdup(optarg); | ||
58 | - break; | ||
59 | - default: | ||
60 | - goto help; | ||
61 | - } | ||
62 | + GError *error = NULL; | ||
63 | + GOptionContext *context; | ||
64 | + | ||
65 | + context = g_option_context_new(NULL); | ||
66 | + g_option_context_add_main_entries(context, entries, NULL); | ||
67 | + if (!g_option_context_parse(context, &argc, &argv, &error)) { | ||
68 | + g_printerr("Option parsing failed: %s\n", error->message); | ||
69 | + exit(EXIT_FAILURE); | ||
70 | + } | ||
71 | + | ||
72 | + if (opt_print_caps) { | ||
73 | + g_print("{\n"); | ||
74 | + g_print(" \"type\": \"scsi\"\n"); | ||
75 | + g_print("}\n"); | ||
76 | + goto out; | ||
77 | } | ||
78 | - if (!unix_fn || !iscsi_uri) { | ||
79 | + | ||
80 | + if (!iscsi_uri) { | ||
81 | goto help; | ||
82 | } | ||
83 | |||
84 | - lsock = unix_sock_new(unix_fn); | ||
85 | - if (lsock < 0) { | ||
86 | - goto err; | ||
87 | + if (opt_socket_path) { | ||
88 | + lsock = unix_sock_new(opt_socket_path); | ||
89 | + if (lsock < 0) { | ||
90 | + exit(EXIT_FAILURE); | ||
91 | + } | ||
92 | + } else if (opt_fdnum < 0) { | ||
93 | + g_print("%s\n", g_option_context_get_help(context, true, NULL)); | ||
94 | + exit(EXIT_FAILURE); | ||
95 | + } else { | ||
96 | + lsock = opt_fdnum; | ||
97 | } | ||
98 | |||
99 | csock = accept(lsock, NULL, NULL); | ||
100 | @@ -XXX,XX +XXX,XX @@ out: | ||
101 | if (vdev_scsi) { | ||
102 | g_main_loop_unref(vdev_scsi->loop); | ||
103 | g_free(vdev_scsi); | ||
104 | - unlink(unix_fn); | ||
105 | + unlink(opt_socket_path); | ||
106 | } | ||
107 | if (csock >= 0) { | ||
108 | close(csock); | ||
109 | @@ -XXX,XX +XXX,XX @@ out: | ||
110 | if (lsock >= 0) { | ||
111 | close(lsock); | ||
112 | } | ||
113 | - g_free(unix_fn); | ||
114 | + g_free(opt_socket_path); | ||
115 | g_free(iscsi_uri); | ||
116 | |||
117 | return err; | ||
118 | @@ -XXX,XX +XXX,XX @@ err: | ||
119 | goto out; | ||
120 | |||
121 | help: | ||
122 | - fprintf(stderr, "Usage: %s [ -u unix_sock_path -i iscsi_uri ] | [ -h ]\n", | ||
123 | + fprintf(stderr, "Usage: %s [ -s socket-path -i iscsi-uri -f fd -p print-capabilities ] | [ -h ]\n", | ||
124 | argv[0]); | ||
125 | - fprintf(stderr, " -u path to unix socket\n"); | ||
126 | - fprintf(stderr, " -i iscsi uri for lun 0\n"); | ||
127 | + fprintf(stderr, " -s, --socket-path=SOCKET_PATH path to unix socket\n"); | ||
128 | + fprintf(stderr, " -i, --iscsi-uri=ISCSI_URI iscsi uri for lun 0\n"); | ||
129 | + fprintf(stderr, " -f, --fd=FILE_DESCRIPTOR file-descriptor\n"); | ||
130 | + fprintf(stderr, " -p, --print-capabilities=PRINT_CAPABILITIES denotes print-capabilities\n"); | ||
131 | fprintf(stderr, " -h print help and quit\n"); | ||
132 | |||
133 | goto err; | ||
134 | -- | 58 | -- |
135 | 2.35.1 | 59 | 2.13.6 |
60 | |||
61 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The GLib documentation says "a NULL-terminated array of GOptionEntrys" | ||
2 | so we'd better make sure there is a terminator that lets | ||
3 | g_option_context_add_main_entries() know when the end of the array has | ||
4 | been reached. | ||
5 | 1 | ||
6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
7 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
8 | Message-id: 20220411150057.3009667-1-stefanha@redhat.com | ||
9 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
10 | --- | ||
11 | contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- | ||
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/contrib/vhost-user-blk/vhost-user-blk.c | ||
17 | +++ b/contrib/vhost-user-blk/vhost-user-blk.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static GOptionEntry entries[] = { | ||
19 | {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, | ||
20 | "block device or file path", "PATH"}, | ||
21 | { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, | ||
22 | - "Enable read-only", NULL } | ||
23 | + "Enable read-only", NULL }, | ||
24 | + { NULL, }, | ||
25 | }; | ||
26 | |||
27 | int main(int argc, char **argv) | ||
28 | -- | ||
29 | 2.35.1 | diff view generated by jsdifflib |