Skip to contentSkip to conversation

coroutine: Clean up includes

PATCH In review Markus Armbruster 3 participants 13 messages Dec 21, 2022 – Dec 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover coroutine: Clean up includes

v3:
* PATCH 4: Unnecessary hunks dropped

v2:
* Rebased
* PATCH 4: Rewritten [Paolo]
* PATCH 5: New

Markus Armbruster (5):
coroutine: Clean up superfluous inclusion of qemu/coroutine.h
coroutine: Move coroutine_fn to qemu/osdep.h, trim includes
coroutine: Clean up superfluous inclusion of qemu/lockable.h
coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h
coroutine: Use Coroutine typedef name instead of structure tag

 crypto/block-luks-priv.h      |   1 -
 hw/9pfs/coth.h                |   2 +-
 include/block/aio.h           |   9 +-
 include/block/aio_task.h      |   2 -
 include/block/block-common.h  |   1 -
 include/block/graph-lock.h    |   2 -
 include/block/raw-aio.h       |   1 -
 include/io/channel.h          |   2 +-
 include/monitor/hmp.h         |   1 -
 include/qemu/coroutine-core.h | 154 ++++++++++++++++++++++++++++++++++
 include/qemu/coroutine.h      | 113 ++-----------------------
 include/qemu/lockable.h       |   2 +-
 include/qemu/osdep.h          |  16 ++++
 include/qemu/progress_meter.h |   2 +-
 include/qemu/typedefs.h       |   1 -
 include/scsi/pr-manager.h     |   1 -
 nbd/nbd-internal.h            |   1 -
 block/progress_meter.c        |   2 +
 blockjob.c                    |   1 -
 crypto/block-luks.c           |   1 -
 hw/9pfs/codir.c               |   1 -
 hw/9pfs/cofile.c              |   1 -
 hw/9pfs/cofs.c                |   1 -
 hw/9pfs/coxattr.c             |   1 -
 nbd/client-connection.c       |   1 +
 tests/unit/test-aio.c         |   2 +-
 tests/unit/test-coroutine.c   |   2 -
 tests/unit/test-vmstate.c     |   1 -
 ui/console.c                  |   1 +
 util/async.c                  |   4 +-
 util/qemu-coroutine-lock.c    |   1 -
 util/qemu-coroutine-sleep.c   |   1 -
 util/qemu-coroutine.c         |   1 -
 33 files changed, 192 insertions(+), 141 deletions(-)
 create mode 100644 include/qemu/coroutine-core.h
Signature · 1 line
2.38.1
#1 lore raw

PATCH v3 1/5 coroutine: Clean up superfluous inclusion of qemu/coroutine.h

---
 crypto/block-luks-priv.h    | 1 -
 include/block/raw-aio.h     | 1 -
 include/scsi/pr-manager.h   | 1 -
 nbd/nbd-internal.h          | 1 -
 blockjob.c                  | 1 -
 crypto/block-luks.c         | 1 -
 hw/9pfs/codir.c             | 1 -
 hw/9pfs/cofile.c            | 1 -
 hw/9pfs/cofs.c              | 1 -
 hw/9pfs/coxattr.c           | 1 -
 tests/unit/test-coroutine.c | 1 -
 tests/unit/test-vmstate.c   | 1 -
 util/qemu-coroutine-lock.c  | 1 -
 util/qemu-coroutine-sleep.c | 1 -
 util/qemu-coroutine.c       | 1 -
 15 files changed, 15 deletions(-)
crypto/block-luks-priv.h +0 -1
index 90a20d432b..dc2dd14e52 100644
@@ -31,7 +31,6 @@
 #include "crypto/random.h"
 #include "qemu/uuid.h"
 
-#include "qemu/coroutine.h"
 #include "qemu/bitmap.h"
 
 /*
include/block/raw-aio.h +0 -1
index 21fc10c4c9..f8cda9df91 100644
@@ -17,7 +17,6 @@
 #define QEMU_RAW_AIO_H
 
 #include "block/aio.h"
-#include "qemu/coroutine.h"
 #include "qemu/iov.h"
 
 /* AIO request types */
include/scsi/pr-manager.h +0 -1
index e4ecbe00f6..45de28d354 100644
@@ -5,7 +5,6 @@
 #include "qapi/visitor.h"
 #include "qom/object_interfaces.h"
 #include "block/aio.h"
