Skip to content

Commit ea8c155

Browse files
committed
Merge remote-tracking branch 'stable/linux-5.7.y' into v5.7+
2 parents ceebd05 + 7977a46 commit ea8c155

122 files changed

Lines changed: 1543 additions & 611 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 7
4-
SUBLEVEL = 7
4+
SUBLEVEL = 8
55
EXTRAVERSION =
66
NAME = Kleptomaniac Octopus
77

arch/mips/kernel/traps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,7 @@ static void configure_status(void)
21212121

21222122
change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
21232123
status_set);
2124+
back_to_back_c0_hazard();
21242125
}
21252126

21262127
unsigned int hwrena;

arch/mips/lantiq/xway/sysctrl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ void __init ltq_soc_init(void)
514514
clkdev_add_pmu("1e10b308.eth", NULL, 0, 0, PMU_SWITCH |
515515
PMU_PPE_DP | PMU_PPE_TC);
516516
clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
517-
clkdev_add_pmu("1e108000.gswip", "gphy0", 0, 0, PMU_GPHY);
518-
clkdev_add_pmu("1e108000.gswip", "gphy1", 0, 0, PMU_GPHY);
517+
clkdev_add_pmu("1e108000.switch", "gphy0", 0, 0, PMU_GPHY);
518+
clkdev_add_pmu("1e108000.switch", "gphy1", 0, 0, PMU_GPHY);
519519
clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
520520
clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE);
521521
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
@@ -538,8 +538,8 @@ void __init ltq_soc_init(void)
538538
PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
539539
PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
540540
PMU_PPE_QSB | PMU_PPE_TOP);
541-
clkdev_add_pmu("1e108000.gswip", "gphy0", 0, 0, PMU_GPHY);
542-
clkdev_add_pmu("1e108000.gswip", "gphy1", 0, 0, PMU_GPHY);
541+
clkdev_add_pmu("1e108000.switch", "gphy0", 0, 0, PMU_GPHY);
542+
clkdev_add_pmu("1e108000.switch", "gphy1", 0, 0, PMU_GPHY);
543543
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
544544
clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
545545
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);

arch/powerpc/include/asm/kvm_book3s_64.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <asm/book3s/64/mmu-hash.h>
1515
#include <asm/cpu_has_feature.h>
1616
#include <asm/ppc-opcode.h>
17+
#include <asm/pte-walk.h>
1718

1819
#ifdef CONFIG_PPC_PSERIES
1920
static inline bool kvmhv_on_pseries(void)
@@ -634,6 +635,28 @@ extern void kvmhv_remove_nest_rmap_range(struct kvm *kvm,
634635
unsigned long gpa, unsigned long hpa,
635636
unsigned long nbytes);
636637

638+
static inline pte_t *
639+
find_kvm_secondary_pte_unlocked(struct kvm *kvm, unsigned long ea,
640+
unsigned *hshift)
641+
{
642+
pte_t *pte;
643+
644+
pte = __find_linux_pte(kvm->arch.pgtable, ea, NULL, hshift);
645+
return pte;
646+
}
647+
648+
static inline pte_t *find_kvm_secondary_pte(struct kvm *kvm, unsigned long ea,
649+
unsigned *hshift)
650+
{
651+
pte_t *pte;
652+
653+
VM_WARN(!spin_is_locked(&kvm->mmu_lock),
654+
"%s called with kvm mmu_lock not held \n", __func__);
655+
pte = __find_linux_pte(kvm->arch.pgtable, ea, NULL, hshift);
656+
657+
return pte;
658+
}
659+
637660
#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
638661

639662
#endif /* __ASM_KVM_BOOK3S_64_H__ */

arch/powerpc/kvm/book3s_64_mmu_radix.c

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,11 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
993993
return 0;
994994
}
995995

996-
ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
996+
ptep = find_kvm_secondary_pte(kvm, gpa, &shift);
997997
if (ptep && pte_present(*ptep))
998998
kvmppc_unmap_pte(kvm, ptep, gpa, shift, memslot,
999999
kvm->arch.lpid);
1000-
return 0;
1000+
return 0;
10011001
}
10021002

10031003
/* Called with kvm->mmu_lock held */
@@ -1013,7 +1013,7 @@ int kvm_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
10131013
if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE)
10141014
return ref;
10151015

1016-
ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
1016+
ptep = find_kvm_secondary_pte(kvm, gpa, &shift);
10171017
if (ptep && pte_present(*ptep) && pte_young(*ptep)) {
10181018
old = kvmppc_radix_update_pte(kvm, ptep, _PAGE_ACCESSED, 0,
10191019
gpa, shift);
@@ -1040,7 +1040,7 @@ int kvm_test_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
10401040
if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE)
10411041
return ref;
10421042

