[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 48/60] accel/tcg: Disconnect TargetPageDataNode from page size
From: |
Richard Henderson |
Subject: |
[PATCH 48/60] accel/tcg: Disconnect TargetPageDataNode from page size |
Date: |
Fri, 1 Mar 2024 13:06:07 -1000 |
Dynamically size the node for the runtime target page size.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20240102015808.132373-29-richard.henderson@linaro.org>
---
accel/tcg/user-exec.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 69b7429e31..3cac3a78c4 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -864,7 +864,7 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env,
vaddr addr,
typedef struct TargetPageDataNode {
struct rcu_head rcu;
IntervalTreeNode itree;
- char data[TPD_PAGES][TARGET_PAGE_DATA_SIZE] __attribute__((aligned));
+ char data[] __attribute__((aligned));
} TargetPageDataNode;
static IntervalTreeRoot targetdata_root;
@@ -902,7 +902,8 @@ void page_reset_target_data(target_ulong start,
target_ulong last)
n_last = MIN(last, n->last);
p_len = (n_last + 1 - n_start) >> TARGET_PAGE_BITS;
- memset(t->data[p_ofs], 0, p_len * TARGET_PAGE_DATA_SIZE);
+ memset(t->data + p_ofs * TARGET_PAGE_DATA_SIZE, 0,
+ p_len * TARGET_PAGE_DATA_SIZE);
}
}
@@ -910,7 +911,7 @@ void *page_get_target_data(target_ulong address)
{
IntervalTreeNode *n;
TargetPageDataNode *t;
- target_ulong page, region;
+ target_ulong page, region, p_ofs;
page = address & TARGET_PAGE_MASK;
region = address & TBD_MASK;
@@ -926,7 +927,8 @@ void *page_get_target_data(target_ulong address)
mmap_lock();
n = interval_tree_iter_first(&targetdata_root, page, page);
if (!n) {
- t = g_new0(TargetPageDataNode, 1);
+ t = g_malloc0(sizeof(TargetPageDataNode)
+ + TPD_PAGES * TARGET_PAGE_DATA_SIZE);
n = &t->itree;
n->start = region;
n->last = region | ~TBD_MASK;
@@ -936,7 +938,8 @@ void *page_get_target_data(target_ulong address)
}
t = container_of(n, TargetPageDataNode, itree);
- return t->data[(page - region) >> TARGET_PAGE_BITS];
+ p_ofs = (page - region) >> TARGET_PAGE_BITS;
+ return t->data + p_ofs * TARGET_PAGE_DATA_SIZE;
}
#else
void page_reset_target_data(target_ulong start, target_ulong last) { }
--
2.34.1
- [PATCH 41/60] linux-user: Split out mmap_h_eq_g, (continued)
- [PATCH 41/60] linux-user: Split out mmap_h_eq_g, Richard Henderson, 2024/03/01
- [PATCH 45/60] tests/tcg: Extend file in linux-madvise.c, Richard Henderson, 2024/03/01
- [PATCH 42/60] linux-user: Split out mmap_h_lt_g, Richard Henderson, 2024/03/01
- [PATCH 50/60] target/arm: Enable TARGET_PAGE_BITS_VARY for AArch64 user-only, Richard Henderson, 2024/03/01
- [PATCH 47/60] cpu: Remove page_size_init, Richard Henderson, 2024/03/01
- [PATCH 40/60] linux-user: Use do_munmap for target_mmap failure, Richard Henderson, 2024/03/01
- [PATCH 51/60] linux-user: Bound mmap_min_addr by host page size, Richard Henderson, 2024/03/01
- [PATCH 57/60] linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA, Richard Henderson, 2024/03/01
- [PATCH 55/60] tcg/optimize: fix uninitialized variable, Richard Henderson, 2024/03/01
- [PATCH 59/60] linux-user: Rewrite target_shmat, Richard Henderson, 2024/03/01
- [PATCH 48/60] accel/tcg: Disconnect TargetPageDataNode from page size,
Richard Henderson <=
- [PATCH 53/60] target/alpha: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/03/01
- [PATCH 60/60] tests/tcg: Check that shmat() does not break /proc/self/maps, Richard Henderson, 2024/03/01
- [PATCH 49/60] linux-user: Allow TARGET_PAGE_BITS_VARY, Richard Henderson, 2024/03/01
- [PATCH 56/60] linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2, 4}, Richard Henderson, 2024/03/01
- [PATCH 43/60] linux-user: Split out mmap_h_gt_g, Richard Henderson, 2024/03/01
- [PATCH 44/60] tests/tcg: Remove run-test-mmap-*, Richard Henderson, 2024/03/01
- [PATCH 46/60] *-user: Deprecate and disable -p pagesize, Richard Henderson, 2024/03/01
- [PATCH 52/60] target/ppc: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/03/01
- [PULL 00/60] linux-user and tcg patch queue, Richard Henderson, 2024/03/01
- [PATCH 54/60] linux-user: Remove pgb_dynamic alignment assertion, Richard Henderson, 2024/03/01