mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 06:52:13 +00:00
qemu/patches: add patches for qemu 4.2.0
Some patches are still needed in qemu 4.2.0 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
7c13dc3842
commit
ce2acccd4f
@ -0,0 +1,98 @@
|
||||
From 4400ea745b2a073186061a04dc07d90a8fb8a51f Mon Sep 17 00:00:00 2001
|
||||
From: Yang Zhong <yang.zhong@intel.com>
|
||||
Date: Wed, 28 Mar 2018 20:14:53 +0800
|
||||
Subject: [PATCH 1/2] 9p: removing coroutines of 9p to increase the I/O
|
||||
performance
|
||||
|
||||
This is a quick workaround, need to be fixed.
|
||||
|
||||
Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
|
||||
---
|
||||
hw/9pfs/9p.c | 12 +++++-------
|
||||
hw/9pfs/9p.h | 6 +++---
|
||||
hw/9pfs/coth.h | 3 +++
|
||||
3 files changed, 11 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
|
||||
index 520177f40c..191c43e42d 100644
|
||||
--- a/hw/9pfs/9p.c
|
||||
+++ b/hw/9pfs/9p.c
|
||||
@@ -1082,10 +1082,7 @@ static void coroutine_fn pdu_complete(V9fsPDU *pdu, ssize_t len)
|
||||
out_notify:
|
||||
pdu->s->transport->push_and_notify(pdu);
|
||||
|
||||
- /* Now wakeup anybody waiting in flush for this request */
|
||||
- if (!qemu_co_queue_next(&pdu->complete)) {
|
||||
- pdu_free(pdu);
|
||||
- }
|
||||
+ pdu_free(pdu);
|
||||
}
|
||||
|
||||
static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
|
||||
@@ -3968,7 +3965,7 @@ static inline bool is_read_only_op(V9fsPDU *pdu)
|
||||
|
||||
void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr)
|
||||
{
|
||||
- Coroutine *co;
|
||||
+// Coroutine *co;
|
||||
CoroutineEntry *handler;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
@@ -3986,8 +3983,9 @@ void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr)
|
||||
}
|
||||
|
||||
qemu_co_queue_init(&pdu->complete);
|
||||
- co = qemu_coroutine_create(handler, pdu);
|
||||
- qemu_coroutine_enter(co);
|
||||
+ handler(pdu);
|
||||
+ //co = qemu_coroutine_create(handler, pdu);
|
||||
+ //qemu_coroutine_enter(co);
|
||||
}
|
||||
|
||||
/* Returns 0 on success, 1 on failure. */
|
||||
diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
|
||||
index 3904f82901..30ecab2b2e 100644
|
||||
--- a/hw/9pfs/9p.h
|
||||
+++ b/hw/9pfs/9p.h
|
||||
@@ -380,21 +380,21 @@ extern int total_open_fd;
|
||||
static inline void v9fs_path_write_lock(V9fsState *s)
|
||||
{
|
||||
if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) {
|
||||
- qemu_co_rwlock_wrlock(&s->rename_lock);
|
||||
+ // qemu_co_rwlock_wrlock(&s->rename_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void v9fs_path_read_lock(V9fsState *s)
|
||||
{
|
||||
if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) {
|
||||
- qemu_co_rwlock_rdlock(&s->rename_lock);
|
||||
+ // qemu_co_rwlock_rdlock(&s->rename_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void v9fs_path_unlock(V9fsState *s)
|
||||
{
|
||||
if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) {
|
||||
- qemu_co_rwlock_unlock(&s->rename_lock);
|
||||
+ // qemu_co_rwlock_unlock(&s->rename_lock);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
|
||||
index c2cdc7a9ea..0fe971d1f5 100644
|
||||
--- a/hw/9pfs/coth.h
|
||||
+++ b/hw/9pfs/coth.h
|
||||
@@ -46,6 +46,9 @@
|
||||
qemu_coroutine_yield(); \
|
||||
} while (0)
|
||||
|
||||
+#undef v9fs_co_run_in_worker
|
||||
+#define v9fs_co_run_in_worker(code_block) do {code_block} while(0);
|
||||
+
|
||||
void co_run_in_worker_bh(void *);
|
||||
int coroutine_fn v9fs_co_readlink(V9fsPDU *, V9fsPath *, V9fsString *);
|
||||
int coroutine_fn v9fs_co_readdir(V9fsPDU *, V9fsFidState *, struct dirent **);
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,45 @@
|
||||
From f06edce09ed88568a743c6aa36343081e35cca54 Mon Sep 17 00:00:00 2001
|
||||
From: Julio Montes <julio.montes@intel.com>
|
||||
Date: Mon, 8 Jul 2019 21:19:36 +0000
|
||||
Subject: [PATCH 2/2] memory-backend-file/nvdimm: support read-only files as
|
||||
memory-backends
|
||||
|
||||
Currently it is not possible to use a file that is part of a read-only
|
||||
filesystem as memory backend for nvdimm devices, even if the file itself
|
||||
is not modified in the guest. Same goes for files that do not have write access.
|
||||
In order to improve the security of Virtual Machines that share
|
||||
and do not modify the memory-backend-file, QEMU should support
|
||||
read-only memory-backends.
|
||||
|
||||
Use case:
|
||||
* Kata Containers use a memory-backed-file as read-only rootfs, and this
|
||||
file is used to start all the virtual machines in the node.
|
||||
It would be really bad if somehow a malicious container modified it.
|
||||
|
||||
Signed-off-by: Julio Montes <julio.montes@intel.com>
|
||||
Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
|
||||
Message-Id: <20190708211936.8037-1-julio.montes@intel.com>
|
||||
---
|
||||
exec.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/exec.c b/exec.c
|
||||
index ffdb518535..506a5af8c1 100644
|
||||
--- a/exec.c
|
||||
+++ b/exec.c
|
||||
@@ -1819,6 +1819,12 @@ static int file_ram_open(const char *path,
|
||||
break;
|
||||
}
|
||||
g_free(filename);
|
||||
+ } else if (errno == EROFS || errno == EACCES) {
|
||||
+ fd = open(path, O_RDONLY);
|
||||
+ if (fd >= 0) {
|
||||
+ /* @path names an existing read-only file, use it */
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
if (errno != EEXIST && errno != EINTR) {
|
||||
error_setg_errno(errp, errno,
|
||||
--
|
||||
2.21.0
|
||||
|
Loading…
Reference in New Issue
Block a user