-#include "qemu/coroutine.h"
 
 #define TYPE_PR_MANAGER "pr-manager"
 
nbd/nbd-internal.h +0 -1
index 1b2141ab4b..df42fef706 100644
@@ -13,7 +13,6 @@
 #include "sysemu/block-backend.h"
 #include "io/channel-tls.h"
 
-#include "qemu/coroutine.h"
 #include "qemu/iov.h"
 
 #ifndef _WIN32
blockjob.c +0 -1
index b7daf2a9f6..54b4091a36 100644
@@ -32,7 +32,6 @@
 #include "qapi/error.h"
 #include "qapi/qapi-events-block-core.h"
 #include "qapi/qmp/qerror.h"
-#include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 
crypto/block-luks.c +0 -1
index ff9e3945d1..5688783ab1 100644
@@ -32,7 +32,6 @@
 #include "crypto/random.h"
 #include "qemu/uuid.h"
 
-#include "qemu/coroutine.h"
 #include "qemu/bitmap.h"
 
 /*
hw/9pfs/codir.c +0 -1
index 93ba44fb75..7ba63be489 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "fsdev/qemu-fsdev.h"
 #include "qemu/thread.h"
-#include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
 #include "coth.h"
 #include "9p-xattr.h"
hw/9pfs/cofile.c +0 -1
index 20f93a90e7..9c5344039e 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "fsdev/qemu-fsdev.h"
 #include "qemu/thread.h"
-#include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
 #include "coth.h"
 
hw/9pfs/cofs.c +0 -1
index 9d0adc2e78..67e3ae5c5c 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "fsdev/qemu-fsdev.h"
 #include "qemu/thread.h"
-#include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
 #include "coth.h"
 
hw/9pfs/coxattr.c +0 -1
index dbcd09e0fd..cd0f8488ac 100644
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 #include "fsdev/qemu-fsdev.h"
 #include "qemu/thread.h"
-#include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
 #include "coth.h"
 
tests/unit/test-coroutine.c +0 -1
index e16b80c245..513800d3db 100644
@@ -12,7 +12,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/coroutine.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/lockable.h"
 
tests/unit/test-vmstate.c +0 -1
index 541bb4f63e..79357b29ca 100644
@@ -29,7 +29,6 @@
 #include "migration/qemu-file-types.h"
 #include "../migration/qemu-file.h"
 #include "../migration/savevm.h"
-#include "qemu/coroutine.h"
 #include "qemu/module.h"
 #include "io/channel-file.h"
 
util/qemu-coroutine-lock.c +0 -1
index 45c6b57374..58f3f77181 100644
@@ -27,7 +27,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/coroutine.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/processor.h"
 #include "qemu/queue.h"
util/qemu-coroutine-sleep.c +0 -1
index 571ab521ff..af59f9af98 100644
@@ -12,7 +12,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/coroutine.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/timer.h"
 #include "block/aio.h"
util/qemu-coroutine.c +0 -1
index 356b746f0b..8494523692 100644
@@ -16,7 +16,6 @@
 #include "trace.h"
 #include "qemu/thread.h"
 #include "qemu/atomic.h"
-#include "qemu/coroutine.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/coroutine-tls.h"
 #include "block/aio.h"
Signature · 1 line
2.38.1
#2 lore raw

PATCH v3 2/5 coroutine: Move coroutine_fn to qemu/osdep.h, trim includes

In reply to Markus Armbruster

block/block-hmp-cmds.h and qemu/co-shared-resource.h use coroutine_fn without including qemu/coroutine.h. They compile only if it's already included from elsewhere.

I could fix that, but pulling in qemu/coroutine.h and everything it includes just for a macro that expands into nothing feels silly. Instead, move the macro to qemu/osdep.h.

Inclusions of qemu/coroutine.h just for coroutine_fn become superfluous. Drop them.

---
 include/block/aio_task.h     |  2 --
 include/block/block-common.h |  1 -
 include/block/graph-lock.h   |  2 --
 include/monitor/hmp.h        |  1 -
 include/qemu/coroutine.h     | 18 +++++++-----------
 include/qemu/osdep.h         | 16 ++++++++++++++++
 6 files changed, 23 insertions(+), 17 deletions(-)
include/block/aio_task.h +0 -2
index 50bc1e1817..18a9c41f4e 100644
@@ -25,8 +25,6 @@
 #ifndef BLOCK_AIO_TASK_H
 #define BLOCK_AIO_TASK_H
 
-#include "qemu/coroutine.h"
-
 typedef struct AioTaskPool AioTaskPool;
 typedef struct AioTask AioTask;
 typedef int coroutine_fn (*AioTaskFunc)(AioTask *task);
include/block/block-common.h +0 -1
index 4749c46a5e..434ffc5d34 100644
@@ -27,7 +27,6 @@
 #include "block/aio.h"
 #include "block/aio-wait.h"
 #include "qemu/iov.h"
-#include "qemu/coroutine.h"
 #include "block/accounting.h"
 #include "qemu/hbitmap.h"
 #include "qemu/transactions.h"
include/block/graph-lock.h +0 -2
index 4c92cd8edf..3ab924d5e2 100644
@@ -23,8 +23,6 @@
 #include "qemu/osdep.h"
 #include "qemu/clang-tsa.h"
 
-#include "qemu/coroutine.h"
-
 /**
  * Graph Lock API
  * This API provides a rwlock used to protect block layer
include/monitor/hmp.h +0 -1
index dfbc0c9a2f..c92f69da8b 100644
@@ -15,7 +15,6 @@
 #define HMP_H
 
 #include "qemu/readline.h"
-#include "qemu/coroutine.h"
 #include "qapi/qapi-types-common.h"
 
 bool hmp_handle_error(Monitor *mon, Error *err);
include/qemu/coroutine.h +7 -11
index 89650a2d7f..2496a4f4ef 100644
@@ -26,23 +26,19 @@
  * waiting for events to complete.
  *
  * These functions are re-entrant and may be used outside the global mutex.
- */
-
-/**
- * Mark a function that executes in coroutine context
  *
- * Functions that execute in coroutine context cannot be called directly from
- * normal functions.  In the future it would be nice to enable compiler or
- * static checker support for catching such errors.  This annotation might make
- * it possible and in the meantime it serves as documentation.
- *
- * For example:
+ * Functions that execute in coroutine context cannot be called
+ * directly from normal functions.  Use @coroutine_fn to mark such
+ * functions.  For example:
  *
  *   static void coroutine_fn foo(void) {
  *       ....
  *   }
+ *
+ * In the future it would be nice to have the compiler or a static
+ * checker catch misuse of such functions.  This annotation might make
+ * it possible and in the meantime it serves as documentation.
  */
