Loading core/Makefile +33 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,11 @@ endif endif endif # Do this early because sysprop.mk depends on BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC. ifeq (default,$(ENABLE_UFFD_GC)) BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC := $(OUT_DIR)/soong/dexpreopt/kernel_version_for_uffd_gc.txt endif # ENABLE_UFFD_GC include $(BUILD_SYSTEM)/sysprop.mk # ---------------------------------------------------------------- Loading Loading @@ -5256,6 +5261,34 @@ my_board_extracted_kernel := endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS ifeq (default,$(ENABLE_UFFD_GC)) ifneq (,$(BUILT_KERNEL_VERSION_FILE)) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): $(BUILT_KERNEL_VERSION_FILE) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): cp $(BUILT_KERNEL_VERSION_FILE) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC) else # We make this a warning rather than an error to avoid breaking too many builds. When it happens, # we use a placeholder as the kernel version, which is consumed by uffd_gc_utils.py. $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): echo $$'\ Unable to determine UFFD GC flag because the kernel version is not available and\n\ PRODUCT_ENABLE_UFFD_GC is "default".\n\ You can fix this by:\n\ 1. [Recommended] Making the kernel version available.\n\ (1). Set PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS to "true".\n\ (2). If you are still getting this message after doing so, see the warning about\n\ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS in the build logs.\n\ or\n\ 2. Explicitly setting PRODUCT_ENABLE_UFFD_GC to "true" or "false" based on the kernel version.\n\ (1). Set PRODUCT_ENABLE_UFFD_GC to "true" if the kernel is a GKI kernel and is android12-5.4\n\ or above, or a non-GKI kernel that supports userfaultfd(2) and MREMAP_DONTUNMAP.\n\ (2). Set PRODUCT_ENABLE_UFFD_GC to "false" otherwise.'\ && echo '<unknown-kernel>' > $@ endif # BUILT_KERNEL_VERSION_FILE endif # ENABLE_UFFD_GC == "default" # -- Check VINTF compatibility of build. # Skip partial builds; only check full builds. Only check if: # - PRODUCT_ENFORCE_VINTF_MANIFEST is true Loading core/art_config.mk +5 −28 Original line number Diff line number Diff line Loading @@ -12,38 +12,15 @@ # ENABLE_UFFD_GC: Whether to use userfaultfd GC. config_enable_uffd_gc := \ $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC)) $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC) default) ifeq (,$(filter-out default,$(config_enable_uffd_gc))) ENABLE_UFFD_GC := true # Disable userfaultfd GC if the device doesn't support it (i.e., if # `min(ro.board.api_level ?? ro.board.first_api_level ?? MAX_VALUE, # ro.product.first_api_level ?? ro.build.version.sdk ?? MAX_VALUE) < 31`) # This logic aligns with how `ro.vendor.api_level` is calculated in # `system/core/init/property_service.cpp`. # We omit the check on `ro.build.version.sdk` here because we are on the latest build system. board_api_level := $(firstword $(BOARD_API_LEVEL) $(BOARD_SHIPPING_API_LEVEL)) ifneq (,$(board_api_level)) ifeq (true,$(call math_lt,$(board_api_level),31)) ENABLE_UFFD_GC := false endif endif ifneq (,$(PRODUCT_SHIPPING_API_LEVEL)) ifeq (true,$(call math_lt,$(PRODUCT_SHIPPING_API_LEVEL),31)) ENABLE_UFFD_GC := false endif endif else ifeq (true,$(config_enable_uffd_gc)) ENABLE_UFFD_GC := true else ifeq (false,$(config_enable_uffd_gc)) ENABLE_UFFD_GC := false else ifeq (,$(filter default true false,$(config_enable_uffd_gc))) $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc)) endif ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC) ENABLE_UFFD_GC := $(config_enable_uffd_gc) # If the value is "default", it will be mangled by post_process_props.py. ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(config_enable_uffd_gc) # Create APEX_BOOT_JARS_EXCLUDED which is a list of jars to be removed from # ApexBoorJars when built from mainline prebuilts. Loading core/dex_preopt.mk +4 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ my_boot_image_module := # Build the boot.zip which contains the boot jars and their compilation output # We can do this only if preopt is enabled and if the product uses libart config (which sets the # default properties for preopting). # At the time of writing, this is only for ART Cloud. ifeq ($(WITH_DEXPREOPT), true) ifneq ($(WITH_DEXPREOPT_ART_BOOT_IMG_ONLY), true) ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true) Loading Loading @@ -95,15 +96,16 @@ bootclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DE bootclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)) boot_images := $(subst :,$(space),$(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(DEXPREOPT_INFIX))) boot_image_arg := $(subst $(space),:,$(patsubst /%,%,$(boot_images))) dex2oat_extra_args := $(if $(filter true,$(ENABLE_UFFD_GC)),--runtime-arg -Xgc:CMC) uffd_gc_flag_txt := $(OUT_DIR)/soong/dexpreopt/uffd_gc_flag.txt boot_zip_metadata_txt := $(dir $(boot_zip))boot_zip/METADATA.txt $(boot_zip_metadata_txt): $(uffd_gc_flag_txt) $(boot_zip_metadata_txt): rm -f $@ echo "bootclasspath = $(bootclasspath_arg)" >> $@ echo "bootclasspath-locations = $(bootclasspath_locations_arg)" >> $@ echo "boot-image = $(boot_image_arg)" >> $@ echo "extra-args = $(dex2oat_extra_args)" >> $@ echo "extra-args = `cat $(uffd_gc_flag_txt)`" >> $@ $(call dist-for-goals, droidcore, $(boot_zip_metadata_txt)) Loading core/dex_preopt_config.mk +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX)) $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS)) $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty) $(call add_json_bool, EnableUffdGc, $(filter true,$(ENABLE_UFFD_GC))) $(call add_json_str, EnableUffdGc, $(ENABLE_UFFD_GC)) ifdef TARGET_ARCH $(call add_json_map, CpuVariant) Loading core/sysprop.mk +5 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ $(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\ $(eval _option := --allow-dup)\ ) $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6) $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC) $(hide) echo Building $$@ $(hide) mkdir -p $$(dir $$@) $(hide) rm -f $$@ && touch $$@ Loading @@ -148,7 +148,10 @@ endif echo "$$(line)" >> $$@;\ )\ ) $(hide) $(POST_PROCESS_PROPS) $$(_option) --sdk-version $(PLATFORM_SDK_VERSION) $$@ $(5) $(hide) $(POST_PROCESS_PROPS) $$(_option) \ --sdk-version $(PLATFORM_SDK_VERSION) \ --kernel-version-file-for-uffd-gc "$(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC)" \ $$@ $(5) $(hide) $(foreach file,$(strip $(6)),\ if [ -f "$(file)" ]; then\ cat $(file) >> $$@;\ Loading Loading
core/Makefile +33 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,11 @@ endif endif endif # Do this early because sysprop.mk depends on BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC. ifeq (default,$(ENABLE_UFFD_GC)) BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC := $(OUT_DIR)/soong/dexpreopt/kernel_version_for_uffd_gc.txt endif # ENABLE_UFFD_GC include $(BUILD_SYSTEM)/sysprop.mk # ---------------------------------------------------------------- Loading Loading @@ -5256,6 +5261,34 @@ my_board_extracted_kernel := endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS ifeq (default,$(ENABLE_UFFD_GC)) ifneq (,$(BUILT_KERNEL_VERSION_FILE)) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): $(BUILT_KERNEL_VERSION_FILE) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): cp $(BUILT_KERNEL_VERSION_FILE) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC) else # We make this a warning rather than an error to avoid breaking too many builds. When it happens, # we use a placeholder as the kernel version, which is consumed by uffd_gc_utils.py. $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC): echo $$'\ Unable to determine UFFD GC flag because the kernel version is not available and\n\ PRODUCT_ENABLE_UFFD_GC is "default".\n\ You can fix this by:\n\ 1. [Recommended] Making the kernel version available.\n\ (1). Set PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS to "true".\n\ (2). If you are still getting this message after doing so, see the warning about\n\ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS in the build logs.\n\ or\n\ 2. Explicitly setting PRODUCT_ENABLE_UFFD_GC to "true" or "false" based on the kernel version.\n\ (1). Set PRODUCT_ENABLE_UFFD_GC to "true" if the kernel is a GKI kernel and is android12-5.4\n\ or above, or a non-GKI kernel that supports userfaultfd(2) and MREMAP_DONTUNMAP.\n\ (2). Set PRODUCT_ENABLE_UFFD_GC to "false" otherwise.'\ && echo '<unknown-kernel>' > $@ endif # BUILT_KERNEL_VERSION_FILE endif # ENABLE_UFFD_GC == "default" # -- Check VINTF compatibility of build. # Skip partial builds; only check full builds. Only check if: # - PRODUCT_ENFORCE_VINTF_MANIFEST is true Loading
core/art_config.mk +5 −28 Original line number Diff line number Diff line Loading @@ -12,38 +12,15 @@ # ENABLE_UFFD_GC: Whether to use userfaultfd GC. config_enable_uffd_gc := \ $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC)) $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC) default) ifeq (,$(filter-out default,$(config_enable_uffd_gc))) ENABLE_UFFD_GC := true # Disable userfaultfd GC if the device doesn't support it (i.e., if # `min(ro.board.api_level ?? ro.board.first_api_level ?? MAX_VALUE, # ro.product.first_api_level ?? ro.build.version.sdk ?? MAX_VALUE) < 31`) # This logic aligns with how `ro.vendor.api_level` is calculated in # `system/core/init/property_service.cpp`. # We omit the check on `ro.build.version.sdk` here because we are on the latest build system. board_api_level := $(firstword $(BOARD_API_LEVEL) $(BOARD_SHIPPING_API_LEVEL)) ifneq (,$(board_api_level)) ifeq (true,$(call math_lt,$(board_api_level),31)) ENABLE_UFFD_GC := false endif endif ifneq (,$(PRODUCT_SHIPPING_API_LEVEL)) ifeq (true,$(call math_lt,$(PRODUCT_SHIPPING_API_LEVEL),31)) ENABLE_UFFD_GC := false endif endif else ifeq (true,$(config_enable_uffd_gc)) ENABLE_UFFD_GC := true else ifeq (false,$(config_enable_uffd_gc)) ENABLE_UFFD_GC := false else ifeq (,$(filter default true false,$(config_enable_uffd_gc))) $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc)) endif ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC) ENABLE_UFFD_GC := $(config_enable_uffd_gc) # If the value is "default", it will be mangled by post_process_props.py. ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(config_enable_uffd_gc) # Create APEX_BOOT_JARS_EXCLUDED which is a list of jars to be removed from # ApexBoorJars when built from mainline prebuilts. Loading
core/dex_preopt.mk +4 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ my_boot_image_module := # Build the boot.zip which contains the boot jars and their compilation output # We can do this only if preopt is enabled and if the product uses libart config (which sets the # default properties for preopting). # At the time of writing, this is only for ART Cloud. ifeq ($(WITH_DEXPREOPT), true) ifneq ($(WITH_DEXPREOPT_ART_BOOT_IMG_ONLY), true) ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true) Loading Loading @@ -95,15 +96,16 @@ bootclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DE bootclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)) boot_images := $(subst :,$(space),$(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(DEXPREOPT_INFIX))) boot_image_arg := $(subst $(space),:,$(patsubst /%,%,$(boot_images))) dex2oat_extra_args := $(if $(filter true,$(ENABLE_UFFD_GC)),--runtime-arg -Xgc:CMC) uffd_gc_flag_txt := $(OUT_DIR)/soong/dexpreopt/uffd_gc_flag.txt boot_zip_metadata_txt := $(dir $(boot_zip))boot_zip/METADATA.txt $(boot_zip_metadata_txt): $(uffd_gc_flag_txt) $(boot_zip_metadata_txt): rm -f $@ echo "bootclasspath = $(bootclasspath_arg)" >> $@ echo "bootclasspath-locations = $(bootclasspath_locations_arg)" >> $@ echo "boot-image = $(boot_image_arg)" >> $@ echo "extra-args = $(dex2oat_extra_args)" >> $@ echo "extra-args = `cat $(uffd_gc_flag_txt)`" >> $@ $(call dist-for-goals, droidcore, $(boot_zip_metadata_txt)) Loading
core/dex_preopt_config.mk +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX)) $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS)) $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty) $(call add_json_bool, EnableUffdGc, $(filter true,$(ENABLE_UFFD_GC))) $(call add_json_str, EnableUffdGc, $(ENABLE_UFFD_GC)) ifdef TARGET_ARCH $(call add_json_map, CpuVariant) Loading
core/sysprop.mk +5 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ $(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\ $(eval _option := --allow-dup)\ ) $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6) $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC) $(hide) echo Building $$@ $(hide) mkdir -p $$(dir $$@) $(hide) rm -f $$@ && touch $$@ Loading @@ -148,7 +148,10 @@ endif echo "$$(line)" >> $$@;\ )\ ) $(hide) $(POST_PROCESS_PROPS) $$(_option) --sdk-version $(PLATFORM_SDK_VERSION) $$@ $(5) $(hide) $(POST_PROCESS_PROPS) $$(_option) \ --sdk-version $(PLATFORM_SDK_VERSION) \ --kernel-version-file-for-uffd-gc "$(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC)" \ $$@ $(5) $(hide) $(foreach file,$(strip $(6)),\ if [ -f "$(file)" ]; then\ cat $(file) >> $$@;\ Loading