diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bio.h | 4 | ||||
| -rw-r--r-- | include/linux/compiler-clang.h | 5 | ||||
| -rw-r--r-- | include/linux/compiler-gcc.h | 19 | ||||
| -rw-r--r-- | include/linux/compiler.h | 5 | ||||
| -rw-r--r-- | include/linux/genhd.h | 4 | ||||
| -rw-r--r-- | include/linux/init.h | 8 | ||||
| -rw-r--r-- | include/linux/jump_label.h | 3 | ||||
| -rw-r--r-- | include/linux/kconfig.h | 9 | ||||
| -rw-r--r-- | include/linux/kernel.h | 1 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 6 | ||||
| -rw-r--r-- | include/linux/memcontrol.h | 24 | ||||
| -rw-r--r-- | include/linux/mutex.h | 5 | ||||
| -rw-r--r-- | include/linux/nospec.h | 26 | ||||
| -rw-r--r-- | include/linux/perf/arm_pmu.h | 26 | ||||
| -rw-r--r-- | include/linux/ptr_ring.h | 2 | ||||
| -rw-r--r-- | include/linux/sched/mm.h | 13 | ||||
| -rw-r--r-- | include/linux/sched/user.h | 4 | ||||
| -rw-r--r-- | include/linux/skbuff.h | 2 | ||||
| -rw-r--r-- | include/linux/swap.h | 2 | ||||
| -rw-r--r-- | include/linux/workqueue.h | 1 | 
20 files changed, 101 insertions, 68 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index d0eb659fa733..ce547a25e8ae 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -511,6 +511,7 @@ void zero_fill_bio(struct bio *bio);  extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);  extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);  extern unsigned int bvec_nr_vecs(unsigned short idx); +extern const char *bio_devname(struct bio *bio, char *buffer);  #define bio_set_dev(bio, bdev) 			\  do {						\ @@ -529,9 +530,6 @@ do {						\  #define bio_dev(bio) \  	disk_devt((bio)->bi_disk) -#define bio_devname(bio, buf) \ -	__bdevname(bio_dev(bio), (buf)) -  #ifdef CONFIG_BLK_CGROUP  int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);  void bio_disassociate_task(struct bio *bio); diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index d02a4df3f473..d3f264a5b04d 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -27,3 +27,8 @@  #if __has_feature(address_sanitizer)  #define __SANITIZE_ADDRESS__  #endif + +/* Clang doesn't have a way to turn it off per-function, yet. */ +#ifdef __noretpoline +#undef __noretpoline +#endif diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 73bc63e0a1c4..e2c7f4369eff 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -93,6 +93,10 @@  #define __weak		__attribute__((weak))  #define __alias(symbol)	__attribute__((alias(#symbol))) +#ifdef RETPOLINE +#define __noretpoline __attribute__((indirect_branch("keep"))) +#endif +  /*   * it doesn't make sense on ARM (currently the only user of __naked)   * to trace naked functions because then mcount is called without @@ -208,6 +212,15 @@  #endif  /* + * calling noreturn functions, __builtin_unreachable() and __builtin_trap() + * confuse the stack allocation in gcc, leading to overly large stack + * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365 + * + * Adding an empty inline assembly before it works around the problem + */ +#define barrier_before_unreachable() asm volatile("") + +/*   * Mark a position in code as unreachable.  This can be used to   * suppress control flow warnings after asm blocks that transfer   * control elsewhere. @@ -217,7 +230,11 @@   * unreleased.  Really, we need to have autoconf for the kernel.   */  #define unreachable() \ -	do { annotate_unreachable(); __builtin_unreachable(); } while (0) +	do {					\ +		annotate_unreachable();		\ +		barrier_before_unreachable();	\ +		__builtin_unreachable();	\ +	} while (0)  /* Mark a function definition as prohibited from being cloned. */  #define __noclone	__attribute__((__noclone__, __optimize__("no-tracer"))) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index e835fc0423ec..ab4711c63601 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -86,6 +86,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,  # define barrier_data(ptr) barrier()  #endif +/* workaround for GCC PR82365 if needed */ +#ifndef barrier_before_unreachable +# define barrier_before_unreachable() do { } while (0) +#endif +  /* Unreachable code */  #ifdef CONFIG_STACK_VALIDATION  /* diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 5e3531027b51..c826b0b5232a 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -198,6 +198,7 @@ struct gendisk {  	void *private_data;  	int flags; +	struct rw_semaphore lookup_sem;  	struct kobject *slave_dir;  	struct timer_rand_state *random; @@ -600,8 +601,9 @@ extern void delete_partition(struct gendisk *, int);  extern void printk_all_partitions(void);  extern struct gendisk *__alloc_disk_node(int minors, int node_id); -extern struct kobject *get_disk(struct gendisk *disk); +extern struct kobject *get_disk_and_module(struct gendisk *disk);  extern void put_disk(struct gendisk *disk); +extern void put_disk_and_module(struct gendisk *disk);  extern void blk_register_region(dev_t devt, unsigned long range,  			struct module *module,  			struct kobject *(*probe)(dev_t, int *, void *), diff --git a/include/linux/init.h b/include/linux/init.h index 506a98151131..bc27cf03c41e 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -6,10 +6,10 @@  #include <linux/types.h>  /* Built-in __init functions needn't be compiled with retpoline */ -#if defined(RETPOLINE) && !defined(MODULE) -#define __noretpoline __attribute__((indirect_branch("keep"))) +#if defined(__noretpoline) && !defined(MODULE) +#define __noinitretpoline __noretpoline  #else -#define __noretpoline +#define __noinitretpoline  #endif  /* These macros are used to mark some functions or  @@ -47,7 +47,7 @@  /* These are for everybody (although not all archs will actually     discard it in modules) */ -#define __init		__section(.init.text) __cold  __latent_entropy __noretpoline +#define __init		__section(.init.text) __cold  __latent_entropy __noinitretpoline  #define __initdata	__section(.init.data)  #define __initconst	__section(.init.rodata)  #define __exitdata	__section(.exit.data) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index b6a29c126cc4..2168cc6b8b30 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -151,6 +151,7 @@ extern struct jump_entry __start___jump_table[];  extern struct jump_entry __stop___jump_table[];  extern void jump_label_init(void); +extern void jump_label_invalidate_init(void);  extern void jump_label_lock(void);  extern void jump_label_unlock(void);  extern void arch_jump_label_transform(struct jump_entry *entry, @@ -198,6 +199,8 @@ static __always_inline void jump_label_init(void)  	static_key_initialized = true;  } +static inline void jump_label_invalidate_init(void) {} +  static __always_inline bool static_key_false(struct static_key *key)  {  	if (unlikely(static_key_count(key) > 0)) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index fec5076eda91..dcde9471897d 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -4,6 +4,12 @@  #include <generated/autoconf.h> +#ifdef CONFIG_CPU_BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#else +#define __LITTLE_ENDIAN 1234 +#endif +  #define __ARG_PLACEHOLDER_1 0,  #define __take_second_arg(__ignored, val, ...) val @@ -64,4 +70,7 @@   */  #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) +/* Make sure we always have all types and struct attributes defined. */ +#include <linux/compiler_types.h> +  #endif /* __LINUX_KCONFIG_H */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ce51455e2adf..3fd291503576 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -472,6 +472,7 @@ extern bool parse_option_str(const char *str, const char *option);  extern char *next_arg(char *args, char **param, char **val);  extern int core_kernel_text(unsigned long addr); +extern int init_kernel_text(unsigned long addr);  extern int core_kernel_data(unsigned long addr);  extern int __kernel_text_address(unsigned long addr);  extern int kernel_text_address(unsigned long addr); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ac0062b74aed..6930c63126c7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1105,7 +1105,6 @@ static inline void kvm_irq_routing_update(struct kvm *kvm)  {  }  #endif -void kvm_arch_irq_routing_update(struct kvm *kvm);  static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)  { @@ -1114,6 +1113,8 @@ static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)  #endif /* CONFIG_HAVE_KVM_EVENTFD */ +void kvm_arch_irq_routing_update(struct kvm *kvm); +  static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)  {  	/* @@ -1272,4 +1273,7 @@ static inline long kvm_arch_vcpu_async_ioctl(struct file *filp,  }  #endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */ +void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, +		unsigned long start, unsigned long end); +  #endif diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 882046863581..c46016bb25eb 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -523,9 +523,11 @@ static inline void __mod_memcg_state(struct mem_cgroup *memcg,  static inline void mod_memcg_state(struct mem_cgroup *memcg,  				   int idx, int val)  { -	preempt_disable(); +	unsigned long flags; + +	local_irq_save(flags);  	__mod_memcg_state(memcg, idx, val); -	preempt_enable(); +	local_irq_restore(flags);  }  /** @@ -606,9 +608,11 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec,  static inline void mod_lruvec_state(struct lruvec *lruvec,  				    enum node_stat_item idx, int val)  { -	preempt_disable(); +	unsigned long flags; + +	local_irq_save(flags);  	__mod_lruvec_state(lruvec, idx, val); -	preempt_enable(); +	local_irq_restore(flags);  }  static inline void __mod_lruvec_page_state(struct page *page, @@ -630,9 +634,11 @@ static inline void __mod_lruvec_page_state(struct page *page,  static inline void mod_lruvec_page_state(struct page *page,  					 enum node_stat_item idx, int val)  { -	preempt_disable(); +	unsigned long flags; + +	local_irq_save(flags);  	__mod_lruvec_page_state(page, idx, val); -	preempt_enable(); +	local_irq_restore(flags);  }  unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, @@ -659,9 +665,11 @@ static inline void __count_memcg_events(struct mem_cgroup *memcg,  static inline void count_memcg_events(struct mem_cgroup *memcg,  				      int idx, unsigned long count)  { -	preempt_disable(); +	unsigned long flags; + +	local_irq_save(flags);  	__count_memcg_events(memcg, idx, count); -	preempt_enable(); +	local_irq_restore(flags);  }  /* idx can be of type enum memcg_event_item or vm_event_item */ diff --git a/include/linux/mutex.h b/include/linux/mutex.h index f25c13423bd4..cb3bbed4e633 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -66,6 +66,11 @@ struct mutex {  #endif  }; +/* + * Internal helper function; C doesn't allow us to hide it :/ + * + * DO NOT USE (outside of mutex code). + */  static inline struct task_struct *__mutex_owner(struct mutex *lock)  {  	return (struct task_struct *)(atomic_long_read(&lock->owner) & ~0x07); diff --git a/include/linux/nospec.h b/include/linux/nospec.h index fbc98e2c8228..e791ebc65c9c 100644 --- a/include/linux/nospec.h +++ b/include/linux/nospec.h @@ -5,6 +5,7 @@  #ifndef _LINUX_NOSPEC_H  #define _LINUX_NOSPEC_H +#include <asm/barrier.h>  /**   * array_index_mask_nospec() - generate a ~0 mask when index < size, 0 otherwise @@ -30,26 +31,6 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,  #endif  /* - * Warn developers about inappropriate array_index_nospec() usage. - * - * Even if the CPU speculates past the WARN_ONCE branch, the - * sign bit of @index is taken into account when generating the - * mask. - * - * This warning is compiled out when the compiler can infer that - * @index and @size are less than LONG_MAX. - */ -#define array_index_mask_nospec_check(index, size)				\ -({										\ -	if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX,			\ -	    "array_index_nospec() limited to range of [0, LONG_MAX]\n"))	\ -		_mask = 0;							\ -	else									\ -		_mask = array_index_mask_nospec(index, size);			\ -	_mask;									\ -}) - -/*   * array_index_nospec - sanitize an array index after a bounds check   *   * For a code sequence like: @@ -67,12 +48,11 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,  ({									\  	typeof(index) _i = (index);					\  	typeof(size) _s = (size);					\ -	unsigned long _mask = array_index_mask_nospec_check(_i, _s);	\ +	unsigned long _mask = array_index_mask_nospec(_i, _s);		\  									\  	BUILD_BUG_ON(sizeof(_i) > sizeof(long));			\  	BUILD_BUG_ON(sizeof(_s) > sizeof(long));			\  									\ -	_i &= _mask;							\ -	_i;								\ +	(typeof(_i)) (_i & _mask);					\  })  #endif /* _LINUX_NOSPEC_H */ diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index af0f44effd44..40036a57d072 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -14,26 +14,10 @@  #include <linux/interrupt.h>  #include <linux/perf_event.h> +#include <linux/platform_device.h>  #include <linux/sysfs.h>  #include <asm/cputype.h> -/* - * struct arm_pmu_platdata - ARM PMU platform data - * - * @handle_irq: an optional handler which will be called from the - *	interrupt and passed the address of the low level handler, - *	and can be used to implement any platform specific handling - *	before or after calling it. - * - * @irq_flags: if non-zero, these flags will be passed to request_irq - *             when requesting interrupts for this PMU device. - */ -struct arm_pmu_platdata { -	irqreturn_t (*handle_irq)(int irq, void *dev, -				  irq_handler_t pmu_handler); -	unsigned long irq_flags; -}; -  #ifdef CONFIG_ARM_PMU  /* @@ -92,7 +76,6 @@ enum armpmu_attr_groups {  struct arm_pmu {  	struct pmu	pmu; -	cpumask_t	active_irqs;  	cpumask_t	supported_cpus;  	char		*name;  	irqreturn_t	(*handle_irq)(int irq_num, void *dev); @@ -174,12 +157,11 @@ static inline int arm_pmu_acpi_probe(armpmu_init_fn init_fn) { return 0; }  /* Internal functions only for core arm_pmu code */  struct arm_pmu *armpmu_alloc(void); +struct arm_pmu *armpmu_alloc_atomic(void);  void armpmu_free(struct arm_pmu *pmu);  int armpmu_register(struct arm_pmu *pmu); -int armpmu_request_irqs(struct arm_pmu *armpmu); -void armpmu_free_irqs(struct arm_pmu *armpmu); -int armpmu_request_irq(struct arm_pmu *armpmu, int cpu); -void armpmu_free_irq(struct arm_pmu *armpmu, int cpu); +int armpmu_request_irq(int irq, int cpu); +void armpmu_free_irq(int irq, int cpu);  #define ARMV8_PMU_PDEV_NAME "armv8-pmu" diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h index b884b7794187..e6335227b844 100644 --- a/include/linux/ptr_ring.h +++ b/include/linux/ptr_ring.h @@ -469,7 +469,7 @@ static inline int ptr_ring_consume_batched_bh(struct ptr_ring *r,   */  static inline void **__ptr_ring_init_queue_alloc(unsigned int size, gfp_t gfp)  { -	if (size * sizeof(void *) > KMALLOC_MAX_SIZE) +	if (size > KMALLOC_MAX_SIZE / sizeof(void *))  		return NULL;  	return kvmalloc_array(size, sizeof(void *), gfp | __GFP_ZERO);  } diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 1149533aa2fa..9806184bb3d5 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -36,7 +36,18 @@ static inline void mmgrab(struct mm_struct *mm)  	atomic_inc(&mm->mm_count);  } -extern void mmdrop(struct mm_struct *mm); +extern void __mmdrop(struct mm_struct *mm); + +static inline void mmdrop(struct mm_struct *mm) +{ +	/* +	 * The implicit full barrier implied by atomic_dec_and_test() is +	 * required by the membarrier system call before returning to +	 * user-space, after storing to rq->curr. +	 */ +	if (unlikely(atomic_dec_and_test(&mm->mm_count))) +		__mmdrop(mm); +}  /**   * mmget() - Pin the address space associated with a &struct mm_struct. diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index 0dcf4e480ef7..96fe289c4c6e 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h @@ -4,6 +4,7 @@  #include <linux/uidgid.h>  #include <linux/atomic.h> +#include <linux/ratelimit.h>  struct key; @@ -41,6 +42,9 @@ struct user_struct {      defined(CONFIG_NET)  	atomic_long_t locked_vm;  #endif + +	/* Miscellaneous per-user rate limit */ +	struct ratelimit_state ratelimit;  };  extern int uids_sysfs_init(void); diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5ebc0f869720..c1e66bdcf583 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3646,7 +3646,7 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,  	return true;  } -/* For small packets <= CHECKSUM_BREAK peform checksum complete directly +/* For small packets <= CHECKSUM_BREAK perform checksum complete directly   * in checksum_init.   */  #define CHECKSUM_BREAK 76 diff --git a/include/linux/swap.h b/include/linux/swap.h index 7b6a59f722a3..a1a3f4ed94ce 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -337,8 +337,6 @@ extern void deactivate_file_page(struct page *page);  extern void mark_page_lazyfree(struct page *page);  extern void swap_setup(void); -extern void add_page_to_unevictable_list(struct page *page); -  extern void lru_cache_add_active_or_unevictable(struct page *page,  						struct vm_area_struct *vma); diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 4a54ef96aff5..bc0cda180c8b 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -465,6 +465,7 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);  extern void workqueue_set_max_active(struct workqueue_struct *wq,  				     int max_active); +extern struct work_struct *current_work(void);  extern bool current_is_workqueue_rescuer(void);  extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);  extern unsigned int work_busy(struct work_struct *work);  |