Skip to content

Commit af27154

Browse files
authored
Merge pull request #116 from AFLplusplus/update_qemu_v10_0_3
Update QEMU to V10.0.3
2 parents 0bea78a + 124e7a4 commit af27154

File tree

108 files changed

+1437
-775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1437
-775
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
build:
19-
runs-on: [self-hosted, qemu]
19+
runs-on: ubuntu-24.04
2020
container: registry.gitlab.com/qemu-project/qemu/qemu/ubuntu2204:latest
2121
steps:
2222
- uses: actions/checkout@v4

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.0.0
1+
10.0.3

accel/kvm/kvm-all.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,8 @@ int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
443443
return kvm_fd;
444444
}
445445

446-
static void kvm_reset_parked_vcpus(void *param)
446+
static void kvm_reset_parked_vcpus(KVMState *s)
447447
{
448-
KVMState *s = param;
449448
struct KVMParkedVcpu *cpu;
450449

451450
QLIST_FOREACH(cpu, &s->kvm_parked_vcpus, node) {
@@ -2563,8 +2562,7 @@ static int kvm_init(MachineState *ms)
25632562
{
25642563
MachineClass *mc = MACHINE_GET_CLASS(ms);
25652564
static const char upgrade_note[] =
2566-
"Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n"
2567-
"(see http://sourceforge.net/projects/kvm).\n";
2565+
"Please upgrade to at least kernel 4.5.\n";
25682566
const struct {
25692567
const char *name;
25702568
int num;
@@ -2744,7 +2742,6 @@ static int kvm_init(MachineState *ms)
27442742
}
27452743

27462744
qemu_register_reset(kvm_unpoison_all, NULL);
2747-
qemu_register_reset(kvm_reset_parked_vcpus, s);
27482745

27492746
if (s->kernel_irqchip_allowed) {
27502747
kvm_irqchip_create(s);
@@ -2914,6 +2911,10 @@ static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg
29142911
void kvm_cpu_synchronize_post_reset(CPUState *cpu)
29152912
{
29162913
run_on_cpu(cpu, do_kvm_cpu_synchronize_post_reset, RUN_ON_CPU_NULL);
2914+
2915+
if (cpu == first_cpu) {
2916+
kvm_reset_parked_vcpus(kvm_state);
2917+
}
29172918
}
29182919

29192920
static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg)

accel/tcg/translate-all.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int64_t decode_sleb128(const uint8_t **pp)
113113
val |= (int64_t)(byte & 0x7f) << shift;
114114
shift += 7;
115115
} while (byte & 0x80);
116-
if (shift < TARGET_LONG_BITS && (byte & 0x40)) {
116+
if (shift < 64 && (byte & 0x40)) {
117117
val |= -(int64_t)1 << shift;
118118
}
119119

audio/audio.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,14 @@ size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size)
905905

906906
int AUD_get_buffer_size_out(SWVoiceOut *sw)
907907
{
908+
if (!sw) {
909+
return 0;
910+
}
911+
912+
if (audio_get_pdo_out(sw->s->dev)->mixing_engine) {
913+
return sw->resample_buf.size * sw->info.bytes_per_frame;
914+
}
915+
908916
return sw->hw->samples * sw->hw->info.bytes_per_frame;
909917
}
910918

block/file-posix.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,9 +2484,9 @@ static inline bool raw_check_linux_aio(BDRVRawState *s)
24842484
}
24852485
#endif
24862486

2487-
static int coroutine_fn raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr,
2488-
uint64_t bytes, QEMUIOVector *qiov, int type,
2489-
int flags)
2487+
static int coroutine_fn GRAPH_RDLOCK
2488+
raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr, uint64_t bytes,
2489+
QEMUIOVector *qiov, int type, int flags)
24902490
{
24912491
BDRVRawState *s = bs->opaque;
24922492
RawPosixAIOData acb;
@@ -2545,7 +2545,7 @@ static int coroutine_fn raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr,
25452545
ret = raw_thread_pool_submit(handle_aiocb_rw, &acb);
25462546
if (ret == 0 && (flags & BDRV_REQ_FUA)) {
25472547
/* TODO Use pwritev2() instead if it's available */
2548-
ret = raw_co_flush_to_disk(bs);
2548+
ret = bdrv_co_flush(bs);
25492549
}
25502550
goto out; /* Avoid the compiler err of unused label */
25512551

@@ -2580,16 +2580,16 @@ static int coroutine_fn raw_co_prw(BlockDriverState *bs, int64_t *offset_ptr,
25802580
return ret;
25812581
}
25822582

2583-
static int coroutine_fn raw_co_preadv(BlockDriverState *bs, int64_t offset,
2584-
int64_t bytes, QEMUIOVector *qiov,
2585-
BdrvRequestFlags flags)
2583+
static int coroutine_fn GRAPH_RDLOCK
2584+
raw_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
2585+
QEMUIOVector *qiov, BdrvRequestFlags flags)
25862586
{
25872587
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_READ, flags);
25882588
}
25892589

2590-
static int coroutine_fn raw_co_pwritev(BlockDriverState *bs, int64_t offset,
2591-
int64_t bytes, QEMUIOVector *qiov,
2592-
BdrvRequestFlags flags)
2590+
static int coroutine_fn GRAPH_RDLOCK
2591+
raw_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes,
2592+
QEMUIOVector *qiov, BdrvRequestFlags flags)
25932593
{
25942594
return raw_co_prw(bs, &offset, bytes, qiov, QEMU_AIO_WRITE, flags);
25952595
}
@@ -3525,10 +3525,11 @@ static int coroutine_fn raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op,
35253525
#endif
35263526

