Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic multi-threaded capability tag implementation #158

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

LawrenceEsswood
Copy link
Contributor

When MTTCG is enabled, this turns every tag bit into a write-preferring readers-writer lock. When single-threaded, the old one bit per tag is used.

Originally this was based on the morello branch, and so although I have tried to keep it separate, some general fixes I did there have crept in. Namely, the raw_tag version of capability loading (to get the un-squashed tag to implement atomics), and some sign fixes for TCG atomics.

@LawrenceEsswood
Copy link
Contributor Author

This may want a little more testing, but purecap riscv boots.

@arichardson
Copy link
Member

I am seeing the following error booting a purecap kernel (looks like my initial atomics implementation is broken for multi-tcg):

/local/scratch/alr48/cheri/output/sdk/bin/qemu-system-riscv64cheri.with-multi-tcg -M virt -m 2048 -nographic -bios bbl-riscv64cheri-virt-fw_jump.bin -kernel /local/scratch/alr48/cheri/output/kernel-riscv64-purecap.CHERI-PURECAP-QEMU-MFS-ROOT -append init_path=/sbin/startup-benchmark.sh
bbl loader
qemu-system-riscv64cheri.with-multi-tcg: ../../qemu/target/riscv/op_helper_cheri.c:313: void lr_c_impl(CPUArchState *, uint32_t, uint32_t, target_long, uintptr_t): Assertion `!qemu_tcg_mttcg_enabled() || (cpu_in_exclusive_context(env_cpu(env)) && "Should have raised EXCP_ATOMIC")' failed.
Aborted (core dumped)

@arichardson arichardson force-pushed the concurrent_tags_rebased branch 2 times, most recently from 28b843a to 11e9301 Compare July 20, 2021 12:10
accel/tcg/cpu-exec.c Outdated Show resolved Hide resolved
default-configs/targets/mips64cheri128-softmmu.mak Outdated Show resolved Hide resolved
target/cheri-common/cheri_tagmem_ex_locks.h Outdated Show resolved Hide resolved
include/hw/core/cpu.h Outdated Show resolved Hide resolved

static inline void cheri_tag_writer_release(tag_writer_lock_t lock)
{
if (lock != TAG_LOCK_NONE && lock != NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to not permit NULL here and force callers to do the right thing. I think most do already, just store_cap_to_memory that doesn't check take_lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to distinguish between there being no locking due to being single core (NULL) and there being locking but no lock at this location (TAG_LOCK_NONE). The lock_for_x family will all return NULL if locking is off, which will then be ignored by release.

target/cheri-common/cheri_tagmem.h Outdated Show resolved Hide resolved
target/cheri-common/cheri_tagmem.h Outdated Show resolved Hide resolved
target/riscv/op_helper_cheri.c Outdated Show resolved Hide resolved
tcg/tcg-op.c Outdated Show resolved Hide resolved
tcg/tcg-op.c Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants