mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 19:13:39 -04:00
Merge 5.15-rc3 into tty-next
We need the tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -14,14 +14,6 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef acpi_os_memmap
|
||||
static inline void __iomem *acpi_os_memmap(acpi_physical_address phys,
|
||||
acpi_size size)
|
||||
{
|
||||
return ioremap_cache(phys, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern bool acpi_permanent_mmap;
|
||||
|
||||
void __iomem __ref
|
||||
|
||||
@@ -1023,16 +1023,7 @@ static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
|
||||
port &= IO_SPACE_LIMIT;
|
||||
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
|
||||
}
|
||||
#define __pci_ioport_unmap __pci_ioport_unmap
|
||||
static inline void __pci_ioport_unmap(void __iomem *p)
|
||||
{
|
||||
uintptr_t start = (uintptr_t) PCI_IOBASE;
|
||||
uintptr_t addr = (uintptr_t) p;
|
||||
|
||||
if (addr >= start && addr < start + IO_SPACE_LIMIT)
|
||||
return;
|
||||
iounmap(p);
|
||||
}
|
||||
#define ARCH_HAS_GENERIC_IOPORT_MAP
|
||||
#endif
|
||||
|
||||
#ifndef ioport_unmap
|
||||
@@ -1048,21 +1039,10 @@ extern void ioport_unmap(void __iomem *p);
|
||||
#endif /* CONFIG_HAS_IOPORT_MAP */
|
||||
|
||||
#ifndef CONFIG_GENERIC_IOMAP
|
||||
struct pci_dev;
|
||||
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
|
||||
|
||||
#ifndef __pci_ioport_unmap
|
||||
static inline void __pci_ioport_unmap(void __iomem *p) {}
|
||||
#endif
|
||||
|
||||
#ifndef pci_iounmap
|
||||
#define pci_iounmap pci_iounmap
|
||||
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
|
||||
{
|
||||
__pci_ioport_unmap(p);
|
||||
}
|
||||
#define ARCH_WANTS_GENERIC_PCI_IOUNMAP
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_GENERIC_IOMAP */
|
||||
|
||||
#ifndef xlate_dev_mem_ptr
|
||||
#define xlate_dev_mem_ptr xlate_dev_mem_ptr
|
||||
|
||||
@@ -110,16 +110,6 @@ static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
|
||||
struct pci_dev;
|
||||
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
|
||||
#elif defined(CONFIG_GENERIC_IOMAP)
|
||||
struct pci_dev;
|
||||
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
|
||||
{ }
|
||||
#endif
|
||||
|
||||
#include <asm-generic/pci_iomap.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -197,10 +197,12 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
|
||||
return hv_vp_index[cpu_number];
|
||||
}
|
||||
|
||||
static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||
const struct cpumask *cpus)
|
||||
static inline int __cpumask_to_vpset(struct hv_vpset *vpset,
|
||||
const struct cpumask *cpus,
|
||||
bool exclude_self)
|
||||
{
|
||||
int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1;
|
||||
int this_cpu = smp_processor_id();
|
||||
|
||||
/* valid_bank_mask can represent up to 64 banks */
|
||||
if (hv_max_vp_index / 64 >= 64)
|
||||
@@ -218,6 +220,8 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||
* Some banks may end up being empty but this is acceptable.
|
||||
*/
|
||||
for_each_cpu(cpu, cpus) {
|
||||
if (exclude_self && cpu == this_cpu)
|
||||
continue;
|
||||
vcpu = hv_cpu_number_to_vp_number(cpu);
|
||||
if (vcpu == VP_INVAL)
|
||||
return -1;
|
||||
@@ -232,6 +236,19 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||
return nr_bank;
|
||||
}
|
||||
|
||||
static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||
const struct cpumask *cpus)
|
||||
{
|
||||
return __cpumask_to_vpset(vpset, cpus, false);
|
||||
}
|
||||
|
||||
static inline int cpumask_to_vpset_noself(struct hv_vpset *vpset,
|
||||
const struct cpumask *cpus)
|
||||
{
|
||||
WARN_ON_ONCE(preemptible());
|
||||
return __cpumask_to_vpset(vpset, cpus, true);
|
||||
}
|
||||
|
||||
void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
|
||||
bool hv_is_hyperv_initialized(void);
|
||||
bool hv_is_hibernation_supported(void);
|
||||
|
||||
@@ -18,6 +18,7 @@ extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
|
||||
extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
|
||||
unsigned long offset,
|
||||
unsigned long maxlen);
|
||||
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
|
||||
/* Create a virtual mapping cookie for a port on a given PCI device.
|
||||
* Do not call this directly, it exists to make it easier for architectures
|
||||
* to override */
|
||||
@@ -50,6 +51,8 @@ static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
|
||||
{ }
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_GENERIC_PCI_IOMAP_H */
|
||||
|
||||
@@ -116,11 +116,7 @@
|
||||
* GCC 4.5 and later have a 32 bytes section alignment for structures.
|
||||
* Except GCC 4.9, that feels the need to align on 64 bytes.
|
||||
*/
|
||||
#if __GNUC__ == 4 && __GNUC_MINOR__ == 9
|
||||
#define STRUCT_ALIGNMENT 64
|
||||
#else
|
||||
#define STRUCT_ALIGNMENT 32
|
||||
#endif
|
||||
#define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
|
||||
|
||||
/*
|
||||
|
||||
@@ -194,7 +194,7 @@ void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size,
|
||||
struct buffer_head *__bread_gfp(struct block_device *,
|
||||
sector_t block, unsigned size, gfp_t gfp);
|
||||
void invalidate_bh_lrus(void);
|
||||
void invalidate_bh_lrus_cpu(int cpu);
|
||||
void invalidate_bh_lrus_cpu(void);
|
||||
bool has_bh_in_lru(int cpu, void *dummy);
|
||||
struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
|
||||
void free_buffer_head(struct buffer_head * bh);
|
||||
@@ -408,7 +408,7 @@ static inline int inode_has_buffers(struct inode *inode) { return 0; }
|
||||
static inline void invalidate_inode_buffers(struct inode *inode) {}
|
||||
static inline int remove_inode_buffers(struct inode *inode) { return 1; }
|
||||
static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
|
||||
static inline void invalidate_bh_lrus_cpu(int cpu) {}
|
||||
static inline void invalidate_bh_lrus_cpu(void) {}
|
||||
static inline bool has_bh_in_lru(int cpu, void *dummy) { return false; }
|
||||
#define buffer_heads_over_limit 0
|
||||
|
||||
|
||||
@@ -752,107 +752,54 @@ static inline void cgroup_threadgroup_change_end(struct task_struct *tsk) {}
|
||||
* sock_cgroup_data is embedded at sock->sk_cgrp_data and contains
|
||||
* per-socket cgroup information except for memcg association.
|
||||
*
|
||||
* On legacy hierarchies, net_prio and net_cls controllers directly set
|
||||
* attributes on each sock which can then be tested by the network layer.
|
||||
* On the default hierarchy, each sock is associated with the cgroup it was
|
||||
* created in and the networking layer can match the cgroup directly.
|
||||
*
|
||||
* To avoid carrying all three cgroup related fields separately in sock,
|
||||
* sock_cgroup_data overloads (prioidx, classid) and the cgroup pointer.
|
||||
* On boot, sock_cgroup_data records the cgroup that the sock was created
|
||||
* in so that cgroup2 matches can be made; however, once either net_prio or
|
||||
* net_cls starts being used, the area is overridden to carry prioidx and/or
|
||||
* classid. The two modes are distinguished by whether the lowest bit is
|
||||
* set. Clear bit indicates cgroup pointer while set bit prioidx and
|
||||
* classid.
|
||||
*
|
||||
* While userland may start using net_prio or net_cls at any time, once
|
||||
* either is used, cgroup2 matching no longer works. There is no reason to
|
||||
* mix the two and this is in line with how legacy and v2 compatibility is
|
||||
* handled. On mode switch, cgroup references which are already being
|
||||
* pointed to by socks may be leaked. While this can be remedied by adding
|
||||
* synchronization around sock_cgroup_data, given that the number of leaked
|
||||
* cgroups is bound and highly unlikely to be high, this seems to be the
|
||||
* better trade-off.
|
||||
* On legacy hierarchies, net_prio and net_cls controllers directly
|
||||
* set attributes on each sock which can then be tested by the network
|
||||
* layer. On the default hierarchy, each sock is associated with the
|
||||
* cgroup it was created in and the networking layer can match the
|
||||
* cgroup directly.
|
||||
*/
|
||||
struct sock_cgroup_data {
|
||||
union {
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
struct {
|
||||
u8 is_data : 1;
|
||||
u8 no_refcnt : 1;
|
||||
u8 unused : 6;
|
||||
u8 padding;
|
||||
u16 prioidx;
|
||||
u32 classid;
|
||||
} __packed;
|
||||
#else
|
||||
struct {
|
||||
u32 classid;
|
||||
u16 prioidx;
|
||||
u8 padding;
|
||||
u8 unused : 6;
|
||||
u8 no_refcnt : 1;
|
||||
u8 is_data : 1;
|
||||
} __packed;
|
||||
struct cgroup *cgroup; /* v2 */
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
u32 classid; /* v1 */
|
||||
#endif
|
||||
#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
u16 prioidx; /* v1 */
|
||||
#endif
|
||||
u64 val;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* There's a theoretical window where the following accessors race with
|
||||
* updaters and return part of the previous pointer as the prioidx or
|
||||
* classid. Such races are short-lived and the result isn't critical.
|
||||
*/
|
||||
static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd)
|
||||
{
|
||||
/* fallback to 1 which is always the ID of the root cgroup */
|
||||
return (skcd->is_data & 1) ? skcd->prioidx : 1;
|
||||
#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
return READ_ONCE(skcd->prioidx);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd)
|
||||
{
|
||||
/* fallback to 0 which is the unconfigured default classid */
|
||||
return (skcd->is_data & 1) ? skcd->classid : 0;
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
return READ_ONCE(skcd->classid);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* If invoked concurrently, the updaters may clobber each other. The
|
||||
* caller is responsible for synchronization.
|
||||
*/
|
||||
static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
|
||||
u16 prioidx)
|
||||
{
|
||||
struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
|
||||
|
||||
if (sock_cgroup_prioidx(&skcd_buf) == prioidx)
|
||||
return;
|
||||
|
||||
if (!(skcd_buf.is_data & 1)) {
|
||||
skcd_buf.val = 0;
|
||||
skcd_buf.is_data = 1;
|
||||
}
|
||||
|
||||
skcd_buf.prioidx = prioidx;
|
||||
WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
|
||||
#ifdef CONFIG_CGROUP_NET_PRIO
|
||||
WRITE_ONCE(skcd->prioidx, prioidx);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd,
|
||||
u32 classid)
|
||||
{
|
||||
struct sock_cgroup_data skcd_buf = {{ .val = READ_ONCE(skcd->val) }};
|
||||
|
||||
if (sock_cgroup_classid(&skcd_buf) == classid)
|
||||
return;
|
||||
|
||||
if (!(skcd_buf.is_data & 1)) {
|
||||
skcd_buf.val = 0;
|
||||
skcd_buf.is_data = 1;
|
||||
}
|
||||
|
||||
skcd_buf.classid = classid;
|
||||
WRITE_ONCE(skcd->val, skcd_buf.val); /* see sock_cgroup_ptr() */
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
WRITE_ONCE(skcd->classid, classid);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* CONFIG_SOCK_CGROUP_DATA */
|
||||
|
||||
@@ -829,33 +829,13 @@ static inline void cgroup_account_cputime_field(struct task_struct *task,
|
||||
*/
|
||||
#ifdef CONFIG_SOCK_CGROUP_DATA
|
||||
|
||||
#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
|
||||
extern spinlock_t cgroup_sk_update_lock;
|
||||
#endif
|
||||
|
||||
void cgroup_sk_alloc_disable(void);
|
||||
void cgroup_sk_alloc(struct sock_cgroup_data *skcd);
|
||||
void cgroup_sk_clone(struct sock_cgroup_data *skcd);
|
||||
void cgroup_sk_free(struct sock_cgroup_data *skcd);
|
||||
|
||||
static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd)
|
||||
{
|
||||
#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
|
||||
unsigned long v;
|
||||
|
||||
/*
|
||||
* @skcd->val is 64bit but the following is safe on 32bit too as we
|
||||
* just need the lower ulong to be written and read atomically.
|
||||
*/
|
||||
v = READ_ONCE(skcd->val);
|
||||
|
||||
if (v & 3)
|
||||
return &cgrp_dfl_root.cgrp;
|
||||
|
||||
return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp;
|
||||
#else
|
||||
return (struct cgroup *)(unsigned long)skcd->val;
|
||||
#endif
|
||||
return skcd->cgroup;
|
||||
}
|
||||
|
||||
#else /* CONFIG_CGROUP_DATA */
|
||||
|
||||
@@ -62,19 +62,6 @@
|
||||
#define __no_sanitize_coverage
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Not all versions of clang implement the type-generic versions
|
||||
* of the builtin overflow checkers. Fortunately, clang implements
|
||||
* __has_builtin allowing us to avoid awkward version
|
||||
* checks. Unfortunately, we don't know which version of gcc clang
|
||||
* pretends to be, so the macro may or may not be defined.
|
||||
*/
|
||||
#if __has_builtin(__builtin_mul_overflow) && \
|
||||
__has_builtin(__builtin_add_overflow) && \
|
||||
__has_builtin(__builtin_sub_overflow)
|
||||
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
|
||||
#endif
|
||||
|
||||
#if __has_feature(shadow_call_stack)
|
||||
# define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
|
||||
#endif
|
||||
|
||||
@@ -95,10 +95,8 @@
|
||||
|
||||
#if GCC_VERSION >= 70000
|
||||
#define KASAN_ABI_VERSION 5
|
||||
#elif GCC_VERSION >= 50000
|
||||
#else
|
||||
#define KASAN_ABI_VERSION 4
|
||||
#elif GCC_VERSION >= 40902
|
||||
#define KASAN_ABI_VERSION 3
|
||||
#endif
|
||||
|
||||
#if __has_attribute(__no_sanitize_address__)
|
||||
@@ -125,10 +123,6 @@
|
||||
#define __no_sanitize_coverage
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= 50100
|
||||
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Turn individual warnings and errors on and off locally, depending
|
||||
* on version.
|
||||
|
||||
@@ -188,6 +188,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
||||
(typeof(ptr)) (__ptr + (off)); })
|
||||
#endif
|
||||
|
||||
#define absolute_pointer(val) RELOC_HIDE((void *)(val), 0)
|
||||
|
||||
#ifndef OPTIMIZER_HIDE_VAR
|
||||
/* Make the optimizer believe the variable can be manipulated arbitrarily. */
|
||||
#define OPTIMIZER_HIDE_VAR(var) \
|
||||
|
||||
@@ -20,29 +20,6 @@
|
||||
* Provide links to the documentation of each supported compiler, if it exists.
|
||||
*/
|
||||
|
||||
/*
|
||||
* __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.
|
||||
* In the meantime, to support gcc < 5, we implement __has_attribute
|
||||
* by hand.
|
||||
*/
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) __GCC4_has_attribute_##x
|
||||
# define __GCC4_has_attribute___assume_aligned__ 1
|
||||
# define __GCC4_has_attribute___copy__ 0
|
||||
# define __GCC4_has_attribute___designated_init__ 0
|
||||
# define __GCC4_has_attribute___error__ 1
|
||||
# define __GCC4_has_attribute___externally_visible__ 1
|
||||
# define __GCC4_has_attribute___no_caller_saved_registers__ 0
|
||||
# define __GCC4_has_attribute___noclone__ 1
|
||||
# define __GCC4_has_attribute___no_profile_instrument_function__ 0
|
||||
# define __GCC4_has_attribute___nonstring__ 0
|
||||
# define __GCC4_has_attribute___no_sanitize_address__ 1
|
||||
# define __GCC4_has_attribute___no_sanitize_undefined__ 1
|
||||
# define __GCC4_has_attribute___no_sanitize_coverage__ 0
|
||||
# define __GCC4_has_attribute___fallthrough__ 0
|
||||
# define __GCC4_has_attribute___warning__ 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alias-function-attribute
|
||||
*/
|
||||
@@ -77,7 +54,6 @@
|
||||
* compiler should see some alignment anyway, when the return value is
|
||||
* massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
*
|
||||
* Optional: only supported since gcc >= 4.9
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-assume_005faligned-function-attribute
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright 2019-2021 NXP Semiconductors
|
||||
* Copyright 2019-2021 NXP
|
||||
*/
|
||||
|
||||
#ifndef _NET_DSA_TAG_OCELOT_H
|
||||
|
||||
@@ -251,7 +251,7 @@ static inline struct fwnode_handle *irq_domain_alloc_fwnode(phys_addr_t *pa)
|
||||
}
|
||||
|
||||
void irq_domain_free_fwnode(struct fwnode_handle *fwnode);
|
||||
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
|
||||
struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size,
|
||||
irq_hw_number_t hwirq_max, int direct_max,
|
||||
const struct irq_domain_ops *ops,
|
||||
void *host_data);
|
||||
|
||||
@@ -80,6 +80,9 @@ struct mdio_driver {
|
||||
|
||||
/* Clears up any memory if needed */
|
||||
void (*remove)(struct mdio_device *mdiodev);
|
||||
|
||||
/* Quiesces the device on system shutdown, turns off interrupts etc */
|
||||
void (*shutdown)(struct mdio_device *mdiodev);
|
||||
};
|
||||
|
||||
static inline struct mdio_driver *
|
||||
|
||||
@@ -118,6 +118,7 @@ int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
|
||||
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
void memblock_free_all(void);
|
||||
void memblock_free_ptr(void *ptr, size_t size);
|
||||
void reset_node_managed_pages(pg_data_t *pgdat);
|
||||
void reset_all_zones_managed_pages(void);
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ struct migration_target_control;
|
||||
*/
|
||||
#define MIGRATEPAGE_SUCCESS 0
|
||||
|
||||
/*
|
||||
* Keep sync with:
|
||||
* - macro MIGRATE_REASON in include/trace/events/migrate.h
|
||||
* - migrate_reason_names[MR_TYPES] in mm/debug.c
|
||||
*/
|
||||
enum migrate_reason {
|
||||
MR_COMPACTION,
|
||||
MR_MEMORY_FAILURE,
|
||||
@@ -32,7 +37,6 @@ enum migrate_reason {
|
||||
MR_TYPES
|
||||
};
|
||||
|
||||
/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
|
||||
extern const char *migrate_reason_names[MR_TYPES];
|
||||
|
||||
#ifdef CONFIG_MIGRATION
|
||||
|
||||
@@ -144,15 +144,6 @@ static inline void mmap_read_unlock(struct mm_struct *mm)
|
||||
up_read(&mm->mmap_lock);
|
||||
}
|
||||
|
||||
static inline bool mmap_read_trylock_non_owner(struct mm_struct *mm)
|
||||
{
|
||||
if (mmap_read_trylock(mm)) {
|
||||
rwsem_release(&mm->mmap_lock.dep_map, _RET_IP_);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void mmap_read_unlock_non_owner(struct mm_struct *mm)
|
||||
{
|
||||
__mmap_lock_trace_released(mm, false);
|
||||
|
||||
@@ -150,6 +150,20 @@ static inline int nvmem_cell_read_u64(struct device *dev,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int nvmem_cell_read_variable_le_u32(struct device *dev,
|
||||
const char *cell_id,
|
||||
u32 *val)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline int nvmem_cell_read_variable_le_u64(struct device *dev,
|
||||
const char *cell_id,
|
||||
u64 *val)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline struct nvmem_device *nvmem_device_get(struct device *dev,
|
||||
const char *name)
|
||||
{
|
||||
|
||||
@@ -6,12 +6,9 @@
|
||||
#include <linux/limits.h>
|
||||
|
||||
/*
|
||||
* In the fallback code below, we need to compute the minimum and
|
||||
* maximum values representable in a given type. These macros may also
|
||||
* be useful elsewhere, so we provide them outside the
|
||||
* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW block.
|
||||
*
|
||||
* It would seem more obvious to do something like
|
||||
* We need to compute the minimum and maximum values representable in a given
|
||||
* type. These macros may also be useful elsewhere. It would seem more obvious
|
||||
* to do something like:
|
||||
*
|
||||
* #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0)
|
||||
* #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0)
|
||||
@@ -54,7 +51,6 @@ static inline bool __must_check __must_check_overflow(bool overflow)
|
||||
return unlikely(overflow);
|
||||
}
|
||||
|
||||
#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW
|
||||
/*
|
||||
* For simplicity and code hygiene, the fallback code below insists on
|
||||
* a, b and *d having the same type (similar to the min() and max()
|
||||
@@ -90,134 +86,6 @@ static inline bool __must_check __must_check_overflow(bool overflow)
|
||||
__builtin_mul_overflow(__a, __b, __d); \
|
||||
}))
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/* Checking for unsigned overflow is relatively easy without causing UB. */
|
||||
#define __unsigned_add_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = __a + __b; \
|
||||
*__d < __a; \
|
||||
})
|
||||
#define __unsigned_sub_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = __a - __b; \
|
||||
__a < __b; \
|
||||
})
|
||||
/*
|
||||
* If one of a or b is a compile-time constant, this avoids a division.
|
||||
*/
|
||||
#define __unsigned_mul_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = __a * __b; \
|
||||
__builtin_constant_p(__b) ? \
|
||||
__b > 0 && __a > type_max(typeof(__a)) / __b : \
|
||||
__a > 0 && __b > type_max(typeof(__b)) / __a; \
|
||||
})
|
||||
|
||||
/*
|
||||
* For signed types, detecting overflow is much harder, especially if
|
||||
* we want to avoid UB. But the interface of these macros is such that
|
||||
* we must provide a result in *d, and in fact we must produce the
|
||||
* result promised by gcc's builtins, which is simply the possibly
|
||||
* wrapped-around value. Fortunately, we can just formally do the
|
||||
* operations in the widest relevant unsigned type (u64) and then
|
||||
* truncate the result - gcc is smart enough to generate the same code
|
||||
* with and without the (u64) casts.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Adding two signed integers can overflow only if they have the same
|
||||
* sign, and overflow has happened iff the result has the opposite
|
||||
* sign.
|
||||
*/
|
||||
#define __signed_add_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = (u64)__a + (u64)__b; \
|
||||
(((~(__a ^ __b)) & (*__d ^ __a)) \
|
||||
& type_min(typeof(__a))) != 0; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Subtraction is similar, except that overflow can now happen only
|
||||
* when the signs are opposite. In this case, overflow has happened if
|
||||
* the result has the opposite sign of a.
|
||||
*/
|
||||
#define __signed_sub_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = (u64)__a - (u64)__b; \
|
||||
((((__a ^ __b)) & (*__d ^ __a)) \
|
||||
& type_min(typeof(__a))) != 0; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Signed multiplication is rather hard. gcc always follows C99, so
|
||||
* division is truncated towards 0. This means that we can write the
|
||||
* overflow check like this:
|
||||
*
|
||||
* (a > 0 && (b > MAX/a || b < MIN/a)) ||
|
||||
* (a < -1 && (b > MIN/a || b < MAX/a) ||
|
||||
* (a == -1 && b == MIN)
|
||||
*
|
||||
* The redundant casts of -1 are to silence an annoying -Wtype-limits
|
||||
* (included in -Wextra) warning: When the type is u8 or u16, the
|
||||
* __b_c_e in check_mul_overflow obviously selects
|
||||
* __unsigned_mul_overflow, but unfortunately gcc still parses this
|
||||
* code and warns about the limited range of __b.
|
||||
*/
|
||||
|
||||
#define __signed_mul_overflow(a, b, d) ({ \
|
||||
typeof(a) __a = (a); \
|
||||
typeof(b) __b = (b); \
|
||||
typeof(d) __d = (d); \
|
||||
typeof(a) __tmax = type_max(typeof(a)); \
|
||||
typeof(a) __tmin = type_min(typeof(a)); \
|
||||
(void) (&__a == &__b); \
|
||||
(void) (&__a == __d); \
|
||||
*__d = (u64)__a * (u64)__b; \
|
||||
(__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \
|
||||
(__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \
|
||||
(__b == (typeof(__b))-1 && __a == __tmin); \
|
||||
})
|
||||
|
||||
|
||||
#define check_add_overflow(a, b, d) __must_check_overflow( \
|
||||
__builtin_choose_expr(is_signed_type(typeof(a)), \
|
||||
__signed_add_overflow(a, b, d), \
|
||||
__unsigned_add_overflow(a, b, d)))
|
||||
|
||||
#define check_sub_overflow(a, b, d) __must_check_overflow( \
|
||||
__builtin_choose_expr(is_signed_type(typeof(a)), \
|
||||
__signed_sub_overflow(a, b, d), \
|
||||
__unsigned_sub_overflow(a, b, d)))
|
||||
|
||||
#define check_mul_overflow(a, b, d) __must_check_overflow( \
|
||||
__builtin_choose_expr(is_signed_type(typeof(a)), \
|
||||
__signed_mul_overflow(a, b, d), \
|
||||
__unsigned_mul_overflow(a, b, d)))
|
||||
|
||||
#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
|
||||
|
||||
/** check_shl_overflow() - Calculate a left-shifted value and check overflow
|
||||
*
|
||||
* @a: Value to be shifted
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright (c) 2016-2018, NXP Semiconductors
|
||||
* Copyright 2016-2018 NXP
|
||||
* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
|
||||
*/
|
||||
#ifndef _LINUX_PACKING_H
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
#define ARCH_DEFAULT_PKEY 0
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_PKEYS
|
||||
#include <asm/pkeys.h>
|
||||
#else /* ! CONFIG_ARCH_HAS_PKEYS */
|
||||
|
||||
@@ -1471,6 +1471,7 @@ struct task_struct {
|
||||
mce_whole_page : 1,
|
||||
__mce_reserved : 62;
|
||||
struct callback_head mce_kill_me;
|
||||
int mce_count;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KRETPROBES
|
||||
|
||||
@@ -1940,7 +1940,7 @@ static inline void __skb_insert(struct sk_buff *newsk,
|
||||
WRITE_ONCE(newsk->prev, prev);
|
||||
WRITE_ONCE(next->prev, newsk);
|
||||
WRITE_ONCE(prev->next, newsk);
|
||||
list->qlen++;
|
||||
WRITE_ONCE(list->qlen, list->qlen + 1);
|
||||
}
|
||||
|
||||
static inline void __skb_queue_splice(const struct sk_buff_head *list,
|
||||
|
||||
@@ -197,6 +197,8 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
|
||||
|
||||
mem_cgroup_handle_over_high();
|
||||
blkcg_maybe_throttle_current();
|
||||
|
||||
rseq_handle_notify_resume(NULL, regs);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,6 +27,12 @@ enum iter_type {
|
||||
ITER_DISCARD,
|
||||
};
|
||||
|
||||
struct iov_iter_state {
|
||||
size_t iov_offset;
|
||||
size_t count;
|
||||
unsigned long nr_segs;
|
||||
};
|
||||
|
||||
struct iov_iter {
|
||||
u8 iter_type;
|
||||
bool data_source;
|
||||
@@ -47,7 +53,6 @@ struct iov_iter {
|
||||
};
|
||||
loff_t xarray_start;
|
||||
};
|
||||
size_t truncated;
|
||||
};
|
||||
|
||||
static inline enum iter_type iov_iter_type(const struct iov_iter *i)
|
||||
@@ -55,6 +60,14 @@ static inline enum iter_type iov_iter_type(const struct iov_iter *i)
|
||||
return i->iter_type;
|
||||
}
|
||||
|
||||
static inline void iov_iter_save_state(struct iov_iter *iter,
|
||||
struct iov_iter_state *state)
|
||||
{
|
||||
state->iov_offset = iter->iov_offset;
|
||||
state->count = iter->count;
|
||||
state->nr_segs = iter->nr_segs;
|
||||
}
|
||||
|
||||
static inline bool iter_is_iovec(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_IOVEC;
|
||||
@@ -233,6 +246,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
|
||||
ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
|
||||
size_t maxsize, size_t *start);
|
||||
int iov_iter_npages(const struct iov_iter *i, int maxpages);
|
||||
void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state);
|
||||
|
||||
const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags);
|
||||
|
||||
@@ -255,10 +269,8 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count)
|
||||
* conversion in assignement is by definition greater than all
|
||||
* values of size_t, including old i->count.
|
||||
*/
|
||||
if (i->count > count) {
|
||||
i->truncated += i->count - count;
|
||||
if (i->count > count)
|
||||
i->count = count;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -267,7 +279,6 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count)
|
||||
*/
|
||||
static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
|
||||
{
|
||||
i->truncated -= count - i->count;
|
||||
i->count = count;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ struct usb_hcd {
|
||||
#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
|
||||
#define HCD_FLAG_DEAD 6 /* controller has died? */
|
||||
#define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */
|
||||
#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */
|
||||
|
||||
/* The flags can be tested using these macros; they are likely to
|
||||
* be slightly faster than test_bit().
|
||||
@@ -134,6 +135,7 @@ struct usb_hcd {
|
||||
#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
|
||||
#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
|
||||
#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
|
||||
#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER))
|
||||
|
||||
/*
|
||||
* Specifies if interfaces are authorized by default
|
||||
|
||||
@@ -447,6 +447,11 @@ static inline bool dsa_port_is_user(struct dsa_port *dp)
|
||||
return dp->type == DSA_PORT_TYPE_USER;
|
||||
}
|
||||
|
||||
static inline bool dsa_port_is_unused(struct dsa_port *dp)
|
||||
{
|
||||
return dp->type == DSA_PORT_TYPE_UNUSED;
|
||||
}
|
||||
|
||||
static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p)
|
||||
{
|
||||
return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_UNUSED;
|
||||
@@ -580,8 +585,16 @@ struct dsa_switch_ops {
|
||||
int (*change_tag_protocol)(struct dsa_switch *ds, int port,
|
||||
enum dsa_tag_protocol proto);
|
||||
|
||||
/* Optional switch-wide initialization and destruction methods */
|
||||
int (*setup)(struct dsa_switch *ds);
|
||||
void (*teardown)(struct dsa_switch *ds);
|
||||
|
||||
/* Per-port initialization and destruction methods. Mandatory if the
|
||||
* driver registers devlink port regions, optional otherwise.
|
||||
*/
|
||||
int (*port_setup)(struct dsa_switch *ds, int port);
|
||||
void (*port_teardown)(struct dsa_switch *ds, int port);
|
||||
|
||||
u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
|
||||
|
||||
/*
|
||||
@@ -1041,6 +1054,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr,
|
||||
|
||||
void dsa_unregister_switch(struct dsa_switch *ds);
|
||||
int dsa_register_switch(struct dsa_switch *ds);
|
||||
void dsa_switch_shutdown(struct dsa_switch *ds);
|
||||
struct dsa_switch *dsa_switch_find(int tree_index, int sw_index);
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
int dsa_switch_suspend(struct dsa_switch *ds);
|
||||
|
||||
@@ -1640,6 +1640,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
|
||||
release_sock(sk);
|
||||
__release(&sk->sk_lock.slock);
|
||||
} else {
|
||||
mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
|
||||
spin_unlock_bh(&sk->sk_lock.slock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ struct scsi_device {
|
||||
struct scsi_vpd __rcu *vpd_pg83;
|
||||
struct scsi_vpd __rcu *vpd_pg80;
|
||||
struct scsi_vpd __rcu *vpd_pg89;
|
||||
unsigned char current_tag; /* current tag */
|
||||
struct scsi_target *sdev_target;
|
||||
|
||||
blist_flags_t sdev_bflags; /* black/white flags as also found in
|
||||
|
||||
@@ -306,11 +306,13 @@ enum afs_flock_operation {
|
||||
|
||||
enum afs_cb_break_reason {
|
||||
afs_cb_break_no_break,
|
||||
afs_cb_break_no_promise,
|
||||
afs_cb_break_for_callback,
|
||||
afs_cb_break_for_deleted,
|
||||
afs_cb_break_for_lapsed,
|
||||
afs_cb_break_for_s_reinit,
|
||||
afs_cb_break_for_unlink,
|
||||
afs_cb_break_for_vsbreak,
|
||||
afs_cb_break_for_v_break,
|
||||
afs_cb_break_for_volume_callback,
|
||||
afs_cb_break_for_zap,
|
||||
};
|
||||
@@ -602,11 +604,13 @@ enum afs_cb_break_reason {
|
||||
|
||||
#define afs_cb_break_reasons \
|
||||
EM(afs_cb_break_no_break, "no-break") \
|
||||
EM(afs_cb_break_no_promise, "no-promise") \
|
||||
EM(afs_cb_break_for_callback, "break-cb") \
|
||||
EM(afs_cb_break_for_deleted, "break-del") \
|
||||
EM(afs_cb_break_for_lapsed, "break-lapsed") \
|
||||
EM(afs_cb_break_for_s_reinit, "s-reinit") \
|
||||
EM(afs_cb_break_for_unlink, "break-unlink") \
|
||||
EM(afs_cb_break_for_vsbreak, "break-vs") \
|
||||
EM(afs_cb_break_for_v_break, "break-v") \
|
||||
EM(afs_cb_break_for_volume_callback, "break-v-cb") \
|
||||
E_(afs_cb_break_for_zap, "break-zap")
|
||||
|
||||
|
||||
@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup,
|
||||
TP_STRUCT__entry(
|
||||
__field(dev_t, dev )
|
||||
__field(erofs_nid_t, nid )
|
||||
__field(const char *, name )
|
||||
__string(name, dentry->d_name.name )
|
||||
__field(unsigned int, flags )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->dev = dir->i_sb->s_dev;
|
||||
__entry->nid = EROFS_I(dir)->nid;
|
||||
__entry->name = dentry->d_name.name;
|
||||
__assign_str(name, dentry->d_name.name);
|
||||
__entry->flags = flags;
|
||||
),
|
||||
|
||||
TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
|
||||
show_dev_nid(__entry),
|
||||
__entry->name,
|
||||
__get_str(name),
|
||||
__entry->flags)
|
||||
);
|
||||
|
||||
|
||||
@@ -225,7 +225,14 @@ struct binder_freeze_info {
|
||||
|
||||
struct binder_frozen_status_info {
|
||||
__u32 pid;
|
||||
|
||||
/* process received sync transactions since last frozen
|
||||
* bit 0: received sync transaction after being frozen
|
||||
* bit 1: new pending sync transaction during freezing
|
||||
*/
|
||||
__u32 sync_recv;
|
||||
|
||||
/* process received async transactions since last frozen */
|
||||
__u32 async_recv;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
|
||||
/*
|
||||
* include/uapi/linux/cifs/cifs_mount.h
|
||||
*
|
||||
* Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)
|
||||
*
|
||||
|
||||
@@ -317,13 +317,19 @@ enum {
|
||||
IORING_REGISTER_IOWQ_AFF = 17,
|
||||
IORING_UNREGISTER_IOWQ_AFF = 18,
|
||||
|
||||
/* set/get max number of workers */
|
||||
/* set/get max number of io-wq workers */
|
||||
IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
|
||||
|
||||
/* this goes last */
|
||||
IORING_REGISTER_LAST
|
||||
};
|
||||
|
||||
/* io-wq worker categories */
|
||||
enum {
|
||||
IO_WQ_BOUND,
|
||||
IO_WQ_UNBOUND,
|
||||
};
|
||||
|
||||
/* deprecated, see struct io_uring_rsrc_update */
|
||||
struct io_uring_files_update {
|
||||
__u32 offset;
|
||||
|
||||
@@ -46,19 +46,7 @@ extern unsigned long *xen_contiguous_bitmap;
|
||||
int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
|
||||
unsigned int address_bits,
|
||||
dma_addr_t *dma_handle);
|
||||
|
||||
void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
|
||||
#else
|
||||
static inline int xen_create_contiguous_region(phys_addr_t pstart,
|
||||
unsigned int order,
|
||||
unsigned int address_bits,
|
||||
dma_addr_t *dma_handle)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void xen_destroy_contiguous_region(phys_addr_t pstart,
|
||||
unsigned int order) { }
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_XEN_PV)
|
||||
|
||||
Reference in New Issue
Block a user