Skip to content

Commit 0a46e4f

Browse files
authored
Merge pull request #65 from sysprog21/tlb
Cut TLBI broadcasts with FEAT_TLBIRANGE
2 parents 1569ca2 + 9fc96f7 commit 0a46e4f

11 files changed

Lines changed: 1480 additions & 161 deletions

File tree

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ $(BUILD_DIR)/test-multi-vcpu: $(BUILD_DIR)/test-multi-vcpu.o | $(BUILD_DIR)
131131
$(BUILD_DIR)/test-rwx: $(BUILD_DIR)/test-rwx.o | $(BUILD_DIR)
132132
$(call link-and-sign,$@,$<)
133133

134+
## Build the TLBI RVAE1IS operand encoder unit test (native macOS binary).
135+
# Pure C; no HVF entitlement needed. Verifies the architectural bit-layout
136+
# of tlbi_rvae1is_operand so a future regression that drops TG=01 (which
137+
# the Apple Silicon integration tests would silently tolerate) fails CI
138+
# immediately.
139+
$(BUILD_DIR)/test-tlbi-encoder-host: $(BUILD_DIR)/test-tlbi-encoder-host.o \
140+
| $(BUILD_DIR)
141+
@echo " LD $@"
142+
$(Q)$(CC) $(CFLAGS) -o $@ $^
143+
134144
## Build the proctitle argv-tail regression test (native macOS binary)
135145
# Links against the project-built proctitle.o so the exact in-tree code is
136146
# exercised; no HVF entitlement is needed because the test only manipulates
@@ -167,6 +177,12 @@ $(BUILD_DIR)/test-shim-cred-race: tests/test-shim-cred-race.c | $(BUILD_DIR)
167177
@echo " CROSS $< (with -lpthread)"
168178
$(Q)$(CROSS_COMPILE)gcc -D_GNU_SOURCE -static -O2 -o $@ $< -lpthread
169179

180+
# test-mprotect-mt stresses multi-vCPU mprotect under concurrent reader
181+
# threads to surface stale-TLB regressions.
182+
$(BUILD_DIR)/test-mprotect-mt: tests/test-mprotect-mt.c | $(BUILD_DIR)
183+
@echo " CROSS $< (with -lpthread)"
184+
$(Q)$(CROSS_COMPILE)gcc -D_GNU_SOURCE -static -O2 -o $@ $< -lpthread
185+
170186
# test-shim-urandom-smp spawns N pthreads racing on a shared FD_URANDOM
171187
# slot to exercise the shim's LDXR/STXR head-advance under contention.
172188
$(BUILD_DIR)/test-shim-urandom-smp: tests/test-shim-urandom-smp.c | $(BUILD_DIR)

mk/config.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ ifeq ($(origin GUEST_TEST_BINARIES), undefined)
1515
endif
1616

1717
# Exclude native macOS test files from cross-compilation
18-
NATIVE_TESTS := tests/test-multi-vcpu.c tests/test-rwx.c
18+
NATIVE_TESTS := tests/test-multi-vcpu.c tests/test-rwx.c \
19+
tests/test-tlbi-encoder-host.c
1920
SPECIAL_TEST_SRCS := tests/test-lowbase-mem.c
2021
SPECIAL_TEST_BINS := $(BUILD_DIR)/test-lowbase-mem-200000 $(BUILD_DIR)/test-lowbase-mem-300000
2122

mk/tests.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ define RUN_OPTIONAL_SKIP77
3535
endef
3636

3737
## Run the unit test suite plus busybox applet validation
38-
check: $(ELFUSE_BIN) $(TEST_DEPS) check-syscall-coverage
38+
check: $(ELFUSE_BIN) $(TEST_DEPS) check-syscall-coverage \
39+
$(BUILD_DIR)/test-tlbi-encoder-host
3940
@bash tests/driver.sh -e $(ELFUSE_BIN) -d $(TEST_DIR) -v
41+
@printf "\n$(BLUE)━━━ TLBI RVAE1IS encoder unit test ━━━$(RESET)\n"
42+
@$(BUILD_DIR)/test-tlbi-encoder-host
4043
@printf "\n$(BLUE)━━━ proctitle argv-tail regression ━━━$(RESET)\n"
4144
@$(MAKE) --no-print-directory test-proctitle-host
4245
@printf "\n$(BLUE)━━━ proctitle low-stack regression ━━━$(RESET)\n"

0 commit comments

Comments
 (0)