History

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 <akpm@linux-foundation.org>: (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 ...

Linus Torvalds committed 6 years ago

Commit 886d7de2 parents 5bfea2d 469cbd0199 files · +3312 −2163Browse files

Showing the changes to include/linux (9 of 199 files). Show all

Unified · Split

9 files
  1. include/linux/binfmts.h +1 −2
  2. include/linux/bitops.h +1 −1
  3. include/linux/elfnote.h +1 −1
  4. include/linux/highmem.h +75 −6
  5. include/linux/ioport.h +1 −0
  6. include/linux/memory_hotplug.h +2 −7
  7. include/linux/mm.h +3 −9
  8. include/linux/sched.h +3 −0
  9. include/linux/seq_file.h +19 −0
include/linux/binfmts.h+1−2
@@ -130,8 +130,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, · 129 unmodified lines
130130 extern int transfer_args_to_stack(struct linux_binprm *bprm,
131131 unsigned long *sp_location);
132132 extern int bprm_change_interp(const char *interp, struct linux_binprm *bprm);
133−extern int copy_strings_kernel(int argc, const char *const *argv,
134− struct linux_binprm *bprm);
133+int copy_string_kernel(const char *arg, struct linux_binprm *bprm);
135134 extern void set_binfmt(struct linux_binfmt *new);
136135 extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);
137136
include/linux/bitops.h+1−1
@@ -72,7 +72,7 @@ static inline int get_bitmask_order(unsigned int count) · 71 unmodified lines
7272
7373 static __always_inline unsigned long hweight_long(unsigned long w)
7474 {
75− return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
75+ return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w);
7676 }
7777
7878 /**
include/linux/elfnote.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 .popsection ;
5555
5656 #define ELFNOTE(name, type, desc) \
57− ELFNOTE_START(name, type, "") \
57+ ELFNOTE_START(name, type, "a") \
5858 desc ; \
5959 ELFNOTE_END
6060
include/linux/highmem.h+75−6
@@ -32,8 +32,65 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size) · 31 unmodified lines
3232 #include <asm/kmap_types.h>
3333
3434 #ifdef CONFIG_HIGHMEM
35+extern void *kmap_atomic_high_prot(struct page *page, pgprot_t prot);
36+extern void kunmap_atomic_high(void *kvaddr);
3537 #include <asm/highmem.h>
3638
39+#ifndef ARCH_HAS_KMAP_FLUSH_TLB
40+static inline void kmap_flush_tlb(unsigned long addr) { }
41+#endif
42+
43+#ifndef kmap_prot
44+#define kmap_prot PAGE_KERNEL
45+#endif
46+
47+void *kmap_high(struct page *page);
48+static inline void *kmap(struct page *page)
49+{
50+ void *addr;
51+
52+ might_sleep();
53+ if (!PageHighMem(page))
54+ addr = page_address(page);
55+ else
56+ addr = kmap_high(page);
57+ kmap_flush_tlb((unsigned long)addr);
58+ return addr;
59+}
60+
61+void kunmap_high(struct page *page);
62+
63+static inline void kunmap(struct page *page)
64+{
65+ might_sleep();
66+ if (!PageHighMem(page))
67+ return;
68+ kunmap_high(page);
69+}
70+
71+/*
72+ * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
73+ * no global lock is needed and because the kmap code must perform a global TLB
74+ * invalidation when the kmap pool wraps.
75+ *
76+ * However when holding an atomic kmap is is not legal to sleep, so atomic
77+ * kmaps are appropriate for short, tight code paths only.
78+ *
79+ * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
80+ * gives a more generic (and caching) interface. But kmap_atomic can
81+ * be used in IRQ contexts, so in some (very limited) cases we need
82+ * it.
83+ */
84+static inline void *kmap_atomic_prot(struct page *page, pgprot_t prot)
85+{
86+ preempt_disable();
87+ pagefault_disable();
88+ if (!PageHighMem(page))
89+ return page_address(page);
90+ return kmap_atomic_high_prot(page, prot);
91+}
92+#define kmap_atomic(page) kmap_atomic_prot(page, kmap_prot)
93+
3794 /* declarations for linux/mm/highmem.c */
3895 unsigned int nr_free_highpages(void);
3996 extern atomic_long_t _totalhigh_pages;
@@ -77,15 +134,21 @@ static inline struct page *kmap_to_page(void *addr) · 37 unmodified lines
77134
78135 static inline unsigned long totalhigh_pages(void) { return 0UL; }
79136
80−#ifndef ARCH_HAS_KMAP
81137 static inline void *kmap(struct page *page)
82138 {
83139 might_sleep();
84140 return page_address(page);
85141 }
86142
143+static inline void kunmap_high(struct page *page)
144+{
145+}
146+
87147 static inline void kunmap(struct page *page)
88148 {
149+#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
150+ kunmap_flush_on_unmap(page_address(page));
151+#endif
89152 }
90153
91154 static inline void *kmap_atomic(struct page *page)
@@ -96,16 +159,20 @@ static inline void *kmap_atomic(struct page *page) · 4 unmodified lines
96159 }
97160 #define kmap_atomic_prot(page, prot) kmap_atomic(page)
98161
99−static inline void __kunmap_atomic(void *addr)
162+static inline void kunmap_atomic_high(void *addr)
100163 {
101− pagefault_enable();
102− preempt_enable();
164+ /*
165+ * Mostly nothing to do in the CONFIG_HIGHMEM=n case as kunmap_atomic()
166+ * handles re-enabling faults + preemption
167+ */
168+#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
169+ kunmap_flush_on_unmap(addr);
170+#endif
103171 }
104172
105173 #define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
106174
107175 #define kmap_flush_unused() do {} while(0)
108−#endif
109176
110177 #endif /* CONFIG_HIGHMEM */
111178
@@ -149,7 +216,9 @@ static inline void kmap_atomic_idx_pop(void) · 37 unmodified lines
149216 #define kunmap_atomic(addr) \
150217 do { \
151218 BUILD_BUG_ON(__same_type((addr), struct page *)); \
152− __kunmap_atomic(addr); \
219+ kunmap_atomic_high(addr); \
220+ pagefault_enable(); \
221+ preempt_enable(); \
153222 } while (0)
154223
155224
include/linux/ioport.h+1−0
@@ -103,6 +103,7 @@ struct resource { · 102 unmodified lines
103103 #define IORESOURCE_MEM_32BIT (3<<3)
104104 #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
105105 #define IORESOURCE_MEM_EXPANSIONROM (1<<6)
106+#define IORESOURCE_MEM_DRIVER_MANAGED (1<<7)
106107
107108 /* PnP I/O specific bits (IORESOURCE_BITS) */
108109 #define IORESOURCE_IO_16BIT_ADDR (1<<0)
include/linux/memory_hotplug.h+2−7
@@ -314,19 +314,12 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {} · 313 unmodified lines
314314
315315 #ifdef CONFIG_MEMORY_HOTREMOVE
316316
317−extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
318317 extern void try_offline_node(int nid);
319318 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
320319 extern int remove_memory(int nid, u64 start, u64 size);
321320 extern void __remove_memory(int nid, u64 start, u64 size);
322321
323322 #else
324−static inline bool is_mem_section_removable(unsigned long pfn,
325− unsigned long nr_pages)
326−{
327− return false;
328−}
329−
330323 static inline void try_offline_node(int nid) {}
331324
332325 static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
@@ -349,6 +342,8 @@ extern void __ref free_area_init_core_hotplug(int nid); · 16 unmodified lines
349342 extern int __add_memory(int nid, u64 start, u64 size);
350343 extern int add_memory(int nid, u64 start, u64 size);
351344 extern int add_memory_resource(int nid, struct resource *resource);
345+extern int add_memory_driver_managed(int nid, u64 start, u64 size,
346+ const char *resource_name);
352347 extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
353348 unsigned long nr_pages, struct vmem_altmap *altmap);
354349 extern void remove_pfn_range_from_zone(struct zone *zone,
include/linux/mm.h+3−9
@@ -776,6 +776,7 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) · 775 unmodified lines
776776 }
777777
778778 extern void kvfree(const void *addr);
779+extern void kvfree_sensitive(const void *addr, size_t len);
779780
780781 /*
781782 * Mapcount of compound page as a whole, does not include mapped sub-pages.
@@ -1372,7 +1373,7 @@ static inline int cpu_pid_to_cpupid(int nid, int pid) · 590 unmodified lines
13721373
13731374 static inline bool cpupid_pid_unset(int cpupid)
13741375 {
1375− return 1;
1376+ return true;
13761377 }
13771378
13781379 static inline void page_cpupid_reset_last(struct page *page)
@@ -1725,7 +1726,7 @@ struct frame_vector { · 346 unmodified lines
17251726 unsigned int nr_frames; /* Number of frames stored in ptrs array */
17261727 bool got_ref; /* Did we pin pages by getting page ref? */
17271728 bool is_pfns; /* Does array contain pages or pfns? */
1728− void *ptrs[0]; /* Array of pinned pfns / pages. Use
1729+ void *ptrs[]; /* Array of pinned pfns / pages. Use
17291730 * pfns_vector_pages() or pfns_vector_pfns()
17301731 * for access */
17311732 };
@@ -2069,11 +2070,6 @@ int __pte_alloc_kernel(pmd_t *pmd); · 337 unmodified lines
20692070
20702071 #if defined(CONFIG_MMU)
20712072
2072−/*
2073− * The following ifdef needed to get the 5level-fixup.h header to work.
2074− * Remove it when 5level-fixup.h has been removed.
2075− */
2076−#ifndef __ARCH_HAS_5LEVEL_HACK
20772073 static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd,
20782074 unsigned long address)
20792075 {
@@ -2102,8 +2098,6 @@ static inline p4d_t *p4d_alloc_track(struct mm_struct *mm, pgd_t *pgd, · 22 unmodified lines
21022098 return p4d_offset(pgd, address);
21032099 }
21042100
2105−#endif /* !__ARCH_HAS_5LEVEL_HACK */
2106−
21072101 static inline pud_t *pud_alloc_track(struct mm_struct *mm, p4d_t *p4d,
21082102 unsigned long address,
21092103 pgtbl_mod_mask *mod_mask)
include/linux/sched.h+3−0
@@ -1247,6 +1247,9 @@ struct task_struct { · 1246 unmodified lines
12471247
12481248 /* KCOV sequence number: */
12491249 int kcov_sequence;
1250+
1251+ /* Collect coverage from softirq context: */
1252+ unsigned int kcov_softirq;
12501253 #endif
12511254
12521255 #ifdef CONFIG_MEMCG
include/linux/seq_file.h+19−0
@@ -145,6 +145,25 @@ void *__seq_open_private(struct file *, const struct seq_operations *, int); · 144 unmodified lines
145145 int seq_open_private(struct file *, const struct seq_operations *, int);
146146 int seq_release_private(struct inode *, struct file *);
147147
148+#define DEFINE_SEQ_ATTRIBUTE(__name) \
149+static int __name ## _open(struct inode *inode, struct file *file) \
150+{ \
151+ int ret = seq_open(file, &__name ## _sops); \
152+ if (!ret && inode->i_private) { \
153+ struct seq_file *seq_f = file->private_data; \
154+ seq_f->private = inode->i_private; \
155+ } \
156+ return ret; \
157+} \
158+ \
159+static const struct file_operations __name ## _fops = { \
160+ .owner = THIS_MODULE, \
161+ .open = __name ## _open, \
162+ .read = seq_read, \
163+ .llseek = seq_lseek, \
164+ .release = seq_release, \
165+}
166+
148167 #define DEFINE_SHOW_ATTRIBUTE(__name) \
149168 static int __name ## _open(struct inode *inode, struct file *file) \
150169 { \