diff --git a/BUILD.bazel b/BUILD.bazel index 6eff05f4a..814aeb7f5 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -2246,6 +2246,26 @@ cc_binary_with_abi( ], ) +cc_binary_with_abi( + name = "kselftest_wrapfd_test", + srcs = [ + "include/uapi/linux/wrapfd.h", + "tools/include/linux/align.h", + "tools/include/uapi/linux/const.h", + "tools/testing/selftests/drivers/wrapfd/wrapfd.c", + ], + copts = _KSELFTEST_COPTS, + includes = [ + "include/uapi", + "tools/include", + "tools/testing/selftests", + ], + linkopts = ["-static"], + path_prefix = _KSELFTEST_DIR, + visibility = ["//visibility:private"], + deps = [":kselftest_headers_lib"], +) + copy_file( name = "kselftest_gen_config", src = select({ @@ -2319,6 +2339,7 @@ android_filegroup( ":kselftest_vdso_vdso_test_clock_getres_x86_64", ":kselftest_vdso_vdso_test_getcpu_x86_64", ":kselftest_vdso_vdso_test_gettimeofday_x86_64", + ":kselftest_wrapfd_test_x86_64", ":kselftest_x86_check_initial_reg_state_x86_64", ":kselftest_x86_ldt_gdt_x86_64", ":kselftest_x86_ptrace_syscall_x86_64", @@ -2524,6 +2545,7 @@ android_filegroup( ":kselftest_vdso_vdso_test_clock_getres_arm64", ":kselftest_vdso_vdso_test_getcpu_arm64", ":kselftest_vdso_vdso_test_gettimeofday_arm64", + ":kselftest_wrapfd_test_arm64", ], cpu = "arm64", visibility = ["//visibility:private"], diff --git a/android/gki/aarch64/afdo/README.md b/android/gki/aarch64/afdo/README.md index 362e25d31..d5c8cfb2e 100644 --- a/android/gki/aarch64/afdo/README.md +++ b/android/gki/aarch64/afdo/README.md @@ -5,12 +5,12 @@ optimize kernel builds, improving performance for specific architectures and ker ## kernel.afdo -The AutoFDO profile (kernel.afdo) for vmlinux is collected on kernel version 6.6.123 ( -SHA 276ca917d82bbadd5904c10e4073f9955cd8893d, build server ID 14925724) using Pixel 10. +The AutoFDO profile (kernel.afdo) for vmlinux is collected on kernel version 6.6.129 ( +SHA 11444f5f7cd158c7f2a7a8ee271f22973eb3e9f1, build server ID 15398938) using Pixel 10. ## Performance improvements -The metrics below reflect the latest benchmark evaluations gathered using the 6.6.123 profile on +The metrics below reflect the latest benchmark evaluations gathered using the 6.6.129 profile on Pixel 8. While a successful profile is defined by positive improvements across most benchmarks, results may fluctuate between updates. These variances can be driven by kernel and userspace code changes, the sampled nature of AutoFDO profiles, testing hardware differences, and inherent @@ -18,11 +18,11 @@ benchmark noise. | Benchmark | Improvement | | -------------------- | ----------- | -| Boot time | 1.5% | -| Cold App launch time | 3.0% | -| Binder-rpc | 19.5% | -| Binder-addints | 37.7% | -| Hwbinder | 11.7% | +| Boot time | 1.7% | +| Cold App launch time | 2.9% | +| Binder-rpc | 17% | +| Binder-addints | 15.5% | +| Hwbinder | 18.9% | Other improvements tested on past profiles: diff --git a/android/gki/aarch64/afdo/kernel.afdo b/android/gki/aarch64/afdo/kernel.afdo index 92ccbdc6f..574b78b38 100644 Binary files a/android/gki/aarch64/afdo/kernel.afdo and b/android/gki/aarch64/afdo/kernel.afdo differ diff --git a/arch/arm64/include/asm/mem_relinquish.h b/arch/arm64/include/asm/mem_relinquish.h index d25b6fb34..1476e91e6 100644 --- a/arch/arm64/include/asm/mem_relinquish.h +++ b/arch/arm64/include/asm/mem_relinquish.h @@ -9,6 +9,7 @@ struct page; +bool page_relinquish_disallowed(void); void page_relinquish(struct page *page); void post_page_relinquish_tlb_inv(void); diff --git a/arch/arm64/kvm/hyp/include/nvhe/pkvm.h b/arch/arm64/kvm/hyp/include/nvhe/pkvm.h index 887ac4485..fb054d619 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/pkvm.h +++ b/arch/arm64/kvm/hyp/include/nvhe/pkvm.h @@ -13,6 +13,9 @@ #include #include +/* Sentinel: distinct from NULL and any real pkvm_hyp_vcpu pointer. */ +#define PKVM_PVMFW_ENTERED ((struct pkvm_hyp_vcpu *)-1L) + /* * Holds the relevant data for maintaining the vcpu state completely at hyp. */ @@ -56,8 +59,14 @@ struct pkvm_hyp_vm { struct hyp_pool pool; hyp_spinlock_t pgtable_lock; - /* Primary vCPU pending entry to the pvmfw */ - struct pkvm_hyp_vcpu *pvmfw_entry_vcpu; + /* + * Primary vCPU slot, set once at first successful init and + * never cleared after the primary has entered pvmfw. Encodings: + * NULL - no primary claimed. + * real vCPU pointer - claimed; for pvmfw VMs, not yet entered. + * PKVM_PVMFW_ENTERED - claimed and has entered pvmfw (sticky). + */ + struct pkvm_hyp_vcpu *primary_vcpu; unsigned short refcount; @@ -138,7 +147,7 @@ bool kvm_handle_pvm_restricted(struct kvm_vcpu *vcpu, u64 *exit_code); void kvm_reset_pvm_sys_regs(struct kvm_vcpu *vcpu); int kvm_check_pvm_sysreg_table(void); -void pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu); +int pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu); bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code); bool kvm_hyp_handle_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code); diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c index 5c1378953..ee07b4ee2 100644 --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c @@ -186,14 +186,37 @@ static void handle_pvm_entry_psci(struct pkvm_hyp_vcpu *hyp_vcpu) unsigned long cpu_id = smccc_get_arg1(&hyp_vcpu->vcpu); struct pkvm_hyp_vcpu *target_vcpu; struct pkvm_hyp_vm *hyp_vm; + int prev; hyp_vm = pkvm_hyp_vcpu_to_hyp_vm(hyp_vcpu); target_vcpu = pkvm_mpidr_to_hyp_vcpu(hyp_vm, cpu_id); - if (target_vcpu && READ_ONCE(target_vcpu->power_state) == PSCI_0_2_AFFINITY_LEVEL_ON_PENDING) - WRITE_ONCE(target_vcpu->power_state, PSCI_0_2_AFFINITY_LEVEL_OFF); + /* + * pvm_psci_vcpu_on() resolved this MPIDR before + * forwarding and vcpus[] entries are never removed, + * so a NULL here is an EL2-internal invariant + * violation, not host-reachable. + */ + WARN_ON(!target_vcpu); - ret = PSCI_RET_INTERNAL_FAILURE; + prev = cmpxchg_relaxed(&target_vcpu->power_state, + PSCI_0_2_AFFINITY_LEVEL_ON_PENDING, + PSCI_0_2_AFFINITY_LEVEL_OFF); + /* + * Rollback win (prior == ON_PENDING): target never ran. + * Clear reset_state->reset so a future smp_load_acquire + * doesn't pair with this cancelled cycle's release, and + * report INTERNAL_FAILURE. Otherwise the target's reset + * advanced past ON_PENDING (possibly on to OFF via its + * own CPU_OFF), so per PSCI the guest sees SUCCESS. + */ + if (prev == PSCI_0_2_AFFINITY_LEVEL_ON_PENDING) { + WRITE_ONCE(target_vcpu->vcpu.arch.reset_state.reset, + false); + ret = PSCI_RET_INTERNAL_FAILURE; + } else { + ret = PSCI_RET_SUCCESS; + } } break; @@ -918,12 +941,6 @@ static struct kvm_vcpu *__get_host_hyp_vcpus(struct kvm_vcpu *arg, __get_host_hyp_vcpus(__vcpu, hyp_vcpup); \ }) -static bool is_vcpu_runnable(struct pkvm_hyp_vcpu *hyp_vcpu) -{ - return (!pkvm_hyp_vcpu_is_protected(hyp_vcpu) || - hyp_vcpu->power_state == PSCI_0_2_AFFINITY_LEVEL_ON); -} - static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt) { struct pkvm_hyp_vcpu *hyp_vcpu; @@ -943,11 +960,16 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt) goto out; if (unlikely(hyp_vcpu)) { - if (hyp_vcpu->power_state == PSCI_0_2_AFFINITY_LEVEL_ON_PENDING) - pkvm_reset_vcpu(hyp_vcpu); - - if (unlikely(!is_vcpu_runnable(hyp_vcpu))) + switch (READ_ONCE(hyp_vcpu->power_state)) { + case PSCI_0_2_AFFINITY_LEVEL_ON: + break; + case PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: + if (pkvm_reset_vcpu(hyp_vcpu)) + goto out; + break; + default: goto out; + } flush_hyp_vcpu(hyp_vcpu); ret = __kvm_vcpu_run(&hyp_vcpu->vcpu); diff --git a/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c b/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c index 66fd9ed61..137284810 100644 --- a/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c +++ b/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c @@ -498,6 +498,9 @@ int kvm_iommu_map_pages(pkvm_handle_t domain_id, unsigned long iova, iova + size < iova || paddr + size < paddr) return -E2BIG; + if (!IS_ALIGNED(iova | paddr, pgsize)) + return -EINVAL; + if (domain_id == KVM_IOMMU_DOMAIN_IDMAP_ID) return -EINVAL; @@ -602,6 +605,9 @@ size_t kvm_iommu_unmap_pages(pkvm_handle_t domain_id, iova + size < iova) return 0; + if (!IS_ALIGNED(iova, pgsize)) + return 0; + if (domain_id == KVM_IOMMU_DOMAIN_IDMAP_ID) return 0; diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c index dd4899d66..6839019b3 100644 --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c @@ -520,19 +520,28 @@ static int pkvm_vcpu_init_ptrauth(struct pkvm_hyp_vcpu *hyp_vcpu) return ret; } -static int pkvm_vcpu_init_psci(struct pkvm_hyp_vcpu *hyp_vcpu) +static int pkvm_vcpu_init_psci(struct pkvm_hyp_vcpu *hyp_vcpu, u32 mp_state) { struct vcpu_reset_state *reset_state = &hyp_vcpu->vcpu.arch.reset_state; struct pkvm_hyp_vm *hyp_vm = pkvm_hyp_vcpu_to_hyp_vm(hyp_vcpu); - if (hyp_vcpu->vcpu.arch.mp_state.mp_state == KVM_MP_STATE_STOPPED) { + if (!pkvm_hyp_vcpu_is_protected(hyp_vcpu)) { + /* + * The host is responsible for managing the vcpu state. + * Treat it as always on as far as hyp is concerned. + */ + hyp_vcpu->power_state = PSCI_0_2_AFFINITY_LEVEL_ON; + return 0; + } + + if (mp_state == KVM_MP_STATE_STOPPED) { reset_state->reset = false; hyp_vcpu->power_state = PSCI_0_2_AFFINITY_LEVEL_OFF; } else if (pkvm_hyp_vm_has_pvmfw(hyp_vm)) { - if (hyp_vm->pvmfw_entry_vcpu) + if (READ_ONCE(hyp_vm->primary_vcpu)) return -EINVAL; - hyp_vm->pvmfw_entry_vcpu = hyp_vcpu; + WRITE_ONCE(hyp_vm->primary_vcpu, hyp_vcpu); reset_state->reset = true; hyp_vcpu->power_state = PSCI_0_2_AFFINITY_LEVEL_ON_PENDING; } else { @@ -703,7 +712,6 @@ static int init_pkvm_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu, hyp_vcpu->vcpu.arch.hw_mmu = &hyp_vm->kvm.arch.mmu; hyp_vcpu->vcpu.arch.cflags = READ_ONCE(host_vcpu->arch.cflags); - hyp_vcpu->vcpu.arch.mp_state.mp_state = mp_state; hyp_vcpu->vcpu.arch.debug_ptr = &host_vcpu->arch.vcpu_debug_state; hyp_vcpu->vcpu.arch.hyp_reqs->type = KVM_HYP_LAST_REQ; @@ -719,7 +727,7 @@ static int init_pkvm_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu, goto done; } - WARN_ON(pkvm_vcpu_init_psci(hyp_vcpu)); + WARN_ON(pkvm_vcpu_init_psci(hyp_vcpu, mp_state)); pkvm_vcpu_init_traps(hyp_vcpu); kvm_reset_pvm_sys_regs(&hyp_vcpu->vcpu); done: @@ -1072,18 +1080,46 @@ void pkvm_poison_pvmfw_pages(void) } /* - * This function sets the registers on the vcpu to their architecturally defined - * reset values. + * Gate entry to the vCPU; on the first entry after OFF -> ON_PENDING, + * reset its registers to architectural values. * - * Note: Can only be called by the vcpu on itself, after it has been turned on. + * Returns 0 if the vCPU is runnable on return, or -ECANCELED if a + * concurrent rollback or unpublished reset_state cancelled this entry. + * + * Caller must be the vCPU itself. */ -void pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) +int pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) { struct kvm_vcpu *vcpu = &hyp_vcpu->vcpu; struct vcpu_reset_state *reset_state = &vcpu->arch.reset_state; struct pkvm_hyp_vm *hyp_vm = pkvm_hyp_vcpu_to_hyp_vm(hyp_vcpu); + int prev; - WARN_ON(!reset_state->reset); + /* + * Pair with smp_store_release in pvm_psci_vcpu_on() (or the + * plain write under vcpus_lock in pkvm_vcpu_init_psci() for + * first-run). False: source not yet published, bail. + */ + if (!smp_load_acquire(&reset_state->reset)) + return -ECANCELED; + + /* + * Commit ON_PENDING -> ON before any side effect: a concurrent + * rollback may race and advance power_state to OFF. Relaxed: + * atomic transition + observe prior is the contract; reset_state + * publication is the release/acquire pair above. + */ + prev = cmpxchg_relaxed(&hyp_vcpu->power_state, + PSCI_0_2_AFFINITY_LEVEL_ON_PENDING, + PSCI_0_2_AFFINITY_LEVEL_ON); + if (prev != PSCI_0_2_AFFINITY_LEVEL_ON_PENDING) { + /* + * Only a concurrent rollback (ON_PENDING -> OFF) can race us + * here. + */ + WARN_ON(prev != PSCI_0_2_AFFINITY_LEVEL_OFF); + return -ECANCELED; + } pkvm_vcpu_init_ptrauth(hyp_vcpu); kvm_reset_vcpu_core(vcpu); @@ -1091,7 +1127,7 @@ void pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) /* Must be done after reseting sys registers. */ kvm_reset_vcpu_psci(vcpu, reset_state); - if (hyp_vm->pvmfw_entry_vcpu == hyp_vcpu) { + if (READ_ONCE(hyp_vm->primary_vcpu) == hyp_vcpu) { struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu; u64 entry = hyp_vm->kvm.arch.pkvm.pvmfw_load_addr; int i; @@ -1108,7 +1144,13 @@ void pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) /* PC: IPA of pvmfw base */ *vcpu_pc(&hyp_vcpu->vcpu) = entry; - hyp_vm->pvmfw_entry_vcpu = NULL; + + /* + * Single-writer (this vCPU, post cmpxchg ON_PENDING -> ON). + * WRITE_ONCE pairs with READ_ONCE under vcpus_lock in + * pkvm_vcpu_init_psci() / pkvm_reset_vcpu(). + */ + WRITE_ONCE(hyp_vm->primary_vcpu, PKVM_PVMFW_ENTERED); /* Auto enroll MMIO guard */ set_bit(KVM_ARCH_FLAG_MMIO_GUARD, &hyp_vm->kvm.arch.flags); @@ -1121,9 +1163,7 @@ void pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) hyp_vcpu->exit_code = 0; - WARN_ON(hyp_vcpu->power_state != PSCI_0_2_AFFINITY_LEVEL_ON_PENDING); - WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_RUNNABLE); - WRITE_ONCE(hyp_vcpu->power_state, PSCI_0_2_AFFINITY_LEVEL_ON); + return 0; } struct kvm_hyp_req *pkvm_hyp_req_reserve(struct pkvm_hyp_vcpu *hyp_vcpu, u8 type) @@ -1200,11 +1240,14 @@ static bool pvm_psci_vcpu_on(struct pkvm_hyp_vcpu *hyp_vcpu) /* * Make sure the requested vcpu is not on to begin with. - * Atomic to avoid race between vcpus trying to power on the same vcpu. + * Atomic to avoid race between vcpus powering on the same vcpu. + * Relaxed: atomic transition + observe prior is the contract; + * publication of the reset_state writes below is the + * smp_store_release on reset_state->reset. */ - power_state = cmpxchg(&target->power_state, - PSCI_0_2_AFFINITY_LEVEL_OFF, - PSCI_0_2_AFFINITY_LEVEL_ON_PENDING); + power_state = cmpxchg_relaxed(&target->power_state, + PSCI_0_2_AFFINITY_LEVEL_OFF, + PSCI_0_2_AFFINITY_LEVEL_ON_PENDING); switch (power_state) { case PSCI_0_2_AFFINITY_LEVEL_ON_PENDING: ret = PSCI_RET_ON_PENDING; @@ -1224,7 +1267,8 @@ static bool pvm_psci_vcpu_on(struct pkvm_hyp_vcpu *hyp_vcpu) reset_state->r0 = smccc_get_arg3(&hyp_vcpu->vcpu); /* Propagate caller endianness */ reset_state->be = kvm_vcpu_is_be(&hyp_vcpu->vcpu); - reset_state->reset = true; + /* Pair with smp_load_acquire in pkvm_reset_vcpu(). */ + smp_store_release(&reset_state->reset, true); /* * Return to the host, which should make the KVM_REQ_VCPU_RESET request @@ -1313,12 +1357,12 @@ done: */ static bool pvm_psci_vcpu_off(struct pkvm_hyp_vcpu *hyp_vcpu) { - struct kvm_vcpu *vcpu = &hyp_vcpu->vcpu; - - WARN_ON(vcpu->arch.mp_state.mp_state == KVM_MP_STATE_STOPPED); - WARN_ON(hyp_vcpu->power_state != PSCI_0_2_AFFINITY_LEVEL_ON); - - WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_STOPPED); + /* + * No concurrent writer: this vCPU is running guest code (so + * power_state == ON), and the other CPUs' cmpxchg sites gate + * on OFF (CPU_ON) or ON_PENDING (rollback). + */ + WARN_ON(READ_ONCE(hyp_vcpu->power_state) != PSCI_0_2_AFFINITY_LEVEL_ON); WRITE_ONCE(hyp_vcpu->power_state, PSCI_0_2_AFFINITY_LEVEL_OFF); /* Return to the host so that it can finish powering off the vcpu. */ diff --git a/arch/arm64/mm/mem_relinquish.c b/arch/arm64/mm/mem_relinquish.c index b0f4a170d..ac240a37b 100644 --- a/arch/arm64/mm/mem_relinquish.c +++ b/arch/arm64/mm/mem_relinquish.c @@ -32,6 +32,7 @@ ARM_SMCCC_KVM_FUNC_MEM_RELINQUISH) #endif /* ARM_SMCCC_KVM_FUNC_MEM_RELINQUISH */ +static bool __page_relinquish_disallowed; static unsigned long memshare_granule_sz; static void kvm_page_relinquish(struct page *page) @@ -68,8 +69,10 @@ void kvm_init_memrelinquish_services(void) arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_HYP_MEMINFO_FUNC_ID, 0, 0, 0, &res); - if (res.a0 > PAGE_SIZE) /* Includes error codes */ + if (res.a0 > PAGE_SIZE) { /* Includes error codes */ + __page_relinquish_disallowed = true; return; + } memshare_granule_sz = res.a0; @@ -77,6 +80,12 @@ void kvm_init_memrelinquish_services(void) hyp_ops.page_relinquish = kvm_page_relinquish; } +bool page_relinquish_disallowed(void) +{ + return __page_relinquish_disallowed; +} +EXPORT_SYMBOL_GPL(page_relinquish_disallowed); + void page_relinquish(struct page *page) { if (hyp_ops.page_relinquish) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 4a6fb1fe1..b750ba826 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -1139,6 +1139,9 @@ static int virtballoon_restore(struct virtio_device *vdev) static int virtballoon_validate(struct virtio_device *vdev) { + if (WARN_ON(page_relinquish_disallowed())) + return -ENODEV; + /* * Inform the hypervisor that our pages are poisoned or * initialized. If we cannot do that then we should disable diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 299949198..2a1cf48ee 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2268,6 +2268,9 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) /* check if we need more GC first */ unusable = f2fs_get_unusable_blocks(sbi); + + f2fs_info(sbi, "%s starts, unusable: %u", __func__, unusable); + if (!f2fs_disable_cp_again(sbi, unusable)) goto skip_gc; @@ -2275,6 +2278,8 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) sbi->gc_mode = GC_URGENT_HIGH; + f2fs_info(sbi, "%s: run f2fs_gc() to migrate blocks", __func__); + while (!f2fs_time_over(sbi, DISABLE_TIME)) { struct f2fs_gc_control gc_control = { .victim_segno = NULL_SEGNO, @@ -2295,6 +2300,12 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) break; } + f2fs_info(sbi, "%s: call sync_filesystem() to persist meta: %lld, node: %lld, data: %lld", + __func__, + get_pages(sbi, F2FS_DIRTY_META), + get_pages(sbi, F2FS_DIRTY_NODES), + get_pages(sbi, F2FS_DIRTY_DATA)); + ret = sync_filesystem(sbi->sb); if (ret || err) { err = ret ? ret : err; @@ -2308,6 +2319,12 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi) } skip_gc: + f2fs_info(sbi, "%s: call f2fs_write_checkpoint(), meta: %lld, node: %lld, data: %lld", + __func__, + get_pages(sbi, F2FS_DIRTY_META), + get_pages(sbi, F2FS_DIRTY_NODES), + get_pages(sbi, F2FS_DIRTY_DATA)); + f2fs_down_write_trace(&sbi->gc_lock, &lc); cpc.reason = CP_PAUSE; set_sbi_flag(sbi, SBI_CP_DISABLED); @@ -2325,7 +2342,7 @@ out_unlock: restore_flag: sbi->gc_mode = gc_mode; sbi->sb->s_flags = s_flags; /* Restore SB_RDONLY status */ - f2fs_info(sbi, "f2fs_disable_checkpoint() finish, err:%d", err); + f2fs_info(sbi, "%s finishes, err:%d", __func__, err); return err; } diff --git a/include/linux/mem_relinquish.h b/include/linux/mem_relinquish.h index 518c71685..ae761cbd4 100644 --- a/include/linux/mem_relinquish.h +++ b/include/linux/mem_relinquish.h @@ -13,6 +13,7 @@ #else /* !CONFIG_MEMORY_RELINQUISH */ +static inline bool page_relinquish_disallowed(void) { return false; } static inline void page_relinquish(struct page *page) { } static inline void post_page_relinquish_tlb_inv(void) { } diff --git a/net/core/gro.c b/net/core/gro.c index 92cb86d4c..9ed95aaab 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -216,16 +216,17 @@ done: p->data_len += len; p->truesize += delta_truesize; p->len += len; + skb_shinfo(p)->flags |= skbinfo->flags & SKBFL_SHARED_FRAG; if (lp != p) { lp->data_len += len; lp->truesize += delta_truesize; lp->len += len; + skb_shinfo(lp)->flags |= skbinfo->flags & SKBFL_SHARED_FRAG; } NAPI_GRO_CB(skb)->same_flow = 1; return 0; } - static void napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb) { struct packet_offload *ptype; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ea863f2a2..03f88181d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2058,6 +2058,7 @@ struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom, skb_frag_ref(skb, i); } skb_shinfo(n)->nr_frags = i; + skb_shinfo(n)->flags |= skb_shinfo(skb)->flags & SKBFL_SHARED_FRAG; } if (skb_has_frag_list(skb)) { @@ -4094,6 +4095,8 @@ onlymerged: tgt->ip_summed = CHECKSUM_PARTIAL; skb->ip_summed = CHECKSUM_PARTIAL; + skb_shinfo(tgt)->flags |= skb_shinfo(skb)->flags & SKBFL_SHARED_FRAG; + skb_len_add(skb, -shiftlen); skb_len_add(tgt, shiftlen); @@ -4666,7 +4669,8 @@ normal: skb_copy_from_linear_data_offset(head_skb, offset, skb_put(nskb, hsize), hsize); - skb_shinfo(nskb)->flags |= skb_shinfo(head_skb)->flags & + skb_shinfo(nskb)->flags |= (skb_shinfo(head_skb)->flags | + skb_shinfo(frag_skb)->flags) & SKBFL_SHARED_FRAG; if (skb_zerocopy_clone(nskb, frag_skb, GFP_ATOMIC)) @@ -4683,6 +4687,9 @@ normal: nfrags = skb_shinfo(list_skb)->nr_frags; frag = skb_shinfo(list_skb)->frags; frag_skb = list_skb; + + skb_shinfo(nskb)->flags |= skb_shinfo(frag_skb)->flags & SKBFL_SHARED_FRAG; + if (!skb_headlen(list_skb)) { BUG_ON(!nfrags); } else { @@ -5832,6 +5839,8 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, from_shinfo->frags, from_shinfo->nr_frags * sizeof(skb_frag_t)); to_shinfo->nr_frags += from_shinfo->nr_frags; + if (from_shinfo->nr_frags) + to_shinfo->flags |= from_shinfo->flags & SKBFL_SHARED_FRAG; if (!skb_cloned(from)) from_shinfo->nr_frags = 0; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index ff2630bf6..4a8bba237 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2367,6 +2367,7 @@ static int tcp_clone_payload(struct sock *sk, struct sk_buff *to, todo = min_t(int, skb_frag_size(fragfrom), probe_size - len); len += todo; + skb_shinfo(to)->flags |= skb_shinfo(skb)->flags & SKBFL_SHARED_FRAG; if (lastfrag && skb_frag_page(fragfrom) == skb_frag_page(lastfrag) && skb_frag_off(fragfrom) == skb_frag_off(lastfrag) + diff --git a/tools/testing/selftests/android/config_arm64.xml b/tools/testing/selftests/android/config_arm64.xml index 4981a2747..a10cca357 100644 --- a/tools/testing/selftests/android/config_arm64.xml +++ b/tools/testing/selftests/android/config_arm64.xml @@ -80,5 +80,6 @@ SPDX-License-Identifier: GPL-2.0 OR Apache-2.0