Skip to content

Commit 886d7de

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton: - More MM work. 100ish more to go. Mike Rapoport's "mm: remove __ARCH_HAS_5LEVEL_HACK" series should fix the current ppc issue - Various other little subsystems * emailed patches from Andrew Morton <[email protected]>: (127 commits) lib/ubsan.c: fix gcc-10 warnings tools/testing/selftests/vm: remove duplicate headers selftests: vm: pkeys: fix multilib builds for x86 selftests: vm: pkeys: use the correct page size on powerpc selftests/vm/pkeys: override access right definitions on powerpc selftests/vm/pkeys: test correct behaviour of pkey-0 selftests/vm/pkeys: introduce a sub-page allocator selftests/vm/pkeys: detect write violation on a mapped access-denied-key page selftests/vm/pkeys: associate key on a mapped page and detect write violation selftests/vm/pkeys: associate key on a mapped page and detect access violation selftests/vm/pkeys: improve checks to determine pkey support selftests/vm/pkeys: fix assertion in test_pkey_alloc_exhaust() selftests/vm/pkeys: fix number of reserved powerpc pkeys selftests/vm/pkeys: introduce powerpc support selftests/vm/pkeys: introduce generic pkey abstractions selftests: vm: pkeys: use the correct huge page size selftests/vm/pkeys: fix alloc_random_pkey() to make it really random selftests/vm/pkeys: fix assertion in pkey_disable_set/clear() selftests/vm/pkeys: fix pkey_disable_clear() selftests: vm: pkeys: add helpers for pkey bits ...
2 parents 5bfea2d + 469cbd0 commit 886d7de

File tree

199 files changed

+3312
-2163
lines changed

Some content is hidden

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

199 files changed

+3312
-2163
lines changed

Documentation/dev-tools/kcov.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,15 @@ This allows to collect coverage from two types of kernel background
217217
threads: the global ones, that are spawned during kernel boot in a limited
218218
number of instances (e.g. one USB hub_event() worker thread is spawned per
219219
USB HCD); and the local ones, that are spawned when a user interacts with
220-
some kernel interface (e.g. vhost workers).
220+
some kernel interface (e.g. vhost workers); as well as from soft
221+
interrupts.
221222

222-
To enable collecting coverage from a global background thread, a unique
223-
global handle must be assigned and passed to the corresponding
224-
kcov_remote_start() call. Then a userspace process can pass a list of such
225-
handles to the KCOV_REMOTE_ENABLE ioctl in the handles array field of the
226-
kcov_remote_arg struct. This will attach the used kcov device to the code
227-
sections, that are referenced by those handles.
223+
To enable collecting coverage from a global background thread or from a
224+
softirq, a unique global handle must be assigned and passed to the
225+
corresponding kcov_remote_start() call. Then a userspace process can pass
226+
a list of such handles to the KCOV_REMOTE_ENABLE ioctl in the handles
227+
array field of the kcov_remote_arg struct. This will attach the used kcov
228+
device to the code sections, that are referenced by those handles.
228229

229230
Since there might be many local background threads spawned from different
230231
userspace processes, we can't use a single global handle per annotation.
@@ -242,7 +243,7 @@ handles as they don't belong to a particular subsystem. The bytes 4-7 are
242243
currently reserved and must be zero. In the future the number of bytes
243244
used for the subsystem or handle ids might be increased.
244245

245-
When a particular userspace proccess collects coverage by via a common
246+
When a particular userspace proccess collects coverage via a common
246247
handle, kcov will collect coverage for each code section that is annotated
247248
to use the common handle obtained as kcov_handle from the current
248249
task_struct. However non common handles allow to collect coverage
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Feature name: debug-vm-pgtable
3+
# Kconfig: ARCH_HAS_DEBUG_VM_PGTABLE
4+
# description: arch supports pgtable tests for semantics compliance
5+
#
6+
-----------------------
7+
| arch |status|
8+
-----------------------
9+
| alpha: | TODO |
10+
| arc: | ok |
11+
| arm: | TODO |
12+
| arm64: | ok |
13+
| c6x: | TODO |
14+
| csky: | TODO |
15+
| h8300: | TODO |
16+
| hexagon: | TODO |
17+
| ia64: | TODO |
18+
| m68k: | TODO |
19+
| microblaze: | TODO |
20+
| mips: | TODO |
21+
| nds32: | TODO |
22+
| nios2: | TODO |
23+
| openrisc: | TODO |
24+
| parisc: | TODO |
25+
| powerpc: | ok |
26+
| riscv: | TODO |
27+
| s390: | ok |
28+
| sh: | TODO |
29+
| sparc: | TODO |
30+
| um: | TODO |
31+
| unicore32: | TODO |
32+
| x86: | ok |
33+
| xtensa: | TODO |
34+
-----------------------

