!498 [sync] PR-492/497: spec: Update release version with !266 and support sw64

From: @yezengruan 
Reviewed-by: @imxcc 
Signed-off-by: @imxcc
This commit is contained in:
openeuler-ci-bot 2022-03-18 12:30:34 +00:00 committed by Gitee
commit 171bef105c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 134 additions and 2 deletions

View File

@ -0,0 +1,120 @@
From 2135fe8e9c4d459d3f06babf3bfd71b5387b0214 Mon Sep 17 00:00:00 2001
From: jiang-dawei15 <jiangdawei15@huawei.com>
Date: Tue, 15 Mar 2022 10:28:34 +0800
Subject: [PATCH] coro: support live patch for libcare
Description:
For coroutine live patch, we need find all coroutines stack and check them
before patching. There is no structure to manage all coroutines in qemu. So we
add a list which contain all running coroutines to accelerate libcare live
patch.
---
include/qemu/coroutine_int.h | 3 ++-
util/coroutine-ucontext.c | 52 ++++++++++++++++++++++++++++++++++++
util/qemu-coroutine.c | 4 +++
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/include/qemu/coroutine_int.h b/include/qemu/coroutine_int.h
index 1da148552f..11b550a0fc 100644
--- a/include/qemu/coroutine_int.h
+++ b/include/qemu/coroutine_int.h
@@ -73,5 +73,6 @@ Coroutine *qemu_coroutine_new(void);
void qemu_coroutine_delete(Coroutine *co);
CoroutineAction qemu_coroutine_switch(Coroutine *from, Coroutine *to,
CoroutineAction action);
-
+void qemu_coroutine_info_add(const Coroutine *co_);
+void qemu_coroutine_info_delete(const Coroutine *co_);
#endif
diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c
index 904b375192..23ab7cdf74 100644
--- a/util/coroutine-ucontext.c
+++ b/util/coroutine-ucontext.c
@@ -79,6 +79,19 @@ union cc_arg {
int i[2];
};
+/**
+ * coroutines list for libcare
+ */
+struct CoroutineInformation {
+ sigjmp_buf *env;
+ QLIST_ENTRY(CoroutineInformation) next;
+};
+
+static QemuMutex coro_mtx;
+QLIST_HEAD(, CoroutineInformation) coro_info_list = QLIST_HEAD_INITIALIZER(pool);
+int coro_env_offset = offsetof(struct CoroutineInformation, env);
+int coro_next_offset = offsetof(struct CoroutineInformation, next);
+
/*
* QEMU_ALWAYS_INLINE only does so if __OPTIMIZE__, so we cannot use it.
* always_inline is required to avoid TSan runtime fatal errors.
@@ -330,3 +343,42 @@ bool qemu_in_coroutine(void)
{
return current && current->caller;
}
+
+static void __attribute__((constructor)) coro_mutex_init(void)
+{
+ qemu_mutex_init(&coro_mtx);
+}
+
+void qemu_coroutine_info_add(const Coroutine *co_)
+{
+ CoroutineUContext *co;
+ struct CoroutineInformation *coro_info;
+
+ /* save coroutine env to coro_info_list */
+ co = DO_UPCAST(CoroutineUContext, base, co_);
+ coro_info = g_malloc0(sizeof(struct CoroutineInformation));
+ coro_info->env = &co->env;
+
+ qemu_mutex_lock(&coro_mtx);
+ QLIST_INSERT_HEAD(&coro_info_list, coro_info, next);
+ qemu_mutex_unlock(&coro_mtx);
+}
+
+void qemu_coroutine_info_delete(const Coroutine *co_)
+{
+ CoroutineUContext *co;
+ struct CoroutineInformation *coro_info;
+
+ /* Remove relative coroutine env info from coro_info_list */
+ co = DO_UPCAST(CoroutineUContext, base, co_);
+
+ qemu_mutex_lock(&coro_mtx);
+ QLIST_FOREACH(coro_info, &coro_info_list, next) {
+ if (coro_info->env == &co->env) {
+ QLIST_REMOVE(coro_info, next);
+ g_free(coro_info);
+ break;
+ }
+ }
+ qemu_mutex_unlock(&coro_mtx);
+}
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
index b9586d6929..9c81336d8e 100644
--- a/util/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -75,6 +75,8 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque)
co = qemu_coroutine_new();
}
+ qemu_coroutine_info_add(co);
+
co->entry = entry;
co->entry_arg = opaque;
QSIMPLEQ_INIT(&co->co_queue_wakeup);
@@ -85,6 +87,8 @@ static void coroutine_delete(Coroutine *co)
{
co->caller = NULL;
+ qemu_coroutine_info_delete(co);
+
if (CONFIG_COROUTINE_POOL) {
if (release_pool_size < POOL_BATCH_SIZE * 2) {
QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next);
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: qemu
Version: 6.2.0
Release: 25
Release: 27
Epoch: 2
Summary: QEMU is a generic and open source machine emulator and virtualizer
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
@ -234,6 +234,8 @@ Patch0220: pcie-Add-pcie-root-port-fast-plug-unplug-feature.patch
Patch0221: pcie-Compat-with-devices-which-do-not-support-Link-W.patch
Patch0222: scsi-bus-fix-unmatched-object_unref.patch
Patch0223: tools-virtiofsd-Add-rseq-syscall-to-the-seccomp-allo.patch
Patch0224: sw_64-Add-sw64-architecture-support.patch
Patch0225: coro-support-live-patch-for-libcare.patch
BuildRequires: flex
BuildRequires: gcc
@ -383,7 +385,7 @@ cd ../
./configure \
--prefix=%{_prefix} \
--target-list=${buildarch} \
--extra-cflags="%{optflags} -fPIE -DPIE -fPIC" \
--extra-cflags="%{optflags} -fPIE -DPIE -fPIC -ftls-model=initial-exec" \
--extra-ldflags="-Wl,--build-id -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack" \
--datadir=%{_datadir} \
--docdir=%{_docdir}/ \
@ -622,6 +624,9 @@ getent passwd qemu >/dev/null || \
%{_datadir}/%{name}/kvmvapic.bin
%{_datadir}/%{name}/sgabios.bin
%endif
%exclude %{_datadir}/%{name}/core3-hmcode
%exclude %{_datadir}/%{name}/core3-reset
%exclude %{_datadir}/%{name}/uefi-bios-sw
%files help
%dir %{qemudocdir}
@ -682,6 +687,13 @@ getent passwd qemu >/dev/null || \
%endif
%changelog
* Fri Mar 18 2022 yezengruan <yezengruan@huawei.com>
- coro: support live patch for libcare
- add patch for sw64 support
* Tue Mar 15 2022 jiangdawei <jiangdawei15@huawei.com>
- cflags: add ftls-mode=initial-exec
* Tue Mar 15 2022 yezengruan <yezengruan@huawei.com>
- sw_64: Add sw64 architecture support
- update BinDir