[PATCH v12 2/7] block/nbd.c: Add yank feature
Register a yank function which shuts down the socket and sets s->state = NBD_CLIENT_QUIT. This is the same behaviour as if an error occured. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- block/nbd.c | 154 +++- 1 file changed, 93 insertions(+), 61 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index 42536702b6..994d1e7b33 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -35,6 +35,7 @@ #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" +#include "qemu/atomic.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qmp/qstring.h" @@ -44,6 +45,8 @@ #include "block/nbd.h" #include "block/block_int.h" +#include "qemu/yank.h" + #define EN_OPTSTR ":exportname=" #define MAX_NBD_REQUESTS16 @@ -141,14 +144,13 @@ typedef struct BDRVNBDState { NBDConnectThread *connect_thread; } BDRVNBDState; -static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr, - Error **errp); -static QIOChannelSocket *nbd_co_establish_connection(BlockDriverState *bs, - Error **errp); +static int nbd_establish_connection(BlockDriverState *bs, SocketAddress *saddr, +Error **errp); +static int nbd_co_establish_connection(BlockDriverState *bs, Error **errp); static void nbd_co_establish_connection_cancel(BlockDriverState *bs, bool detach); -static int nbd_client_handshake(BlockDriverState *bs, QIOChannelSocket *sioc, -Error **errp); +static int nbd_client_handshake(BlockDriverState *bs, Error **errp); +static void nbd_yank(void *opaque); static void nbd_clear_bdrvstate(BDRVNBDState *s) { @@ -166,12 +168,12 @@ static void nbd_clear_bdrvstate(BDRVNBDState *s) static void nbd_channel_error(BDRVNBDState *s, int ret) { if (ret == -EIO) { -if (s->state == NBD_CLIENT_CONNECTED) { +if (qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTED) { s->state = s->reconnect_delay ? NBD_CLIENT_CONNECTING_WAIT : NBD_CLIENT_CONNECTING_NOWAIT; } } else { -if (s->state == NBD_CLIENT_CONNECTED) { +if (qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTED) { qio_channel_shutdown(s->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL); } s->state = NBD_CLIENT_QUIT; @@ -204,7 +206,7 @@ static void reconnect_delay_timer_cb(void *opaque) { BDRVNBDState *s = opaque; -if (s->state == NBD_CLIENT_CONNECTING_WAIT) { +if (qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTING_WAIT) { s->state = NBD_CLIENT_CONNECTING_NOWAIT; while (qemu_co_enter_next(&s->free_sema, NULL)) { /* Resume all queued requests */ @@ -216,7 +218,7 @@ static void reconnect_delay_timer_cb(void *opaque) static void reconnect_delay_timer_init(BDRVNBDState *s, uint64_t expire_time_ns) { -if (s->state != NBD_CLIENT_CONNECTING_WAIT) { +if (qatomic_load_acquire(&s->state) != NBD_CLIENT_CONNECTING_WAIT) { return; } @@ -261,7 +263,7 @@ static void nbd_client_attach_aio_context(BlockDriverState *bs, * s->connection_co is either yielded from nbd_receive_reply or from * nbd_co_reconnect_loop() */ -if (s->state == NBD_CLIENT_CONNECTED) { +if (qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTED) { qio_channel_attach_aio_context(QIO_CHANNEL(s->ioc), new_context); } @@ -287,7 +289,7 @@ static void coroutine_fn nbd_client_co_drain_begin(BlockDriverState *bs) reconnect_delay_timer_del(s); -if (s->state == NBD_CLIENT_CONNECTING_WAIT) { +if (qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTING_WAIT) { s->state = NBD_CLIENT_CONNECTING_NOWAIT; qemu_co_queue_restart_all(&s->free_sema); } @@ -338,13 +340,14 @@ static void nbd_teardown_connection(BlockDriverState *bs) static bool nbd_client_connecting(BDRVNBDState *s) { -return s->state == NBD_CLIENT_CONNECTING_WAIT || -s->state == NBD_CLIENT_CONNECTING_NOWAIT; +NBDClientState state = qatomic_load_acquire(&s->state); +return state == NBD_CLIENT_CONNECTING_WAIT || +state == NBD_CLIENT_CONNECTING_NOWAIT; } static bool nbd_client_connecting_wait(BDRVNBDState *s) { -return s->state == NBD_CLIENT_CONNECTING_WAIT; +return qatomic_load_acquire(&s->state) == NBD_CLIENT_CONNECTING_WAIT; } static void connect_bh(void *opaque) @@ -424,12 +427,12 @@ static void *connect_thread_func(void *opaque) return NULL; } -static QIOChannelSocket *coroutine_fn +static int coroutine_fn nbd_co_establish_connection(BlockDriverState *bs, Error **errp) { +int ret; QemuThread thread; BDRVNBDState *s = bs->opaque; -QIOChannelSocket *res; NBDConnectThread *thr = s->connect_thread
[PATCH v12 0/7] Introduce 'yank' oob qmp command to recover from hanging qemu
Hello Everyone, So here is v12. @Marc-André Lureau, We still need an ACK for the chardev patch. Changes: v12: -rebase onto master -minor change to migration (removal of "defer" branch in qemu_start_incoming_migration) -add Reviewed-by tags v11: -squashed MAINTAINERS update into patch 1 -move qmp doc of yank before misc -add title for qmp docs -change "Since:" to 6.0 -add Reviewed-by tags v10: -moved from qapi/misc.json to qapi/yank.json -rename 'blockdev' -> 'block-node' -document difference betwen migration yank instance and migrate_cancel -better document return values of yank command -better document yank_lock -minor style and spelling fixes v9: -rebase onto master -implemented new qmp api as proposed by Markus v8: -add Reviewed-by and Acked-by tags -rebase onto master -minor change to migration -convert to meson -change "Since:" to 5.2 -varios code style fixes (Markus Armbruster) -point to oob restrictions in comment to yank_register_function (Markus Armbruster) -improve qmp documentation (Markus Armbruster) -document oob suitability of qio_channel and io_shutdown (Markus Armbruster) v7: -yank_register_instance now returns error via Error **errp instead of aborting -dropped "chardev/char.c: Check for duplicate id before creating chardev" v6: -add Reviewed-by and Acked-by tags -rebase on master -lots of changes in nbd due to rebase -only take maintainership of util/yank.c and include/qemu/yank.h (Daniel P. Berrangé) -fix a crash discovered by the newly added chardev test -fix the test itself v5: -move yank.c to util/ -move yank.h to include/qemu/ -add license to yank.h -use const char* -nbd: use atomic_store_release and atomic_load_aqcuire -io-channel: ensure thread-safety and document it -add myself as maintainer for yank v4: -fix build errors... v3: -don't touch softmmu/vl.c, use __contructor__ attribute instead (Paolo Bonzini) -fix build errors -rewrite migration patch so it actually passes all tests v2: -don't touch io/ code anymore -always register yank functions -'yank' now takes a list of instances to yank -'query-yank' returns a list of yankable instances Overview: Hello Everyone, In many cases, if qemu has a network connection (qmp, migration, chardev, etc.) to some other server and that server dies or hangs, qemu hangs too. These patches introduce the new 'yank' out-of-band qmp command to recover from these kinds of hangs. The different subsystems register callbacks which get executed with the yank command. For example the callback can shutdown() a socket. This is intended for the colo use-case, but it can be used for other things too of course. Regards, Lukas Straub Lukas Straub (7): Introduce yank feature block/nbd.c: Add yank feature chardev/char-socket.c: Add yank feature migration: Add yank feature io/channel-tls.c: make qio_channel_tls_shutdown thread-safe io: Document qmp oob suitability of qio_channel_shutdown and io_shutdown tests/test-char.c: Wait for the chardev to connect in char_socket_client_dupid_test MAINTAINERS | 7 ++ block/nbd.c | 154 ++-- chardev/char-socket.c | 35 ++ include/io/channel.h | 5 +- include/qemu/yank.h | 95 +++ io/channel-tls.c | 6 +- migration/channel.c | 13 ++ migration/migration.c | 24 migration/multifd.c | 10 ++ migration/qemu-file-channel.c | 7 ++ migration/savevm.c| 6 + qapi/meson.build | 1 + qapi/qapi-schema.json | 1 + qapi/yank.json| 119 +++ tests/test-char.c | 1 + util/meson.build | 1 + util/yank.c | 216 ++ 17 files changed, 637 insertions(+), 64 deletions(-) create mode 100644 include/qemu/yank.h create mode 100644 qapi/yank.json create mode 100644 util/yank.c -- 2.20.1 pgpVozt0Ip024.pgp Description: OpenPGP digital signature
[PATCH v12 1/7] Introduce yank feature
The yank feature allows to recover from hanging qemu by "yanking" at various parts. Other qemu systems can register themselves and multiple yank functions. Then all yank functions for selected instances can be called by the 'yank' out-of-band qmp command. Available instances can be queried by a 'query-yank' oob command. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster --- MAINTAINERS | 7 ++ include/qemu/yank.h | 95 +++ qapi/meson.build | 1 + qapi/qapi-schema.json | 1 + qapi/yank.json| 119 +++ util/meson.build | 1 + util/yank.c | 216 ++ 7 files changed, 440 insertions(+) create mode 100644 include/qemu/yank.h create mode 100644 qapi/yank.json create mode 100644 util/yank.c diff --git a/MAINTAINERS b/MAINTAINERS index d48a4e8a8b..5d7e3c0e4b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2705,6 +2705,13 @@ F: util/uuid.c F: include/qemu/uuid.h F: tests/test-uuid.c +Yank feature +M: Lukas Straub +S: Odd fixes +F: util/yank.c +F: include/qemu/yank.h +F: qapi/yank.json + COLO Framework M: zhanghailiang S: Maintained diff --git a/include/qemu/yank.h b/include/qemu/yank.h new file mode 100644 index 00..96f5b2626f --- /dev/null +++ b/include/qemu/yank.h @@ -0,0 +1,95 @@ +/* + * QEMU yank feature + * + * Copyright (c) Lukas Straub + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef YANK_H +#define YANK_H + +#include "qapi/qapi-types-yank.h" + +typedef void (YankFn)(void *opaque); + +/** + * yank_register_instance: Register a new instance. + * + * This registers a new instance for yanking. Must be called before any yank + * function is registered for this instance. + * + * This function is thread-safe. + * + * @instance: The instance. + * @errp: Error object. + */ +void yank_register_instance(const YankInstance *instance, Error **errp); + +/** + * yank_unregister_instance: Unregister a instance. + * + * This unregisters a instance. Must be called only after every yank function + * of the instance has been unregistered. + * + * This function is thread-safe. + * + * @instance: The instance. + */ +void yank_unregister_instance(const YankInstance *instance); + +/** + * yank_register_function: Register a yank function + * + * This registers a yank function. All limitations of qmp oob commands apply + * to the yank function as well. See docs/devel/qapi-code-gen.txt under + * "An OOB-capable command handler must satisfy the following conditions". + * + * This function is thread-safe. + * + * @instance: The instance. + * @func: The yank function. + * @opaque: Will be passed to the yank function. + */ +void yank_register_function(const YankInstance *instance, +YankFn *func, +void *opaque); + +/** + * yank_unregister_function: Unregister a yank function + * + * This unregisters a yank function. + * + * This function is thread-safe. + * + * @instance: The instance. + * @func: func that was passed to yank_register_function. + * @opaque: opaque that was passed to yank_register_function. + */ +void yank_unregister_function(const YankInstance *instance, + YankFn *func, + void *opaque); + +/** + * yank_generic_iochannel: Generic yank function for iochannel + * + * This is a generic yank function which will call qio_channel_shutdown on the + * provided QIOChannel. + * + * @opaque: QIOChannel to shutdown + */ +void yank_generic_iochannel(void *opaque); + +#define BLOCKDEV_YANK_INSTANCE(the_node_name) (&(YankInstance) { \ +.type = YANK_INSTANCE_TYPE_BLOCK_NODE, \ +.u.block_node.node_name = (the_node_name) }) + +#define CHARDEV_YANK_INSTANCE(the_id) (&(YankInstance) { \ +.type = YANK_INSTANCE_TYPE_CHARDEV, \ +.u.chardev.id = (the_id) }) + +#define MIGRATION_YANK_INSTANCE (&(YankInstance) { \ +.type = YANK_INSTANCE_TYPE_MIGRATION }) + +#endif diff --git a/qapi/meson.build b/qapi/meson.build index 0e98146f1f..ab68e7900e 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -47,6 +47,7 @@ qapi_all_modules = [ 'trace', 'transaction', 'ui', + 'yank', ] qapi_storage_daemon_modules = [ diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 0b444b76d2..3441c9a9ae 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -86,6 +86,7 @@ { 'include': 'machine.json' } { 'include': 'machine-target.json' } { 'include': 'replay.json' } +{ 'include': 'yank.json' } { 'include': 'misc.json' } { 'include': 'misc-target.json' } { 'include': 'audio.json' } diff --git a/qapi/yank.json b/qapi/yank.json new file mode 100644 index 00..167a775594 --- /dev/null +++ b/qapi/yank.json @@ -0,0 +1,119 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# + +## +# = Yank feature +## +
[PATCH v12 4/7] migration: Add yank feature
Register yank functions on sockets to shut them down. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Acked-by: Dr. David Alan Gilbert --- migration/channel.c | 13 + migration/migration.c | 24 migration/multifd.c | 10 ++ migration/qemu-file-channel.c | 7 +++ migration/savevm.c| 6 ++ 5 files changed, 60 insertions(+) diff --git a/migration/channel.c b/migration/channel.c index 8a783baa0b..35fe234e9c 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -18,6 +18,8 @@ #include "trace.h" #include "qapi/error.h" #include "io/channel-tls.h" +#include "io/channel-socket.h" +#include "qemu/yank.h" /** * @migration_channel_process_incoming - Create new incoming migration channel @@ -35,6 +37,11 @@ void migration_channel_process_incoming(QIOChannel *ioc) trace_migration_set_incoming_channel( ioc, object_get_typename(OBJECT(ioc))); +if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) { +yank_register_function(MIGRATION_YANK_INSTANCE, yank_generic_iochannel, + QIO_CHANNEL(ioc)); +} + if (s->parameters.tls_creds && *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), @@ -67,6 +74,12 @@ void migration_channel_connect(MigrationState *s, ioc, object_get_typename(OBJECT(ioc)), hostname, error); if (!error) { +if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) { +yank_register_function(MIGRATION_YANK_INSTANCE, + yank_generic_iochannel, + QIO_CHANNEL(ioc)); +} + if (s->parameters.tls_creds && *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), diff --git a/migration/migration.c b/migration/migration.c index e0dbde4091..dc520a721b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -56,6 +56,7 @@ #include "net/announce.h" #include "qemu/queue.h" #include "multifd.h" +#include "qemu/yank.h" #ifdef CONFIG_VFIO #include "hw/vfio/vfio-common.h" @@ -254,6 +255,8 @@ void migration_incoming_state_destroy(void) qapi_free_SocketAddressList(mis->socket_address_list); mis->socket_address_list = NULL; } + +yank_unregister_instance(MIGRATION_YANK_INSTANCE); } static void migrate_generate_event(int new_state) @@ -418,6 +421,11 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p = NULL; +yank_register_instance(MIGRATION_YANK_INSTANCE, errp); +if (*errp) { +return; +} + qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || @@ -432,6 +440,7 @@ static void qemu_start_incoming_migration(const char *uri, Error **errp) } else if (strstart(uri, "fd:", &p)) { fd_start_incoming_migration(p, errp); } else { +yank_unregister_instance(MIGRATION_YANK_INSTANCE); error_setg(errp, "unknown migration protocol: %s", uri); } } @@ -1737,6 +1746,7 @@ static void migrate_fd_cleanup(MigrationState *s) } notifier_list_notify(&migration_state_notifiers, s); block_cleanup_parameters(s); +yank_unregister_instance(MIGRATION_YANK_INSTANCE); } static void migrate_fd_cleanup_schedule(MigrationState *s) @@ -2011,6 +2021,7 @@ void qmp_migrate_recover(const char *uri, Error **errp) * only re-setup the migration stream and poke existing migration * to continue using that newly established channel. */ +yank_unregister_instance(MIGRATION_YANK_INSTANCE); qemu_start_incoming_migration(uri, errp); } @@ -2148,6 +2159,13 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, return; } +if (!(has_resume && resume)) { +yank_register_instance(MIGRATION_YANK_INSTANCE, errp); +if (*errp) { +return; +} +} + if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || strstart(uri, "vsock:", NULL)) { @@ -2161,6 +2179,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { +if (!(has_resume && resume)) { +yank_unregister_instance(MIGRATION_YANK_INSTANCE); +} error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, @@ -2170,6 +2191,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, } if (local_err) { +if (!(has_resume && resume)) { +yank_unregister_instance(MIGRATION_YANK_INSTANCE); +} migrate_fd_error(s, local_err); error_propagate(errp, local_err); return; diff --git a/migration/
[PATCH v12 3/7] chardev/char-socket.c: Add yank feature
Register a yank function to shutdown the socket on yank. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi --- chardev/char-socket.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 213a4c8dd0..7f2ee9a338 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -34,6 +34,7 @@ #include "qapi/error.h" #include "qapi/clone-visitor.h" #include "qapi/qapi-visit-sockets.h" +#include "qemu/yank.h" #include "chardev/char-io.h" #include "qom/object.h" @@ -70,6 +71,7 @@ struct SocketChardev { size_t read_msgfds_num; int *write_msgfds; size_t write_msgfds_num; +bool registered_yank; SocketAddress *addr; bool is_listen; @@ -415,6 +417,12 @@ static void tcp_chr_free_connection(Chardev *chr) tcp_set_msgfds(chr, NULL, 0); remove_fd_in_watch(chr); +if (s->state == TCP_CHARDEV_STATE_CONNECTING +|| s->state == TCP_CHARDEV_STATE_CONNECTED) { +yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(s->sioc)); +} object_unref(OBJECT(s->sioc)); s->sioc = NULL; object_unref(OBJECT(s->ioc)); @@ -932,6 +940,9 @@ static int tcp_chr_add_client(Chardev *chr, int fd) } tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); tcp_chr_set_client_ioc_name(chr, sioc); +yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); ret = tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return ret; @@ -946,6 +957,9 @@ static void tcp_chr_accept(QIONetListener *listener, tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); tcp_chr_set_client_ioc_name(chr, cioc); +yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(cioc)); tcp_chr_new_client(chr, cioc); } @@ -961,6 +975,9 @@ static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp) object_unref(OBJECT(sioc)); return -1; } +yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return 0; @@ -976,6 +993,9 @@ static void tcp_chr_accept_server_sync(Chardev *chr) tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); sioc = qio_net_listener_wait_client(s->listener); tcp_chr_set_client_ioc_name(chr, sioc); +yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); } @@ -1086,6 +1106,9 @@ static void char_socket_finalize(Object *obj) object_unref(OBJECT(s->tls_creds)); } g_free(s->tls_authz); +if (s->registered_yank) { +yank_unregister_instance(CHARDEV_YANK_INSTANCE(chr->label)); +} qemu_chr_be_event(chr, CHR_EVENT_CLOSED); } @@ -1101,6 +1124,9 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque) if (qio_task_propagate_error(task, &err)) { tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED); +yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); check_report_connect_error(chr, err); goto cleanup; } @@ -1134,6 +1160,9 @@ static void tcp_chr_connect_client_async(Chardev *chr) tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); sioc = qio_channel_socket_new(); tcp_chr_set_client_ioc_name(chr, sioc); +yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); /* * Normally code would use the qio_channel_socket_connect_async * method which uses a QIOTask + qio_task_set_error internally @@ -1376,6 +1405,12 @@ static void qmp_chardev_open_socket(Chardev *chr, qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_FD_PASS); } +yank_register_instance(CHARDEV_YANK_INSTANCE(chr->label), errp); +if (*errp) { +return; +} +s->registered_yank = true; + /* be isn't opened until we get a connection */ *be_opened = false; -- 2.20.1 pgpgT3srzXmI9.pgp Description: OpenPGP digital signature
[PATCH v12 6/7] io: Document qmp oob suitability of qio_channel_shutdown and io_shutdown
Migration and yank code assume that qio_channel_shutdown is thread -safe and can be called from qmp oob handler. Document this after checking the code. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- include/io/channel.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/io/channel.h b/include/io/channel.h index 4d6fe45f63..ab9ea77959 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -92,7 +92,8 @@ struct QIOChannel { * provide additional optional features. * * Consult the corresponding public API docs for a description - * of the semantics of each callback + * of the semantics of each callback. io_shutdown in particular + * must be thread-safe, terminate quickly and must not block. */ struct QIOChannelClass { ObjectClass parent; @@ -510,6 +511,8 @@ int qio_channel_close(QIOChannel *ioc, * QIO_CHANNEL_FEATURE_SHUTDOWN prior to calling * this method. * + * This function is thread-safe, terminates quickly and does not block. + * * Returns: 0 on success, -1 on error */ int qio_channel_shutdown(QIOChannel *ioc, -- 2.20.1 pgpw1CygrcATs.pgp Description: OpenPGP digital signature
[PATCH v12 7/7] tests/test-char.c: Wait for the chardev to connect in char_socket_client_dupid_test
A connecting chardev object has an additional reference by the connecting thread, so if the chardev is still connecting by the end of the test, then the chardev object won't be freed. This in turn means that the yank instance won't be unregistered and when running the next test-case yank_register_instance will abort, because the yank instance is already/still registered. Signed-off-by: Lukas Straub Reviewed-by: Daniel P. Berrangé --- tests/test-char.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test-char.c b/tests/test-char.c index 953e0d1c1f..41a76410d8 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -937,6 +937,7 @@ static void char_socket_client_dupid_test(gconstpointer opaque) g_assert_nonnull(opts); chr1 = qemu_chr_new_from_opts(opts, NULL, &error_abort); g_assert_nonnull(chr1); +qemu_chr_wait_connected(chr1, &error_abort); chr2 = qemu_chr_new_from_opts(opts, NULL, &local_err); g_assert_null(chr2); -- 2.20.1 pgpswu6HAepUZ.pgp Description: OpenPGP digital signature
[PATCH v12 5/7] io/channel-tls.c: make qio_channel_tls_shutdown thread-safe
Make qio_channel_tls_shutdown thread-safe by using atomics when accessing tioc->shutdown. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé --- io/channel-tls.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io/channel-tls.c b/io/channel-tls.c index 388f019977..2ae1b92fc0 100644 --- a/io/channel-tls.c +++ b/io/channel-tls.c @@ -23,6 +23,7 @@ #include "qemu/module.h" #include "io/channel-tls.h" #include "trace.h" +#include "qemu/atomic.h" static ssize_t qio_channel_tls_write_handler(const char *buf, @@ -277,7 +278,8 @@ static ssize_t qio_channel_tls_readv(QIOChannel *ioc, return QIO_CHANNEL_ERR_BLOCK; } } else if (errno == ECONNABORTED && - (tioc->shutdown & QIO_CHANNEL_SHUTDOWN_READ)) { + (qatomic_load_acquire(&tioc->shutdown) & +QIO_CHANNEL_SHUTDOWN_READ)) { return 0; } @@ -361,7 +363,7 @@ static int qio_channel_tls_shutdown(QIOChannel *ioc, { QIOChannelTLS *tioc = QIO_CHANNEL_TLS(ioc); -tioc->shutdown |= how; +qatomic_or(&tioc->shutdown, how); return qio_channel_shutdown(tioc->master, how, errp); } -- 2.20.1 pgp_lZLTBABRj.pgp Description: OpenPGP digital signature
Re: [PATCH v2] hw/block/nand: Decommission the NAND museum
Le 16/10/2020 à 18:52, Philippe Mathieu-Daudé a écrit : > Cc'ing qemu-trivial@ since this patch is reviewed. > > On 10/15/20 8:12 PM, Philippe Mathieu-Daudé wrote: >> ping^2... >> >> On 10/1/20 7:31 PM, Philippe Mathieu-Daudé wrote: >>> ping qemu-block or qemu-arm? >>> >>> On 9/15/20 7:16 PM, Philippe Mathieu-Daudé wrote: This is the QEMU equivalent of this Linux commit (but 7 years later): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 The MTD subsystem has its own small museum of ancient NANDs in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. The museum contains stone age NANDs with 256 bytes pages, as well as iron age NANDs with 512 bytes per page and up to 8MiB page size. It is with great sorrow that I inform you that the museum is being decommissioned. The MTD subsystem is out of budget for Kconfig options and already has too many of them, and there is a general kernel trend to simplify the configuration menu. We remove the stone age exhibits along with closing the museum, but some of the iron age ones are transferred to the regular NAND depot. Namely, only those which have unique device IDs are transferred, and the ones which have conflicting device IDs are removed. The machine using this device are: - axis-dev88 - tosa (via tc6393xb_init) - spitz based (akita, borzoi, terrier) Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- Peter, as 4 of the 5 machines are ARM-based, can this go via your tree? --- hw/block/nand.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/block/nand.c b/hw/block/nand.c index 5c8112ed5a4..5f01ba2bc44 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -138,7 +138,7 @@ static void mem_and(uint8_t *dest, const uint8_t *src, size_t n) # define ADDR_SHIFT 16 # include "nand.c" -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ static const struct { int size; int width; @@ -154,15 +154,14 @@ static const struct { [0xe8] = { 1, 8, 8, 4, 0 }, [0xec] = { 1, 8, 8, 4, 0 }, [0xea] = { 2, 8, 8, 4, 0 }, - [0xd5] = { 4, 8, 9, 4, 0 }, [0xe3] = { 4, 8, 9, 4, 0 }, [0xe5] = { 4, 8, 9, 4, 0 }, - [0xd6] = { 8, 8, 9, 4, 0 }, - [0x39] = { 8, 8, 9, 4, 0 }, - [0xe6] = { 8, 8, 9, 4, 0 }, - [0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, - [0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, + [0x6b] = { 4, 8, 9, 4, 0 }, + [0xe3] = { 4, 8, 9, 4, 0 }, + [0xe5] = { 4, 8, 9, 4, 0 }, + [0xd6] = { 8, 8, 9, 4, 0 }, + [0xe6] = { 8, 8, 9, 4, 0 }, [0x33] = { 16, 8, 9, 5, 0 }, [0x73] = { 16, 8, 9, 5, 0 }, >>> >> > Applied to my trivial-patches branch. Thanks, Laurent
Re: [PATCH v2] hw/block/nand: Decommission the NAND museum
On Sun, 13 Dec 2020 at 17:21, Laurent Vivier wrote: > > Le 16/10/2020 à 18:52, Philippe Mathieu-Daudé a écrit : > > Cc'ing qemu-trivial@ since this patch is reviewed. > > > > On 10/15/20 8:12 PM, Philippe Mathieu-Daudé wrote: > >> ping^2... > >> > >> On 10/1/20 7:31 PM, Philippe Mathieu-Daudé wrote: > >>> ping qemu-block or qemu-arm? > >>> > >>> On 9/15/20 7:16 PM, Philippe Mathieu-Daudé wrote: > This is the QEMU equivalent of this Linux commit (but 7 years later): > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 > > The MTD subsystem has its own small museum of ancient NANDs > in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. > The museum contains stone age NANDs with 256 bytes pages, as well > as iron age NANDs with 512 bytes per page and up to 8MiB page size. > > It is with great sorrow that I inform you that the museum is being > decommissioned. The MTD subsystem is out of budget for Kconfig > options and already has too many of them, and there is a general > kernel trend to simplify the configuration menu. > > We remove the stone age exhibits along with closing the museum, > but some of the iron age ones are transferred to the regular NAND > depot. Namely, only those which have unique device IDs are > transferred, and the ones which have conflicting device IDs are > removed. > > The machine using this device are: > - axis-dev88 > - tosa (via tc6393xb_init) > - spitz based (akita, borzoi, terrier) > > Reviewed-by: Richard Henderson > Signed-off-by: Philippe Mathieu-Daudé > --- > Peter, as 4 of the 5 machines are ARM-based, can this go via your tree? > --- > hw/block/nand.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/hw/block/nand.c b/hw/block/nand.c > index 5c8112ed5a4..5f01ba2bc44 100644 > --- a/hw/block/nand.c > +++ b/hw/block/nand.c > @@ -138,7 +138,7 @@ static void mem_and(uint8_t *dest, const uint8_t > *src, size_t n) > # define ADDR_SHIFT16 > # include "nand.c" > -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ > +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ > static const struct { > int size; > int width; > @@ -154,15 +154,14 @@ static const struct { > [0xe8] = { 1,8,8, 4, 0 }, > [0xec] = { 1,8,8, 4, 0 }, > [0xea] = { 2,8,8, 4, 0 }, > -[0xd5] = { 4,8,9, 4, 0 }, > [0xe3] = { 4,8,9, 4, 0 }, > [0xe5] = { 4,8,9, 4, 0 }, > -[0xd6] = { 8,8,9, 4, 0 }, > -[0x39] = { 8,8,9, 4, 0 }, > -[0xe6] = { 8,8,9, 4, 0 }, > -[0x49] = { 8,16,9, 4, NAND_BUSWIDTH_16 }, > -[0x59] = { 8,16,9, 4, NAND_BUSWIDTH_16 }, > +[0x6b] = { 4,8,9, 4, 0 }, > +[0xe3] = { 4,8,9, 4, 0 }, > +[0xe5] = { 4,8,9, 4, 0 }, > +[0xd6] = { 8,8,9, 4, 0 }, > +[0xe6] = { 8,8,9, 4, 0 }, > [0x33] = { 16,8,9, 5, 0 }, > [0x73] = { 16,8,9, 5, 0 }, > > >>> > >> > > > > Applied to my trivial-patches branch. Er, I made review comments on this one; it needs a respin. thanks -- PMM
Re: [PATCH v2] hw/block/nand: Decommission the NAND museum
Le 13/12/2020 à 20:01, Peter Maydell a écrit : > On Sun, 13 Dec 2020 at 17:21, Laurent Vivier wrote: >> >> Le 16/10/2020 à 18:52, Philippe Mathieu-Daudé a écrit : >>> Cc'ing qemu-trivial@ since this patch is reviewed. >>> >>> On 10/15/20 8:12 PM, Philippe Mathieu-Daudé wrote: ping^2... On 10/1/20 7:31 PM, Philippe Mathieu-Daudé wrote: > ping qemu-block or qemu-arm? > > On 9/15/20 7:16 PM, Philippe Mathieu-Daudé wrote: >> This is the QEMU equivalent of this Linux commit (but 7 years later): >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 >> >> The MTD subsystem has its own small museum of ancient NANDs >> in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. >> The museum contains stone age NANDs with 256 bytes pages, as well >> as iron age NANDs with 512 bytes per page and up to 8MiB page size. >> >> It is with great sorrow that I inform you that the museum is being >> decommissioned. The MTD subsystem is out of budget for Kconfig >> options and already has too many of them, and there is a general >> kernel trend to simplify the configuration menu. >> >> We remove the stone age exhibits along with closing the museum, >> but some of the iron age ones are transferred to the regular NAND >> depot. Namely, only those which have unique device IDs are >> transferred, and the ones which have conflicting device IDs are >> removed. >> >> The machine using this device are: >> - axis-dev88 >> - tosa (via tc6393xb_init) >> - spitz based (akita, borzoi, terrier) >> >> Reviewed-by: Richard Henderson >> Signed-off-by: Philippe Mathieu-Daudé >> --- >> Peter, as 4 of the 5 machines are ARM-based, can this go via your tree? >> --- >> hw/block/nand.c | 13 ++--- >> 1 file changed, 6 insertions(+), 7 deletions(-) >> >> diff --git a/hw/block/nand.c b/hw/block/nand.c >> index 5c8112ed5a4..5f01ba2bc44 100644 >> --- a/hw/block/nand.c >> +++ b/hw/block/nand.c >> @@ -138,7 +138,7 @@ static void mem_and(uint8_t *dest, const uint8_t >> *src, size_t n) >> # define ADDR_SHIFT16 >> # include "nand.c" >> -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ >> +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ >> static const struct { >> int size; >> int width; >> @@ -154,15 +154,14 @@ static const struct { >> [0xe8] = { 1,8,8, 4, 0 }, >> [0xec] = { 1,8,8, 4, 0 }, >> [0xea] = { 2,8,8, 4, 0 }, >> -[0xd5] = { 4,8,9, 4, 0 }, >> [0xe3] = { 4,8,9, 4, 0 }, >> [0xe5] = { 4,8,9, 4, 0 }, >> -[0xd6] = { 8,8,9, 4, 0 }, >> -[0x39] = { 8,8,9, 4, 0 }, >> -[0xe6] = { 8,8,9, 4, 0 }, >> -[0x49] = { 8,16,9, 4, NAND_BUSWIDTH_16 }, >> -[0x59] = { 8,16,9, 4, NAND_BUSWIDTH_16 }, >> +[0x6b] = { 4,8,9, 4, 0 }, >> +[0xe3] = { 4,8,9, 4, 0 }, >> +[0xe5] = { 4,8,9, 4, 0 }, >> +[0xd6] = { 8,8,9, 4, 0 }, >> +[0xe6] = { 8,8,9, 4, 0 }, >> [0x33] = { 16,8,9, 5, 0 }, >> [0x73] = { 16,8,9, 5, 0 }, >> > >>> >> >> Applied to my trivial-patches branch. > > Er, I made review comments on this one; it needs a respin. Yes, removed from my queue. Thanks, Laurent
Re: [PATCH v2] hw/block/nand: Decommission the NAND museum
On 10/19/20 6:05 PM, Peter Maydell wrote: > On Tue, 15 Sep 2020 at 18:52, Philippe Mathieu-Daudé wrote: >> >> This is the QEMU equivalent of this Linux commit (but 7 years later): >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 >> >> The MTD subsystem has its own small museum of ancient NANDs >> in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. >> The museum contains stone age NANDs with 256 bytes pages, as well >> as iron age NANDs with 512 bytes per page and up to 8MiB page size. >> >> It is with great sorrow that I inform you that the museum is being >> decommissioned. The MTD subsystem is out of budget for Kconfig >> options and already has too many of them, and there is a general >> kernel trend to simplify the configuration menu. >> >> We remove the stone age exhibits along with closing the museum, >> but some of the iron age ones are transferred to the regular NAND >> depot. Namely, only those which have unique device IDs are >> transferred, and the ones which have conflicting device IDs are >> removed. >> >> The machine using this device are: >> - axis-dev88 >> - tosa (via tc6393xb_init) >> - spitz based (akita, borzoi, terrier) >> >> Reviewed-by: Richard Henderson >> Signed-off-by: Philippe Mathieu-Daudé >> --- >> Peter, as 4 of the 5 machines are ARM-based, can this go via your tree? >> --- >> hw/block/nand.c | 13 ++--- >> 1 file changed, 6 insertions(+), 7 deletions(-) >> >> diff --git a/hw/block/nand.c b/hw/block/nand.c >> index 5c8112ed5a4..5f01ba2bc44 100644 >> --- a/hw/block/nand.c >> +++ b/hw/block/nand.c >> @@ -138,7 +138,7 @@ static void mem_and(uint8_t *dest, const uint8_t *src, >> size_t n) >> # define ADDR_SHIFT16 >> # include "nand.c" >> >> -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ >> +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ >> static const struct { >> int size; >> int width; >> @@ -154,15 +154,14 @@ static const struct { >> [0xe8] = { 1, 8, 8, 4, 0 }, >> [0xec] = { 1, 8, 8, 4, 0 }, >> [0xea] = { 2, 8, 8, 4, 0 }, >> -[0xd5] = { 4, 8, 9, 4, 0 }, >> [0xe3] = { 4, 8, 9, 4, 0 }, >> [0xe5] = { 4, 8, 9, 4, 0 }, >> -[0xd6] = { 8, 8, 9, 4, 0 }, >> >> -[0x39] = { 8, 8, 9, 4, 0 }, >> -[0xe6] = { 8, 8, 9, 4, 0 }, >> -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, >> -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, >> +[0x6b] = { 4,8,9, 4, 0 }, >> +[0xe3] = { 4,8,9, 4, 0 }, >> +[0xe5] = { 4,8,9, 4, 0 }, > > This line adds an entry for 0xe5, but there is already one > further up in the array (you can see it in this hunk). > > More generally, it doesn't seem to match the referenced > kernel commit, which deletes 14 lines and adds 5 > (which are a subset of the 14 deleted, really, so > they probably show up for us as "9 deletions" since > we don't have the #ifdef...#endif the kernel does). Well, this is what this patch intended to do... 14 deletions: -[0x6e] = { 1, 8, 8, 4, 0 }, -[0x64] = { 2, 8, 8, 4, 0 }, -[0x6b] = { 4, 8, 9, 4, 0 }, -[0xe8] = { 1, 8, 8, 4, 0 }, -[0xec] = { 1, 8, 8, 4, 0 }, -[0xea] = { 2, 8, 8, 4, 0 }, -[0xd5] = { 4, 8, 9, 4, 0 }, -[0xe3] = { 4, 8, 9, 4, 0 }, -[0xe5] = { 4, 8, 9, 4, 0 }, -[0xd6] = { 8, 8, 9, 4, 0 }, - -[0x39] = { 8, 8, 9, 4, 0 }, -[0xe6] = { 8, 8, 9, 4, 0 }, -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, and 5 additions: +[0x6b] = { 4, 8, 9, 4, 0 }, +[0xe3] = { 4, 8, 9, 4, 0 }, +[0xe5] = { 4, 8, 9, 4, 0 }, +[0xd6] = { 8, 8, 9, 4, 0 }, +[0xe6] = { 8, 8, 9, 4, 0 }, When combined, the resulting diff is: -[0x6e] = { 1, 8, 8, 4, 0 }, -[0x64] = { 2, 8, 8, 4, 0 }, [0x6b] = { 4, 8, 9, 4, 0 }, -[0xe8] = { 1, 8, 8, 4, 0 }, -[0xec] = { 1, 8, 8, 4, 0 }, -[0xea] = { 2, 8, 8, 4, 0 }, -[0xd5] = { 4, 8, 9, 4, 0 }, [0xe3] = { 4, 8, 9, 4, 0 }, [0xe5] = { 4, 8, 9, 4, 0 }, [0xd6] = { 8, 8, 9, 4, 0 }, - -[0x39] = { 8, 8, 9, 4, 0 }, [0xe6] = { 8, 8, 9, 4, 0 }, -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, But trying to commit that I get (while only removing lines!): ERROR: code indent should never use tabs #14: FILE: hw/block/nand.c:150: +[0x6b] = { 4,^I8,^I9, 4, 0 },$ ERROR: code indent should never use tabs #15: FILE: hw/block/n
Re: [PATCH v2] hw/block/nand: Decommission the NAND museum
On 12/14/20 1:11 AM, Philippe Mathieu-Daudé wrote: > On 10/19/20 6:05 PM, Peter Maydell wrote: >> On Tue, 15 Sep 2020 at 18:52, Philippe Mathieu-Daudé wrote: >>> >>> This is the QEMU equivalent of this Linux commit (but 7 years later): >>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 >>> >>> The MTD subsystem has its own small museum of ancient NANDs >>> in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. >>> The museum contains stone age NANDs with 256 bytes pages, as well >>> as iron age NANDs with 512 bytes per page and up to 8MiB page size. >>> >>> It is with great sorrow that I inform you that the museum is being >>> decommissioned. The MTD subsystem is out of budget for Kconfig >>> options and already has too many of them, and there is a general >>> kernel trend to simplify the configuration menu. >>> >>> We remove the stone age exhibits along with closing the museum, >>> but some of the iron age ones are transferred to the regular NAND >>> depot. Namely, only those which have unique device IDs are >>> transferred, and the ones which have conflicting device IDs are >>> removed. >>> >>> The machine using this device are: >>> - axis-dev88 >>> - tosa (via tc6393xb_init) >>> - spitz based (akita, borzoi, terrier) >>> >>> Reviewed-by: Richard Henderson >>> Signed-off-by: Philippe Mathieu-Daudé >>> --- >>> Peter, as 4 of the 5 machines are ARM-based, can this go via your tree? >>> --- >>> hw/block/nand.c | 13 ++--- >>> 1 file changed, 6 insertions(+), 7 deletions(-) >>> >>> diff --git a/hw/block/nand.c b/hw/block/nand.c >>> index 5c8112ed5a4..5f01ba2bc44 100644 >>> --- a/hw/block/nand.c >>> +++ b/hw/block/nand.c >>> @@ -138,7 +138,7 @@ static void mem_and(uint8_t *dest, const uint8_t *src, >>> size_t n) >>> # define ADDR_SHIFT16 >>> # include "nand.c" >>> >>> -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ >>> +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ >>> static const struct { >>> int size; >>> int width; >>> @@ -154,15 +154,14 @@ static const struct { >>> [0xe8] = { 1, 8, 8, 4, 0 }, >>> [0xec] = { 1, 8, 8, 4, 0 }, >>> [0xea] = { 2, 8, 8, 4, 0 }, >>> -[0xd5] = { 4, 8, 9, 4, 0 }, >>> [0xe3] = { 4, 8, 9, 4, 0 }, >>> [0xe5] = { 4, 8, 9, 4, 0 }, >>> -[0xd6] = { 8, 8, 9, 4, 0 }, >>> >>> -[0x39] = { 8, 8, 9, 4, 0 }, >>> -[0xe6] = { 8, 8, 9, 4, 0 }, >>> -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, >>> -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, >>> +[0x6b] = { 4,8,9, 4, 0 }, >>> +[0xe3] = { 4,8,9, 4, 0 }, >>> +[0xe5] = { 4,8,9, 4, 0 }, >> >> This line adds an entry for 0xe5, but there is already one >> further up in the array (you can see it in this hunk). >> >> More generally, it doesn't seem to match the referenced >> kernel commit, which deletes 14 lines and adds 5 >> (which are a subset of the 14 deleted, really, so >> they probably show up for us as "9 deletions" since >> we don't have the #ifdef...#endif the kernel does). > > Well, this is what this patch intended to do... > 14 deletions: > > -[0x6e] = { 1, 8, 8, 4, 0 }, > -[0x64] = { 2, 8, 8, 4, 0 }, > -[0x6b] = { 4, 8, 9, 4, 0 }, > -[0xe8] = { 1, 8, 8, 4, 0 }, > -[0xec] = { 1, 8, 8, 4, 0 }, > -[0xea] = { 2, 8, 8, 4, 0 }, > -[0xd5] = { 4, 8, 9, 4, 0 }, > -[0xe3] = { 4, 8, 9, 4, 0 }, > -[0xe5] = { 4, 8, 9, 4, 0 }, > -[0xd6] = { 8, 8, 9, 4, 0 }, > - > -[0x39] = { 8, 8, 9, 4, 0 }, > -[0xe6] = { 8, 8, 9, 4, 0 }, > -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, > -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, > > and 5 additions: > > +[0x6b] = { 4, 8, 9, 4, 0 }, > +[0xe3] = { 4, 8, 9, 4, 0 }, > +[0xe5] = { 4, 8, 9, 4, 0 }, > +[0xd6] = { 8, 8, 9, 4, 0 }, > +[0xe6] = { 8, 8, 9, 4, 0 }, OK, the kernel commit has 9+5=14 removals and 5 "additions", because the "additions" change the hex index from lowercase to uppercase. I.e.: - {"NAND 4MiB 3,3V 8-bit",0xe5, 512, 4, 0x2000, SP_OPTIONS}, + {"NAND 4MiB 3,3V 8-bit",0xE5, 512, 4, 0x2000, SP_OPTIONS}, This explain why the resulting diff is 9 removals: > > When combined, the resulting diff is: > > -[0x6e] = { 1,8, 8, 4, 0 }, > -[0x64] = { 2,8, 8, 4, 0 }, > [0x6b] = { 4,8, 9, 4, 0 }, > -[0xe8] = { 1,8, 8, 4, 0 }, > -[0xec] = { 1,8, 8, 4, 0 }, > -[0xea] = { 2,8, 8, 4, 0 }, > -[0xd5] = { 4,8, 9, 4, 0 }, > [0xe3] = { 4,8, 9, 4, 0
[PATCH v3] hw/block/nand: Decommission the NAND museum
This is the QEMU equivalent of this Linux commit (but 7 years later): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7025a43a9da2 The MTD subsystem has its own small museum of ancient NANDs in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. The museum contains stone age NANDs with 256 bytes pages, as well as iron age NANDs with 512 bytes per page and up to 8MiB page size. It is with great sorrow that I inform you that the museum is being decommissioned. The MTD subsystem is out of budget for Kconfig options and already has too many of them, and there is a general kernel trend to simplify the configuration menu. We remove the stone age exhibits along with closing the museum, but some of the iron age ones are transferred to the regular NAND depot. Namely, only those which have unique device IDs are transferred, and the ones which have conflicting device IDs are removed. The machine using this device are: - axis-dev88 - tosa (via tc6393xb_init) - spitz based (akita, borzoi, terrier) Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- v3: Do not manually convert tabs to space to avoid mistakes... While this patch only *removes* lines, checkpatch still complains: ERROR: code indent should never use tabs #14: FILE: hw/block/nand.c:150: +[0x6b] = { 4,^I8,^I9, 4, 0 },$ ERROR: code indent should never use tabs #15: FILE: hw/block/nand.c:151: +[0xe3] = { 4,^I8,^I9, 4, 0 },$ ERROR: code indent should never use tabs #16: FILE: hw/block/nand.c:152: +[0xe5] = { 4,^I8,^I9, 4, 0 },$ ERROR: code indent should never use tabs #17: FILE: hw/block/nand.c:153: +[0xd6] = { 8,^I8,^I9, 4, 0 },$ ERROR: code indent should never use tabs #18: FILE: hw/block/nand.c:154: +[0xe6] = { 8,^I8,^I9, 4, 0 },$ --- hw/block/nand.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/hw/block/nand.c b/hw/block/nand.c index 1d7a48a2ec2..9ed54a0a922 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -137,7 +137,7 @@ static void mem_and(uint8_t *dest, const uint8_t *src, size_t n) # define ADDR_SHIFT16 # include "nand.c" -/* Information based on Linux drivers/mtd/nand/nand_ids.c */ +/* Information based on Linux drivers/mtd/nand/raw/nand_ids.c */ static const struct { int size; int width; @@ -147,21 +147,11 @@ static const struct { } nand_flash_ids[0x100] = { [0 ... 0xff] = { 0 }, -[0x6e] = { 1, 8, 8, 4, 0 }, -[0x64] = { 2, 8, 8, 4, 0 }, [0x6b] = { 4, 8, 9, 4, 0 }, -[0xe8] = { 1, 8, 8, 4, 0 }, -[0xec] = { 1, 8, 8, 4, 0 }, -[0xea] = { 2, 8, 8, 4, 0 }, -[0xd5] = { 4, 8, 9, 4, 0 }, [0xe3] = { 4, 8, 9, 4, 0 }, [0xe5] = { 4, 8, 9, 4, 0 }, [0xd6] = { 8, 8, 9, 4, 0 }, - -[0x39] = { 8, 8, 9, 4, 0 }, [0xe6] = { 8, 8, 9, 4, 0 }, -[0x49] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, -[0x59] = { 8, 16, 9, 4, NAND_BUSWIDTH_16 }, [0x33] = { 16, 8, 9, 5, 0 }, [0x73] = { 16, 8, 9, 5, 0 }, -- 2.26.2
RE: [PATCH v4 09/32] qdev: Make qdev_get_prop_ptr() get Object* arg
> -Original Message- > From: Eduardo Habkost > Sent: 11 December 2020 22:05 > To: qemu-de...@nongnu.org > Cc: Markus Armbruster ; Igor Mammedov > ; Stefan Berger > ; Marc-André Lureau ; > Daniel P. Berrange > ; Philippe Mathieu-Daudé ; John Snow > ; Kevin > Wolf ; Eric Blake ; Paolo Bonzini > ; Cornelia > Huck ; Stefan Berger ; Stefano > Stabellini > ; Anthony Perard ; Paul > Durrant ; Max > Reitz ; Thomas Huth ; Richard Henderson > ; David > Hildenbrand ; Halil Pasic ; Christian > Borntraeger > ; Matthew Rosato ; Alex > Williamson > ; xen-de...@lists.xenproject.org; > qemu-block@nongnu.org; qemu- > s3...@nongnu.org > Subject: [PATCH v4 09/32] qdev: Make qdev_get_prop_ptr() get Object* arg > > Make the code more generic and not specific to TYPE_DEVICE. > > Reviewed-by: Marc-André Lureau > Reviewed-by: Cornelia Huck #s390 parts > Signed-off-by: Eduardo Habkost Xen parts... Acked-by: Paul Durrant
RE: [PATCH v4 23/32] qdev: Move dev->realized check to qdev_property_set()
> -Original Message- > From: Eduardo Habkost > Sent: 11 December 2020 22:05 > To: qemu-de...@nongnu.org > Cc: Markus Armbruster ; Igor Mammedov > ; Stefan Berger > ; Marc-André Lureau ; > Daniel P. Berrange > ; Philippe Mathieu-Daudé ; John Snow > ; Kevin > Wolf ; Eric Blake ; Paolo Bonzini > ; Stefan > Berger ; Stefano Stabellini > ; Anthony Perard > ; Paul Durrant ; Max Reitz > ; Cornelia Huck > ; Halil Pasic ; Christian Borntraeger > ; Richard Henderson ; David > Hildenbrand ; > Thomas Huth ; Matthew Rosato ; Alex > Williamson > ; Mark Cave-Ayland > ; Artyom Tarasenko > ; xen-de...@lists.xenproject.org; qemu-block@nongnu.org; > qemu-s3...@nongnu.org > Subject: [PATCH v4 23/32] qdev: Move dev->realized check to > qdev_property_set() > > Every single qdev property setter function manually checks > dev->realized. We can just check dev->realized inside > qdev_property_set() instead. > > The check is being added as a separate function > (qdev_prop_allow_set()) because it will become a callback later. > > Reviewed-by: Stefan Berger > Signed-off-by: Eduardo Habkost Xen parts... Acked-by: Paul Durrant
RE: [PATCH v4 30/32] qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr()
> -Original Message- > From: Eduardo Habkost > Sent: 11 December 2020 22:05 > To: qemu-de...@nongnu.org > Cc: Markus Armbruster ; Igor Mammedov > ; Stefan Berger > ; Marc-André Lureau ; > Daniel P. Berrange > ; Philippe Mathieu-Daudé ; John Snow > ; Kevin > Wolf ; Eric Blake ; Paolo Bonzini > ; Stefan > Berger ; Stefano Stabellini > ; Anthony Perard > ; Paul Durrant ; Max Reitz > ; Cornelia Huck > ; Halil Pasic ; Christian Borntraeger > ; Richard Henderson ; David > Hildenbrand ; > Thomas Huth ; Matthew Rosato ; Alex > Williamson > ; xen-de...@lists.xenproject.org; > qemu-block@nongnu.org; qemu- > s3...@nongnu.org > Subject: [PATCH v4 30/32] qdev: Rename qdev_get_prop_ptr() to > object_field_prop_ptr() > > The function will be moved to common QOM code, as it is not > specific to TYPE_DEVICE anymore. > > Reviewed-by: Stefan Berger > Signed-off-by: Eduardo Habkost Xen parts... Acked-by: Paul Durrant