arch/arc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config ARC
77
def_bool y
88
select ARC_TIMERS
9+
select ARCH_HAS_DEBUG_VM_PGTABLE
910
select ARCH_HAS_DMA_PREP_COHERENT
1011
select ARCH_HAS_PTE_SPECIAL
1112
select ARCH_HAS_SETUP_DMA_OPS

arch/arc/include/asm/highmem.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,15 @@
2525
#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
2626
#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
2727

28-
#define kmap_prot PAGE_KERNEL
29-
30-
3128
#include <asm/cacheflush.h>
3229

33-
extern void *kmap(struct page *page);
34-
extern void *kmap_high(struct page *page);
35-
extern void *kmap_atomic(struct page *page);
36-
extern void __kunmap_atomic(void *kvaddr);
37-
extern void kunmap_high(struct page *page);
38-
3930
extern void kmap_init(void);
4031

4132
static inline void flush_cache_kmaps(void)
4233
{
4334
flush_cache_all();
4435
}
4536

46-
static inline void kunmap(struct page *page)
47-
{
48-
BUG_ON(in_interrupt());
49-
if (!PageHighMem(page))
50-
return;
51-
kunmap_high(page);
52-
}
53-
54-
5537
#endif
5638

5739
#endif

arch/arc/mm/highmem.c

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,38 +49,23 @@
4949
extern pte_t * pkmap_page_table;
5050
static pte_t * fixmap_page_table;
5151

52-
void *kmap(struct page *page)
53-
{
54-
BUG_ON(in_interrupt());
55-
if (!PageHighMem(page))
56-
return page_address(page);
57-
58-
return kmap_high(page);
59-
}
60-
EXPORT_SYMBOL(kmap);
61-
62-
void *kmap_atomic(struct page *page)
52+
void *kmap_atomic_high_prot(struct page *page, pgprot_t prot)
6353
{
6454
int idx, cpu_idx;
6555
unsigned long vaddr;
6656

67-
preempt_disable();
68-
pagefault_disable();
69-
if (!PageHighMem(page))
70-
return page_address(page);
71-
7257
cpu_idx = kmap_atomic_idx_push();
7358
idx = cpu_idx + KM_TYPE_NR * smp_processor_id();
7459
vaddr = FIXMAP_ADDR(idx);
7560

7661
set_pte_at(&init_mm, vaddr, fixmap_page_table + idx,
77-
mk_pte(page, kmap_prot));
62+
mk_pte(page, prot));
7863

7964
return (void *)vaddr;
8065
}
81-
EXPORT_SYMBOL(kmap_atomic);
66+
EXPORT_SYMBOL(kmap_atomic_high_prot);
8267

83-
void __kunmap_atomic(void *kv)
68+
void kunmap_atomic_high(void *kv)
8469
{
8570
unsigned long kvaddr = (unsigned long)kv;
8671

@@ -102,11 +87,8 @@ void __kunmap_atomic(void *kv)
10287

10388
kmap_atomic_idx_pop();
10489
}
105-
106-
pagefault_enable();
107-
preempt_enable();
10890
}
109-
EXPORT_SYMBOL(__kunmap_atomic);
91+
EXPORT_SYMBOL(kunmap_atomic_high);
11092

11193
static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)
11294
{

arch/arm/include/asm/highmem.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
1111
#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
1212

13-
#define kmap_prot PAGE_KERNEL
14-
1513
#define flush_cache_kmaps() \
1614
do { \
1715
if (cache_is_vivt()) \
@@ -20,9 +18,6 @@
2018

2119
extern pte_t *pkmap_page_table;
2220

23-
extern void *kmap_high(struct page *page);
24-
extern void kunmap_high(struct page *page);
25-
2621
/*
2722
* The reason for kmap_high_get() is to ensure that the currently kmap'd
2823
* page usage count does not decrease to zero while we're using its
@@ -63,10 +58,6 @@ static inline void *kmap_high_get(struct page *page)
6358
* when CONFIG_HIGHMEM is not set.
6459
*/
6560
#ifdef CONFIG_HIGHMEM
66-
extern void *kmap(struct page *page);
67-
extern void kunmap(struct page *page);
68-
extern void *kmap_atomic(struct page *page);
69-
extern void __kunmap_atomic(void *kvaddr);
7061
extern void *kmap_atomic_pfn(unsigned long pfn);
7162
#endif
7263

arch/arm/include/asm/pgtable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#else
1919

20-
#define __ARCH_USE_5LEVEL_HACK
2120
#include <asm-generic/pgtable-nopud.h>
2221
#include <asm/memory.h>
2322
#include <asm/pgtable-hwdef.h>

arch/arm/lib/uaccess_with_memcpy.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp)
2424
{
2525
unsigned long addr = (unsigned long)_addr;
2626
pgd_t *pgd;
27+
p4d_t *p4d;
2728
pmd_t *pmd;
2829
pte_t *pte;
2930
pud_t *pud;
@@ -33,7 +34,11 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp)
3334
if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd)))
3435
return 0;
3536

