-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2 iQEtBAABCAAXBQJY7MfPEBxmYW16QHJlZGhhdC5jb20ACgkQyjViTGqRccbnCgf+ N6q6oHpcO6LsisYNPxpJ5p/Vnah/DKNgGhCnwCOHXkhv17KJHCIKqHo+07zcRJUk kO9Yc2g9PaWkgM61NsecnbTc4YE8G5SGrBCRj0o3f5Re8X3OnEi2Or8etaa9o/ZF qIkRk5SMYE2aQFRzn7Hw7LZ/9cta5DPI6+vCzs//S4mnx06p/068Ai21lAWC4Mxy 8dLbz+0GCXEdr9XRweoQKYTYH5HE+gLpRtzlD4QtbfbGN2qkUtR/DLnHTFCUqJ10 F+GBi440L4A7ZXzHIGKVWSH4wO67X65lnWhEFUhIyXHZqkuZzTwsEfIqR005sMub hViMFGYv6sEbf+A9sBz1Xw== =BCcn -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/famz/tags/block-pull-request' into staging # gpg: Signature made Tue 11 Apr 2017 13:10:55 BST # gpg: using RSA key 0xCA35624C6A9171C6 # gpg: Good signature from "Fam Zheng <famz@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6 * remotes/famz/tags/block-pull-request: sheepdog: Use bdrv_coroutine_enter before BDRV_POLL_WHILE block: Fix bdrv_co_flush early return block: Use bdrv_coroutine_enter to start I/O coroutines qemu-io-cmds: Use bdrv_coroutine_enter blockjob: Use bdrv_coroutine_enter to start coroutine block: Introduce bdrv_coroutine_enter async: Introduce aio_co_enter coroutine: Extract qemu_aio_coroutine_enter tests/block-job-txn: Don't start block job before adding to txn block: Quiesce old aio context during bdrv_set_aio_context block: Make bdrv_parent_drained_begin/end public Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
aa388ddc36
12
block.c
12
block.c
|
@ -4324,6 +4324,11 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs)
|
|||
return bs->aio_context;
|
||||
}
|
||||
|
||||
void bdrv_coroutine_enter(BlockDriverState *bs, Coroutine *co)
|
||||
{
|
||||
aio_co_enter(bdrv_get_aio_context(bs), co);
|
||||
}
|
||||
|
||||
static void bdrv_do_remove_aio_context_notifier(BdrvAioNotifier *ban)
|
||||
{
|
||||
QLIST_REMOVE(ban, list);
|
||||
|
@ -4396,11 +4401,12 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
|
|||
|
||||
void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context)
|
||||
{
|
||||
AioContext *ctx;
|
||||
AioContext *ctx = bdrv_get_aio_context(bs);
|
||||
|
||||
aio_disable_external(ctx);
|
||||
bdrv_parent_drained_begin(bs);
|
||||
bdrv_drain(bs); /* ensure there are no in-flight requests */
|
||||
|
||||
ctx = bdrv_get_aio_context(bs);
|
||||
while (aio_poll(ctx, false)) {
|
||||
/* wait for all bottom halves to execute */
|
||||
}
|
||||
|
@ -4412,6 +4418,8 @@ void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context)
|
|||
*/
|
||||
aio_context_acquire(new_context);
|
||||
bdrv_attach_aio_context(bs, new_context);
|
||||
bdrv_parent_drained_end(bs);
|
||||
aio_enable_external(ctx);
|
||||
aio_context_release(new_context);
|
||||
}
|
||||
|
||||
|
|
|
@ -1045,7 +1045,7 @@ static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf,
|
|||
co_entry(&rwco);
|
||||
} else {
|
||||
Coroutine *co = qemu_coroutine_create(co_entry, &rwco);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(blk_bs(blk), co);
|
||||
BDRV_POLL_WHILE(blk_bs(blk), rwco.ret == NOT_DONE);
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, int64_t offset, int bytes,
|
|||
acb->has_returned = false;
|
||||
|
||||
co = qemu_coroutine_create(co_entry, acb);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(blk_bs(blk), co);
|
||||
|
||||
acb->has_returned = true;
|
||||
if (acb->rwco.ret != NOT_DONE) {
|
||||
|
|
34
block/io.c
34
block/io.c
|
@ -44,7 +44,7 @@ static void coroutine_fn bdrv_co_do_rw(void *opaque);
|
|||
static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
|
||||
int64_t offset, int count, BdrvRequestFlags flags);
|
||||
|
||||
static void bdrv_parent_drained_begin(BlockDriverState *bs)
|
||||
void bdrv_parent_drained_begin(BlockDriverState *bs)
|
||||
{
|
||||
BdrvChild *c;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static void bdrv_parent_drained_begin(BlockDriverState *bs)
|
|||
}
|
||||
}
|
||||
|
||||
static void bdrv_parent_drained_end(BlockDriverState *bs)
|
||||
void bdrv_parent_drained_end(BlockDriverState *bs)
|
||||
{
|
||||
BdrvChild *c;
|
||||
|
||||
|
@ -616,7 +616,7 @@ static int bdrv_prwv_co(BdrvChild *child, int64_t offset,
|
|||
bdrv_rw_co_entry(&rwco);
|
||||
} else {
|
||||
co = qemu_coroutine_create(bdrv_rw_co_entry, &rwco);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(child->bs, co);
|
||||
BDRV_POLL_WHILE(child->bs, rwco.ret == NOT_DONE);
|
||||
}
|
||||
return rwco.ret;
|
||||
|
@ -1880,7 +1880,7 @@ int64_t bdrv_get_block_status_above(BlockDriverState *bs,
|
|||
} else {
|
||||
co = qemu_coroutine_create(bdrv_get_block_status_above_co_entry,
|
||||
&data);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
BDRV_POLL_WHILE(bs, !data.done);
|
||||
}
|
||||
return data.ret;
|
||||
|
@ -2006,7 +2006,7 @@ bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,
|
|||
};
|
||||
Coroutine *co = qemu_coroutine_create(bdrv_co_rw_vmstate_entry, &data);
|
||||
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
while (data.ret == -EINPROGRESS) {
|
||||
aio_poll(bdrv_get_aio_context(bs), true);
|
||||
}
|
||||
|
@ -2223,7 +2223,7 @@ static BlockAIOCB *bdrv_co_aio_prw_vector(BdrvChild *child,
|
|||
acb->is_write = is_write;
|
||||
|
||||
co = qemu_coroutine_create(bdrv_co_do_rw, acb);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(child->bs, co);
|
||||
|
||||
bdrv_co_maybe_schedule_bh(acb);
|
||||
return &acb->common;
|
||||
|
@ -2254,7 +2254,7 @@ BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
|
|||
acb->req.error = -EINPROGRESS;
|
||||
|
||||
co = qemu_coroutine_create(bdrv_aio_flush_co_entry, acb);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
|
||||
bdrv_co_maybe_schedule_bh(acb);
|
||||
return &acb->common;
|
||||
|
@ -2278,16 +2278,17 @@ static void coroutine_fn bdrv_flush_co_entry(void *opaque)
|
|||
|
||||
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
|
||||
bdrv_is_sg(bs)) {
|
||||
return 0;
|
||||
}
|
||||
int current_gen;
|
||||
int ret = 0;
|
||||
|
||||
bdrv_inc_in_flight(bs);
|
||||
|
||||
int current_gen = bs->write_gen;
|
||||
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
|
||||
bdrv_is_sg(bs)) {
|
||||
goto early_exit;
|
||||
}
|
||||
|
||||
current_gen = bs->write_gen;
|
||||
|
||||
/* Wait until any previous flushes are completed */
|
||||
while (bs->active_flush_req) {
|
||||
|
@ -2370,6 +2371,7 @@ out:
|
|||
/* Return value is ignored - it's ok if wait queue is empty */
|
||||
qemu_co_queue_next(&bs->flush_queue);
|
||||
|
||||
early_exit:
|
||||
bdrv_dec_in_flight(bs);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2387,7 +2389,7 @@ int bdrv_flush(BlockDriverState *bs)
|
|||
bdrv_flush_co_entry(&flush_co);
|
||||
} else {
|
||||
co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
BDRV_POLL_WHILE(bs, flush_co.ret == NOT_DONE);
|
||||
}
|
||||
|
||||
|
@ -2534,7 +2536,7 @@ int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count)
|
|||
bdrv_pdiscard_co_entry(&rwco);
|
||||
} else {
|
||||
co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
BDRV_POLL_WHILE(bs, rwco.ret == NOT_DONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -736,7 +736,7 @@ static int do_req(int sockfd, BlockDriverState *bs, SheepdogReq *hdr,
|
|||
} else {
|
||||
co = qemu_coroutine_create(do_co_req, &srco);
|
||||
if (bs) {
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(bs, co);
|
||||
BDRV_POLL_WHILE(bs, !srco.finished);
|
||||
} else {
|
||||
qemu_coroutine_enter(co);
|
||||
|
|
|
@ -290,7 +290,7 @@ void block_job_start(BlockJob *job)
|
|||
job->pause_count--;
|
||||
job->busy = true;
|
||||
job->paused = false;
|
||||
qemu_coroutine_enter(job->co);
|
||||
bdrv_coroutine_enter(blk_bs(job->blk), job->co);
|
||||
}
|
||||
|
||||
void block_job_ref(BlockJob *job)
|
||||
|
@ -532,7 +532,7 @@ void block_job_user_resume(BlockJob *job)
|
|||
void block_job_enter(BlockJob *job)
|
||||
{
|
||||
if (job->co && !job->busy) {
|
||||
qemu_coroutine_enter(job->co);
|
||||
bdrv_coroutine_enter(blk_bs(job->blk), job->co);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -510,6 +510,15 @@ void aio_co_schedule(AioContext *ctx, struct Coroutine *co);
|
|||
*/
|
||||
void aio_co_wake(struct Coroutine *co);
|
||||
|
||||
/**
|
||||
* aio_co_enter:
|
||||
* @ctx: the context to run the coroutine
|
||||
* @co: the coroutine to run
|
||||
*
|
||||
* Enter a coroutine in the specified AioContext.
|
||||
*/
|
||||
void aio_co_enter(AioContext *ctx, struct Coroutine *co);
|
||||
|
||||
/**
|
||||
* Return the AioContext whose event loop runs in the current thread.
|
||||
*
|
||||
|
|
|
@ -557,6 +557,11 @@ bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag);
|
|||
*/
|
||||
AioContext *bdrv_get_aio_context(BlockDriverState *bs);
|
||||
|
||||
/**
|
||||
* Transfer control to @co in the aio context of @bs
|
||||
*/
|
||||
void bdrv_coroutine_enter(BlockDriverState *bs, Coroutine *co);
|
||||
|
||||
/**
|
||||
* bdrv_set_aio_context:
|
||||
*
|
||||
|
@ -572,6 +577,22 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo);
|
|||
void bdrv_io_plug(BlockDriverState *bs);
|
||||
void bdrv_io_unplug(BlockDriverState *bs);
|
||||
|
||||
/**
|
||||
* bdrv_parent_drained_begin:
|
||||
*
|
||||
* Begin a quiesced section of all users of @bs. This is part of
|
||||
* bdrv_drained_begin.
|
||||
*/
|
||||
void bdrv_parent_drained_begin(BlockDriverState *bs);
|
||||
|
||||
/**
|
||||
* bdrv_parent_drained_end:
|
||||
*
|
||||
* End a quiesced section of all users of @bs. This is part of
|
||||
* bdrv_drained_end.
|
||||
*/
|
||||
void bdrv_parent_drained_end(BlockDriverState *bs);
|
||||
|
||||
/**
|
||||
* bdrv_drained_begin:
|
||||
*
|
||||
|
|
|
@ -76,6 +76,11 @@ void qemu_coroutine_enter(Coroutine *coroutine);
|
|||
*/
|
||||
void qemu_coroutine_enter_if_inactive(Coroutine *co);
|
||||
|
||||
/**
|
||||
* Transfer control to a coroutine and associate it with ctx
|
||||
*/
|
||||
void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co);
|
||||
|
||||
/**
|
||||
* Transfer control back to a coroutine's caller
|
||||
*
|
||||
|
|
|
@ -521,7 +521,7 @@ static int do_co_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
|||
}
|
||||
|
||||
co = qemu_coroutine_create(co_pwrite_zeroes_entry, &data);
|
||||
qemu_coroutine_enter(co);
|
||||
bdrv_coroutine_enter(blk_bs(blk), co);
|
||||
while (!data.done) {
|
||||
aio_poll(blk_get_aio_context(blk), true);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ Automatically detecting the format is dangerous for raw images, write operations
|
|||
Specify the 'raw' format explicitly to remove the restrictions.
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 1024, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"return": []}
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
@ -73,7 +73,7 @@ Automatically detecting the format is dangerous for raw images, write operations
|
|||
Specify the 'raw' format explicitly to remove the restrictions.
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 1024, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"return": []}
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
@ -115,7 +115,7 @@ Automatically detecting the format is dangerous for raw images, write operations
|
|||
Specify the 'raw' format explicitly to remove the restrictions.
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2560, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 0, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"return": []}
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
@ -135,7 +135,7 @@ Automatically detecting the format is dangerous for raw images, write operations
|
|||
Specify the 'raw' format explicitly to remove the restrictions.
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2560, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"return": []}
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
@ -195,7 +195,7 @@ Automatically detecting the format is dangerous for raw images, write operations
|
|||
Specify the 'raw' format explicitly to remove the restrictions.
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "src", "operation": "write", "action": "report"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2048, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": OFFSET, "speed": 0, "type": "mirror", "error": "Operation not permitted"}}
|
||||
{"return": []}
|
||||
read 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
|
|
@ -110,7 +110,6 @@ static BlockJob *test_block_job_start(unsigned int iterations,
|
|||
s->result = result;
|
||||
data->job = s;
|
||||
data->result = result;
|
||||
block_job_start(&s->common);
|
||||
return &s->common;
|
||||
}
|
||||
|
||||
|
@ -123,6 +122,7 @@ static void test_single_job(int expected)
|
|||
txn = block_job_txn_new();
|
||||
job = test_block_job_start(1, true, expected, &result);
|
||||
block_job_txn_add_job(txn, job);
|
||||
block_job_start(job);
|
||||
|
||||
if (expected == -ECANCELED) {
|
||||
block_job_cancel(job);
|
||||
|
@ -164,6 +164,8 @@ static void test_pair_jobs(int expected1, int expected2)
|
|||
block_job_txn_add_job(txn, job1);
|
||||
job2 = test_block_job_start(2, true, expected2, &result2);
|
||||
block_job_txn_add_job(txn, job2);
|
||||
block_job_start(job1);
|
||||
block_job_start(job2);
|
||||
|
||||
if (expected1 == -ECANCELED) {
|
||||
block_job_cancel(job1);
|
||||
|
@ -223,6 +225,8 @@ static void test_pair_jobs_fail_cancel_race(void)
|
|||
block_job_txn_add_job(txn, job1);
|
||||
job2 = test_block_job_start(2, false, 0, &result2);
|
||||
block_job_txn_add_job(txn, job2);
|
||||
block_job_start(job1);
|
||||
block_job_start(job2);
|
||||
|
||||
block_job_cancel(job1);
|
||||
|
||||
|
|
|
@ -453,6 +453,11 @@ void aio_co_wake(struct Coroutine *co)
|
|||
smp_read_barrier_depends();
|
||||
ctx = atomic_read(&co->ctx);
|
||||
|
||||
aio_co_enter(ctx, co);
|
||||
}
|
||||
|
||||
void aio_co_enter(AioContext *ctx, struct Coroutine *co)
|
||||
{
|
||||
if (ctx != qemu_get_current_aio_context()) {
|
||||
aio_co_schedule(ctx, co);
|
||||
return;
|
||||
|
@ -464,7 +469,7 @@ void aio_co_wake(struct Coroutine *co)
|
|||
QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
|
||||
} else {
|
||||
aio_context_acquire(ctx);
|
||||
qemu_coroutine_enter(co);
|
||||
qemu_aio_coroutine_enter(ctx, co);
|
||||
aio_context_release(ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,12 +102,12 @@ static void coroutine_delete(Coroutine *co)
|
|||
qemu_coroutine_delete(co);
|
||||
}
|
||||
|
||||
void qemu_coroutine_enter(Coroutine *co)
|
||||
void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co)
|
||||
{
|
||||
Coroutine *self = qemu_coroutine_self();
|
||||
CoroutineAction ret;
|
||||
|
||||
trace_qemu_coroutine_enter(self, co, co->entry_arg);
|
||||
trace_qemu_aio_coroutine_enter(ctx, self, co, co->entry_arg);
|
||||
|
||||
if (co->caller) {
|
||||
fprintf(stderr, "Co-routine re-entered recursively\n");
|
||||
|
@ -115,7 +115,7 @@ void qemu_coroutine_enter(Coroutine *co)
|
|||
}
|
||||
|
||||
co->caller = self;
|
||||
co->ctx = qemu_get_current_aio_context();
|
||||
co->ctx = ctx;
|
||||
|
||||
/* Store co->ctx before anything that stores co. Matches
|
||||
* barrier in aio_co_wake and qemu_co_mutex_wake.
|
||||
|
@ -139,6 +139,11 @@ void qemu_coroutine_enter(Coroutine *co)
|
|||
}
|
||||
}
|
||||
|
||||
void qemu_coroutine_enter(Coroutine *co)
|
||||
{
|
||||
qemu_aio_coroutine_enter(qemu_get_current_aio_context(), co);
|
||||
}
|
||||
|
||||
void qemu_coroutine_enter_if_inactive(Coroutine *co)
|
||||
{
|
||||
if (!qemu_coroutine_entered(co)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %
|
|||
buffer_free(const char *buf, size_t len) "%s: capacity %zd"
|
||||
|
||||
# util/qemu-coroutine.c
|
||||
qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p opaque %p"
|
||||
qemu_aio_coroutine_enter(void *ctx, void *from, void *to, void *opaque) "ctx %p from %p to %p opaque %p"
|
||||
qemu_coroutine_yield(void *from, void *to) "from %p to %p"
|
||||
qemu_coroutine_terminate(void *co) "self %p"
|
||||
|
||||
|
|
Loading…
Reference in a new issue