Skip to content

Commit db32cf8

Browse files
committed
Merge branch 'for-next/fixes' into for-next/core
Merge in arm64 fixes queued for 6.7 so that kpti_install_ng_mappings() can be updated to use arm64_kernel_unmapped_at_el0() instead of checking the ARM64_UNMAP_KERNEL_AT_EL0 CPU capability directly. * for-next/fixes: arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify perf/arm-cmn: Fail DTC counter allocation correctly arm64: Avoid enabling KPTI unnecessarily
2 parents 3e8626b + 3c06960 commit db32cf8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
834834
pte = set_pte_bit(pte, __pgprot(PTE_DIRTY));
835835

836836
pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
837+
/*
838+
* If we end up clearing hw dirtiness for a sw-dirty PTE, set hardware
839+
* dirtiness again.
840+
*/
841+
if (pte_sw_dirty(pte))
842+
pte = pte_mkdirty(pte);
837843
return pte;
838844
}
839845

arch/arm64/kernel/cpufeature.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,10 @@ static int __init __kpti_install_ng_mappings(void *__unused)
18431843

18441844
static void __init kpti_install_ng_mappings(void)
18451845
{
1846+
/* Check whether KPTI is going to be used */
1847+
if (!arm64_kernel_unmapped_at_el0())
1848+
return;
1849+
18461850
/*
18471851
* We don't need to rewrite the page-tables if either we've done
18481852
* it already or we have KASLR enabled and therefore have not

drivers/perf/arm-cmn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
18161816
idx = 0;
18171817
while (cmn->dtc[j].counters[idx])
18181818
if (++idx == CMN_DT_NUM_COUNTERS)
1819-
goto free_dtms;
1819+
return -ENOSPC;
18201820
}
18211821
hw->dtc_idx[j] = idx;
18221822
}

0 commit comments

Comments
 (0)