aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-08-26 03:19:13 -0400
committerIngo Molnar <mingo@kernel.org>2017-08-26 03:19:13 -0400
commit413d63d71b222108d19703f3fd5cf9108652a730 (patch)
tree4680de6aebb6430dc5f3d9327f86d65149e6b5ae /include/linux
parentd6c8103b0265d8db30e20e948a4f06382bbdaea7 (diff)
parent90a6cd503982bfd33ce8c70eb49bd2dd33bc6325 (diff)
Merge branch 'linus' into x86/mm to pick up fixes and to fix conflicts
Conflicts: arch/x86/kernel/head64.c arch/x86/mm/mmap.c Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bpf-cgroup.h2
-rw-r--r--include/linux/bpf_verifier.h1
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/ceph/ceph_features.h8
-rw-r--r--include/linux/ceph/osd_client.h1
-rw-r--r--include/linux/ceph/osdmap.h2
-rw-r--r--include/linux/ceph/rados.h4
-rw-r--r--include/linux/compiler-gcc.h13
-rw-r--r--include/linux/compiler.h5
-rw-r--r--include/linux/cpuhotplug.h2
-rw-r--r--include/linux/cpuset.h19
-rw-r--r--include/linux/cred.h4
-rw-r--r--include/linux/crush/crush.h2
-rw-r--r--include/linux/dax.h1
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/devpts_fs.h10
-rw-r--r--include/linux/dma-fence.h2
-rw-r--r--include/linux/dma-mapping.h40
-rw-r--r--include/linux/fs.h17
-rw-r--r--include/linux/fs_struct.h2
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/iio/common/st_sensors.h7
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/ipv6.h6
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/jhash.h29
-rw-r--r--include/linux/key-type.h4
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kthread.h2
-rw-r--r--include/linux/kvm_host.h7
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/linux/llist.h21
-rw-r--r--include/linux/lsm_hooks.h4
-rw-r--r--include/linux/memblock.h6
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--include/linux/mlx4/device.h11
-rw-r--r--include/linux/mlx5/mlx5_ifc.h10
-rw-r--r--include/linux/mlx5/qp.h1
-rw-r--r--include/linux/mm_types.h70
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h2
-rw-r--r--include/linux/mtd/nand.h6
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netfilter.h9
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_xdr.h2
-rw-r--r--include/linux/nmi.h8
-rw-r--r--include/linux/nvme-fc-driver.h7
-rw-r--r--include/linux/nvme-fc.h19
-rw-r--r--include/linux/nvme.h16
-rw-r--r--include/linux/oom.h22
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/path.h2
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/perf/arm_pmu.h4
-rw-r--r--include/linux/perf_event.h4
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/pid.h4
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/pinconf-generic.h4
-rw-r--r--include/linux/platform_data/hsmmc-omap.h10
-rw-r--r--include/linux/platform_data/st_sensors_pdata.h2
-rw-r--r--include/linux/proc_ns.h2
-rw-r--r--include/linux/ptp_clock_kernel.h20
-rw-r--r--include/linux/ptr_ring.h9
-rw-r--r--include/linux/sched.h67
-rw-r--r--include/linux/sched/signal.h2
-rw-r--r--include/linux/sem.h2
-rw-r--r--include/linux/shm.h2
-rw-r--r--include/linux/skb_array.h3
-rw-r--r--include/linux/sync_file.h3
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/trace_events.h2
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/usb/audio-v2.h14
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/user_namespace.h2
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/uuid.h14
-rw-r--r--include/linux/vfio.h4
-rw-r--r--include/linux/wait.h45
-rw-r--r--include/linux/workqueue.h4
90 files changed, 480 insertions, 227 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index c749eef1daa1..27b4b6615263 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1209,6 +1209,7 @@ static inline bool acpi_has_watchdog(void) { return false; }
1209#endif 1209#endif
1210 1210
1211#ifdef CONFIG_ACPI_SPCR_TABLE 1211#ifdef CONFIG_ACPI_SPCR_TABLE
1212extern bool qdf2400_e44_present;
1212int parse_spcr(bool earlycon); 1213int parse_spcr(bool earlycon);
1213#else 1214#else
1214static inline int parse_spcr(bool earlycon) { return 0; } 1215static inline int parse_spcr(bool earlycon) { return 0; }
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 05488da3aee9..3ae9013eeaaa 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -46,7 +46,7 @@ struct linux_binprm {
46 unsigned interp_flags; 46 unsigned interp_flags;
47 unsigned interp_data; 47 unsigned interp_data;
48 unsigned long loader, exec; 48 unsigned long loader, exec;
49}; 49} __randomize_layout;
50 50
51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) 52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
@@ -81,7 +81,7 @@ struct linux_binfmt {
81 int (*load_shlib)(struct file *); 81 int (*load_shlib)(struct file *);
82 int (*core_dump)(struct coredump_params *cprm); 82 int (*core_dump)(struct coredump_params *cprm);
83 unsigned long min_coredump; /* minimal dump size */ 83 unsigned long min_coredump; /* minimal dump size */
84}; 84} __randomize_layout;
85 85
86extern void __register_binfmt(struct linux_binfmt *fmt, int insert); 86extern void __register_binfmt(struct linux_binfmt *fmt, int insert);
87 87
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 360c082e885c..d41d40ac3efd 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -85,7 +85,7 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
85 int __ret = 0; \ 85 int __ret = 0; \
86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \ 86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \
87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \ 87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \
88 if (sk_fullsock(__sk)) \ 88 if (__sk && sk_fullsock(__sk)) \
89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \ 89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \
90 sock_ops, \ 90 sock_ops, \
91 BPF_CGROUP_SOCK_OPS); \ 91 BPF_CGROUP_SOCK_OPS); \
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 621076f56251..8e5d31f6faef 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -43,6 +43,7 @@ struct bpf_reg_state {
43 u32 min_align; 43 u32 min_align;
44 u32 aux_off; 44 u32 aux_off;
45 u32 aux_off_align; 45 u32 aux_off_align;
46 bool value_from_signed;
46}; 47};
47 48
48enum bpf_stack_slot_type { 49enum bpf_stack_slot_type {
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 408bc09ce497..cb28eb21e3ca 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -17,7 +17,7 @@ struct cdev {
17 struct list_head list; 17 struct list_head list;
18 dev_t dev; 18 dev_t dev;
19 unsigned int count; 19 unsigned int count;
20}; 20} __randomize_layout;
21 21
22void cdev_init(struct cdev *, const struct file_operations *); 22void cdev_init(struct cdev *, const struct file_operations *);
23 23
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index f0f6c537b64c..040dd105c3e7 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -10,14 +10,14 @@
10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL 10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
11 11
12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ 12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \
13 const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ 13 static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \
14 const static uint64_t CEPH_FEATUREMASK_##name = \ 14 static const uint64_t CEPH_FEATUREMASK_##name = \
15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
16 16
17/* this bit is ignored but still advertised by release *when* */ 17/* this bit is ignored but still advertised by release *when* */
18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ 18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
19 const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ 19 static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
20 const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ 20 static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \
21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
22 22
23/* 23/*
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index c6d96a5f46fd..adf670ecaf94 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -148,6 +148,7 @@ struct ceph_osd_request_target {
148 int size; 148 int size;
149 int min_size; 149 int min_size;
150 bool sort_bitwise; 150 bool sort_bitwise;
151 bool recovery_deletes;
151 152
152 unsigned int flags; /* CEPH_OSD_FLAG_* */ 153 unsigned int flags; /* CEPH_OSD_FLAG_* */
153 bool paused; 154 bool paused;
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index a0996cb9faed..af3444a5bfdd 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -272,6 +272,8 @@ bool ceph_is_new_interval(const struct ceph_osds *old_acting,
272 u32 new_pg_num, 272 u32 new_pg_num,
273 bool old_sort_bitwise, 273 bool old_sort_bitwise,
274 bool new_sort_bitwise, 274 bool new_sort_bitwise,
275 bool old_recovery_deletes,
276 bool new_recovery_deletes,
275 const struct ceph_pg *pgid); 277 const struct ceph_pg *pgid);
276bool ceph_osds_changed(const struct ceph_osds *old_acting, 278bool ceph_osds_changed(const struct ceph_osds *old_acting,
277 const struct ceph_osds *new_acting, 279 const struct ceph_osds *new_acting,
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 385db08bb8b2..b8281feda9c7 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -158,6 +158,10 @@ extern const char *ceph_osd_state_name(int s);
158#define CEPH_OSDMAP_NOTIERAGENT (1<<13) /* disable tiering agent */ 158#define CEPH_OSDMAP_NOTIERAGENT (1<<13) /* disable tiering agent */
159#define CEPH_OSDMAP_NOREBALANCE (1<<14) /* block osd backfill unless pg is degraded */ 159#define CEPH_OSDMAP_NOREBALANCE (1<<14) /* block osd backfill unless pg is degraded */
160#define CEPH_OSDMAP_SORTBITWISE (1<<15) /* use bitwise hobject_t sort */ 160#define CEPH_OSDMAP_SORTBITWISE (1<<15) /* use bitwise hobject_t sort */
161#define CEPH_OSDMAP_REQUIRE_JEWEL (1<<16) /* require jewel for booting osds */
162#define CEPH_OSDMAP_REQUIRE_KRAKEN (1<<17) /* require kraken for booting osds */
163#define CEPH_OSDMAP_REQUIRE_LUMINOUS (1<<18) /* require l for booting osds */
164#define CEPH_OSDMAP_RECOVERY_DELETES (1<<19) /* deletes performed during recovery instead of peering */
161 165
162/* 166/*
163 * The error code to return when an OSD can't handle a write 167 * The error code to return when an OSD can't handle a write
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index c28cedde973f..71b86a5d3061 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -237,6 +237,7 @@
237#endif /* GCC_VERSION >= 40500 */ 237#endif /* GCC_VERSION >= 40500 */
238 238
239#if GCC_VERSION >= 40600 239#if GCC_VERSION >= 40600
240
240/* 241/*
241 * When used with Link Time Optimization, gcc can optimize away C functions or 242 * When used with Link Time Optimization, gcc can optimize away C functions or
242 * variables which are referenced only from assembly code. __visible tells the 243 * variables which are referenced only from assembly code. __visible tells the
@@ -244,7 +245,17 @@
244 * this. 245 * this.
245 */ 246 */
246#define __visible __attribute__((externally_visible)) 247#define __visible __attribute__((externally_visible))
247#endif 248
249/*
250 * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only
251 * possible since GCC 4.6. To provide as much build testing coverage
252 * as possible, this is used for all GCC 4.6+ builds, and not just on
253 * RANDSTRUCT_PLUGIN builds.
254 */
255#define randomized_struct_fields_start struct {
256#define randomized_struct_fields_end } __randomize_layout;
257
258#endif /* GCC_VERSION >= 40600 */
248 259
249 260
250#if GCC_VERSION >= 40900 && !defined(__CHECKER__) 261#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 3f8c88e29a46..43cac547f773 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -452,6 +452,11 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
452# define __no_randomize_layout 452# define __no_randomize_layout
453#endif 453#endif
454 454
455#ifndef randomized_struct_fields_start
456# define randomized_struct_fields_start
457# define randomized_struct_fields_end
458#endif
459
455/* 460/*
456 * Tell gcc if a function is cold. The compiler will assume any path 461 * Tell gcc if a function is cold. The compiler will assume any path
457 * directly leading to the call is unlikely. 462 * directly leading to the call is unlikely.
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index b56573bf440d..82b30e638430 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -39,8 +39,6 @@ enum cpuhp_state {
39 CPUHP_PCI_XGENE_DEAD, 39 CPUHP_PCI_XGENE_DEAD,
40 CPUHP_IOMMU_INTEL_DEAD, 40 CPUHP_IOMMU_INTEL_DEAD,
41 CPUHP_LUSTRE_CFS_DEAD, 41 CPUHP_LUSTRE_CFS_DEAD,
42 CPUHP_SCSI_BNX2FC_DEAD,
43 CPUHP_SCSI_BNX2I_DEAD,
44 CPUHP_WORKQUEUE_PREP, 42 CPUHP_WORKQUEUE_PREP,
45 CPUHP_POWER_NUMA_PREPARE, 43 CPUHP_POWER_NUMA_PREPARE,
46 CPUHP_HRTIMERS_PREPARE, 44 CPUHP_HRTIMERS_PREPARE,
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 119a3f9604b0..898cfe2eeb42 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -18,6 +18,19 @@
18 18
19#ifdef CONFIG_CPUSETS 19#ifdef CONFIG_CPUSETS
20 20
21/*
22 * Static branch rewrites can happen in an arbitrary order for a given
23 * key. In code paths where we need to loop with read_mems_allowed_begin() and
24 * read_mems_allowed_retry() to get a consistent view of mems_allowed, we need
25 * to ensure that begin() always gets rewritten before retry() in the
26 * disabled -> enabled transition. If not, then if local irqs are disabled
27 * around the loop, we can deadlock since retry() would always be
28 * comparing the latest value of the mems_allowed seqcount against 0 as
29 * begin() still would see cpusets_enabled() as false. The enabled -> disabled
30 * transition should happen in reverse order for the same reasons (want to stop
31 * looking at real value of mems_allowed.sequence in retry() first).
32 */
33extern struct static_key_false cpusets_pre_enable_key;
21extern struct static_key_false cpusets_enabled_key; 34extern struct static_key_false cpusets_enabled_key;
22static inline bool cpusets_enabled(void) 35static inline bool cpusets_enabled(void)
23{ 36{
@@ -32,12 +45,14 @@ static inline int nr_cpusets(void)
32 45
33static inline void cpuset_inc(void) 46static inline void cpuset_inc(void)
34{ 47{
48 static_branch_inc(&cpusets_pre_enable_key);
35 static_branch_inc(&cpusets_enabled_key); 49 static_branch_inc(&cpusets_enabled_key);
36} 50}
37 51
38static inline void cpuset_dec(void) 52static inline void cpuset_dec(void)
39{ 53{
40 static_branch_dec(&cpusets_enabled_key); 54 static_branch_dec(&cpusets_enabled_key);
55 static_branch_dec(&cpusets_pre_enable_key);
41} 56}
42 57
43extern int cpuset_init(void); 58extern int cpuset_init(void);
@@ -115,7 +130,7 @@ extern void cpuset_print_current_mems_allowed(void);
115 */ 130 */
116static inline unsigned int read_mems_allowed_begin(void) 131static inline unsigned int read_mems_allowed_begin(void)
117{ 132{
118 if (!cpusets_enabled()) 133 if (!static_branch_unlikely(&cpusets_pre_enable_key))
119 return 0; 134 return 0;
120 135
121 return read_seqcount_begin(&current->mems_allowed_seq); 136 return read_seqcount_begin(&current->mems_allowed_seq);
@@ -129,7 +144,7 @@ static inline unsigned int read_mems_allowed_begin(void)
129 */ 144 */
130static inline bool read_mems_allowed_retry(unsigned int seq) 145static inline bool read_mems_allowed_retry(unsigned int seq)
131{ 146{
132 if (!cpusets_enabled()) 147 if (!static_branch_unlikely(&cpusets_enabled_key))
133 return false; 148 return false;
134 149
135 return read_seqcount_retry(&current->mems_allowed_seq, seq); 150 return read_seqcount_retry(&current->mems_allowed_seq, seq);
diff --git a/include/linux/cred.h b/include/linux/cred.h
index c728d515e5e2..099058e1178b 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -31,7 +31,7 @@ struct group_info {
31 atomic_t usage; 31 atomic_t usage;
32 int ngroups; 32 int ngroups;
33 kgid_t gid[0]; 33 kgid_t gid[0];
34}; 34} __randomize_layout;
35 35
36/** 36/**
37 * get_group_info - Get a reference to a group info structure 37 * get_group_info - Get a reference to a group info structure
@@ -145,7 +145,7 @@ struct cred {
145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ 145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
146 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 146 struct group_info *group_info; /* supplementary groups for euid/fsgid */
147 struct rcu_head rcu; /* RCU deletion hook */ 147 struct rcu_head rcu; /* RCU deletion hook */
148}; 148} __randomize_layout;
149 149
150extern void __put_cred(struct cred *); 150extern void __put_cred(struct cred *);
151extern void exit_creds(struct task_struct *); 151extern void exit_creds(struct task_struct *);
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 92e165d417a6..07eed95e10c7 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -193,7 +193,7 @@ struct crush_choose_arg {
193struct crush_choose_arg_map { 193struct crush_choose_arg_map {
194#ifdef __KERNEL__ 194#ifdef __KERNEL__
195 struct rb_node node; 195 struct rb_node node;
196 u64 choose_args_index; 196 s64 choose_args_index;
197#endif 197#endif
198 struct crush_choose_arg *args; /*!< replacement for each bucket 198 struct crush_choose_arg *args; /*!< replacement for each bucket
199 in the crushmap */ 199 in the crushmap */
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 794811875732..df97b7af7e2c 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -87,6 +87,7 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
87void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 87void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
88 size_t size); 88 size_t size);
89void dax_write_cache(struct dax_device *dax_dev, bool wc); 89void dax_write_cache(struct dax_device *dax_dev, bool wc);
90bool dax_write_cache_enabled(struct dax_device *dax_dev);
90 91
91/* 92/*
92 * We use lowest available bit in exceptional entry for locking, one bit for 93 * We use lowest available bit in exceptional entry for locking, one bit for
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3f3ff4ccdc3f..aae1cdb76851 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -118,7 +118,7 @@ struct dentry {
118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ 118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */
119 struct rcu_head d_rcu; 119 struct rcu_head d_rcu;
120 } d_u; 120 } d_u;
121}; 121} __randomize_layout;
122 122
123/* 123/*
124 * dentry->d_lock spinlock nesting subclasses: 124 * dentry->d_lock spinlock nesting subclasses:
diff --git a/include/linux/device.h b/include/linux/device.h
index 723cd54b94da..beabdbc08420 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -843,7 +843,7 @@ struct dev_links_info {
843 * hibernation, system resume and during runtime PM transitions 843 * hibernation, system resume and during runtime PM transitions
844 * along with subsystem-level and driver-level callbacks. 844 * along with subsystem-level and driver-level callbacks.
845 * @pins: For device pin management. 845 * @pins: For device pin management.
846 * See Documentation/pinctrl.txt for details. 846 * See Documentation/driver-api/pinctl.rst for details.
847 * @msi_list: Hosts MSI descriptors 847 * @msi_list: Hosts MSI descriptors
848 * @msi_domain: The generic MSI domain this device is using. 848 * @msi_domain: The generic MSI domain this device is using.
849 * @numa_node: NUMA node this device is close to. 849 * @numa_node: NUMA node this device is close to.
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index 277ab9af9ac2..100cb4343763 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -19,6 +19,7 @@
19 19
20struct pts_fs_info; 20struct pts_fs_info;
21 21
22struct vfsmount *devpts_mntget(struct file *, struct pts_fs_info *);
22struct pts_fs_info *devpts_acquire(struct file *); 23struct pts_fs_info *devpts_acquire(struct file *);
23void devpts_release(struct pts_fs_info *); 24void devpts_release(struct pts_fs_info *);
24 25
@@ -32,6 +33,15 @@ void *devpts_get_priv(struct dentry *);
32/* unlink */ 33/* unlink */
33void devpts_pty_kill(struct dentry *); 34void devpts_pty_kill(struct dentry *);
34 35
36/* in pty.c */
37int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags);
38
39#else
40static inline int
41ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
42{
43 return -EIO;
44}
35#endif 45#endif
36 46
37 47
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index a5195a7d6f77..0a186c4f3981 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -55,6 +55,7 @@ struct dma_fence_cb;
55 * of the time. 55 * of the time.
56 * 56 *
57 * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled 57 * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled
58 * DMA_FENCE_FLAG_TIMESTAMP_BIT - timestamp recorded for fence signaling
58 * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called 59 * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called
59 * DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the 60 * DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
60 * implementer of the fence for its own purposes. Can be used in different 61 * implementer of the fence for its own purposes. Can be used in different
@@ -84,6 +85,7 @@ struct dma_fence {
84 85
85enum dma_fence_flag_bits { 86enum dma_fence_flag_bits {
86 DMA_FENCE_FLAG_SIGNALED_BIT, 87 DMA_FENCE_FLAG_SIGNALED_BIT,
88 DMA_FENCE_FLAG_TIMESTAMP_BIT,
87 DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, 89 DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
88 DMA_FENCE_FLAG_USER_BITS, /* must always be last member */ 90 DMA_FENCE_FLAG_USER_BITS, /* must always be last member */
89}; 91};
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index fce2369ecf82..2189c79cde5d 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -158,16 +158,40 @@ static inline int is_device_dma_capable(struct device *dev)
158 * These three functions are only for dma allocator. 158 * These three functions are only for dma allocator.
159 * Don't use them in device drivers. 159 * Don't use them in device drivers.
160 */ 160 */
161int dma_alloc_from_coherent(struct device *dev, ssize_t size, 161int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
162 dma_addr_t *dma_handle, void **ret); 162 dma_addr_t *dma_handle, void **ret);
163int dma_release_from_coherent(struct device *dev, int order, void *vaddr); 163int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr);
164 164
165int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, 165int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
166 void *cpu_addr, size_t size, int *ret); 166 void *cpu_addr, size_t size, int *ret);
167
168void *dma_alloc_from_global_coherent(ssize_t size, dma_addr_t *dma_handle);
169int dma_release_from_global_coherent(int order, void *vaddr);
170int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
171 size_t size, int *ret);
172
167#else 173#else
168#define dma_alloc_from_coherent(dev, size, handle, ret) (0) 174#define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
169#define dma_release_from_coherent(dev, order, vaddr) (0) 175#define dma_release_from_dev_coherent(dev, order, vaddr) (0)
170#define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0) 176#define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
177
178static inline void *dma_alloc_from_global_coherent(ssize_t size,
179 dma_addr_t *dma_handle)
180{
181 return NULL;
182}
183
184static inline int dma_release_from_global_coherent(int order, void *vaddr)
185{
186 return 0;
187}
188
189static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
190 void *cpu_addr, size_t size,
191 int *ret)
192{
193 return 0;
194}
171#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ 195#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
172 196
173#ifdef CONFIG_HAS_DMA 197#ifdef CONFIG_HAS_DMA
@@ -482,7 +506,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
482 506
483 BUG_ON(!ops); 507 BUG_ON(!ops);
484 508
485 if (dma_alloc_from_coherent(dev, size, dma_handle, &cpu_addr)) 509 if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
486 return cpu_addr; 510 return cpu_addr;
487 511
488 if (!arch_dma_alloc_attrs(&dev, &flag)) 512 if (!arch_dma_alloc_attrs(&dev, &flag))
@@ -504,7 +528,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
504 BUG_ON(!ops); 528 BUG_ON(!ops);
505 WARN_ON(irqs_disabled()); 529 WARN_ON(irqs_disabled());
506 530
507 if (dma_release_from_coherent(dev, get_order(size), cpu_addr)) 531 if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr))
508 return; 532 return;
509 533
510 if (!ops->free || !cpu_addr) 534 if (!ops->free || !cpu_addr)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7b5d6816542b..6e1fd5d21248 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -296,7 +296,7 @@ struct kiocb {
296 void *private; 296 void *private;
297 int ki_flags; 297 int ki_flags;
298 enum rw_hint ki_hint; 298 enum rw_hint ki_hint;
299}; 299} __randomize_layout;
300 300
301static inline bool is_sync_kiocb(struct kiocb *kiocb) 301static inline bool is_sync_kiocb(struct kiocb *kiocb)
302{ 302{
@@ -404,7 +404,7 @@ struct address_space {
404 struct list_head private_list; /* ditto */ 404 struct list_head private_list; /* ditto */
405 void *private_data; /* ditto */ 405 void *private_data; /* ditto */
406 errseq_t wb_err; 406 errseq_t wb_err;
407} __attribute__((aligned(sizeof(long)))); 407} __attribute__((aligned(sizeof(long)))) __randomize_layout;
408 /* 408 /*
409 * On most architectures that alignment is already the case; but 409 * On most architectures that alignment is already the case; but
410 * must be enforced here for CRIS, to let the least significant bit 410 * must be enforced here for CRIS, to let the least significant bit
@@ -447,7 +447,7 @@ struct block_device {
447 int bd_fsfreeze_count; 447 int bd_fsfreeze_count;
448 /* Mutex for freeze */ 448 /* Mutex for freeze */
449 struct mutex bd_fsfreeze_mutex; 449 struct mutex bd_fsfreeze_mutex;
450}; 450} __randomize_layout;
451 451
452/* 452/*
453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
@@ -666,7 +666,7 @@ struct inode {
666#endif 666#endif
667 667
668 void *i_private; /* fs or device private pointer */ 668 void *i_private; /* fs or device private pointer */
669}; 669} __randomize_layout;
670 670
671static inline unsigned int i_blocksize(const struct inode *node) 671static inline unsigned int i_blocksize(const struct inode *node)
672{ 672{
@@ -883,7 +883,8 @@ struct file {
883#endif /* #ifdef CONFIG_EPOLL */ 883#endif /* #ifdef CONFIG_EPOLL */
884 struct address_space *f_mapping; 884 struct address_space *f_mapping;
885 errseq_t f_wb_err; 885 errseq_t f_wb_err;
886} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 886} __randomize_layout
887 __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
887 888
888struct file_handle { 889struct file_handle {
889 __u32 handle_bytes; 890 __u32 handle_bytes;
@@ -1020,7 +1021,7 @@ struct file_lock {
1020 int state; /* state of grant or error if -ve */ 1021 int state; /* state of grant or error if -ve */
1021 } afs; 1022 } afs;
1022 } fl_u; 1023 } fl_u;
1023}; 1024} __randomize_layout;
1024 1025
1025struct file_lock_context { 1026struct file_lock_context {
1026 spinlock_t flc_lock; 1027 spinlock_t flc_lock;
@@ -1412,7 +1413,7 @@ struct super_block {
1412 1413
1413 spinlock_t s_inode_wblist_lock; 1414 spinlock_t s_inode_wblist_lock;
1414 struct list_head s_inodes_wb; /* writeback inodes */ 1415 struct list_head s_inodes_wb; /* writeback inodes */
1415}; 1416} __randomize_layout;
1416 1417
1417/* Helper functions so that in most cases filesystems will 1418/* Helper functions so that in most cases filesystems will
1418 * not need to deal directly with kuid_t and kgid_t and can 1419 * not need to deal directly with kuid_t and kgid_t and can
@@ -1698,7 +1699,7 @@ struct file_operations {
1698 u64); 1699 u64);
1699 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *, 1700 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *,
1700 u64); 1701 u64);
1701}; 1702} __randomize_layout;
1702 1703
1703struct inode_operations { 1704struct inode_operations {
1704 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); 1705 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 0efc3e62843a..7a026240cbb1 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -12,7 +12,7 @@ struct fs_struct {
12 int umask; 12 int umask;
13 int in_exec; 13 int in_exec;
14 struct path root, pwd; 14 struct path root, pwd;
15}; 15} __randomize_layout;
16 16
17extern struct kmem_cache *fs_cachep; 17extern struct kmem_cache *fs_cachep;
18 18
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 5857390ac35a..6383115e9d2c 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -145,8 +145,8 @@ enum {
145#ifdef CONFIG_DYNAMIC_FTRACE 145#ifdef CONFIG_DYNAMIC_FTRACE
146/* The hash used to know what functions callbacks trace */ 146/* The hash used to know what functions callbacks trace */
147struct ftrace_ops_hash { 147struct ftrace_ops_hash {
148 struct ftrace_hash *notrace_hash; 148 struct ftrace_hash __rcu *notrace_hash;
149 struct ftrace_hash *filter_hash; 149 struct ftrace_hash __rcu *filter_hash;
150 struct mutex regex_lock; 150 struct mutex regex_lock;
151}; 151};
152 152
@@ -168,7 +168,7 @@ static inline void ftrace_free_init_mem(void) { }
168 */ 168 */
169struct ftrace_ops { 169struct ftrace_ops {
170 ftrace_func_t func; 170 ftrace_func_t func;
171 struct ftrace_ops *next; 171 struct ftrace_ops __rcu *next;
172 unsigned long flags; 172 unsigned long flags;
173 void *private; 173 void *private;
174 ftrace_func_t saved_func; 174 ftrace_func_t saved_func;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 00ca5b86a753..d501d3956f13 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -689,7 +689,8 @@ i2c_unlock_adapter(struct i2c_adapter *adapter)
689#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 689#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
690#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 690#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
691#define I2C_CLASS_SPD (1<<7) /* Memory modules */ 691#define I2C_CLASS_SPD (1<<7) /* Memory modules */
692#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */ 692/* Warn users that the adapter doesn't support classes anymore */
693#define I2C_CLASS_DEPRECATED (1<<8)
693 694
694/* Internal numbers to terminate lists */ 695/* Internal numbers to terminate lists */
695#define I2C_CLIENT_END 0xfffeU 696#define I2C_CLIENT_END 0xfffeU
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 497f2b3a5a62..97f1b465d04f 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -105,6 +105,11 @@ struct st_sensor_fullscale {
105 struct st_sensor_fullscale_avl fs_avl[ST_SENSORS_FULLSCALE_AVL_MAX]; 105 struct st_sensor_fullscale_avl fs_avl[ST_SENSORS_FULLSCALE_AVL_MAX];
106}; 106};
107 107
108struct st_sensor_sim {
109 u8 addr;
110 u8 value;
111};
112
108/** 113/**
109 * struct st_sensor_bdu - ST sensor device block data update 114 * struct st_sensor_bdu - ST sensor device block data update
110 * @addr: address of the register. 115 * @addr: address of the register.
@@ -197,6 +202,7 @@ struct st_sensor_transfer_function {
197 * @bdu: Block data update register. 202 * @bdu: Block data update register.
198 * @das: Data Alignment Selection register. 203 * @das: Data Alignment Selection register.
199 * @drdy_irq: Data ready register of the sensor. 204 * @drdy_irq: Data ready register of the sensor.
205 * @sim: SPI serial interface mode register of the sensor.
200 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read. 206 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
201 * @bootime: samples to discard when sensor passing from power-down to power-up. 207 * @bootime: samples to discard when sensor passing from power-down to power-up.
202 */ 208 */
@@ -213,6 +219,7 @@ struct st_sensor_settings {
213 struct st_sensor_bdu bdu; 219 struct st_sensor_bdu bdu;
214 struct st_sensor_das das; 220 struct st_sensor_das das;
215 struct st_sensor_data_ready_irq drdy_irq; 221 struct st_sensor_data_ready_irq drdy_irq;
222 struct st_sensor_sim sim;
216 bool multi_read_bit; 223 bool multi_read_bit;
217 unsigned int bootime; 224 unsigned int bootime;
218}; 225};
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 5591f055e13f..fadd579d577d 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -23,6 +23,6 @@ struct kern_ipc_perm {
23 23
24 struct rcu_head rcu; 24 struct rcu_head rcu;
25 atomic_t refcount; 25 atomic_t refcount;
26} ____cacheline_aligned_in_smp; 26} ____cacheline_aligned_in_smp __randomize_layout;
27 27
28#endif /* _LINUX_IPC_H */ 28#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 848e5796400e..65327ee0936b 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -61,7 +61,7 @@ struct ipc_namespace {
61 struct ucounts *ucounts; 61 struct ucounts *ucounts;
62 62
63 struct ns_common ns; 63 struct ns_common ns;
64}; 64} __randomize_layout;
65 65
66extern struct ipc_namespace init_ipc_ns; 66extern struct ipc_namespace init_ipc_ns;
67extern spinlock_t mq_lock; 67extern spinlock_t mq_lock;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e1b442996f81..474d6bbc158c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -128,6 +128,7 @@ struct inet6_skb_parm {
128#define IP6SKB_FRAGMENTED 16 128#define IP6SKB_FRAGMENTED 16
129#define IP6SKB_HOPBYHOP 32 129#define IP6SKB_HOPBYHOP 32
130#define IP6SKB_L3SLAVE 64 130#define IP6SKB_L3SLAVE 64
131#define IP6SKB_JUMBOGRAM 128
131}; 132};
132 133
133#if defined(CONFIG_NET_L3_MASTER_DEV) 134#if defined(CONFIG_NET_L3_MASTER_DEV)
@@ -152,6 +153,11 @@ static inline int inet6_iif(const struct sk_buff *skb)
152 return l3_slave ? skb->skb_iif : IP6CB(skb)->iif; 153 return l3_slave ? skb->skb_iif : IP6CB(skb)->iif;
153} 154}
154 155
156static inline bool inet6_is_jumbogram(const struct sk_buff *skb)
157{
158 return !!(IP6CB(skb)->flags & IP6SKB_JUMBOGRAM);
159}
160
155/* can not be used in TCP layer after tcp_v6_fill_cb */ 161/* can not be used in TCP layer after tcp_v6_fill_cb */
156static inline bool inet6_exact_dif_match(struct net *net, struct sk_buff *skb) 162static inline bool inet6_exact_dif_match(struct net *net, struct sk_buff *skb)
157{ 163{
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 00db35b61e9e..d2d543794093 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -388,7 +388,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
388 * @irq_mask_ack: ack and mask an interrupt source 388 * @irq_mask_ack: ack and mask an interrupt source
389 * @irq_unmask: unmask an interrupt source 389 * @irq_unmask: unmask an interrupt source
390 * @irq_eoi: end of interrupt 390 * @irq_eoi: end of interrupt
391 * @irq_set_affinity: set the CPU affinity on SMP machines 391 * @irq_set_affinity: Set the CPU affinity on SMP machines. If the force
392 * argument is true, it tells the driver to
393 * unconditionally apply the affinity setting. Sanity
394 * checks against the supplied affinity mask are not
395 * required. This is used for CPU hotplug where the
396 * target CPU is not yet set in the cpu_online_mask.
392 * @irq_retrigger: resend an IRQ to the CPU 397 * @irq_retrigger: resend an IRQ to the CPU
393 * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ 398 * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
394 * @irq_set_wake: enable/disable power-management wake-on of an IRQ 399 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 348c6f47e4cc..8037850f3104 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
85 k += 12; 85 k += 12;
86 } 86 }
87 /* Last block: affect all 32 bits of (c) */ 87 /* Last block: affect all 32 bits of (c) */
88 /* All the case statements fall through */
89 switch (length) { 88 switch (length) {
90 case 12: c += (u32)k[11]<<24; 89 case 12: c += (u32)k[11]<<24; /* fall through */
91 case 11: c += (u32)k[10]<<16; 90 case 11: c += (u32)k[10]<<16; /* fall through */
92 case 10: c += (u32)k[9]<<8; 91 case 10: c += (u32)k[9]<<8; /* fall through */
93 case 9: c += k[8]; 92 case 9: c += k[8]; /* fall through */
94 case 8: b += (u32)k[7]<<24; 93 case 8: b += (u32)k[7]<<24; /* fall through */
95 case 7: b += (u32)k[6]<<16; 94 case 7: b += (u32)k[6]<<16; /* fall through */
96 case 6: b += (u32)k[5]<<8; 95 case 6: b += (u32)k[5]<<8; /* fall through */
97 case 5: b += k[4]; 96 case 5: b += k[4]; /* fall through */
98 case 4: a += (u32)k[3]<<24; 97 case 4: a += (u32)k[3]<<24; /* fall through */
99 case 3: a += (u32)k[2]<<16; 98 case 3: a += (u32)k[2]<<16; /* fall through */
100 case 2: a += (u32)k[1]<<8; 99 case 2: a += (u32)k[1]<<8; /* fall through */
101 case 1: a += k[0]; 100 case 1: a += k[0];
102 __jhash_final(a, b, c); 101 __jhash_final(a, b, c);
103 case 0: /* Nothing left to add */ 102 case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
131 k += 3; 130 k += 3;
132 } 131 }
133 132
134 /* Handle the last 3 u32's: all the case statements fall through */ 133 /* Handle the last 3 u32's */
135 switch (length) { 134 switch (length) {
136 case 3: c += k[2]; 135 case 3: c += k[2]; /* fall through */
137 case 2: b += k[1]; 136 case 2: b += k[1]; /* fall through */
138 case 1: a += k[0]; 137 case 1: a += k[0];
139 __jhash_final(a, b, c); 138 __jhash_final(a, b, c);
140 case 0: /* Nothing left to add */ 139 case 0: /* Nothing left to add */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 8496cf64575c..9520fc3c3b9a 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -45,7 +45,7 @@ struct key_preparsed_payload {
45 size_t datalen; /* Raw datalen */ 45 size_t datalen; /* Raw datalen */
46 size_t quotalen; /* Quota length for proposed payload */ 46 size_t quotalen; /* Quota length for proposed payload */
47 time_t expiry; /* Expiry time of key */ 47 time_t expiry; /* Expiry time of key */
48}; 48} __randomize_layout;
49 49
50typedef int (*request_key_actor_t)(struct key_construction *key, 50typedef int (*request_key_actor_t)(struct key_construction *key,
51 const char *op, void *aux); 51 const char *op, void *aux);
@@ -158,7 +158,7 @@ struct key_type {
158 /* internal fields */ 158 /* internal fields */
159 struct list_head link; /* link in types list */ 159 struct list_head link; /* link in types list */
160 struct lock_class_key lock_class; /* key->sem lock class */ 160 struct lock_class_key lock_class; /* key->sem lock class */
161}; 161} __randomize_layout;
162 162
163extern struct key_type key_type_keyring; 163extern struct key_type key_type_keyring;
164 164
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index c4e441e00db5..655082c88fd9 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -64,7 +64,7 @@ struct subprocess_info {
64 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
65 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
66 void *data; 66 void *data;
67}; 67} __randomize_layout;
68 68
69extern int 69extern int
70call_usermodehelper(const char *path, char **argv, char **envp, int wait); 70call_usermodehelper(const char *path, char **argv, char **envp, int wait);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index eeab34b0f589..4d800c79475a 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -172,7 +172,7 @@ struct kset {
172 spinlock_t list_lock; 172 spinlock_t list_lock;
173 struct kobject kobj; 173 struct kobject kobj;
174 const struct kset_uevent_ops *uevent_ops; 174 const struct kset_uevent_ops *uevent_ops;
175}; 175} __randomize_layout;
176 176
177extern void kset_init(struct kset *kset); 177extern void kset_init(struct kset *kset);
178extern int __must_check kset_register(struct kset *kset); 178extern int __must_check kset_register(struct kset *kset);
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 4fec8b775895..82e197eeac91 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -15,7 +15,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
15 * @threadfn: the function to run in the thread 15 * @threadfn: the function to run in the thread
16 * @data: data pointer for @threadfn() 16 * @data: data pointer for @threadfn()
17 * @namefmt: printf-style format string for the thread name 17 * @namefmt: printf-style format string for the thread name
18 * @...: arguments for @namefmt. 18 * @arg...: arguments for @namefmt.
19 * 19 *
20 * This macro will create a kthread on the current node, leaving it in 20 * This macro will create a kthread on the current node, leaving it in
21 * the stopped state. This is just a helper for kthread_create_on_node(); 21 * the stopped state. This is just a helper for kthread_create_on_node();
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 648b34cabb38..21a6fd6c44af 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -445,6 +445,7 @@ struct kvm {
445 struct kvm_stat_data **debugfs_stat_data; 445 struct kvm_stat_data **debugfs_stat_data;
446 struct srcu_struct srcu; 446 struct srcu_struct srcu;
447 struct srcu_struct irq_srcu; 447 struct srcu_struct irq_srcu;
448 pid_t userspace_pid;
448}; 449};
449 450
450#define kvm_err(fmt, ...) \ 451#define kvm_err(fmt, ...) \
@@ -476,7 +477,8 @@ struct kvm {
476static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) 477static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx)
477{ 478{
478 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu, 479 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu,
479 lockdep_is_held(&kvm->slots_lock)); 480 lockdep_is_held(&kvm->slots_lock) ||
481 !refcount_read(&kvm->users_count));
480} 482}
481 483
482static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) 484static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
@@ -569,7 +571,8 @@ void kvm_put_kvm(struct kvm *kvm);
569static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) 571static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
570{ 572{
571 return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu, 573 return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu,
572 lockdep_is_held(&kvm->slots_lock)); 574 lockdep_is_held(&kvm->slots_lock) ||
575 !refcount_read(&kvm->users_count));
573} 576}
574 577
575static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 578static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 55de3da58b1c..931c32f1f18d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -435,7 +435,7 @@ enum {
435 ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ 435 ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */
436 ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ 436 ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */
437 ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ 437 ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */
438 ATA_HORKAGE_NO_NCQ_LOG = (1 << 23), /* don't use NCQ for log read */ 438 ATA_HORKAGE_NO_DMA_LOG = (1 << 23), /* don't use DMA for log read */
439 ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ 439 ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
440 ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ 440 ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */
441 441
diff --git a/include/linux/llist.h b/include/linux/llist.h
index d11738110a7a..1957635e6d5f 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -93,6 +93,23 @@ static inline void init_llist_head(struct llist_head *list)
93 container_of(ptr, type, member) 93 container_of(ptr, type, member)
94 94
95/** 95/**
96 * member_address_is_nonnull - check whether the member address is not NULL
97 * @ptr: the object pointer (struct type * that contains the llist_node)
98 * @member: the name of the llist_node within the struct.
99 *
100 * This macro is conceptually the same as
101 * &ptr->member != NULL
102 * but it works around the fact that compilers can decide that taking a member
103 * address is never a NULL pointer.
104 *
105 * Real objects that start at a high address and have a member at NULL are
106 * unlikely to exist, but such pointers may be returned e.g. by the
107 * container_of() macro.
108 */
109#define member_address_is_nonnull(ptr, member) \
110 ((uintptr_t)(ptr) + offsetof(typeof(*(ptr)), member) != 0)
111
112/**
96 * llist_for_each - iterate over some deleted entries of a lock-less list 113 * llist_for_each - iterate over some deleted entries of a lock-less list
97 * @pos: the &struct llist_node to use as a loop cursor 114 * @pos: the &struct llist_node to use as a loop cursor
98 * @node: the first entry of deleted list entries 115 * @node: the first entry of deleted list entries
@@ -145,7 +162,7 @@ static inline void init_llist_head(struct llist_head *list)
145 */ 162 */
146#define llist_for_each_entry(pos, node, member) \ 163#define llist_for_each_entry(pos, node, member) \
147 for ((pos) = llist_entry((node), typeof(*(pos)), member); \ 164 for ((pos) = llist_entry((node), typeof(*(pos)), member); \
148 &(pos)->member != NULL; \ 165 member_address_is_nonnull(pos, member); \
149 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 166 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
150 167
151/** 168/**
@@ -167,7 +184,7 @@ static inline void init_llist_head(struct llist_head *list)
167 */ 184 */
168#define llist_for_each_entry_safe(pos, n, node, member) \ 185#define llist_for_each_entry_safe(pos, n, node, member) \
169 for (pos = llist_entry((node), typeof(*pos), member); \ 186 for (pos = llist_entry((node), typeof(*pos), member); \
170 &pos->member != NULL && \ 187 member_address_is_nonnull(pos, member) && \
171 (n = llist_entry(pos->member.next, typeof(*n), member), true); \ 188 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
172 pos = n) 189 pos = n)
173 190
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 7a86925ba8f3..3a90febadbe2 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1912,7 +1912,7 @@ struct security_hook_heads {
1912 struct list_head audit_rule_match; 1912 struct list_head audit_rule_match;
1913 struct list_head audit_rule_free; 1913 struct list_head audit_rule_free;
1914#endif /* CONFIG_AUDIT */ 1914#endif /* CONFIG_AUDIT */
1915}; 1915} __randomize_layout;
1916 1916
1917/* 1917/*
1918 * Security module hook list structure. 1918 * Security module hook list structure.
@@ -1923,7 +1923,7 @@ struct security_hook_list {
1923 struct list_head *head; 1923 struct list_head *head;
1924 union security_list_options hook; 1924 union security_list_options hook;
1925 char *lsm; 1925 char *lsm;
1926}; 1926} __randomize_layout;
1927 1927
1928/* 1928/*
1929 * Initializing a security_hook_list structure takes 1929 * Initializing a security_hook_list structure takes
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 77d427974f57..bae11c7e7bf3 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -61,6 +61,7 @@ extern int memblock_debug;
61#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK 61#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
62#define __init_memblock __meminit 62#define __init_memblock __meminit
63#define __initdata_memblock __meminitdata 63#define __initdata_memblock __meminitdata
64void memblock_discard(void);
64#else 65#else
65#define __init_memblock 66#define __init_memblock
66#define __initdata_memblock 67#define __initdata_memblock
@@ -74,8 +75,6 @@ phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align,
74 int nid, ulong flags); 75 int nid, ulong flags);
75phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, 76phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
76 phys_addr_t size, phys_addr_t align); 77 phys_addr_t size, phys_addr_t align);
77phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr);
78phys_addr_t get_allocated_memblock_memory_regions_info(phys_addr_t *addr);
79void memblock_allow_resize(void); 78void memblock_allow_resize(void);
80int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); 79int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
81int memblock_add(phys_addr_t base, phys_addr_t size); 80int memblock_add(phys_addr_t base, phys_addr_t size);
@@ -110,6 +109,9 @@ void __next_mem_range_rev(u64 *idx, int nid, ulong flags,
110void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start, 109void __next_reserved_mem_region(u64 *idx, phys_addr_t *out_start,
111 phys_addr_t *out_end); 110 phys_addr_t *out_end);
112 111
112void __memblock_free_early(phys_addr_t base, phys_addr_t size);
113void __memblock_free_late(phys_addr_t base, phys_addr_t size);
114
113/** 115/**
114 * for_each_mem_range - iterate through memblock areas from type_a and not 116 * for_each_mem_range - iterate through memblock areas from type_a and not
115 * included in type_b. Or just type_a if type_b is NULL. 117 * included in type_b. Or just type_a if type_b is NULL.
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3914e3dd6168..9b15a4bcfa77 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -484,7 +484,8 @@ bool mem_cgroup_oom_synchronize(bool wait);
484extern int do_swap_account; 484extern int do_swap_account;
485#endif 485#endif
486 486
487void lock_page_memcg(struct page *page); 487struct mem_cgroup *lock_page_memcg(struct page *page);
488void __unlock_page_memcg(struct mem_cgroup *memcg);
488void unlock_page_memcg(struct page *page); 489void unlock_page_memcg(struct page *page);
489 490
490static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, 491static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
@@ -809,7 +810,12 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
809{ 810{
810} 811}
811 812
812static inline void lock_page_memcg(struct page *page) 813static inline struct mem_cgroup *lock_page_memcg(struct page *page)
814{
815 return NULL;
816}
817
818static inline void __unlock_page_memcg(struct mem_cgroup *memcg)
813{ 819{
814} 820}
815 821
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index d5bed0875d30..b54517c05e9a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -620,6 +620,7 @@ struct mlx4_caps {
620 u32 dmfs_high_rate_qpn_base; 620 u32 dmfs_high_rate_qpn_base;
621 u32 dmfs_high_rate_qpn_range; 621 u32 dmfs_high_rate_qpn_range;
622 u32 vf_caps; 622 u32 vf_caps;
623 bool wol_port[MLX4_MAX_PORTS + 1];
623 struct mlx4_rate_limit_caps rl_caps; 624 struct mlx4_rate_limit_caps rl_caps;
624}; 625};
625 626
@@ -1068,7 +1069,7 @@ static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1068} 1069}
1069 1070
1070int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1071int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
1071 struct mlx4_buf *buf, gfp_t gfp); 1072 struct mlx4_buf *buf);
1072void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1073void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
1073static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 1074static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
1074{ 1075{
@@ -1105,10 +1106,9 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
1105int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1106int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1106 int start_index, int npages, u64 *page_list); 1107 int start_index, int npages, u64 *page_list);
1107int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1108int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1108 struct mlx4_buf *buf, gfp_t gfp); 1109 struct mlx4_buf *buf);
1109 1110
1110int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, 1111int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order);
1111 gfp_t gfp);
1112void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 1112void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
1113 1113
1114int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 1114int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
@@ -1124,8 +1124,7 @@ int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
1124 int *base, u8 flags); 1124 int *base, u8 flags);
1125void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 1125void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
1126 1126
1127int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 1127int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp);
1128 gfp_t gfp);
1129void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 1128void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
1130 1129
1131int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 1130int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn,
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 87869c04849a..3030121b4746 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -7749,8 +7749,10 @@ struct mlx5_ifc_pcam_reg_bits {
7749}; 7749};
7750 7750
7751struct mlx5_ifc_mcam_enhanced_features_bits { 7751struct mlx5_ifc_mcam_enhanced_features_bits {
7752 u8 reserved_at_0[0x7f]; 7752 u8 reserved_at_0[0x7d];
7753 7753
7754 u8 mtpps_enh_out_per_adj[0x1];
7755 u8 mtpps_fs[0x1];
7754 u8 pcie_performance_group[0x1]; 7756 u8 pcie_performance_group[0x1];
7755}; 7757};
7756 7758
@@ -8159,7 +8161,8 @@ struct mlx5_ifc_mtpps_reg_bits {
8159 u8 reserved_at_78[0x4]; 8161 u8 reserved_at_78[0x4];
8160 u8 cap_pin_4_mode[0x4]; 8162 u8 cap_pin_4_mode[0x4];
8161 8163
8162 u8 reserved_at_80[0x80]; 8164 u8 field_select[0x20];
8165 u8 reserved_at_a0[0x60];
8163 8166
8164 u8 enable[0x1]; 8167 u8 enable[0x1];
8165 u8 reserved_at_101[0xb]; 8168 u8 reserved_at_101[0xb];
@@ -8174,8 +8177,9 @@ struct mlx5_ifc_mtpps_reg_bits {
8174 8177
8175 u8 out_pulse_duration[0x10]; 8178 u8 out_pulse_duration[0x10];
8176 u8 out_periodic_adjustment[0x10]; 8179 u8 out_periodic_adjustment[0x10];
8180 u8 enhanced_out_periodic_adjustment[0x20];
8177 8181
8178 u8 reserved_at_1a0[0x60]; 8182 u8 reserved_at_1c0[0x20];
8179}; 8183};
8180 8184
8181struct mlx5_ifc_mtppse_reg_bits { 8185struct mlx5_ifc_mtppse_reg_bits {
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 6f41270d80c0..f378dc0e7eaf 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -212,7 +212,6 @@ struct mlx5_wqe_ctrl_seg {
212#define MLX5_WQE_CTRL_OPCODE_MASK 0xff 212#define MLX5_WQE_CTRL_OPCODE_MASK 0xff
213#define MLX5_WQE_CTRL_WQE_INDEX_MASK 0x00ffff00 213#define MLX5_WQE_CTRL_WQE_INDEX_MASK 0x00ffff00
214#define MLX5_WQE_CTRL_WQE_INDEX_SHIFT 8 214#define MLX5_WQE_CTRL_WQE_INDEX_SHIFT 8
215#define MLX5_WQE_AV_EXT 0x80000000
216 215
217enum { 216enum {
218 MLX5_ETH_WQE_L3_INNER_CSUM = 1 << 4, 217 MLX5_ETH_WQE_L3_INNER_CSUM = 1 << 4,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 45cdb27791a3..3cadee0a3508 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -342,7 +342,7 @@ struct vm_area_struct {
342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */ 342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */
343#endif 343#endif
344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx; 344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx;
345}; 345} __randomize_layout;
346 346
347struct core_thread { 347struct core_thread {
348 struct task_struct *task; 348 struct task_struct *task;
@@ -487,20 +487,22 @@ struct mm_struct {
487 /* numa_scan_seq prevents two threads setting pte_numa */ 487 /* numa_scan_seq prevents two threads setting pte_numa */
488 int numa_scan_seq; 488 int numa_scan_seq;
489#endif 489#endif
490#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
491 /* 490 /*
492 * An operation with batched TLB flushing is going on. Anything that 491 * An operation with batched TLB flushing is going on. Anything that
493 * can move process memory needs to flush the TLB when moving a 492 * can move process memory needs to flush the TLB when moving a
494 * PROT_NONE or PROT_NUMA mapped page. 493 * PROT_NONE or PROT_NUMA mapped page.
495 */ 494 */
496 bool tlb_flush_pending; 495 atomic_t tlb_flush_pending;
496#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
497 /* See flush_tlb_batched_pending() */
498 bool tlb_flush_batched;
497#endif 499#endif
498 struct uprobes_state uprobes_state; 500 struct uprobes_state uprobes_state;
499#ifdef CONFIG_HUGETLB_PAGE 501#ifdef CONFIG_HUGETLB_PAGE
500 atomic_long_t hugetlb_usage; 502 atomic_long_t hugetlb_usage;
501#endif 503#endif
502 struct work_struct async_put_work; 504 struct work_struct async_put_work;
503}; 505} __randomize_layout;
504 506
505extern struct mm_struct init_mm; 507extern struct mm_struct init_mm;
506 508
@@ -518,46 +520,60 @@ static inline cpumask_t *mm_cpumask(struct mm_struct *mm)
518 return mm->cpu_vm_mask_var; 520 return mm->cpu_vm_mask_var;
519} 521}
520 522
521#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION) 523struct mmu_gather;
524extern void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
525 unsigned long start, unsigned long end);
526extern void tlb_finish_mmu(struct mmu_gather *tlb,
527 unsigned long start, unsigned long end);
528
522/* 529/*
523 * Memory barriers to keep this state in sync are graciously provided by 530 * Memory barriers to keep this state in sync are graciously provided by
524 * the page table locks, outside of which no page table modifications happen. 531 * the page table locks, outside of which no page table modifications happen.
525 * The barriers below prevent the compiler from re-ordering the instructions 532 * The barriers are used to ensure the order between tlb_flush_pending updates,
526 * around the memory barriers that are already present in the code. 533 * which happen while the lock is not taken, and the PTE updates, which happen
534 * while the lock is taken, are serialized.
527 */ 535 */
528static inline bool mm_tlb_flush_pending(struct mm_struct *mm) 536static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
529{ 537{
530 barrier(); 538 return atomic_read(&mm->tlb_flush_pending) > 0;
531 return mm->tlb_flush_pending; 539}
540
541/*
542 * Returns true if there are two above TLB batching threads in parallel.
543 */
544static inline bool mm_tlb_flush_nested(struct mm_struct *mm)
545{
546 return atomic_read(&mm->tlb_flush_pending) > 1;
547}
548
549static inline void init_tlb_flush_pending(struct mm_struct *mm)
550{
551 atomic_set(&mm->tlb_flush_pending, 0);
532} 552}
533static inline void set_tlb_flush_pending(struct mm_struct *mm) 553
554static inline void inc_tlb_flush_pending(struct mm_struct *mm)
534{ 555{
535 mm->tlb_flush_pending = true; 556 atomic_inc(&mm->tlb_flush_pending);
536 557
537 /* 558 /*
538 * Guarantee that the tlb_flush_pending store does not leak into the 559 * Guarantee that the tlb_flush_pending increase does not leak into the
539 * critical section updating the page tables 560 * critical section updating the page tables
540 */ 561 */
541 smp_mb__before_spinlock(); 562 smp_mb__before_spinlock();
542} 563}
564
543/* Clearing is done after a TLB flush, which also provides a barrier. */ 565/* Clearing is done after a TLB flush, which also provides a barrier. */
544static inline void clear_tlb_flush_pending(struct mm_struct *mm) 566static inline void dec_tlb_flush_pending(struct mm_struct *mm)
545{
546 barrier();
547 mm->tlb_flush_pending = false;
548}
549#else
550static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
551{
552 return false;
553}
554static inline void set_tlb_flush_pending(struct mm_struct *mm)
555{
556}
557static inline void clear_tlb_flush_pending(struct mm_struct *mm)
558{ 567{
568 /*
569 * Guarantee that the tlb_flush_pending does not not leak into the
570 * critical section, since we must order the PTE change and changes to
571 * the pending TLB flush indication. We could have relied on TLB flush
572 * as a memory barrier, but this behavior is not clearly documented.
573 */
574 smp_mb__before_atomic();
575 atomic_dec(&mm->tlb_flush_pending);
559} 576}
560#endif
561 577
562struct vm_fault; 578struct vm_fault;
563 579
diff --git a/include/linux/module.h b/include/linux/module.h
index 8eb9a1e693e5..e7bdd549e527 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -45,7 +45,7 @@ struct module_kobject {
45 struct kobject *drivers_dir; 45 struct kobject *drivers_dir;
46 struct module_param_attrs *mp; 46 struct module_param_attrs *mp;
47 struct completion *kobj_completion; 47 struct completion *kobj_completion;
48}; 48} __randomize_layout;
49 49
50struct module_attribute { 50struct module_attribute {
51 struct attribute attr; 51 struct attribute attr;
@@ -475,7 +475,7 @@ struct module {
475 ctor_fn_t *ctors; 475 ctor_fn_t *ctors;
476 unsigned int num_ctors; 476 unsigned int num_ctors;
477#endif 477#endif
478} ____cacheline_aligned; 478} ____cacheline_aligned __randomize_layout;
479#ifndef MODULE_ARCH_INIT 479#ifndef MODULE_ARCH_INIT
480#define MODULE_ARCH_INIT {} 480#define MODULE_ARCH_INIT {}
481#endif 481#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 8e0352af06b7..1ce85e6fd95f 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -67,7 +67,7 @@ struct vfsmount {
67 struct dentry *mnt_root; /* root of the mounted tree */ 67 struct dentry *mnt_root; /* root of the mounted tree */
68 struct super_block *mnt_sb; /* pointer to superblock */ 68 struct super_block *mnt_sb; /* pointer to superblock */
69 int mnt_flags; 69 int mnt_flags;
70}; 70} __randomize_layout;
71 71
72struct file; /* forward dec */ 72struct file; /* forward dec */
73struct path; 73struct path;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index f3f302f9c197..a001305f5a79 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -29,7 +29,7 @@ struct msg_queue {
29 struct list_head q_messages; 29 struct list_head q_messages;
30 struct list_head q_receivers; 30 struct list_head q_receivers;
31 struct list_head q_senders; 31 struct list_head q_senders;
32}; 32} __randomize_layout;
33 33
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 892148c448cc..5216d2eb2289 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -681,10 +681,10 @@ struct nand_buffers {
681 * @tWW_min: WP# transition to WE# low 681 * @tWW_min: WP# transition to WE# low
682 */ 682 */
683struct nand_sdr_timings { 683struct nand_sdr_timings {
684 u32 tBERS_max; 684 u64 tBERS_max;
685 u32 tCCS_min; 685 u32 tCCS_min;
686 u32 tPROG_max; 686 u64 tPROG_max;
687 u32 tR_max; 687 u64 tR_max;
688 u32 tALH_min; 688 u32 tALH_min;
689 u32 tADL_min; 689 u32 tADL_min;
690 u32 tALS_min; 690 u32 tALS_min;
diff --git a/include/linux/net.h b/include/linux/net.h
index dda2cc939a53..ebeb48c92005 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -37,7 +37,7 @@ struct net;
37 37
38/* Historically, SOCKWQ_ASYNC_NOSPACE & SOCKWQ_ASYNC_WAITDATA were located 38/* Historically, SOCKWQ_ASYNC_NOSPACE & SOCKWQ_ASYNC_WAITDATA were located
39 * in sock->flags, but moved into sk->sk_wq->flags to be RCU protected. 39 * in sock->flags, but moved into sk->sk_wq->flags to be RCU protected.
40 * Eventually all flags will be in sk->sk_wq_flags. 40 * Eventually all flags will be in sk->sk_wq->flags.
41 */ 41 */
42#define SOCKWQ_ASYNC_NOSPACE 0 42#define SOCKWQ_ASYNC_NOSPACE 0
43#define SOCKWQ_ASYNC_WAITDATA 1 43#define SOCKWQ_ASYNC_WAITDATA 1
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index a4b97be30b28..22f081065d49 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -61,8 +61,6 @@ typedef unsigned int nf_hookfn(void *priv,
61 struct sk_buff *skb, 61 struct sk_buff *skb,
62 const struct nf_hook_state *state); 62 const struct nf_hook_state *state);
63struct nf_hook_ops { 63struct nf_hook_ops {
64 struct list_head list;
65
66 /* User fills in from here down. */ 64 /* User fills in from here down. */
67 nf_hookfn *hook; 65 nf_hookfn *hook;
68 struct net_device *dev; 66 struct net_device *dev;
@@ -160,13 +158,6 @@ int nf_register_net_hooks(struct net *net, const struct nf_hook_ops *reg,
160void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, 158void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg,
161 unsigned int n); 159 unsigned int n);
162 160
163int nf_register_hook(struct nf_hook_ops *reg);
164void nf_unregister_hook(struct nf_hook_ops *reg);
165int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
166void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
167int _nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
168void _nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
169
170/* Functions to register get/setsockopt ranges (non-inclusive). You 161/* Functions to register get/setsockopt ranges (non-inclusive). You
171 need to check permissions yourself! */ 162 need to check permissions yourself! */
172int nf_register_sockopt(struct nf_sockopt_ops *reg); 163int nf_register_sockopt(struct nf_sockopt_ops *reg);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e52cc55ac300..5cc91d6381a3 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -51,7 +51,7 @@ struct nfs_access_entry {
51 struct list_head lru; 51 struct list_head lru;
52 unsigned long jiffies; 52 unsigned long jiffies;
53 struct rpc_cred * cred; 53 struct rpc_cred * cred;
54 int mask; 54 __u32 mask;
55 struct rcu_head rcu_head; 55 struct rcu_head rcu_head;
56}; 56};
57 57
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index ca3bcc4ed4e5..62cbcb842f99 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1235,7 +1235,7 @@ struct nfs41_state_protection {
1235 1235
1236struct nfs41_exchange_id_args { 1236struct nfs41_exchange_id_args {
1237 struct nfs_client *client; 1237 struct nfs_client *client;
1238 nfs4_verifier *verifier; 1238 nfs4_verifier verifier;
1239 u32 flags; 1239 u32 flags;
1240 struct nfs41_state_protection state_protect; 1240 struct nfs41_state_protection state_protect;
1241}; 1241};
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 8aa01fd859fb..a36abe2da13e 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -168,6 +168,14 @@ extern int sysctl_hardlockup_all_cpu_backtrace;
168#define sysctl_softlockup_all_cpu_backtrace 0 168#define sysctl_softlockup_all_cpu_backtrace 0
169#define sysctl_hardlockup_all_cpu_backtrace 0 169#define sysctl_hardlockup_all_cpu_backtrace 0
170#endif 170#endif
171
172#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
173 defined(CONFIG_HARDLOCKUP_DETECTOR)
174void watchdog_update_hrtimer_threshold(u64 period);
175#else
176static inline void watchdog_update_hrtimer_threshold(u64 period) { }
177#endif
178
171extern bool is_hardlockup(void); 179extern bool is_hardlockup(void);
172struct ctl_table; 180struct ctl_table;
173extern int proc_watchdog(struct ctl_table *, int , 181extern int proc_watchdog(struct ctl_table *, int ,
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h
index 6c8c5d8041b7..2591878c1d48 100644
--- a/include/linux/nvme-fc-driver.h
+++ b/include/linux/nvme-fc-driver.h
@@ -346,6 +346,11 @@ struct nvme_fc_remote_port {
346 * indicating an FC transport Aborted status. 346 * indicating an FC transport Aborted status.
347 * Entrypoint is Mandatory. 347 * Entrypoint is Mandatory.
348 * 348 *
349 * @defer_rcv: Called by the transport to signal the LLLD that it has
350 * begun processing of a previously received NVME CMD IU. The LLDD
351 * is now free to re-use the rcv buffer associated with the
352 * nvmefc_tgt_fcp_req.
353 *
349 * @max_hw_queues: indicates the maximum number of hw queues the LLDD 354 * @max_hw_queues: indicates the maximum number of hw queues the LLDD
350 * supports for cpu affinitization. 355 * supports for cpu affinitization.
351 * Value is Mandatory. Must be at least 1. 356 * Value is Mandatory. Must be at least 1.
@@ -846,6 +851,8 @@ struct nvmet_fc_target_template {
846 struct nvmefc_tgt_fcp_req *fcpreq); 851 struct nvmefc_tgt_fcp_req *fcpreq);
847 void (*fcp_req_release)(struct nvmet_fc_target_port *tgtport, 852 void (*fcp_req_release)(struct nvmet_fc_target_port *tgtport,
848 struct nvmefc_tgt_fcp_req *fcpreq); 853 struct nvmefc_tgt_fcp_req *fcpreq);
854 void (*defer_rcv)(struct nvmet_fc_target_port *tgtport,
855 struct nvmefc_tgt_fcp_req *fcpreq);
849 856
850 u32 max_hw_queues; 857 u32 max_hw_queues;
851 u16 max_sgl_segments; 858 u16 max_sgl_segments;
diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index 21c37e39e41a..36cca93a5ff2 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -334,5 +334,24 @@ struct fcnvme_ls_disconnect_acc {
334#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */ 334#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */
335#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */ 335#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */
336 336
337/*
338 * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>"
339 * the string is allowed to be specified with or without a "0x" prefix
340 * infront of the <16hexdigits>. Without is considered the "min" string
341 * and with is considered the "max" string. The hexdigits may be upper
342 * or lower case.
343 */
344#define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */
345#define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */
346#define NVME_FC_TRADDR_HEXNAMELEN 16
347#define NVME_FC_TRADDR_MINLENGTH \
348 (2 * (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
349#define NVME_FC_TRADDR_MAXLENGTH \
350 (2 * (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
351#define NVME_FC_TRADDR_MIN_PN_OFFSET \
352 (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
353#define NVME_FC_TRADDR_MAX_PN_OFFSET \
354 (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
355
337 356
338#endif /* _NVME_FC_H */ 357#endif /* _NVME_FC_H */
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6b8ee9e628e1..25d8225dbd04 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -963,14 +963,14 @@ struct nvme_dbbuf {
963}; 963};
964 964
965struct streams_directive_params { 965struct streams_directive_params {
966 __u16 msl; 966 __le16 msl;
967 __u16 nssa; 967 __le16 nssa;
968 __u16 nsso; 968 __le16 nsso;
969 __u8 rsvd[10]; 969 __u8 rsvd[10];
970 __u32 sws; 970 __le32 sws;
971 __u16 sgs; 971 __le16 sgs;
972 __u16 nsa; 972 __le16 nsa;
973 __u16 nso; 973 __le16 nso;
974 __u8 rsvd2[6]; 974 __u8 rsvd2[6];
975}; 975};
976 976
@@ -1006,7 +1006,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd)
1006 * Why can't we simply have a Fabrics In and Fabrics out command? 1006 * Why can't we simply have a Fabrics In and Fabrics out command?
1007 */ 1007 */
1008 if (unlikely(cmd->common.opcode == nvme_fabrics_command)) 1008 if (unlikely(cmd->common.opcode == nvme_fabrics_command))
1009 return cmd->fabrics.opcode & 1; 1009 return cmd->fabrics.fctype & 1;
1010 return cmd->common.opcode & 1; 1010 return cmd->common.opcode & 1;
1011} 1011}
1012 1012
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 8a266e2be5a6..76aac4ce39bc 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -6,6 +6,8 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/nodemask.h> 7#include <linux/nodemask.h>
8#include <uapi/linux/oom.h> 8#include <uapi/linux/oom.h>
9#include <linux/sched/coredump.h> /* MMF_* */
10#include <linux/mm.h> /* VM_FAULT* */
9 11
10struct zonelist; 12struct zonelist;
11struct notifier_block; 13struct notifier_block;
@@ -63,6 +65,26 @@ static inline bool tsk_is_oom_victim(struct task_struct * tsk)
63 return tsk->signal->oom_mm; 65 return tsk->signal->oom_mm;
64} 66}
65 67
68/*
69 * Checks whether a page fault on the given mm is still reliable.
70 * This is no longer true if the oom reaper started to reap the
71 * address space which is reflected by MMF_UNSTABLE flag set in
72 * the mm. At that moment any !shared mapping would lose the content
73 * and could cause a memory corruption (zero pages instead of the
74 * original content).
75 *
76 * User should call this before establishing a page table entry for
77 * a !shared mapping and under the proper page table lock.
78 *
79 * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise.
80 */
81static inline int check_stable_address_space(struct mm_struct *mm)
82{
83 if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags)))
84 return VM_FAULT_SIGBUS;
85 return 0;
86}
87
66extern unsigned long oom_badness(struct task_struct *p, 88extern unsigned long oom_badness(struct task_struct *p,
67 struct mem_cgroup *memcg, const nodemask_t *nodemask, 89 struct mem_cgroup *memcg, const nodemask_t *nodemask,
68 unsigned long totalpages); 90 unsigned long totalpages);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index baa9344dcd10..79b36f57c3ba 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -163,8 +163,6 @@ void release_pages(struct page **pages, int nr, bool cold);
163 */ 163 */
164static inline int page_cache_get_speculative(struct page *page) 164static inline int page_cache_get_speculative(struct page *page)
165{ 165{
166 VM_BUG_ON(in_interrupt());
167
168#ifdef CONFIG_TINY_RCU 166#ifdef CONFIG_TINY_RCU
169# ifdef CONFIG_PREEMPT_COUNT 167# ifdef CONFIG_PREEMPT_COUNT
170 VM_BUG_ON(!in_atomic() && !irqs_disabled()); 168 VM_BUG_ON(!in_atomic() && !irqs_disabled());
diff --git a/include/linux/path.h b/include/linux/path.h
index d1372186f431..cde895cc4af4 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -7,7 +7,7 @@ struct vfsmount;
7struct path { 7struct path {
8 struct vfsmount *mnt; 8 struct vfsmount *mnt;
9 struct dentry *dentry; 9 struct dentry *dentry;
10}; 10} __randomize_layout;
11 11
12extern void path_get(const struct path *); 12extern void path_get(const struct path *);
13extern void path_put(const struct path *); 13extern void path_put(const struct path *);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 4869e66dd659..f958d0732af6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -188,6 +188,8 @@ enum pci_dev_flags {
188 * the direct_complete optimization. 188 * the direct_complete optimization.
189 */ 189 */
190 PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11), 190 PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),
191 /* Don't use Relaxed Ordering for TLPs directed at this device */
192 PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 12),
191}; 193};
192 194
193enum pci_irq_reroute_variant { 195enum pci_irq_reroute_variant {
@@ -1067,6 +1069,7 @@ void pcie_flr(struct pci_dev *dev);
1067int __pci_reset_function(struct pci_dev *dev); 1069int __pci_reset_function(struct pci_dev *dev);
1068int __pci_reset_function_locked(struct pci_dev *dev); 1070int __pci_reset_function_locked(struct pci_dev *dev);
1069int pci_reset_function(struct pci_dev *dev); 1071int pci_reset_function(struct pci_dev *dev);
1072int pci_reset_function_locked(struct pci_dev *dev);
1070int pci_try_reset_function(struct pci_dev *dev); 1073int pci_try_reset_function(struct pci_dev *dev);
1071int pci_probe_reset_slot(struct pci_slot *slot); 1074int pci_probe_reset_slot(struct pci_slot *slot);
1072int pci_reset_slot(struct pci_slot *slot); 1075int pci_reset_slot(struct pci_slot *slot);
@@ -1125,6 +1128,7 @@ bool pci_check_pme_status(struct pci_dev *dev);
1125void pci_pme_wakeup_bus(struct pci_bus *bus); 1128void pci_pme_wakeup_bus(struct pci_bus *bus);
1126void pci_d3cold_enable(struct pci_dev *dev); 1129void pci_d3cold_enable(struct pci_dev *dev);
1127void pci_d3cold_disable(struct pci_dev *dev); 1130void pci_d3cold_disable(struct pci_dev *dev);
1131bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
1128 1132
1129/* PCI Virtual Channel */ 1133/* PCI Virtual Channel */
1130int pci_save_vc_state(struct pci_dev *dev); 1134int pci_save_vc_state(struct pci_dev *dev);
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 1360dd6d5e61..af0f44effd44 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -24,10 +24,14 @@
24 * interrupt and passed the address of the low level handler, 24 * interrupt and passed the address of the low level handler,
25 * and can be used to implement any platform specific handling 25 * and can be used to implement any platform specific handling
26 * before or after calling it. 26 * before or after calling it.
27 *
28 * @irq_flags: if non-zero, these flags will be passed to request_irq
29 * when requesting interrupts for this PMU device.
27 */ 30 */
28struct arm_pmu_platdata { 31struct arm_pmu_platdata {
29 irqreturn_t (*handle_irq)(int irq, void *dev, 32 irqreturn_t (*handle_irq)(int irq, void *dev,
30 irq_handler_t pmu_handler); 33 irq_handler_t pmu_handler);
34 unsigned long irq_flags;
31}; 35};
32 36
33#ifdef CONFIG_ARM_PMU 37#ifdef CONFIG_ARM_PMU
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index a3b873fc59e4..b14095bcf4bb 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -310,8 +310,8 @@ struct pmu {
310 * Notification that the event was mapped or unmapped. Called 310 * Notification that the event was mapped or unmapped. Called
311 * in the context of the mapping task. 311 * in the context of the mapping task.
312 */ 312 */
313 void (*event_mapped) (struct perf_event *event); /*optional*/ 313 void (*event_mapped) (struct perf_event *event, struct mm_struct *mm); /* optional */
314 void (*event_unmapped) (struct perf_event *event); /*optional*/ 314 void (*event_unmapped) (struct perf_event *event, struct mm_struct *mm); /* optional */
315 315
316 /* 316 /*
317 * Flags for ->add()/->del()/ ->start()/->stop(). There are 317 * Flags for ->add()/->del()/ ->start()/->stop(). There are
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 2a9567bb8186..0bb5b212ab42 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -830,7 +830,7 @@ static inline int phy_read_status(struct phy_device *phydev)
830 dev_err(&_phydev->mdio.dev, format, ##args) 830 dev_err(&_phydev->mdio.dev, format, ##args)
831 831
832#define phydev_dbg(_phydev, format, args...) \ 832#define phydev_dbg(_phydev, format, args...) \
833 dev_dbg(&_phydev->mdio.dev, format, ##args); 833 dev_dbg(&_phydev->mdio.dev, format, ##args)
834 834
835static inline const char *phydev_name(const struct phy_device *phydev) 835static inline const char *phydev_name(const struct phy_device *phydev)
836{ 836{
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 4d179316e431..719582744a2e 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -8,7 +8,9 @@ enum pid_type
8 PIDTYPE_PID, 8 PIDTYPE_PID,
9 PIDTYPE_PGID, 9 PIDTYPE_PGID,
10 PIDTYPE_SID, 10 PIDTYPE_SID,
11 PIDTYPE_MAX 11 PIDTYPE_MAX,
12 /* only valid to __task_pid_nr_ns() */
13 __PIDTYPE_TGID
12}; 14};
13 15
14/* 16/*
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index c2a989dee876..b09136f88cf4 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -52,7 +52,7 @@ struct pid_namespace {
52 int hide_pid; 52 int hide_pid;
53 int reboot; /* group exit code if this pidns was rebooted */ 53 int reboot; /* group exit code if this pidns was rebooted */
54 struct ns_common ns; 54 struct ns_common ns;
55}; 55} __randomize_layout;
56 56
57extern struct pid_namespace init_pid_ns; 57extern struct pid_namespace init_pid_ns;
58 58
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 231d3075815a..e91d1b6a260d 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -81,8 +81,8 @@
81 * it. 81 * it.
82 * @PIN_CONFIG_OUTPUT: this will configure the pin as an output and drive a 82 * @PIN_CONFIG_OUTPUT: this will configure the pin as an output and drive a
83 * value on the line. Use argument 1 to indicate high level, argument 0 to 83 * value on the line. Use argument 1 to indicate high level, argument 0 to
84 * indicate low level. (Please see Documentation/pinctrl.txt, section 84 * indicate low level. (Please see Documentation/driver-api/pinctl.rst,
85 * "GPIO mode pitfalls" for a discussion around this parameter.) 85 * section "GPIO mode pitfalls" for a discussion around this parameter.)
86 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 86 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
87 * supplies, the argument to this parameter (on a custom format) tells 87 * supplies, the argument to this parameter (on a custom format) tells
88 * the driver which alternative power source to use. 88 * the driver which alternative power source to use.
diff --git a/include/linux/platform_data/hsmmc-omap.h b/include/linux/platform_data/hsmmc-omap.h
index 8e981be2e2c2..0ff1e0dba720 100644
--- a/include/linux/platform_data/hsmmc-omap.h
+++ b/include/linux/platform_data/hsmmc-omap.h
@@ -55,9 +55,6 @@ struct omap_hsmmc_platform_data {
55 u32 caps; /* Used for the MMC driver on 2430 and later */ 55 u32 caps; /* Used for the MMC driver on 2430 and later */
56 u32 pm_caps; /* PM capabilities of the mmc */ 56 u32 pm_caps; /* PM capabilities of the mmc */
57 57
58 /* use the internal clock */
59 unsigned internal_clock:1;
60
61 /* nonremovable e.g. eMMC */ 58 /* nonremovable e.g. eMMC */
62 unsigned nonremovable:1; 59 unsigned nonremovable:1;
63 60
@@ -73,13 +70,6 @@ struct omap_hsmmc_platform_data {
73 int gpio_cd; /* gpio (card detect) */ 70 int gpio_cd; /* gpio (card detect) */
74 int gpio_cod; /* gpio (cover detect) */ 71 int gpio_cod; /* gpio (cover detect) */
75 int gpio_wp; /* gpio (write protect) */ 72 int gpio_wp; /* gpio (write protect) */
76
77 int (*set_power)(struct device *dev, int power_on, int vdd);
78 void (*remux)(struct device *dev, int power_on);
79 /* Call back before enabling / disabling regulators */
80 void (*before_set_reg)(struct device *dev, int power_on, int vdd);
81 /* Call back after enabling / disabling regulators */
82 void (*after_set_reg)(struct device *dev, int power_on, int vdd);
83 /* if we have special card, init it using this callback */ 73 /* if we have special card, init it using this callback */
84 void (*init_card)(struct mmc_card *card); 74 void (*init_card)(struct mmc_card *card);
85 75
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h
index 79b0e4cdb814..f8274b0c6888 100644
--- a/include/linux/platform_data/st_sensors_pdata.h
+++ b/include/linux/platform_data/st_sensors_pdata.h
@@ -17,10 +17,12 @@
17 * Available only for accelerometer and pressure sensors. 17 * Available only for accelerometer and pressure sensors.
18 * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). 18 * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet).
19 * @open_drain: set the interrupt line to be open drain if possible. 19 * @open_drain: set the interrupt line to be open drain if possible.
20 * @spi_3wire: enable spi-3wire mode.
20 */ 21 */
21struct st_sensors_platform_data { 22struct st_sensors_platform_data {
22 u8 drdy_int_pin; 23 u8 drdy_int_pin;
23 bool open_drain; 24 bool open_drain;
25 bool spi_3wire;
24}; 26};
25 27
26#endif /* ST_SENSORS_PDATA_H */ 28#endif /* ST_SENSORS_PDATA_H */
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 58ab28d81fc2..06844b54dfc1 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -21,7 +21,7 @@ struct proc_ns_operations {
21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns); 21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns);
22 struct user_namespace *(*owner)(struct ns_common *ns); 22 struct user_namespace *(*owner)(struct ns_common *ns);
23 struct ns_common *(*get_parent)(struct ns_common *ns); 23 struct ns_common *(*get_parent)(struct ns_common *ns);
24}; 24} __randomize_layout;
25 25
26extern const struct proc_ns_operations netns_operations; 26extern const struct proc_ns_operations netns_operations;
27extern const struct proc_ns_operations utsns_operations; 27extern const struct proc_ns_operations utsns_operations;
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index a026bfd089db..51349d124ee5 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -99,6 +99,11 @@ struct system_device_crosststamp;
99 * parameter func: the desired function to use. 99 * parameter func: the desired function to use.
100 * parameter chan: the function channel index to use. 100 * parameter chan: the function channel index to use.
101 * 101 *
102 * @do_work: Request driver to perform auxiliary (periodic) operations
103 * Driver should return delay of the next auxiliary work scheduling
104 * time (>=0) or negative value in case further scheduling
105 * is not required.
106 *
102 * Drivers should embed their ptp_clock_info within a private 107 * Drivers should embed their ptp_clock_info within a private
103 * structure, obtaining a reference to it using container_of(). 108 * structure, obtaining a reference to it using container_of().
104 * 109 *
@@ -126,6 +131,7 @@ struct ptp_clock_info {
126 struct ptp_clock_request *request, int on); 131 struct ptp_clock_request *request, int on);
127 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, 132 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
128 enum ptp_pin_function func, unsigned int chan); 133 enum ptp_pin_function func, unsigned int chan);
134 long (*do_aux_work)(struct ptp_clock_info *ptp);
129}; 135};
130 136
131struct ptp_clock; 137struct ptp_clock;
@@ -211,6 +217,16 @@ extern int ptp_clock_index(struct ptp_clock *ptp);
211int ptp_find_pin(struct ptp_clock *ptp, 217int ptp_find_pin(struct ptp_clock *ptp,
212 enum ptp_pin_function func, unsigned int chan); 218 enum ptp_pin_function func, unsigned int chan);
213 219
220/**
221 * ptp_schedule_worker() - schedule ptp auxiliary work
222 *
223 * @ptp: The clock obtained from ptp_clock_register().
224 * @delay: number of jiffies to wait before queuing
225 * See kthread_queue_delayed_work() for more info.
226 */
227
228int ptp_schedule_worker(struct ptp_clock *ptp, unsigned long delay);
229
214#else 230#else
215static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, 231static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
216 struct device *parent) 232 struct device *parent)
@@ -225,6 +241,10 @@ static inline int ptp_clock_index(struct ptp_clock *ptp)
225static inline int ptp_find_pin(struct ptp_clock *ptp, 241static inline int ptp_find_pin(struct ptp_clock *ptp,
226 enum ptp_pin_function func, unsigned int chan) 242 enum ptp_pin_function func, unsigned int chan)
227{ return -1; } 243{ return -1; }
244static inline int ptp_schedule_worker(struct ptp_clock *ptp,
245 unsigned long delay)
246{ return -EOPNOTSUPP; }
247
228#endif 248#endif
229 249
230#endif 250#endif
diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
index d8c97ec8a8e6..37b4bb2545b3 100644
--- a/include/linux/ptr_ring.h
+++ b/include/linux/ptr_ring.h
@@ -436,9 +436,9 @@ static inline int ptr_ring_consume_batched_bh(struct ptr_ring *r,
436 __PTR_RING_PEEK_CALL_v; \ 436 __PTR_RING_PEEK_CALL_v; \
437}) 437})
438 438
439static inline void **__ptr_ring_init_queue_alloc(int size, gfp_t gfp) 439static inline void **__ptr_ring_init_queue_alloc(unsigned int size, gfp_t gfp)
440{ 440{
441 return kzalloc(ALIGN(size * sizeof(void *), SMP_CACHE_BYTES), gfp); 441 return kcalloc(size, sizeof(void *), gfp);
442} 442}
443 443
444static inline void __ptr_ring_set_size(struct ptr_ring *r, int size) 444static inline void __ptr_ring_set_size(struct ptr_ring *r, int size)
@@ -582,7 +582,8 @@ static inline int ptr_ring_resize(struct ptr_ring *r, int size, gfp_t gfp,
582 * In particular if you consume ring in interrupt or BH context, you must 582 * In particular if you consume ring in interrupt or BH context, you must
583 * disable interrupts/BH when doing so. 583 * disable interrupts/BH when doing so.
584 */ 584 */
585static inline int ptr_ring_resize_multiple(struct ptr_ring **rings, int nrings, 585static inline int ptr_ring_resize_multiple(struct ptr_ring **rings,
586 unsigned int nrings,
586 int size, 587 int size,
587 gfp_t gfp, void (*destroy)(void *)) 588 gfp_t gfp, void (*destroy)(void *))
588{ 589{
@@ -590,7 +591,7 @@ static inline int ptr_ring_resize_multiple(struct ptr_ring **rings, int nrings,
590 void ***queues; 591 void ***queues;
591 int i; 592 int i;
592 593
593 queues = kmalloc(nrings * sizeof *queues, gfp); 594 queues = kmalloc_array(nrings, sizeof(*queues), gfp);
594 if (!queues) 595 if (!queues)
595 goto noqueues; 596 goto noqueues;
596 597
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2ba9ec93423f..c05ac5f5aa03 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -426,7 +426,7 @@ struct sched_rt_entity {
426 /* rq "owned" by this entity/group: */ 426 /* rq "owned" by this entity/group: */
427 struct rt_rq *my_q; 427 struct rt_rq *my_q;
428#endif 428#endif
429}; 429} __randomize_layout;
430 430
431struct sched_dl_entity { 431struct sched_dl_entity {
432 struct rb_node rb_node; 432 struct rb_node rb_node;
@@ -526,6 +526,13 @@ struct task_struct {
526#endif 526#endif
527 /* -1 unrunnable, 0 runnable, >0 stopped: */ 527 /* -1 unrunnable, 0 runnable, >0 stopped: */
528 volatile long state; 528 volatile long state;
529
530 /*
531 * This begins the randomizable portion of task_struct. Only
532 * scheduling-critical items should be added above here.
533 */
534 randomized_struct_fields_start
535
529 void *stack; 536 void *stack;
530 atomic_t usage; 537 atomic_t usage;
531 /* Per task flags (PF_*), defined further below: */ 538 /* Per task flags (PF_*), defined further below: */
@@ -1079,6 +1086,13 @@ struct task_struct {
1079 /* Used by LSM modules for access restriction: */ 1086 /* Used by LSM modules for access restriction: */
1080 void *security; 1087 void *security;
1081#endif 1088#endif
1089
1090 /*
1091 * New fields for task_struct should be added above here, so that
1092 * they are included in the randomized portion of task_struct.
1093 */
1094 randomized_struct_fields_end
1095
1082 /* CPU-specific state of this task: */ 1096 /* CPU-specific state of this task: */
1083 struct thread_struct thread; 1097 struct thread_struct thread;
1084 1098
@@ -1149,13 +1163,6 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
1149 return tsk->tgid; 1163 return tsk->tgid;
1150} 1164}
1151 1165
1152extern pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1153
1154static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1155{
1156 return pid_vnr(task_tgid(tsk));
1157}
1158
1159/** 1166/**
1160 * pid_alive - check that a task structure is not stale 1167 * pid_alive - check that a task structure is not stale
1161 * @p: Task structure to be checked. 1168 * @p: Task structure to be checked.
@@ -1171,23 +1178,6 @@ static inline int pid_alive(const struct task_struct *p)
1171 return p->pids[PIDTYPE_PID].pid != NULL; 1178 return p->pids[PIDTYPE_PID].pid != NULL;
1172} 1179}
1173 1180
1174static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1175{
1176 pid_t pid = 0;
1177
1178 rcu_read_lock();
1179 if (pid_alive(tsk))
1180 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1181 rcu_read_unlock();
1182
1183 return pid;
1184}
1185
1186static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1187{
1188 return task_ppid_nr_ns(tsk, &init_pid_ns);
1189}
1190
1191static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1181static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1192{ 1182{
1193 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); 1183 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
@@ -1209,6 +1199,33 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1209 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); 1199 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1210} 1200}
1211 1201
1202static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1203{
1204 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns);
1205}
1206
1207static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1208{
1209 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL);
1210}
1211
1212static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1213{
1214 pid_t pid = 0;
1215
1216 rcu_read_lock();
1217 if (pid_alive(tsk))
1218 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1219 rcu_read_unlock();
1220
1221 return pid;
1222}
1223
1224static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1225{
1226 return task_ppid_nr_ns(tsk, &init_pid_ns);
1227}
1228
1212/* Obsolete, do not use: */ 1229/* Obsolete, do not use: */
1213static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1230static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1214{ 1231{
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index c06d63b3a583..2a0dd40b15db 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -222,7 +222,7 @@ struct signal_struct {
222 struct mutex cred_guard_mutex; /* guard against foreign influences on 222 struct mutex cred_guard_mutex; /* guard against foreign influences on
223 * credential calculations 223 * credential calculations
224 * (notably. ptrace) */ 224 * (notably. ptrace) */
225}; 225} __randomize_layout;
226 226
227/* 227/*
228 * Bits in flags field of signal_struct. 228 * Bits in flags field of signal_struct.
diff --git a/include/linux/sem.h b/include/linux/sem.h
index be5cf2ea14ad..de2deb8676bd 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -41,7 +41,7 @@ struct sem_array {
41 unsigned int use_global_lock;/* >0: global lock required */ 41 unsigned int use_global_lock;/* >0: global lock required */
42 42
43 struct sem sems[]; 43 struct sem sems[];
44}; 44} __randomize_layout;
45 45
46#ifdef CONFIG_SYSVIPC 46#ifdef CONFIG_SYSVIPC
47 47
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 04e881829625..0fb7061ec54c 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -22,7 +22,7 @@ struct shmid_kernel /* private to the kernel */
22 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
23 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */ 24 struct list_head shm_clist; /* list by creator */
25}; 25} __randomize_layout;
26 26
27/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
28#define SHM_DEST 01000 /* segment will be destroyed on last detach */ 28#define SHM_DEST 01000 /* segment will be destroyed on last detach */
diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h
index 35226cd4efb0..8621ffdeecbf 100644
--- a/include/linux/skb_array.h
+++ b/include/linux/skb_array.h
@@ -193,7 +193,8 @@ static inline int skb_array_resize(struct skb_array *a, int size, gfp_t gfp)
193} 193}
194 194
195static inline int skb_array_resize_multiple(struct skb_array **rings, 195static inline int skb_array_resize_multiple(struct skb_array **rings,
196 int nrings, int size, gfp_t gfp) 196 int nrings, unsigned int size,
197 gfp_t gfp)
197{ 198{
198 BUILD_BUG_ON(offsetof(struct skb_array, ring)); 199 BUILD_BUG_ON(offsetof(struct skb_array, ring));
199 return ptr_ring_resize_multiple((struct ptr_ring **)rings, 200 return ptr_ring_resize_multiple((struct ptr_ring **)rings,
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index 5726107963b2..0ad87c434ae6 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -43,12 +43,13 @@ struct sync_file {
43#endif 43#endif
44 44
45 wait_queue_head_t wq; 45 wait_queue_head_t wq;
46 unsigned long flags;
46 47
47 struct dma_fence *fence; 48 struct dma_fence *fence;
48 struct dma_fence_cb cb; 49 struct dma_fence_cb cb;
49}; 50};
50 51
51#define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS 52#define POLL_ENABLED 0
52 53
53struct sync_file *sync_file_create(struct dma_fence *fence); 54struct sync_file *sync_file_create(struct dma_fence *fence);
54struct dma_fence *sync_file_get_fence(int fd); 55struct dma_fence *sync_file_get_fence(int fd);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3a89b9ff4cdc..1d4dba490fb6 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -120,7 +120,7 @@ struct ctl_table
120 struct ctl_table_poll *poll; 120 struct ctl_table_poll *poll;
121 void *extra1; 121 void *extra1;
122 void *extra2; 122 void *extra2;
123}; 123} __randomize_layout;
124 124
125struct ctl_node { 125struct ctl_node {
126 struct rb_node node; 126 struct rb_node node;
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index f73cedfa2e0b..536c80ff7ad9 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -338,7 +338,7 @@ enum {
338struct trace_event_file { 338struct trace_event_file {
339 struct list_head list; 339 struct list_head list;
340 struct trace_event_call *event_call; 340 struct trace_event_call *event_call;
341 struct event_filter *filter; 341 struct event_filter __rcu *filter;
342 struct dentry *dir; 342 struct dentry *dir;
343 struct trace_array *tr; 343 struct trace_array *tr;
344 struct trace_subsystem_dir *system; 344 struct trace_subsystem_dir *system;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 69464c0d8068..79c30daf46a9 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -332,7 +332,7 @@ struct tty_struct {
332 /* If the tty has a pending do_SAK, queue it here - akpm */ 332 /* If the tty has a pending do_SAK, queue it here - akpm */
333 struct work_struct SAK_work; 333 struct work_struct SAK_work;
334 struct tty_port *port; 334 struct tty_port *port;
335}; 335} __randomize_layout;
336 336
337/* Each of a tty's open files has private_data pointing to tty_file_private */ 337/* Each of a tty's open files has private_data pointing to tty_file_private */
338struct tty_file_private { 338struct tty_file_private {
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b742b5e47cc2..00b2213f6a35 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -291,7 +291,7 @@ struct tty_operations {
291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
292#endif 292#endif
293 const struct file_operations *proc_fops; 293 const struct file_operations *proc_fops;
294}; 294} __randomize_layout;
295 295
296struct tty_driver { 296struct tty_driver {
297 int magic; /* magic number for this structure */ 297 int magic; /* magic number for this structure */
@@ -325,7 +325,7 @@ struct tty_driver {
325 325
326 const struct tty_operations *ops; 326 const struct tty_operations *ops;
327 struct list_head tty_drivers; 327 struct list_head tty_drivers;
328}; 328} __randomize_layout;
329 329
330extern struct list_head tty_drivers; 330extern struct list_head tty_drivers;
331 331
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index c5f2158ab00e..fd73bc0e9027 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -115,13 +115,13 @@ struct uac2_input_terminal_descriptor {
115 __u8 bDescriptorType; 115 __u8 bDescriptorType;
116 __u8 bDescriptorSubtype; 116 __u8 bDescriptorSubtype;
117 __u8 bTerminalID; 117 __u8 bTerminalID;
118 __u16 wTerminalType; 118 __le16 wTerminalType;
119 __u8 bAssocTerminal; 119 __u8 bAssocTerminal;
120 __u8 bCSourceID; 120 __u8 bCSourceID;
121 __u8 bNrChannels; 121 __u8 bNrChannels;
122 __u32 bmChannelConfig; 122 __le32 bmChannelConfig;
123 __u8 iChannelNames; 123 __u8 iChannelNames;
124 __u16 bmControls; 124 __le16 bmControls;
125 __u8 iTerminal; 125 __u8 iTerminal;
126} __attribute__((packed)); 126} __attribute__((packed));
127 127
@@ -132,11 +132,11 @@ struct uac2_output_terminal_descriptor {
132 __u8 bDescriptorType; 132 __u8 bDescriptorType;
133 __u8 bDescriptorSubtype; 133 __u8 bDescriptorSubtype;
134 __u8 bTerminalID; 134 __u8 bTerminalID;
135 __u16 wTerminalType; 135 __le16 wTerminalType;
136 __u8 bAssocTerminal; 136 __u8 bAssocTerminal;
137 __u8 bSourceID; 137 __u8 bSourceID;
138 __u8 bCSourceID; 138 __u8 bCSourceID;
139 __u16 bmControls; 139 __le16 bmControls;
140 __u8 iTerminal; 140 __u8 iTerminal;
141} __attribute__((packed)); 141} __attribute__((packed));
142 142
@@ -164,9 +164,9 @@ struct uac2_as_header_descriptor {
164 __u8 bTerminalLink; 164 __u8 bTerminalLink;
165 __u8 bmControls; 165 __u8 bmControls;
166 __u8 bFormatType; 166 __u8 bFormatType;
167 __u32 bmFormats; 167 __le32 bmFormats;
168 __u8 bNrChannels; 168 __u8 bNrChannels;
169 __u32 bmChannelConfig; 169 __le32 bmChannelConfig;
170 __u8 iChannelNames; 170 __u8 iChannelNames;
171} __attribute__((packed)); 171} __attribute__((packed));
172 172
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 021f7a88f52c..1a59699cf82a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -83,6 +83,7 @@
83/* Driver flags */ 83/* Driver flags */
84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ 84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */ 85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */
86#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */
86 87
87#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 88#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
88 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 89 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 32354b4b4b2b..b3575ce29148 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -66,7 +66,7 @@ struct user_namespace {
66#endif 66#endif
67 struct ucounts *ucounts; 67 struct ucounts *ucounts;
68 int ucount_max[UCOUNT_COUNTS]; 68 int ucount_max[UCOUNT_COUNTS];
69}; 69} __randomize_layout;
70 70
71struct ucounts { 71struct ucounts {
72 struct hlist_node node; 72 struct hlist_node node;
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 60f0bb83b313..da826ed059cf 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -26,7 +26,7 @@ struct uts_namespace {
26 struct user_namespace *user_ns; 26 struct user_namespace *user_ns;
27 struct ucounts *ucounts; 27 struct ucounts *ucounts;
28 struct ns_common ns; 28 struct ns_common ns;
29}; 29} __randomize_layout;
30extern struct uts_namespace init_uts_ns; 30extern struct uts_namespace init_uts_ns;
31 31
32#ifdef CONFIG_UTS_NS 32#ifdef CONFIG_UTS_NS
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 2251e1925ea4..33b0bdbb613c 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -84,26 +84,12 @@ int guid_parse(const char *uuid, guid_t *u);
84int uuid_parse(const char *uuid, uuid_t *u); 84int uuid_parse(const char *uuid, uuid_t *u);
85 85
86/* backwards compatibility, don't use in new code */ 86/* backwards compatibility, don't use in new code */
87typedef uuid_t uuid_be;
88#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
89 UUID_INIT(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
90#define NULL_UUID_BE \
91 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
92 0x00, 0x00, 0x00, 0x00)
93
94#define uuid_le_gen(u) guid_gen(u) 87#define uuid_le_gen(u) guid_gen(u)
95#define uuid_be_gen(u) uuid_gen(u)
96#define uuid_le_to_bin(guid, u) guid_parse(guid, u) 88#define uuid_le_to_bin(guid, u) guid_parse(guid, u)
97#define uuid_be_to_bin(uuid, u) uuid_parse(uuid, u)
98 89
99static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) 90static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
100{ 91{
101 return memcmp(&u1, &u2, sizeof(guid_t)); 92 return memcmp(&u1, &u2, sizeof(guid_t));
102} 93}
103 94
104static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
105{
106 return memcmp(&u1, &u2, sizeof(uuid_t));
107}
108
109#endif 95#endif
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 586809abb273..a47b985341d1 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -152,7 +152,7 @@ extern int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr,
152 size_t *data_size); 152 size_t *data_size);
153 153
154struct pci_dev; 154struct pci_dev;
155#ifdef CONFIG_EEH 155#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
156extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev); 156extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
157extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev); 157extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
158extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, 158extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
@@ -173,7 +173,7 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
173{ 173{
174 return -ENOTTY; 174 return -ENOTTY;
175} 175}
176#endif /* CONFIG_EEH */ 176#endif /* CONFIG_VFIO_SPAPR_EEH */
177 177
178/* 178/*
179 * IRQfd - generic 179 * IRQfd - generic
diff --git a/include/linux/wait.h b/include/linux/wait.h
index b289c96151ee..dc19880c02f5 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -529,13 +529,13 @@ do { \
529 529
530/** 530/**
531 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses 531 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
532 * @wq_head: the waitqueue to wait on 532 * @wq: the waitqueue to wait on
533 * @condition: a C expression for the event to wait for 533 * @condition: a C expression for the event to wait for
534 * @timeout: timeout, as a ktime_t 534 * @timeout: timeout, as a ktime_t
535 * 535 *
536 * The process is put to sleep (TASK_INTERRUPTIBLE) until the 536 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
537 * @condition evaluates to true or a signal is received. 537 * @condition evaluates to true or a signal is received.
538 * The @condition is checked each time the waitqueue @wq_head is woken up. 538 * The @condition is checked each time the waitqueue @wq is woken up.
539 * 539 *
540 * wake_up() has to be called after changing any variable that could 540 * wake_up() has to be called after changing any variable that could
541 * change the result of the wait condition. 541 * change the result of the wait condition.
@@ -735,12 +735,12 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
735 735
736/** 736/**
737 * wait_event_killable - sleep until a condition gets true 737 * wait_event_killable - sleep until a condition gets true
738 * @wq: the waitqueue to wait on 738 * @wq_head: the waitqueue to wait on
739 * @condition: a C expression for the event to wait for 739 * @condition: a C expression for the event to wait for
740 * 740 *
741 * The process is put to sleep (TASK_KILLABLE) until the 741 * The process is put to sleep (TASK_KILLABLE) until the
742 * @condition evaluates to true or a signal is received. 742 * @condition evaluates to true or a signal is received.
743 * The @condition is checked each time the waitqueue @wq is woken up. 743 * The @condition is checked each time the waitqueue @wq_head is woken up.
744 * 744 *
745 * wake_up() has to be called after changing any variable that could 745 * wake_up() has to be called after changing any variable that could
746 * change the result of the wait condition. 746 * change the result of the wait condition.
@@ -757,6 +757,43 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
757 __ret; \ 757 __ret; \
758}) 758})
759 759
760#define __wait_event_killable_timeout(wq_head, condition, timeout) \
761 ___wait_event(wq_head, ___wait_cond_timeout(condition), \
762 TASK_KILLABLE, 0, timeout, \
763 __ret = schedule_timeout(__ret))
764
765/**
766 * wait_event_killable_timeout - sleep until a condition gets true or a timeout elapses
767 * @wq_head: the waitqueue to wait on
768 * @condition: a C expression for the event to wait for
769 * @timeout: timeout, in jiffies
770 *
771 * The process is put to sleep (TASK_KILLABLE) until the
772 * @condition evaluates to true or a kill signal is received.
773 * The @condition is checked each time the waitqueue @wq_head is woken up.
774 *
775 * wake_up() has to be called after changing any variable that could
776 * change the result of the wait condition.
777 *
778 * Returns:
779 * 0 if the @condition evaluated to %false after the @timeout elapsed,
780 * 1 if the @condition evaluated to %true after the @timeout elapsed,
781 * the remaining jiffies (at least 1) if the @condition evaluated
782 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
783 * interrupted by a kill signal.
784 *
785 * Only kill signals interrupt this process.
786 */
787#define wait_event_killable_timeout(wq_head, condition, timeout) \
788({ \
789 long __ret = timeout; \
790 might_sleep(); \
791 if (!___wait_cond_timeout(condition)) \
792 __ret = __wait_event_killable_timeout(wq_head, \
793 condition, timeout); \
794 __ret; \
795})
796
760 797
761#define __wait_event_lock_irq(wq_head, condition, lock, cmd) \ 798#define __wait_event_lock_irq(wq_head, condition, lock, cmd) \
762 (void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \ 799 (void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index c102ef65cb64..db6dc9dc0482 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -323,6 +323,7 @@ enum {
323 323
324 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ 324 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
325 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ 325 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
326 __WQ_ORDERED_EXPLICIT = 1 << 18, /* internal: alloc_ordered_workqueue() */
326 __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */ 327 __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */
327 328
328 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ 329 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
@@ -422,7 +423,8 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
422 * Pointer to the allocated workqueue on success, %NULL on failure. 423 * Pointer to the allocated workqueue on success, %NULL on failure.
423 */ 424 */
424#define alloc_ordered_workqueue(fmt, flags, args...) \ 425#define alloc_ordered_workqueue(fmt, flags, args...) \
425 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) 426 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | \
427 __WQ_ORDERED_EXPLICIT | (flags), 1, ##args)
426 428
427#define create_workqueue(name) \ 429#define create_workqueue(name) \
428 alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name)) 430 alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))