35273527
#if defined(CONFIG_BLKZONED)
3528-
static int coroutine_fn raw_co_zone_append(BlockDriverState *bs,
3529-
int64_t *offset,
3530-
QEMUIOVector *qiov,
3531-
BdrvRequestFlags flags) {
3528+
static int coroutine_fn GRAPH_RDLOCK
3529+
raw_co_zone_append(BlockDriverState *bs,
3530+
int64_t *offset,
3531+
QEMUIOVector *qiov,
3532+
BdrvRequestFlags flags) {
35323533
assert(flags == 0);
35333534
int64_t zone_size_mask = bs->bl.zone_size - 1;
35343535
int64_t iov_len = 0;

common-user/host/riscv/safe-syscall.inc.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ safe_syscall_end:
6969

7070
/* code path setting errno */
7171
0: neg a0, a0
72-
j safe_syscall_set_errno_tail
72+
tail safe_syscall_set_errno_tail
7373

7474
/* code path when we didn't execute the syscall */
7575
2: li a0, QEMU_ERESTARTSYS
76-
j safe_syscall_set_errno_tail
76+
tail safe_syscall_set_errno_tail
7777

7878
.cfi_endproc
7979
.size safe_syscall_base, .-safe_syscall_base

docs/devel/codebase.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ yet, so sometimes the source code is all you have.
116116
* `monitor <https://gitlab.com/qemu-project/qemu/-/tree/master/monitor>`_:
117117
`Monitor <QEMU monitor>` implementation (HMP & QMP).
118118
* `nbd <https://gitlab.com/qemu-project/qemu/-/tree/master/nbd>`_:
119-
QEMU `NBD (Network Block Device) <nbd>` server.
119+
QEMU NBD (Network Block Device) server.
120120
* `net <https://gitlab.com/qemu-project/qemu/-/tree/master/net>`_:
121121
Network (host) support.
122122
* `pc-bios <https://gitlab.com/qemu-project/qemu/-/tree/master/pc-bios>`_:

docs/system/qemu-block-drivers.rst.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,6 @@ What you should *never* do:
500500
- expect it to work when loadvm'ing
501501
- write to the FAT directory on the host system while accessing it with the guest system
502502

503-
.. _nbd:
504-
505503
NBD access
506504
~~~~~~~~~~
507505

hw/9pfs/9p.c

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,24 @@ void coroutine_fn v9fs_reclaim_fd(V9fsPDU *pdu)
434434
V9fsFidState *f;
435435
GHashTableIter iter;
436436
gpointer fid;
437+
int err;
438+
int nclosed = 0;
439+
440+
/* prevent multiple coroutines running this function simultaniously */
441+
if (s->reclaiming) {
442+
return;
443+
}
444+
s->reclaiming = true;
437445

438446
g_hash_table_iter_init(&iter, s->fids);
439447

440448
QSLIST_HEAD(, V9fsFidState) reclaim_list =
441449
QSLIST_HEAD_INITIALIZER(reclaim_list);
442450

451+
/* Pick FIDs to be closed, collect them on reclaim_list. */
443452
while (g_hash_table_iter_next(&iter, &fid, (gpointer *) &f)) {
444453
/*
445-
* Unlink fids cannot be reclaimed. Check
446-
* for them and skip them. Also skip fids
454+
* Unlinked fids cannot be reclaimed, skip those, and also skip fids
447455
* currently being operated on.
448456
*/
449457
if (f->ref || f->flags & FID_NON_RECLAIMABLE) {
@@ -493,23 +501,34 @@ void coroutine_fn v9fs_reclaim_fd(V9fsPDU *pdu)
493501
}
494502
}
495503
/*
496-
* Now close the fid in reclaim list. Free them if they
497-
* are already clunked.
504+
* Close the picked FIDs altogether on a background I/O driver thread. Do
505+
* this all at once to keep latency (i.e. amount of thread hops between main
506+
* thread <-> fs driver background thread) as low as possible.
498507
*/
508+
v9fs_co_run_in_worker({
509+
QSLIST_FOREACH(f, &reclaim_list, reclaim_next) {
510+
err = (f->fid_type == P9_FID_DIR) ?
511+
s->ops->closedir(&s->ctx, &f->fs_reclaim) :
512+
s->ops->close(&s->ctx, &f->fs_reclaim);
513+
if (!err) {
514+
/* total_open_fd must only be mutated on main thread */
515+
nclosed++;
516+
}
517+
}
518+
});
519+
total_open_fd -= nclosed;
520+
/* Free the closed FIDs. */
499521
while (!QSLIST_EMPTY(&reclaim_list)) {
500522
f = QSLIST_FIRST(&reclaim_list);
501523
QSLIST_REMOVE(&reclaim_list, f, V9fsFidState, reclaim_next);
502-
if (f->fid_type == P9_FID_FILE) {
503-
v9fs_co_close(pdu, &f->fs_reclaim);
504-
} else if (f->fid_type == P9_FID_DIR) {
505-
v9fs_co_closedir(pdu, &f->fs_reclaim);
506-
}
507524
/*
508525
* Now drop the fid reference, free it
509526
* if clunked.
510527
*/
511528
put_fid(pdu, f);
512529
}
530+
531+
s->reclaiming = false;
513532
}
514533

515534
/*
@@ -4324,6 +4343,8 @@ int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t,
43244343
s->ctx.fst = &fse->fst;
43254344
fsdev_throttle_init(s->ctx.fst);
43264345

4346+
s->reclaiming = false;
4347+
43274348
rc = 0;
43284349
out:
43294350
if (rc) {

0 commit comments

Comments
 (0)