36-
pud = pud_offset(pgd, addr);
37+
p4d = p4d_offset(pgd, addr);
38+
if (unlikely(p4d_none(*p4d) || p4d_bad(*p4d)))
39+
return 0;
40+
41+
pud = pud_offset(p4d, addr);
3742
if (unlikely(pud_none(*pud) || pud_bad(*pud)))
3843
return 0;
3944

arch/arm/mach-sa1100/assabet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static void __init map_sa1100_gpio_regs( void )
633633
int prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_DOMAIN(DOMAIN_IO);
634634
pmd_t *pmd;
635635

636-
pmd = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
636+
pmd = pmd_offset(pud_offset(p4d_offset(pgd_offset_k(virt), virt), virt), virt);
637637
*pmd = __pmd(phys | prot);
638638
flush_pmd_entry(pmd);
639639
}

arch/arm/mm/dump.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct pg_level {
207207
static struct pg_level pg_level[] = {
208208
{
209209
}, { /* pgd */
210+
}, { /* p4d */
210211
}, { /* pud */
211212
}, { /* pmd */
212213
.bits = section_bits,
@@ -308,7 +309,7 @@ static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start,
308309

309310
for (i = 0; i < PTRS_PER_PTE; i++, pte++) {
310311
addr = start + i * PAGE_SIZE;
311-
note_page(st, addr, 4, pte_val(*pte), domain);
312+
note_page(st, addr, 5, pte_val(*pte), domain);
312313
}
313314
}
314315

@@ -350,14 +351,14 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
350351
addr += SECTION_SIZE;
351352
pmd++;
352353
domain = get_domain_name(pmd);
353-
note_page(st, addr, 3, pmd_val(*pmd), domain);
354+
note_page(st, addr, 4, pmd_val(*pmd), domain);
354355
}
355356
}
356357
}
357358

358-
static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
359+
static void walk_pud(struct pg_state *st, p4d_t *p4d, unsigned long start)
359360
{
360-
pud_t *pud = pud_offset(pgd, 0);
361+
pud_t *pud = pud_offset(p4d, 0);
361362
unsigned long addr;
362363
unsigned i;
363364

@@ -366,7 +367,23 @@ static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
366367
if (!pud_none(*pud)) {
367368
walk_pmd(st, pud, addr);
368369
} else {
369-
note_page(st, addr, 2, pud_val(*pud), NULL);
370+
note_page(st, addr, 3, pud_val(*pud), NULL);
371+
}
372+
}
373+
}
374+
375+
static void walk_p4d(struct pg_state *st, pgd_t *pgd, unsigned long start)
376+
{
377+
p4d_t *p4d = p4d_offset(pgd, 0);
378+
unsigned long addr;
379+
unsigned i;
380+
381+
for (i = 0; i < PTRS_PER_P4D; i++, p4d++) {
382+
addr = start + i * P4D_SIZE;
383+
if (!p4d_none(*p4d)) {
384+
walk_pud(st, p4d, addr);
385+
} else {
386+
note_page(st, addr, 2, p4d_val(*p4d), NULL);
370387
}
371388
}
372389
}
@@ -381,7 +398,7 @@ static void walk_pgd(struct pg_state *st, struct mm_struct *mm,
381398
for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
382399
addr = start + i * PGDIR_SIZE;
383400
if (!pgd_none(*pgd)) {
384-
walk_pud(st, pgd, addr);
401+
walk_p4d(st, pgd, addr);
385402
} else {
386403
note_page(st, addr, 1, pgd_val(*pgd), NULL);
387404
}

0 commit comments

Comments
 (0)