1043-
ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
1043+
ptep = find_kvm_secondary_pte(kvm, gpa, &shift);
10441044
if (ptep && pte_present(*ptep) && pte_young(*ptep))
10451045
ref = 1;
10461046
return ref;
@@ -1052,20 +1052,43 @@ static int kvm_radix_test_clear_dirty(struct kvm *kvm,
10521052
{
10531053
unsigned long gfn = memslot->base_gfn + pagenum;
10541054
unsigned long gpa = gfn << PAGE_SHIFT;
1055-
pte_t *ptep;
1055+
pte_t *ptep, pte;
10561056
unsigned int shift;
10571057
int ret = 0;
10581058
unsigned long old, *rmapp;
10591059

10601060
if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE)
10611061
return ret;
10621062

1063-
ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
1064-
if (ptep && pte_present(*ptep) && pte_dirty(*ptep)) {
1065-
ret = 1;
1066-
if (shift)
1067-
ret = 1 << (shift - PAGE_SHIFT);
1063+
/*
1064+
* For performance reasons we don't hold kvm->mmu_lock while walking the
1065+
* partition scoped table.
1066+
*/
1067+
ptep = find_kvm_secondary_pte_unlocked(kvm, gpa, &shift);
1068+
if (!ptep)
1069+
return 0;
1070+
1071+
pte = READ_ONCE(*ptep);
1072+
if (pte_present(pte) && pte_dirty(pte)) {
10681073
spin_lock(&kvm->mmu_lock);
1074+
/*
1075+
* Recheck the pte again
1076+
*/
1077+
if (pte_val(pte) != pte_val(*ptep)) {
1078+
/*
1079+
* We have KVM_MEM_LOG_DIRTY_PAGES enabled. Hence we can
1080+
* only find PAGE_SIZE pte entries here. We can continue
1081+
* to use the pte addr returned by above page table
1082+
* walk.
1083+
*/
1084+
if (!pte_present(*ptep) || !pte_dirty(*ptep)) {
1085+
spin_unlock(&kvm->mmu_lock);
1086+
return 0;
1087+
}
1088+
}
1089+
1090+
ret = 1;
1091+
VM_BUG_ON(shift);
10691092
old = kvmppc_radix_update_pte(kvm, ptep, _PAGE_DIRTY, 0,
10701093
gpa, shift);
10711094
kvmppc_radix_tlbie_page(kvm, gpa, shift, kvm->arch.lpid);
@@ -1121,7 +1144,7 @@ void kvmppc_radix_flush_memslot(struct kvm *kvm,
11211144
gpa = memslot->base_gfn << PAGE_SHIFT;
11221145
spin_lock(&kvm->mmu_lock);
11231146
for (n = memslot->npages; n; --n) {
1124-
ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
1147+
ptep = find_kvm_secondary_pte(kvm, gpa, &shift);
11251148
if (ptep && pte_present(*ptep))
11261149
kvmppc_unmap_pte(kvm, ptep, gpa, shift, memslot,
11271150
kvm->arch.lpid);

arch/powerpc/kvm/book3s_hv_nested.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run,
13621362
/* See if can find translation in our partition scoped tables for L1 */
13631363
pte = __pte(0);
13641364
spin_lock(&kvm->mmu_lock);
1365-
pte_p = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
1365+
pte_p = find_kvm_secondary_pte(kvm, gpa, &shift);
13661366
if (!shift)
13671367
shift = PAGE_SHIFT;
13681368
if (pte_p)

arch/s390/kernel/debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,10 @@ static debug_entry_t ***debug_areas_alloc(int pages_per_area, int nr_areas)
198198
if (!areas)
199199
goto fail_malloc_areas;
200200
for (i = 0; i < nr_areas; i++) {
201+
/* GFP_NOWARN to avoid user triggerable WARN, we handle fails */
201202
areas[i] = kmalloc_array(pages_per_area,
202203
sizeof(debug_entry_t *),
203-
GFP_KERNEL);
204+
GFP_KERNEL | __GFP_NOWARN);
204205
if (!areas[i])
205206
goto fail_malloc_areas2;
206207
for (j = 0; j < pages_per_area; j++) {

arch/x86/kernel/cpu/intel.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ enum split_lock_detect_state {
4848
static enum split_lock_detect_state sld_state __ro_after_init = sld_off;
4949
static u64 msr_test_ctrl_cache __ro_after_init;
5050

51+
/*
52+
* With a name like MSR_TEST_CTL it should go without saying, but don't touch
53+
* MSR_TEST_CTL unless the CPU is one of the whitelisted models. Writing it
54+
* on CPUs that do not support SLD can cause fireworks, even when writing '0'.
55+
*/
56+
static bool cpu_model_supports_sld __ro_after_init;
57+
5158
/*
5259
* Processors which have self-snooping capability can handle conflicting
5360
* memory type across CPUs by snooping its own cache. However, there exists
@@ -1064,7 +1071,8 @@ static void sld_update_msr(bool on)
10641071

10651072
static void split_lock_init(void)
10661073
{
1067-
split_lock_verify_msr(sld_state != sld_off);
1074+
if (cpu_model_supports_sld)
1075+
split_lock_verify_msr(sld_state != sld_off);
10681076
}
10691077

10701078
static void split_lock_warn(unsigned long ip)
@@ -1167,5 +1175,6 @@ void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c)
11671175
return;
11681176
}
11691177

1178+
cpu_model_supports_sld = true;
11701179
split_lock_setup();
11711180
}

crypto/af_alg.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,15 @@ EXPORT_SYMBOL_GPL(af_alg_release);
128128
void af_alg_release_parent(struct sock *sk)
129129
{
130130
struct alg_sock *ask = alg_sk(sk);
131-
unsigned int nokey = ask->nokey_refcnt;
132-
bool last = nokey && !ask->refcnt;
131+
unsigned int nokey = atomic_read(&ask->nokey_refcnt);
133132

134133
sk = ask->parent;
135134
ask = alg_sk(sk);
136135

137-
local_bh_disable();
138-
bh_lock_sock(sk);
139-
ask->nokey_refcnt -= nokey;
140-
if (!last)
141-
last = !--ask->refcnt;
142-
bh_unlock_sock(sk);
143-
local_bh_enable();
136+
if (nokey)
137+
atomic_dec(&ask->nokey_refcnt);
144138

145-
if (last)
139+
if (atomic_dec_and_test(&ask->refcnt))
146140
sock_put(sk);
147141
}
148142
EXPORT_SYMBOL_GPL(af_alg_release_parent);
@@ -187,7 +181,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
187181

188182
err = -EBUSY;
189183
lock_sock(sk);
190-
if (ask->refcnt | ask->nokey_refcnt)
184+
if (atomic_read(&ask->refcnt))
191185
goto unlock;
192186

193187
swap(ask->type, type);
@@ -236,7 +230,7 @@ static int alg_setsockopt(struct socket *sock, int level, int optname,
236230
int err = -EBUSY;
237231

238232
lock_sock(sk);
239-
if (ask->refcnt)
233+
if (atomic_read(&ask->refcnt) != atomic_read(&ask->nokey_refcnt))
240234
goto unlock;
241235

242236
type = ask->type;
@@ -301,12 +295,14 @@ int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern)
301295
if (err)
302296
goto unlock;
303297

304-
if (nokey || !ask->refcnt++)
298+
if (atomic_inc_return_relaxed(&ask->refcnt) == 1)
305299
sock_hold(sk);
306-
ask->nokey_refcnt += nokey;
300+
if (nokey) {
301+
atomic_inc(&ask->nokey_refcnt);
302+
atomic_set(&alg_sk(sk2)->nokey_refcnt, 1);
303+
}
307304
alg_sk(sk2)->parent = sk;
308305
alg_sk(sk2)->type = type;
309-
alg_sk(sk2)->nokey_refcnt = nokey;
310306

311307
newsock->ops = type->ops;
312308
newsock->state = SS_CONNECTED;

crypto/algif_aead.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static int aead_check_key(struct socket *sock)
384384
struct alg_sock *ask = alg_sk(sk);
385385

386386
lock_sock(sk);
387-
if (ask->refcnt)
387+
if (!atomic_read(&ask->nokey_refcnt))
388388
goto unlock_child;
389389

390390
psk = ask->parent;
@@ -396,11 +396,8 @@ static int aead_check_key(struct socket *sock)
396396
if (crypto_aead_get_flags(tfm->aead) & CRYPTO_TFM_NEED_KEY)
397397
goto unlock;
398398

399-
if (!pask->refcnt++)
400-
sock_hold(psk);
401-
402-
ask->refcnt = 1;
403-
sock_put(psk);
399+
atomic_dec(&pask->nokey_refcnt);
400+
atomic_set(&ask->nokey_refcnt, 0);
404401

405402
err = 0;
406403

0 commit comments

Comments
 (0)