-#define coroutine_fn
 
 typedef struct Coroutine Coroutine;
 
include/qemu/osdep.h +16 -0
index b9c4307779..8e97e5d79a 100644
@@ -157,6 +157,22 @@ extern "C" {
 
 #include "qemu/typedefs.h"
 
+/**
+ * Mark a function that executes in coroutine context
+ *
+ * Functions that execute in coroutine context cannot be called directly from
+ * normal functions.  In the future it would be nice to enable compiler or
+ * static checker support for catching such errors.  This annotation might make
+ * it possible and in the meantime it serves as documentation.
+ *
+ * For example:
+ *
+ *   static void coroutine_fn foo(void) {
+ *       ....
+ *   }
+ */
+#define coroutine_fn
+
 /*
  * For mingw, as of v6.0.0, the function implementing the assert macro is
  * not marked as noreturn, so the compiler cannot delete code following an
Signature · 1 line
2.38.1
#3 lore raw

PATCH v3 3/5 coroutine: Clean up superfluous inclusion of qemu/lockable.h

In reply to Markus Armbruster
---
 include/qemu/progress_meter.h | 2 +-
 block/progress_meter.c        | 2 ++
 tests/unit/test-coroutine.c   | 1 -
 3 files changed, 3 insertions(+), 2 deletions(-)
include/qemu/progress_meter.h +1 -1
index dadf822bbf..0f2c0a32d2 100644
@@ -27,7 +27,7 @@
 #ifndef QEMU_PROGRESS_METER_H
 #define QEMU_PROGRESS_METER_H
 
-#include "qemu/lockable.h"
+#include "qemu/thread.h"
 
 typedef struct ProgressMeter {
     /**
block/progress_meter.c +2 -0
index aa2e60248c..31a170a2cd 100644
@@ -23,7 +23,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "qemu/osdep.h"
+#include "qemu/coroutine.h"
 #include "qemu/progress_meter.h"
 
 void progress_init(ProgressMeter *pm)
tests/unit/test-coroutine.c +0 -1
index 513800d3db..b0d21d673a 100644
@@ -13,7 +13,6 @@
 
 #include "qemu/osdep.h"
 #include "qemu/coroutine_int.h"
-#include "qemu/lockable.h"
 
 /*
  * Check that qemu_in_coroutine() works
Signature · 1 line
2.38.1
#4 lore raw

PATCH v3 4/5 coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h

In reply to Markus Armbruster

qemu/coroutine.h and qemu/lockable.h include each other.

They need each other only in macro expansions, so we could simply drop both inclusions to break the loop, and add suitable includes to files that expand the macros.

Instead, move a part of qemu/coroutine.h to new qemu/coroutine-core.h so that qemu/coroutine-core.h doesn't need qemu/lockable.h, and qemu/lockable.h only needs qemu/coroutine-core.h. Result:
qemu/coroutine.h includes qemu/lockable.h includes qemu/coroutine-core.h.

---
 hw/9pfs/coth.h                |   2 +-
 include/block/aio.h           |   2 +-
 include/io/channel.h          |   2 +-
 include/qemu/coroutine-core.h | 154 ++++++++++++++++++++++++++++++++++
 include/qemu/coroutine.h      |  97 +--------------------
 include/qemu/lockable.h       |   2 +-
 include/qemu/typedefs.h       |   1 -
 nbd/client-connection.c       |   1 +
 tests/unit/test-aio.c         |   2 +-
 ui/console.c                  |   1 +
 10 files changed, 162 insertions(+), 102 deletions(-)
 create mode 100644 include/qemu/coroutine-core.h
hw/9pfs/coth.h +1 -1
index 1a1edbdc2a..2c54249b35 100644
@@ -16,7 +16,7 @@
 #define QEMU_9P_COTH_H
 
 #include "qemu/thread.h"
-#include "qemu/coroutine.h"
+#include "qemu/coroutine-core.h"
 #include "9p.h"
 
 /*
include/block/aio.h +1 -1
index 0f65a3cc9e..3a546e7515 100644
@@ -17,7 +17,7 @@
 #ifdef CONFIG_LINUX_IO_URING
 #include <liburing.h>
 #endif
-#include "qemu/coroutine.h"
+#include "qemu/coroutine-core.h"
 #include "qemu/queue.h"
 #include "qemu/event_notifier.h"
 #include "qemu/thread.h"
include/io/channel.h +1 -1
index f1b7e05f81..78b15f7870 100644
@@ -22,7 +22,7 @@
 #define QIO_CHANNEL_H
 
 #include "qom/object.h"
-#include "qemu/coroutine.h"
+#include "qemu/coroutine-core.h"
 #include "block/aio.h"
 
 #define TYPE_QIO_CHANNEL "qio-channel"
include/qemu/coroutine-core.h new file +154 -0

154 lines not on this page · raw message

include/qemu/coroutine.h +1 -96

115 lines not on this page · raw message

include/qemu/lockable.h +1 -1
index 86db7cb04c..9823220446 100644
@@ -13,7 +13,7 @@
 #ifndef QEMU_LOCKABLE_H
 #define QEMU_LOCKABLE_H
 
-#include "qemu/coroutine.h"
+#include "qemu/coroutine-core.h"
 #include "qemu/thread.h"
 
 typedef void QemuLockUnlockFunc(void *);
include/qemu/typedefs.h +0 -1
index 688408e048..0f7329b70f 100644
@@ -37,7 +37,6 @@ typedef struct BusState BusState;
 typedef struct Chardev Chardev;
 typedef struct Clock Clock;
 typedef struct CompatProperty CompatProperty;
-typedef struct CoMutex CoMutex;
 typedef struct ConfidentialGuestSupport ConfidentialGuestSupport;
 typedef struct CPUAddressSpace CPUAddressSpace;
 typedef struct CPUArchState CPUArchState;
nbd/client-connection.c +1 -0
index 0c5f917efa..e5b1046a1c 100644
@@ -29,6 +29,7 @@
 
 #include "qapi/qapi-visit-sockets.h"
 #include "qapi/clone-visitor.h"
+#include "qemu/coroutine.h"
 
 struct NBDClientConnection {
     /* Initialization constants, never change */
tests/unit/test-aio.c +1 -1
index 178048d2f2..321d7ab01a 100644
@@ -16,7 +16,7 @@
 #include "qemu/timer.h"
 #include "qemu/sockets.h"
 #include "qemu/error-report.h"
-#include "qemu/coroutine.h"
+#include "qemu/coroutine-core.h"
 #include "qemu/main-loop.h"
 
 static AioContext *ctx;
ui/console.c +1 -0
index 9ff9217f9b..ab43561fe1 100644
@@ -27,6 +27,7 @@
 #include "hw/qdev-core.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-ui.h"
+#include "qemu/coroutine.h"
 #include "qemu/fifo8.h"
 #include "qemu/main-loop.h"
 #include "qemu/module.h"
Signature · 1 line
2.38.1
#5 lore raw

Re: [PATCH v3 4/5] coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h

Quoted 7 lines · Markus Armbruster
include/qemu/coroutine-core.h new file +7 -0
+/**
+ * Mark a function that executes in coroutine context
+ *
+ *
+ * Functions that execute in coroutine context cannot be called
+ * directly from normal functions.  Use @coroutine_fn to mark such
+ * functions.  For example:

include/qemu/coroutine-core.h line 56

Quoted 10 lines
include/qemu/coroutine-core.h new file +10 -0
+ *
+ *   static void coroutine_fn foo(void) {
+ *       ....
+ *   }
+ *
+ * In the future it would be nice to have the compiler or a static
+ * checker catch misuse of such functions.  This annotation might make
+ * it possible and in the meantime it serves as documentation.
+ */
+

Is it intentional that "#define coroutine_fn" is not here?

Paolo

#6 lore raw

Re: [PATCH v3 4/5] coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h

Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Markus Armbruster

+/**
+ * Mark a function that executes in coroutine context
+ *
+ *
+ * Functions that execute in coroutine context cannot be called
+ * directly from normal functions. Use @coroutine_fn to mark such
+ * functions. For example:
+ *
+ * static void coroutine_fn foo(void) {
+ * ....
+ * }

Quoted 8 lines
Quoted 6 lines

+ *
+ * In the future it would be nice to have the compiler or a static
+ * checker catch misuse of such functions. This annotation might make
+ * it possible and in the meantime it serves as documentation.
+ */
+

Is it intentional that "#define coroutine_fn" is not here?

Yes: I moved it to qemu/osdep.h in PATCH 2, along with its doc comment. To avoid compromising coroutine.h as overview documentation, I added rephrased documentation there.

This patch copies this rephrased documentation to coroutine-core.h.

I'm open to better ideas.

#7 lore raw

Re: [PATCH v3 4/5] coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h

Quoted 18 lines · Markus Armbruster
Quoted 10 lines
Quoted 10 lines

+/**
+ * Mark a function that executes in coroutine context
+ *
+ *
+ * Functions that execute in coroutine context cannot be called
+ * directly from normal functions. Use @coroutine_fn to mark such
+ * functions. For example:
+ *
+ * static void coroutine_fn foo(void) {
+ * ....

Quoted 8 lines
Quoted 7 lines

+ * }
+ *
+ * In the future it would be nice to have the compiler or a static
+ * checker catch misuse of such functions. This annotation might make
+ * it possible and in the meantime it serves as documentation.
+ */
+

Is it intentional that "#define coroutine_fn" is not here?

Quoted 3 lines

Yes: I moved it to qemu/osdep.h in PATCH 2, along with its doc comment. To avoid compromising coroutine.h as overview documentation, I added rephrased documentation there.

Got it. coroutine.h is not included in the developer documentation so that didn't occur to me but I understand it now.

Paolo

#8 lore raw

PATCH v3 5/5 coroutine: Use Coroutine typedef name instead of structure tag

In reply to Markus Armbruster
---
 include/block/aio.h | 7 +++----
 util/async.c        | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
include/block/aio.h +3 -4
index 3a546e7515..8fba6a3584 100644
@@ -52,7 +52,6 @@ typedef void QEMUBHFunc(void *opaque);
 typedef bool AioPollFn(void *opaque);
 typedef void IOHandler(void *opaque);
 
-struct Coroutine;
 struct ThreadPool;
 struct LinuxAioState;
 struct LuringState;
@@ -694,7 +693,7 @@ static inline bool aio_node_check(AioContext *ctx, bool is_external)
  * is the context in which the coroutine is running (i.e. the value of
  * qemu_get_current_aio_context() from the coroutine itself).
  */
-void aio_co_schedule(AioContext *ctx, struct Coroutine *co);
+void aio_co_schedule(AioContext *ctx, Coroutine *co);
 
 /**
  * aio_co_reschedule_self:
@@ -717,7 +716,7 @@ void coroutine_fn aio_co_reschedule_self(AioContext *new_ctx);
  * context.  The coroutine must not be entered by anyone else while
  * aio_co_wake() is active.
  */
-void aio_co_wake(struct Coroutine *co);
+void aio_co_wake(Coroutine *co);
 
 /**
  * aio_co_enter:
@@ -726,7 +725,7 @@ void aio_co_wake(struct Coroutine *co);
  *
  * Enter a coroutine in the specified AioContext.
  */
-void aio_co_enter(AioContext *ctx, struct Coroutine *co);
+void aio_co_enter(AioContext *ctx, Coroutine *co);
 
 /**
  * Return the AioContext whose event loop runs in the current thread.
util/async.c +2 -2
index 14d63b3091..0657b75397 100644
@@ -640,7 +640,7 @@ void coroutine_fn aio_co_reschedule_self(AioContext *new_ctx)
     }
 }
 
-void aio_co_wake(struct Coroutine *co)
+void aio_co_wake(Coroutine *co)
 {
     AioContext *ctx;
 
@@ -653,7 +653,7 @@ void aio_co_wake(struct Coroutine *co)
     aio_co_enter(ctx, co);
 }
 
-void aio_co_enter(AioContext *ctx, struct Coroutine *co)
+void aio_co_enter(AioContext *ctx, Coroutine *co)
 {
     if (ctx != qemu_get_current_aio_context()) {
         aio_co_schedule(ctx, co);
Signature · 1 line
2.38.1
Tested-by on the v3 series
#9 lore raw
In reply to Markus Armbruster
Quoted 8 lines · Markus Armbruster

v3:
* PATCH 4: Unnecessary hunks dropped

v2:
* Rebased
* PATCH 4: Rewritten [Paolo]
* PATCH 5: New

Quoted 6 lines

Markus Armbruster (5):
coroutine: Clean up superfluous inclusion of qemu/coroutine.h
coroutine: Move coroutine_fn to qemu/osdep.h, trim includes
coroutine: Clean up superfluous inclusion of qemu/lockable.h
coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h
coroutine: Use Coroutine typedef name instead of structure tag

I had to add:

-- >8 --

hw/pci/pci-hmp-cmds.c +1 -0
index fb7591d6ab..b09fce9377 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "monitor/hmp.h"
 #include "monitor/monitor.h"
 #include "pci-internal.h"
hw/virtio/virtio-qmp.c +1 -1
index 8e7282658f..3d4497da99 100644
@@ -11,6 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
 #include "virtio-qmp.h"
 
---

Otherwise I get:

../hw/pci/pci-hmp-cmds.c: In function ‘pcibus_dev_print’:
../hw/pci/pci-hmp-cmds.c:129:31: error: invalid use of incomplete typedef ‘PCIDevice’
129 | int class = pci_get_word(d->config + PCI_CLASS_DEVICE);
| ^~

../hw/virtio/virtio-qmp.c:187:19: error: ‘VHOST_USER_F_PROTOCOL_FEATURES’ undeclared here (not in a function); did you mean ‘VHOST_USER_PROTOCOL_F_RARP’?

  187 |     FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe some recently merged change?

Otherwise:

#10 lore raw
Quoted 49 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Markus Armbruster

v3:
* PATCH 4: Unnecessary hunks dropped
v2:
* Rebased

Quoted 8 lines

* PATCH 4: Rewritten [Paolo]
* PATCH 5: New
Markus Armbruster (5):
coroutine: Clean up superfluous inclusion of qemu/coroutine.h
coroutine: Move coroutine_fn to qemu/osdep.h, trim includes
coroutine: Clean up superfluous inclusion of qemu/lockable.h
coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h
coroutine: Use Coroutine typedef name instead of structure tag

I had to add:

-- >8 --

hw/pci/pci-hmp-cmds.c +1 -0
index fb7591d6ab..b09fce9377 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "monitor/hmp.h"
 #include "monitor/monitor.h"
 #include "pci-internal.h"
hw/virtio/virtio-qmp.c +1 -1
index 8e7282658f..3d4497da99 100644
@@ -11,6 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
 #include "virtio-qmp.h"
 
---

Otherwise I get:

../hw/pci/pci-hmp-cmds.c: In function ‘pcibus_dev_print’:
../hw/pci/pci-hmp-cmds.c:129:31: error: invalid use of incomplete typedef ‘PCIDevice’
129 | int class = pci_get_word(d->config + PCI_CLASS_DEVICE);
| ^~

Quoted 7 lines

../hw/virtio/virtio-qmp.c:187:19: error: ‘VHOST_USER_F_PROTOCOL_FEATURES’ undeclared here (not in a function); did you mean ‘VHOST_USER_PROTOCOL_F_RARP’?

  187 |     FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe some recently merged change?

Yes. I'll rebase.

Quoted 2 lines

Otherwise:

Thanks!

PS: While looking for commits that caused these conflicts, I saw

commit 28b629ab4aa93b9b7ec79c7e480611e4554586be

Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>

commit 69779192acfeb9480183fd076be7480de56b1009

Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>

commit f983e598e5a4eada5bfa4731c9db9fba1943e4e6

Suggested-by Richard Henderson <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>
Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>

Please stop that :)

#11 lore raw
Quoted 7 lines · Markus Armbruster

Philippe Mathieu-Daudé <[email protected]> writes:

PS: While looking for commits that caused these conflicts, I saw

commit 28b629ab4aa93b9b7ec79c7e480611e4554586be

Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>
Quoted 8 lines

commit 69779192acfeb9480183fd076be7480de56b1009

Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>

commit f983e598e5a4eada5bfa4731c9db9fba1943e4e6

Suggested-by Richard Henderson <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>
Signed-off-by Philippe Mathieu-Daudé <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>

Please stop that :)

The original patch looks fine:
https://lore.kernel.org/qemu-devel/[email protected]/

Michael, did you change something in your workflow?

#12 lore raw
In reply to Markus Armbruster
Quoted 57 lines · Markus Armbruster
Quoted 55 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Markus Armbruster

v3:
* PATCH 4: Unnecessary hunks dropped
v2:
* Rebased

Quoted 8 lines

* PATCH 4: Rewritten [Paolo]
* PATCH 5: New
Markus Armbruster (5):
coroutine: Clean up superfluous inclusion of qemu/coroutine.h
coroutine: Move coroutine_fn to qemu/osdep.h, trim includes
coroutine: Clean up superfluous inclusion of qemu/lockable.h
coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h
coroutine: Use Coroutine typedef name instead of structure tag

I had to add:

-- >8 --

hw/pci/pci-hmp-cmds.c +1 -0
index fb7591d6ab..b09fce9377 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "monitor/hmp.h"
 #include "monitor/monitor.h"
 #include "pci-internal.h"
hw/virtio/virtio-qmp.c +1 -1
index 8e7282658f..3d4497da99 100644
@@ -11,6 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
 #include "virtio-qmp.h"
 
---

Otherwise I get:

../hw/pci/pci-hmp-cmds.c: In function ‘pcibus_dev_print’:
../hw/pci/pci-hmp-cmds.c:129:31: error: invalid use of incomplete typedef ‘PCIDevice’
129 | int class = pci_get_word(d->config + PCI_CLASS_DEVICE);
| ^~

../hw/virtio/virtio-qmp.c:187:19: error: ‘VHOST_USER_F_PROTOCOL_FEATURES’ undeclared here (not in a function); did you mean ‘VHOST_USER_PROTOCOL_F_RARP’?

  187 |     FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 3 lines
Quoted 1 line

Maybe some recently merged change?

Yes. I'll rebase.

To avoid confusion: this series doesn't need a rebase. "[PATCH 0/5] include/hw/pci include/hw/cxl: Clean up includes" does.

[...]