Merge tag 'ASB-2026-06-01_15-6.6' of https://android.googlesource.com/kernel/common into HEAD
https://source.android.com/docs/security/bulletin/2026/2026-06-01 CVE-2025-40214 * tag 'ASB-2026-06-01_15-6.6' of https://android.googlesource.com/kernel/common: ANDROID: KVM: arm64: iommu: Harden map/unmap checks ANDROID: ARM64: virtio_balloon: Disable balloon with warning if granule too large ANDROID: KVM: arm64: Make the pvmfw primary slot permanent ANDROID: KVM: arm64: Commit vCPU power_state at the top of pkvm_reset_vcpu ANDROID: KVM: arm64: Return SUCCESS to guest if CPU_ON target ran ANDROID: KVM: arm64: Make CPU_ON failure rollback atomic ANDROID: KVM: arm64: Treat non-protected vCPUs as always on at EL2 ANDROID: KVM: arm64: Remove MP state tracking from EL2 UPSTREAM: net: skbuff: propagate shared-frag marker through frag-transfer helpers UPSTREAM: net: skbuff: preserve shared-frag marker during coalescing BACKPORT: FROMGIT: f2fs: add logs in f2fs_disable_checkpoint() ANDROID: Update AutoFDO profile to 6.6.129 ANDROID: Define bazel target for wrapfd kselftests and run in presubmit ANDROID: selftests/wrapfd: Define a wrapper for remap_file_pages() Change-Id: If3725d30cda509db7865f392cbabe5b2806f5741
This commit is contained in:
commit
2ba452f99a
18 changed files with 212 additions and 56 deletions
22
BUILD.bazel
22
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"],
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
struct page;
|
||||
|
||||
bool page_relinquish_disallowed(void);
|
||||
void page_relinquish(struct page *page);
|
||||
void post_page_relinquish_tlb_inv(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
#include <nvhe/gfp.h>
|
||||
#include <nvhe/spinlock.h>
|
||||
|
||||
/* 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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) +
|
||||
|
|
|
|||
|
|
@ -80,5 +80,6 @@ SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
|
|||
<option name="test-command-line" key="kselftest_vdso_vdso_test_clock_getres" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_clock_getres" />
|
||||
<option name="test-command-line" key="kselftest_vdso_vdso_test_getcpu" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_getcpu" />
|
||||
<option name="test-command-line" key="kselftest_vdso_vdso_test_gettimeofday" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_gettimeofday" />
|
||||
<option name="test-command-line" key="kselftest_wrapfd_test" value="cd &ktest_dir;; ./kselftest_wrapfd_test" />
|
||||
</test>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
|
|||
<option name="test-command-line" key="kselftest_vdso_vdso_test_clock_getres" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_clock_getres" />
|
||||
<option name="test-command-line" key="kselftest_vdso_vdso_test_getcpu" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_getcpu" />
|
||||
<option name="test-command-line" key="kselftest_vdso_vdso_test_gettimeofday" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_gettimeofday" />
|
||||
<option name="test-command-line" key="kselftest_wrapfd_test" value="cd &ktest_dir;; ./kselftest_wrapfd_test" />
|
||||
<option name="test-command-line" key="kselftest_x86_check_initial_reg_state" value="cd &ktest_dir;; ./kselftest_x86_check_initial_reg_state" />
|
||||
<option name="test-command-line" key="kselftest_x86_ldt_gdt" value="cd &ktest_dir;; ./kselftest_x86_ldt_gdt" />
|
||||
<option name="test-command-line" key="kselftest_x86_ptrace_syscall" value="cd &ktest_dir;; ./kselftest_x86_ptrace_syscall" />
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <linux/align.h>
|
||||
|
|
@ -491,6 +492,14 @@ static void test_wrap_rdwr(struct __test_metadata *_metadata,
|
|||
close(wrapfd);
|
||||
}
|
||||
|
||||
/* Bionic's implementation of libc does not have a wrapper for remap_file_pages(). */
|
||||
#ifdef __ANDROID__
|
||||
static int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags)
|
||||
{
|
||||
return syscall(__NR_remap_file_pages, addr, size, prot, pgoff, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_remap_file_pages(struct __test_metadata *_metadata,
|
||||
FIXTURE_DATA(wrapfd_tests) *self, int fd)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue