aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-08-05 16:04:31 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-05 16:04:31 -0400
commitc1c8626fcebed467184ffd8de0ab5c9f9d9c3594 (patch)
tree2c661fee934f4a7985e4f8e29cd1ba63a330a5e4
parentd89d41556141a527030a15233135ba622ba3350d (diff)
parent1ffaddd029c867d134a1dde39f540dcc8c52e274 (diff)
Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Lots of overlapping changes, mostly trivial in nature. The mlxsw conflict was resolving using the example resolution at: https://github.com/jpirko/linux_mlxsw/blob/combined_queue/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile2
-rw-r--r--arch/arc/Kconfig3
-rw-r--r--arch/arc/include/asm/cache.h4
-rw-r--r--arch/arc/include/asm/delay.h3
-rw-r--r--arch/arc/mm/cache.c17
-rw-r--r--arch/arc/mm/dma.c49
-rw-r--r--arch/arc/plat-eznps/include/plat/ctop.h10
-rw-r--r--arch/arc/plat-eznps/mtm.c6
-rw-r--r--arch/arm64/crypto/ghash-ce-glue.c8
-rw-r--r--arch/powerpc/include/asm/mmu_context.h33
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c3
-rw-r--r--arch/powerpc/platforms/pseries/setup.c3
-rw-r--r--arch/x86/boot/compressed/pgtable_64.c73
-rw-r--r--arch/x86/events/intel/uncore.h2
-rw-r--r--arch/x86/events/intel/uncore_snbep.c10
-rw-r--r--arch/x86/kvm/vmx.c22
-rw-r--r--block/blk-core.c5
-rw-r--r--block/blk-mq-tag.c2
-rw-r--r--drivers/crypto/padlock-aes.c8
-rw-r--r--drivers/gpu/drm/bridge/adv7511/adv7511_drv.c12
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c8
-rw-r--r--drivers/gpu/drm/drm_context.c2
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c3
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c59
-rw-r--r--drivers/media/platform/vsp1/vsp1_drm.c4
-rw-r--r--drivers/media/rc/bpf-lirc.c1
-rw-r--r--drivers/media/rc/rc-ir-raw.c8
-rw-r--r--drivers/media/rc/rc-main.c12
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c51
-rw-r--r--drivers/net/wan/lmc/lmc_main.c2
-rw-r--r--drivers/pci/bus.c6
-rw-r--r--drivers/pci/controller/pcie-mobiveil.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c2
-rw-r--r--drivers/pci/pci.h11
-rw-r--r--drivers/pci/probe.c4
-rw-r--r--drivers/pci/remove.c5
-rw-r--r--fs/iomap.c2
-rw-r--r--fs/jfs/jfs_dinode.h7
-rw-r--r--fs/jfs/jfs_incore.h1
-rw-r--r--fs/jfs/super.c3
-rw-r--r--fs/nfs/nfs4proc.c26
-rw-r--r--fs/userfaultfd.c4
-rw-r--r--include/linux/pci.h1
-rw-r--r--ipc/shm.c12
-rw-r--r--kernel/irq/manage.c9
-rw-r--r--kernel/softirq.c2
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--mm/hugetlb.c7
-rw-r--r--mm/memcontrol.c15
-rw-r--r--net/l2tp/l2tp_ppp.c13
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/smc/smc_cdc.c3
-rw-r--r--net/xdp/xsk.c4
-rw-r--r--tools/arch/powerpc/include/uapi/asm/unistd.h1
-rw-r--r--tools/arch/x86/include/asm/mcsafe_test.h13
-rw-r--r--tools/arch/x86/lib/memcpy_64.S112
-rw-r--r--tools/bpf/bpftool/map.c14
-rw-r--r--tools/include/uapi/linux/perf_event.h2
-rw-r--r--tools/perf/arch/x86/util/pmu.c1
-rw-r--r--tools/perf/arch/x86/util/tsc.c1
-rw-r--r--tools/perf/bench/Build1
-rw-r--r--tools/perf/bench/mem-memcpy-x86-64-asm.S1
-rw-r--r--tools/perf/bench/mem-memcpy-x86-64-lib.c24
-rw-r--r--tools/perf/perf.h1
-rw-r--r--tools/perf/util/header.h1
-rw-r--r--tools/perf/util/namespaces.h1
-rwxr-xr-xtools/testing/selftests/bpf/test_lwt_seg6local.sh6
-rw-r--r--tools/testing/selftests/net/tcp_mmap.c2
70 files changed, 539 insertions, 217 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index fbac980d34e1..82f277462349 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5444,6 +5444,7 @@ F: drivers/iommu/exynos-iommu.c
5444 5444
5445EZchip NPS platform support 5445EZchip NPS platform support
5446M: Vineet Gupta <vgupta@synopsys.com> 5446M: Vineet Gupta <vgupta@synopsys.com>
5447M: Ofer Levi <oferle@mellanox.com>
5447S: Supported 5448S: Supported
5448F: arch/arc/plat-eznps 5449F: arch/arc/plat-eznps
5449F: arch/arc/boot/dts/eznps.dts 5450F: arch/arc/boot/dts/eznps.dts
diff --git a/Makefile b/Makefile
index 85f3481a56d6..7a3c4548162b 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
2VERSION = 4 2VERSION = 4
3PATCHLEVEL = 18 3PATCHLEVEL = 18
4SUBLEVEL = 0 4SUBLEVEL = 0
5EXTRAVERSION = -rc7 5EXTRAVERSION = -rc8
6NAME = Merciless Moray 6NAME = Merciless Moray
7 7
8# *DOCUMENTATION* 8# *DOCUMENTATION*
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 9cf59fc60eab..5151d81476a1 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -50,6 +50,9 @@ config ARC
50 select HAVE_KERNEL_LZMA 50 select HAVE_KERNEL_LZMA
51 select ARCH_HAS_PTE_SPECIAL 51 select ARCH_HAS_PTE_SPECIAL
52 52
53config ARCH_HAS_CACHE_LINE_SIZE
54 def_bool y
55
53config MIGHT_HAVE_PCI 56config MIGHT_HAVE_PCI
54 bool 57 bool
55 58
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index 8486f328cc5d..ff7d3232764a 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -48,7 +48,9 @@
48}) 48})
49 49
50/* Largest line length for either L1 or L2 is 128 bytes */ 50/* Largest line length for either L1 or L2 is 128 bytes */
51#define ARCH_DMA_MINALIGN 128 51#define SMP_CACHE_BYTES 128
52#define cache_line_size() SMP_CACHE_BYTES
53#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES
52 54
53extern void arc_cache_init(void); 55extern void arc_cache_init(void);
54extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 56extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
index d5da2115d78a..03d6bb0f4e13 100644
--- a/arch/arc/include/asm/delay.h
+++ b/arch/arc/include/asm/delay.h
@@ -17,8 +17,11 @@
17#ifndef __ASM_ARC_UDELAY_H 17#ifndef __ASM_ARC_UDELAY_H
18#define __ASM_ARC_UDELAY_H 18#define __ASM_ARC_UDELAY_H
19 19
20#include <asm-generic/types.h>
20#include <asm/param.h> /* HZ */ 21#include <asm/param.h> /* HZ */
21 22
23extern unsigned long loops_per_jiffy;
24
22static inline void __delay(unsigned long loops) 25static inline void __delay(unsigned long loops)
23{ 26{
24 __asm__ __volatile__( 27 __asm__ __volatile__(
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index 9dbe645ee127..25c631942500 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -1038,7 +1038,7 @@ void flush_cache_mm(struct mm_struct *mm)
1038void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr, 1038void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr,
1039 unsigned long pfn) 1039 unsigned long pfn)
1040{ 1040{
1041 unsigned int paddr = pfn << PAGE_SHIFT; 1041 phys_addr_t paddr = pfn << PAGE_SHIFT;
1042 1042
1043 u_vaddr &= PAGE_MASK; 1043 u_vaddr &= PAGE_MASK;
1044 1044
@@ -1058,8 +1058,9 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page,
1058 unsigned long u_vaddr) 1058 unsigned long u_vaddr)
1059{ 1059{
1060 /* TBD: do we really need to clear the kernel mapping */ 1060 /* TBD: do we really need to clear the kernel mapping */
1061 __flush_dcache_page(page_address(page), u_vaddr); 1061 __flush_dcache_page((phys_addr_t)page_address(page), u_vaddr);
1062 __flush_dcache_page(page_address(page), page_address(page)); 1062 __flush_dcache_page((phys_addr_t)page_address(page),
1063 (phys_addr_t)page_address(page));
1063 1064
1064} 1065}
1065 1066
@@ -1246,6 +1247,16 @@ void __init arc_cache_init_master(void)
1246 } 1247 }
1247 } 1248 }
1248 1249
1250 /*
1251 * Check that SMP_CACHE_BYTES (and hence ARCH_DMA_MINALIGN) is larger
1252 * or equal to any cache line length.
1253 */
1254 BUILD_BUG_ON_MSG(L1_CACHE_BYTES > SMP_CACHE_BYTES,
1255 "SMP_CACHE_BYTES must be >= any cache line length");
1256 if (is_isa_arcv2() && (l2_line_sz > SMP_CACHE_BYTES))
1257 panic("L2 Cache line [%d] > kernel Config [%d]\n",
1258 l2_line_sz, SMP_CACHE_BYTES);
1259
1249 /* Note that SLC disable not formally supported till HS 3.0 */ 1260 /* Note that SLC disable not formally supported till HS 3.0 */
1250 if (is_isa_arcv2() && l2_line_sz && !slc_enable) 1261 if (is_isa_arcv2() && l2_line_sz && !slc_enable)
1251 arc_slc_disable(); 1262 arc_slc_disable();
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 8c1071840979..ec47e6079f5d 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -129,14 +129,59 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
129 return ret; 129 return ret;
130} 130}
131 131
132/*
133 * Cache operations depending on function and direction argument, inspired by
134 * https://lkml.org/lkml/2018/5/18/979
135 * "dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20]
136 * dma-mapping: provide a generic dma-noncoherent implementation)"
137 *
138 * | map == for_device | unmap == for_cpu
139 * |----------------------------------------------------------------
140 * TO_DEV | writeback writeback | none none
141 * FROM_DEV | invalidate invalidate | invalidate* invalidate*
142 * BIDIR | writeback+inv writeback+inv | invalidate invalidate
143 *
144 * [*] needed for CPU speculative prefetches
145 *
146 * NOTE: we don't check the validity of direction argument as it is done in
147 * upper layer functions (in include/linux/dma-mapping.h)
148 */
149
132void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, 150void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
133 size_t size, enum dma_data_direction dir) 151 size_t size, enum dma_data_direction dir)
134{ 152{
135 dma_cache_wback(paddr, size); 153 switch (dir) {
154 case DMA_TO_DEVICE:
155 dma_cache_wback(paddr, size);
156 break;
157
158 case DMA_FROM_DEVICE:
159 dma_cache_inv(paddr, size);
160 break;
161
162 case DMA_BIDIRECTIONAL:
163 dma_cache_wback_inv(paddr, size);
164 break;
165
166 default:
167 break;
168 }
136} 169}
137 170
138void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, 171void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
139 size_t size, enum dma_data_direction dir) 172 size_t size, enum dma_data_direction dir)
140{ 173{
141 dma_cache_inv(paddr, size); 174 switch (dir) {
175 case DMA_TO_DEVICE:
176 break;
177
178 /* FROM_DEVICE invalidate needed if speculative CPU prefetch only */
179 case DMA_FROM_DEVICE:
180 case DMA_BIDIRECTIONAL:
181 dma_cache_inv(paddr, size);
182 break;
183
184 default:
185 break;
186 }
142} 187}
diff --git a/arch/arc/plat-eznps/include/plat/ctop.h b/arch/arc/plat-eznps/include/plat/ctop.h
index 0c7d11022d0f..4f6a1673b3a6 100644
--- a/arch/arc/plat-eznps/include/plat/ctop.h
+++ b/arch/arc/plat-eznps/include/plat/ctop.h
@@ -21,6 +21,7 @@
21#error "Incorrect ctop.h include" 21#error "Incorrect ctop.h include"
22#endif 22#endif
23 23
24#include <linux/types.h>
24#include <soc/nps/common.h> 25#include <soc/nps/common.h>
25 26
26/* core auxiliary registers */ 27/* core auxiliary registers */
@@ -143,6 +144,15 @@ struct nps_host_reg_gim_p_int_dst {
143}; 144};
144 145
145/* AUX registers definition */ 146/* AUX registers definition */
147struct nps_host_reg_aux_dpc {
148 union {
149 struct {
150 u32 ien:1, men:1, hen:1, reserved:29;
151 };
152 u32 value;
153 };
154};
155
146struct nps_host_reg_aux_udmc { 156struct nps_host_reg_aux_udmc {
147 union { 157 union {
148 struct { 158 struct {
diff --git a/arch/arc/plat-eznps/mtm.c b/arch/arc/plat-eznps/mtm.c
index 2388de3d09ef..ed0077ef666e 100644
--- a/arch/arc/plat-eznps/mtm.c
+++ b/arch/arc/plat-eznps/mtm.c
@@ -15,6 +15,8 @@
15 */ 15 */
16 16
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/init.h>
19#include <linux/kernel.h>
18#include <linux/io.h> 20#include <linux/io.h>
19#include <linux/log2.h> 21#include <linux/log2.h>
20#include <asm/arcregs.h> 22#include <asm/arcregs.h>
@@ -157,10 +159,10 @@ void mtm_enable_core(unsigned int cpu)
157/* Verify and set the value of the mtm hs counter */ 159/* Verify and set the value of the mtm hs counter */
158static int __init set_mtm_hs_ctr(char *ctr_str) 160static int __init set_mtm_hs_ctr(char *ctr_str)
159{ 161{
160 long hs_ctr; 162 int hs_ctr;
161 int ret; 163 int ret;
162 164
163 ret = kstrtol(ctr_str, 0, &hs_ctr); 165 ret = kstrtoint(ctr_str, 0, &hs_ctr);
164 166
165 if (ret || hs_ctr > MT_HS_CNT_MAX || hs_ctr < MT_HS_CNT_MIN) { 167 if (ret || hs_ctr > MT_HS_CNT_MAX || hs_ctr < MT_HS_CNT_MIN) {
166 pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n", 168 pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index 7cf0b1aa6ea8..8a10f1d7199a 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -488,9 +488,13 @@ static int gcm_decrypt(struct aead_request *req)
488 err = skcipher_walk_done(&walk, 488 err = skcipher_walk_done(&walk,
489 walk.nbytes % AES_BLOCK_SIZE); 489 walk.nbytes % AES_BLOCK_SIZE);
490 } 490 }
491 if (walk.nbytes) 491 if (walk.nbytes) {
492 pmull_gcm_encrypt_block(iv, iv, NULL, 492 kernel_neon_begin();
493 pmull_gcm_encrypt_block(iv, iv, ctx->aes_key.key_enc,
493 num_rounds(&ctx->aes_key)); 494 num_rounds(&ctx->aes_key));
495 kernel_neon_end();
496 }
497
494 } else { 498 } else {
495 __aes_arm64_encrypt(ctx->aes_key.key_enc, tag, iv, 499 __aes_arm64_encrypt(ctx->aes_key.key_enc, tag, iv,
496 num_rounds(&ctx->aes_key)); 500 num_rounds(&ctx->aes_key));
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index 79d570cbf332..b2f89b621b15 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -143,24 +143,33 @@ static inline void mm_context_remove_copro(struct mm_struct *mm)
143{ 143{
144 int c; 144 int c;
145 145
146 c = atomic_dec_if_positive(&mm->context.copros);
147
148 /* Detect imbalance between add and remove */
149 WARN_ON(c < 0);
150
151 /* 146 /*
152 * Need to broadcast a global flush of the full mm before 147 * When removing the last copro, we need to broadcast a global
153 * decrementing active_cpus count, as the next TLBI may be 148 * flush of the full mm, as the next TLBI may be local and the
154 * local and the nMMU and/or PSL need to be cleaned up. 149 * nMMU and/or PSL need to be cleaned up.
155 * Should be rare enough so that it's acceptable. 150 *
151 * Both the 'copros' and 'active_cpus' counts are looked at in
152 * flush_all_mm() to determine the scope (local/global) of the
153 * TLBIs, so we need to flush first before decrementing
154 * 'copros'. If this API is used by several callers for the
155 * same context, it can lead to over-flushing. It's hopefully
156 * not common enough to be a problem.
156 * 157 *
157 * Skip on hash, as we don't know how to do the proper flush 158 * Skip on hash, as we don't know how to do the proper flush
158 * for the time being. Invalidations will remain global if 159 * for the time being. Invalidations will remain global if
159 * used on hash. 160 * used on hash. Note that we can't drop 'copros' either, as
161 * it could make some invalidations local with no flush
162 * in-between.
160 */ 163 */
161 if (c == 0 && radix_enabled()) { 164 if (radix_enabled()) {
162 flush_all_mm(mm); 165 flush_all_mm(mm);
163 dec_mm_active_cpus(mm); 166
167 c = atomic_dec_if_positive(&mm->context.copros);
168 /* Detect imbalance between add and remove */
169 WARN_ON(c < 0);
170
171 if (c == 0)
172 dec_mm_active_cpus(mm);
164 } 173 }
165} 174}
166#else 175#else
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index fe9733ffffaa..471aac313b89 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -42,6 +42,8 @@
42#include <asm/ppc-pci.h> 42#include <asm/ppc-pci.h>
43#include <asm/eeh.h> 43#include <asm/eeh.h>
44 44
45#include "../../../drivers/pci/pci.h"
46
45/* hose_spinlock protects accesses to the the phb_bitmap. */ 47/* hose_spinlock protects accesses to the the phb_bitmap. */
46static DEFINE_SPINLOCK(hose_spinlock); 48static DEFINE_SPINLOCK(hose_spinlock);
47LIST_HEAD(hose_list); 49LIST_HEAD(hose_list);
@@ -1014,7 +1016,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
1014 /* Cardbus can call us to add new devices to a bus, so ignore 1016 /* Cardbus can call us to add new devices to a bus, so ignore
1015 * those who are already fully discovered 1017 * those who are already fully discovered
1016 */ 1018 */
1017 if (dev->is_added) 1019 if (pci_dev_is_added(dev))
1018 continue; 1020 continue;
1019 1021
1020 pcibios_setup_device(dev); 1022 pcibios_setup_device(dev);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5bd0eb6681bc..70b2e1e0f23c 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -46,6 +46,7 @@
46 46
47#include "powernv.h" 47#include "powernv.h"
48#include "pci.h" 48#include "pci.h"
49#include "../../../../drivers/pci/pci.h"
49 50
50#define PNV_IODA1_M64_NUM 16 /* Number of M64 BARs */ 51#define PNV_IODA1_M64_NUM 16 /* Number of M64 BARs */
51#define PNV_IODA1_M64_SEGS 8 /* Segments per M64 BAR */ 52#define PNV_IODA1_M64_SEGS 8 /* Segments per M64 BAR */
@@ -3138,7 +3139,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)
3138 struct pci_dn *pdn; 3139 struct pci_dn *pdn;
3139 int mul, total_vfs; 3140 int mul, total_vfs;
3140 3141
3141 if (!pdev->is_physfn || pdev->is_added) 3142 if (!pdev->is_physfn || pci_dev_is_added(pdev))
3142 return; 3143 return;
3143 3144
3144 pdn = pci_get_pdn(pdev); 3145 pdn = pci_get_pdn(pdev);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 139f0af6c3d9..8a4868a3964b 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -71,6 +71,7 @@
71#include <asm/security_features.h> 71#include <asm/security_features.h>
72 72
73#include "pseries.h" 73#include "pseries.h"
74#include "../../../../drivers/pci/pci.h"
74 75
75int CMO_PrPSP = -1; 76int CMO_PrPSP = -1;
76int CMO_SecPSP = -1; 77int CMO_SecPSP = -1;
@@ -664,7 +665,7 @@ static void pseries_pci_fixup_iov_resources(struct pci_dev *pdev)
664 const int *indexes; 665 const int *indexes;
665 struct device_node *dn = pci_device_to_OF_node(pdev); 666 struct device_node *dn = pci_device_to_OF_node(pdev);
666 667
667 if (!pdev->is_physfn || pdev->is_added) 668 if (!pdev->is_physfn || pci_dev_is_added(pdev))
668 return; 669 return;
669 /*Firmware must support open sriov otherwise dont configure*/ 670 /*Firmware must support open sriov otherwise dont configure*/
670 indexes = of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL); 671 indexes = of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL);
diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
index 8c5107545251..9e2157371491 100644
--- a/arch/x86/boot/compressed/pgtable_64.c
+++ b/arch/x86/boot/compressed/pgtable_64.c
@@ -1,3 +1,4 @@
1#include <asm/e820/types.h>
1#include <asm/processor.h> 2#include <asm/processor.h>
2#include "pgtable.h" 3#include "pgtable.h"
3#include "../string.h" 4#include "../string.h"
@@ -34,10 +35,62 @@ unsigned long *trampoline_32bit __section(.data);
34extern struct boot_params *boot_params; 35extern struct boot_params *boot_params;
35int cmdline_find_option_bool(const char *option); 36int cmdline_find_option_bool(const char *option);
36 37
38static unsigned long find_trampoline_placement(void)
39{
40 unsigned long bios_start, ebda_start;
41 unsigned long trampoline_start;
42 struct boot_e820_entry *entry;
43 int i;
44
45 /*
46 * Find a suitable spot for the trampoline.
47 * This code is based on reserve_bios_regions().
48 */
49
50 ebda_start = *(unsigned short *)0x40e << 4;
51 bios_start = *(unsigned short *)0x413 << 10;
52
53 if (bios_start < BIOS_START_MIN || bios_start > BIOS_START_MAX)
54 bios_start = BIOS_START_MAX;
55
56 if (ebda_start > BIOS_START_MIN && ebda_start < bios_start)
57 bios_start = ebda_start;
58
59 bios_start = round_down(bios_start, PAGE_SIZE);
60
61 /* Find the first usable memory region under bios_start. */
62 for (i = boot_params->e820_entries - 1; i >= 0; i--) {
63 entry = &boot_params->e820_table[i];
64
65 /* Skip all entries above bios_start. */
66 if (bios_start <= entry->addr)
67 continue;
68
69 /* Skip non-RAM entries. */
70 if (entry->type != E820_TYPE_RAM)
71 continue;
72
73 /* Adjust bios_start to the end of the entry if needed. */
74 if (bios_start > entry->addr + entry->size)
75 bios_start = entry->addr + entry->size;
76
77 /* Keep bios_start page-aligned. */
78 bios_start = round_down(bios_start, PAGE_SIZE);
79
80 /* Skip the entry if it's too small. */
81 if (bios_start - TRAMPOLINE_32BIT_SIZE < entry->addr)
82 continue;
83
84 break;
85 }
86
87 /* Place the trampoline just below the end of low memory */
88 return bios_start - TRAMPOLINE_32BIT_SIZE;
89}
90
37struct paging_config paging_prepare(void *rmode) 91struct paging_config paging_prepare(void *rmode)
38{ 92{
39 struct paging_config paging_config = {}; 93 struct paging_config paging_config = {};
40 unsigned long bios_start, ebda_start;
41 94
42 /* Initialize boot_params. Required for cmdline_find_option_bool(). */ 95 /* Initialize boot_params. Required for cmdline_find_option_bool(). */
43 boot_params = rmode; 96 boot_params = rmode;
@@ -61,23 +114,7 @@ struct paging_config paging_prepare(void *rmode)
61 paging_config.l5_required = 1; 114 paging_config.l5_required = 1;
62 } 115 }
63 116
64 /* 117 paging_config.trampoline_start = find_trampoline_placement();
65 * Find a suitable spot for the trampoline.
66 * This code is based on reserve_bios_regions().
67 */
68
69 ebda_start = *(unsigned short *)0x40e << 4;
70 bios_start = *(unsigned short *)0x413 << 10;
71
72 if (bios_start < BIOS_START_MIN || bios_start > BIOS_START_MAX)
73 bios_start = BIOS_START_MAX;
74
75 if (ebda_start > BIOS_START_MIN && ebda_start < bios_start)
76 bios_start = ebda_start;
77
78 /* Place the trampoline just below the end of low memory, aligned to 4k */
79 paging_config.trampoline_start = bios_start - TRAMPOLINE_32BIT_SIZE;
80 paging_config.trampoline_start = round_down(paging_config.trampoline_start, PAGE_SIZE);
81 118
82 trampoline_32bit = (unsigned long *)paging_config.trampoline_start; 119 trampoline_32bit = (unsigned long *)paging_config.trampoline_start;
83 120
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index c9e1e0bef3c3..e17ab885b1e9 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -28,7 +28,7 @@
28#define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff) 28#define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff)
29#define UNCORE_PCI_DEV_IDX(data) (data & 0xff) 29#define UNCORE_PCI_DEV_IDX(data) (data & 0xff)
30#define UNCORE_EXTRA_PCI_DEV 0xff 30#define UNCORE_EXTRA_PCI_DEV 0xff
31#define UNCORE_EXTRA_PCI_DEV_MAX 3 31#define UNCORE_EXTRA_PCI_DEV_MAX 4
32 32
33#define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff) 33#define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff)
34 34
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 87dc0263a2e1..51d7c117e3c7 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -1029,6 +1029,7 @@ void snbep_uncore_cpu_init(void)
1029enum { 1029enum {
1030 SNBEP_PCI_QPI_PORT0_FILTER, 1030 SNBEP_PCI_QPI_PORT0_FILTER,
1031 SNBEP_PCI_QPI_PORT1_FILTER, 1031 SNBEP_PCI_QPI_PORT1_FILTER,
1032 BDX_PCI_QPI_PORT2_FILTER,
1032 HSWEP_PCI_PCU_3, 1033 HSWEP_PCI_PCU_3,
1033}; 1034};
1034 1035
@@ -3286,15 +3287,18 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = {
3286 }, 3287 },
3287 { /* QPI Port 0 filter */ 3288 { /* QPI Port 0 filter */
3288 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86), 3289 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86),
3289 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 0), 3290 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
3291 SNBEP_PCI_QPI_PORT0_FILTER),
3290 }, 3292 },
3291 { /* QPI Port 1 filter */ 3293 { /* QPI Port 1 filter */
3292 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96), 3294 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96),
3293 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 1), 3295 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
3296 SNBEP_PCI_QPI_PORT1_FILTER),
3294 }, 3297 },
3295 { /* QPI Port 2 filter */ 3298 { /* QPI Port 2 filter */
3296 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46), 3299 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46),
3297 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2), 3300 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
3301 BDX_PCI_QPI_PORT2_FILTER),
3298 }, 3302 },
3299 { /* PCU.3 (for Capability registers) */ 3303 { /* PCU.3 (for Capability registers) */
3300 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0), 3304 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0),
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e30da9a2430c..5d8e317c2b04 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7893,6 +7893,8 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu)
7893 HRTIMER_MODE_REL_PINNED); 7893 HRTIMER_MODE_REL_PINNED);
7894 vmx->nested.preemption_timer.function = vmx_preemption_timer_fn; 7894 vmx->nested.preemption_timer.function = vmx_preemption_timer_fn;
7895 7895
7896 vmx->nested.vpid02 = allocate_vpid();
7897
7896 vmx->nested.vmxon = true; 7898 vmx->nested.vmxon = true;
7897 return 0; 7899 return 0;
7898 7900
@@ -8480,21 +8482,20 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
8480/* Emulate the VMPTRST instruction */ 8482/* Emulate the VMPTRST instruction */
8481static int handle_vmptrst(struct kvm_vcpu *vcpu) 8483static int handle_vmptrst(struct kvm_vcpu *vcpu)
8482{ 8484{
8483 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 8485 unsigned long exit_qual = vmcs_readl(EXIT_QUALIFICATION);
8484 u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); 8486 u32 instr_info = vmcs_read32(VMX_INSTRUCTION_INFO);
8485 gva_t vmcs_gva; 8487 gpa_t current_vmptr = to_vmx(vcpu)->nested.current_vmptr;
8486 struct x86_exception e; 8488 struct x86_exception e;
8489 gva_t gva;
8487 8490
8488 if (!nested_vmx_check_permission(vcpu)) 8491 if (!nested_vmx_check_permission(vcpu))
8489 return 1; 8492 return 1;
8490 8493
8491 if (get_vmx_mem_address(vcpu, exit_qualification, 8494 if (get_vmx_mem_address(vcpu, exit_qual, instr_info, true, &gva))
8492 vmx_instruction_info, true, &vmcs_gva))
8493 return 1; 8495 return 1;
8494 /* *_system ok, nested_vmx_check_permission has verified cpl=0 */ 8496 /* *_system ok, nested_vmx_check_permission has verified cpl=0 */
8495 if (kvm_write_guest_virt_system(vcpu, vmcs_gva, 8497 if (kvm_write_guest_virt_system(vcpu, gva, (void *)&current_vmptr,
8496 (void *)&to_vmx(vcpu)->nested.current_vmptr, 8498 sizeof(gpa_t), &e)) {
8497 sizeof(u64), &e)) {
8498 kvm_inject_page_fault(vcpu, &e); 8499 kvm_inject_page_fault(vcpu, &e);
8499 return 1; 8500 return 1;
8500 } 8501 }
@@ -10370,11 +10371,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
10370 goto free_vmcs; 10371 goto free_vmcs;
10371 } 10372 }
10372 10373
10373 if (nested) { 10374 if (nested)
10374 nested_vmx_setup_ctls_msrs(&vmx->nested.msrs, 10375 nested_vmx_setup_ctls_msrs(&vmx->nested.msrs,
10375 kvm_vcpu_apicv_active(&vmx->vcpu)); 10376 kvm_vcpu_apicv_active(&vmx->vcpu));
10376 vmx->nested.vpid02 = allocate_vpid();
10377 }
10378 10377
10379 vmx->nested.posted_intr_nv = -1; 10378 vmx->nested.posted_intr_nv = -1;
10380 vmx->nested.current_vmptr = -1ull; 10379 vmx->nested.current_vmptr = -1ull;
@@ -10391,7 +10390,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
10391 return &vmx->vcpu; 10390 return &vmx->vcpu;
10392 10391
10393free_vmcs: 10392free_vmcs:
10394 free_vpid(vmx->nested.vpid02);
10395 free_loaded_vmcs(vmx->loaded_vmcs); 10393 free_loaded_vmcs(vmx->loaded_vmcs);
10396free_msrs: 10394free_msrs:
10397 kfree(vmx->guest_msrs); 10395 kfree(vmx->guest_msrs);
diff --git a/block/blk-core.c b/block/blk-core.c
index f84a9b7b6f5a..ee33590f54eb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2155,11 +2155,12 @@ static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part)
2155 if (part->policy && op_is_write(bio_op(bio))) { 2155 if (part->policy && op_is_write(bio_op(bio))) {
2156 char b[BDEVNAME_SIZE]; 2156 char b[BDEVNAME_SIZE];
2157 2157
2158 printk(KERN_ERR 2158 WARN_ONCE(1,
2159 "generic_make_request: Trying to write " 2159 "generic_make_request: Trying to write "
2160 "to read-only block-device %s (partno %d)\n", 2160 "to read-only block-device %s (partno %d)\n",
2161 bio_devname(bio, b), part->partno); 2161 bio_devname(bio, b), part->partno);
2162 return true; 2162 /* Older lvm-tools actually trigger this */
2163 return false;
2163 } 2164 }
2164 2165
2165 return false; 2166 return false;
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 09b2ee6694fb..3de0836163c2 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
271 * test and set the bit before assining ->rqs[]. 271 * test and set the bit before assining ->rqs[].
272 */ 272 */
273 rq = tags->rqs[bitnr]; 273 rq = tags->rqs[bitnr];
274 if (rq && blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) 274 if (rq && blk_mq_request_started(rq))
275 iter_data->fn(rq, iter_data->data, reserved); 275 iter_data->fn(rq, iter_data->data, reserved);
276 276
277 return true; 277 return true;
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 1c6cbda56afe..09d823d36d3a 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -266,6 +266,8 @@ static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
266 return; 266 return;
267 } 267 }
268 268
269 count -= initial;
270
269 if (initial) 271 if (initial)
270 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ 272 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
271 : "+S"(input), "+D"(output) 273 : "+S"(input), "+D"(output)
@@ -273,7 +275,7 @@ static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
273 275
274 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ 276 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
275 : "+S"(input), "+D"(output) 277 : "+S"(input), "+D"(output)
276 : "d"(control_word), "b"(key), "c"(count - initial)); 278 : "d"(control_word), "b"(key), "c"(count));
277} 279}
278 280
279static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, 281static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
@@ -284,6 +286,8 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
284 if (count < cbc_fetch_blocks) 286 if (count < cbc_fetch_blocks)
285 return cbc_crypt(input, output, key, iv, control_word, count); 287 return cbc_crypt(input, output, key, iv, control_word, count);
286 288
289 count -= initial;
290
287 if (initial) 291 if (initial)
288 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ 292 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
289 : "+S" (input), "+D" (output), "+a" (iv) 293 : "+S" (input), "+D" (output), "+a" (iv)
@@ -291,7 +295,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
291 295
292 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ 296 asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */
293 : "+S" (input), "+D" (output), "+a" (iv) 297 : "+S" (input), "+D" (output), "+a" (iv)
294 : "d" (control_word), "b" (key), "c" (count-initial)); 298 : "d" (control_word), "b" (key), "c" (count));
295 return iv; 299 return iv;
296} 300}
297 301
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 73021b388e12..dd3ff2f2cdce 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -429,6 +429,18 @@ static void adv7511_hpd_work(struct work_struct *work)
429 else 429 else
430 status = connector_status_disconnected; 430 status = connector_status_disconnected;
431 431
432 /*
433 * The bridge resets its registers on unplug. So when we get a plug
434 * event and we're already supposed to be powered, cycle the bridge to
435 * restore its state.
436 */
437 if (status == connector_status_connected &&
438 adv7511->connector.status == connector_status_disconnected &&
439 adv7511->powered) {
440 regcache_mark_dirty(adv7511->regmap);
441 adv7511_power_on(adv7511);
442 }
443
432 if (adv7511->connector.status != status) { 444 if (adv7511->connector.status != status) {
433 adv7511->connector.status = status; 445 adv7511->connector.status = status;
434 if (status == connector_status_disconnected) 446 if (status == connector_status_disconnected)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 130da5195f3b..81e32199d3ef 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1510,8 +1510,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
1510{ 1510{
1511 struct drm_crtc *crtc; 1511 struct drm_crtc *crtc;
1512 struct drm_crtc_state *crtc_state; 1512 struct drm_crtc_state *crtc_state;
1513 struct drm_plane *plane; 1513 struct drm_plane *plane = NULL;
1514 struct drm_plane_state *old_plane_state, *new_plane_state; 1514 struct drm_plane_state *old_plane_state = NULL;
1515 struct drm_plane_state *new_plane_state = NULL;
1515 const struct drm_plane_helper_funcs *funcs; 1516 const struct drm_plane_helper_funcs *funcs;
1516 int i, n_planes = 0; 1517 int i, n_planes = 0;
1517 1518
@@ -1527,7 +1528,8 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
1527 if (n_planes != 1) 1528 if (n_planes != 1)
1528 return -EINVAL; 1529 return -EINVAL;
1529 1530
1530 if (!new_plane_state->crtc) 1531 if (!new_plane_state->crtc ||
1532 old_plane_state->crtc != new_plane_state->crtc)
1531 return -EINVAL; 1533 return -EINVAL;
1532 1534
1533 funcs = plane->helper_private; 1535 funcs = plane->helper_private;
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index 3c4000facb36..f973d287696a 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -372,7 +372,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
372 ctx->handle = drm_legacy_ctxbitmap_next(dev); 372 ctx->handle = drm_legacy_ctxbitmap_next(dev);
373 } 373 }
374 DRM_DEBUG("%d\n", ctx->handle); 374 DRM_DEBUG("%d\n", ctx->handle);
375 if (ctx->handle == -1) { 375 if (ctx->handle < 0) {
376 DRM_DEBUG("Not enough free contexts.\n"); 376 DRM_DEBUG("Not enough free contexts.\n");
377 /* Should this return -EBUSY instead? */ 377 /* Should this return -EBUSY instead? */
378 return -ENOMEM; 378 return -ENOMEM;
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 1d34619eb3fe..a951ec75d01f 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -320,6 +320,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
320 vc4_state->x_scaling[0] = VC4_SCALING_TPZ; 320 vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
321 if (vc4_state->y_scaling[0] == VC4_SCALING_NONE) 321 if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
322 vc4_state->y_scaling[0] = VC4_SCALING_TPZ; 322 vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
323 } else {
324 vc4_state->x_scaling[1] = VC4_SCALING_NONE;
325 vc4_state->y_scaling[1] = VC4_SCALING_NONE;
323 } 326 }
324 327
325 vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE && 328 vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index cc06e8404e9b..583d3a10b940 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1984,15 +1984,64 @@ static int modify_qp(struct ib_uverbs_file *file,
1984 goto release_qp; 1984 goto release_qp;
1985 } 1985 }
1986 1986
1987 if ((cmd->base.attr_mask & IB_QP_AV) && 1987 if ((cmd->base.attr_mask & IB_QP_AV)) {
1988 !rdma_is_port_valid(qp->device, cmd->base.dest.port_num)) { 1988 if (!rdma_is_port_valid(qp->device, cmd->base.dest.port_num)) {
1989 ret = -EINVAL; 1989 ret = -EINVAL;
1990 goto release_qp; 1990 goto release_qp;
1991 }
1992
1993 if (cmd->base.attr_mask & IB_QP_STATE &&
1994 cmd->base.qp_state == IB_QPS_RTR) {
1995 /* We are in INIT->RTR TRANSITION (if we are not,
1996 * this transition will be rejected in subsequent checks).
1997 * In the INIT->RTR transition, we cannot have IB_QP_PORT set,
1998 * but the IB_QP_STATE flag is required.
1999 *
2000 * Since kernel 3.14 (commit dbf727de7440), the uverbs driver,
2001 * when IB_QP_AV is set, has required inclusion of a valid
2002 * port number in the primary AV. (AVs are created and handled
2003 * differently for infiniband and ethernet (RoCE) ports).
2004 *
2005 * Check the port number included in the primary AV against
2006 * the port number in the qp struct, which was set (and saved)
2007 * in the RST->INIT transition.
2008 */
2009 if (cmd->base.dest.port_num != qp->real_qp->port) {
2010 ret = -EINVAL;
2011 goto release_qp;
2012 }
2013 } else {
2014 /* We are in SQD->SQD. (If we are not, this transition will
2015 * be rejected later in the verbs layer checks).
2016 * Check for both IB_QP_PORT and IB_QP_AV, these can be set
2017 * together in the SQD->SQD transition.
2018 *
2019 * If only IP_QP_AV was set, add in IB_QP_PORT as well (the
2020 * verbs layer driver does not track primary port changes
2021 * resulting from path migration. Thus, in SQD, if the primary
2022 * AV is modified, the primary port should also be modified).
2023 *
2024 * Note that in this transition, the IB_QP_STATE flag
2025 * is not allowed.
2026 */
2027 if (((cmd->base.attr_mask & (IB_QP_AV | IB_QP_PORT))
2028 == (IB_QP_AV | IB_QP_PORT)) &&
2029 cmd->base.port_num != cmd->base.dest.port_num) {
2030 ret = -EINVAL;
2031 goto release_qp;
2032 }
2033 if ((cmd->base.attr_mask & (IB_QP_AV | IB_QP_PORT))
2034 == IB_QP_AV) {
2035 cmd->base.attr_mask |= IB_QP_PORT;
2036 cmd->base.port_num = cmd->base.dest.port_num;
2037 }
2038 }
1991 } 2039 }
1992 2040
1993 if ((cmd->base.attr_mask & IB_QP_ALT_PATH) && 2041 if ((cmd->base.attr_mask & IB_QP_ALT_PATH) &&
1994 (!rdma_is_port_valid(qp->device, cmd->base.alt_port_num) || 2042 (!rdma_is_port_valid(qp->device, cmd->base.alt_port_num) ||
1995 !rdma_is_port_valid(qp->device, cmd->base.alt_dest.port_num))) { 2043 !rdma_is_port_valid(qp->device, cmd->base.alt_dest.port_num) ||
2044 cmd->base.alt_port_num != cmd->base.alt_dest.port_num)) {
1996 ret = -EINVAL; 2045 ret = -EINVAL;
1997 goto release_qp; 2046 goto release_qp;
1998 } 2047 }
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index edb35a5c57ea..a99fc0ced7a7 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -728,9 +728,6 @@ EXPORT_SYMBOL_GPL(vsp1_du_setup_lif);
728 */ 728 */
729void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index) 729void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index)
730{ 730{
731 struct vsp1_device *vsp1 = dev_get_drvdata(dev);
732
733 mutex_lock(&vsp1->drm->lock);
734} 731}
735EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin); 732EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
736 733
@@ -846,6 +843,7 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
846 843
847 drm_pipe->crc = cfg->crc; 844 drm_pipe->crc = cfg->crc;
848 845
846 mutex_lock(&vsp1->drm->lock);
849 vsp1_du_pipeline_setup_inputs(vsp1, pipe); 847 vsp1_du_pipeline_setup_inputs(vsp1, pipe);
850 vsp1_du_pipeline_configure(pipe); 848 vsp1_du_pipeline_configure(pipe);
851 mutex_unlock(&vsp1->drm->lock); 849 mutex_unlock(&vsp1->drm->lock);
diff --git a/drivers/media/rc/bpf-lirc.c b/drivers/media/rc/bpf-lirc.c
index fcfab6635f9c..81b150e5dfdb 100644
--- a/drivers/media/rc/bpf-lirc.c
+++ b/drivers/media/rc/bpf-lirc.c
@@ -174,6 +174,7 @@ static int lirc_bpf_detach(struct rc_dev *rcdev, struct bpf_prog *prog)
174 174
175 rcu_assign_pointer(raw->progs, new_array); 175 rcu_assign_pointer(raw->progs, new_array);
176 bpf_prog_array_free(old_array); 176 bpf_prog_array_free(old_array);
177 bpf_prog_put(prog);
177unlock: 178unlock:
178 mutex_unlock(&ir_raw_handler_lock); 179 mutex_unlock(&ir_raw_handler_lock);
179 return ret; 180 return ret;
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 2e0066b1a31c..e7948908e78c 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -30,13 +30,13 @@ static int ir_raw_event_thread(void *data)
30 while (kfifo_out(&raw->kfifo, &ev, 1)) { 30 while (kfifo_out(&raw->kfifo, &ev, 1)) {
31 if (is_timing_event(ev)) { 31 if (is_timing_event(ev)) {
32 if (ev.duration == 0) 32 if (ev.duration == 0)
33 dev_err(&dev->dev, "nonsensical timing event of duration 0"); 33 dev_warn_once(&dev->dev, "nonsensical timing event of duration 0");
34 if (is_timing_event(raw->prev_ev) && 34 if (is_timing_event(raw->prev_ev) &&
35 !is_transition(&ev, &raw->prev_ev)) 35 !is_transition(&ev, &raw->prev_ev))
36 dev_err(&dev->dev, "two consecutive events of type %s", 36 dev_warn_once(&dev->dev, "two consecutive events of type %s",
37 TO_STR(ev.pulse)); 37 TO_STR(ev.pulse));
38 if (raw->prev_ev.reset && ev.pulse == 0) 38 if (raw->prev_ev.reset && ev.pulse == 0)
39 dev_err(&dev->dev, "timing event after reset should be pulse"); 39 dev_warn_once(&dev->dev, "timing event after reset should be pulse");
40 } 40 }
41 list_for_each_entry(handler, &ir_raw_handler_list, list) 41 list_for_each_entry(handler, &ir_raw_handler_list, list)
42 if (dev->enabled_protocols & 42 if (dev->enabled_protocols &
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 2e222d9ee01f..ca68e1d2b2f9 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -679,6 +679,14 @@ static void ir_timer_repeat(struct timer_list *t)
679 spin_unlock_irqrestore(&dev->keylock, flags); 679 spin_unlock_irqrestore(&dev->keylock, flags);
680} 680}
681 681
682static unsigned int repeat_period(int protocol)
683{
684 if (protocol >= ARRAY_SIZE(protocols))
685 return 100;
686
687 return protocols[protocol].repeat_period;
688}
689
682/** 690/**
683 * rc_repeat() - signals that a key is still pressed 691 * rc_repeat() - signals that a key is still pressed
684 * @dev: the struct rc_dev descriptor of the device 692 * @dev: the struct rc_dev descriptor of the device
@@ -691,7 +699,7 @@ void rc_repeat(struct rc_dev *dev)
691{ 699{
692 unsigned long flags; 700 unsigned long flags;
693 unsigned int timeout = nsecs_to_jiffies(dev->timeout) + 701 unsigned int timeout = nsecs_to_jiffies(dev->timeout) +
694 msecs_to_jiffies(protocols[dev->last_protocol].repeat_period); 702 msecs_to_jiffies(repeat_period(dev->last_protocol));
695 struct lirc_scancode sc = { 703 struct lirc_scancode sc = {
696 .scancode = dev->last_scancode, .rc_proto = dev->last_protocol, 704 .scancode = dev->last_scancode, .rc_proto = dev->last_protocol,
697 .keycode = dev->keypressed ? dev->last_keycode : KEY_RESERVED, 705 .keycode = dev->keypressed ? dev->last_keycode : KEY_RESERVED,
@@ -803,7 +811,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode,
803 811
804 if (dev->keypressed) { 812 if (dev->keypressed) {
805 dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) + 813 dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) +
806 msecs_to_jiffies(protocols[protocol].repeat_period); 814 msecs_to_jiffies(repeat_period(protocol));
807 mod_timer(&dev->timer_keyup, dev->keyup_jiffies); 815 mod_timer(&dev->timer_keyup, dev->keyup_jiffies);
808 } 816 }
809 spin_unlock_irqrestore(&dev->keylock, flags); 817 spin_unlock_irqrestore(&dev->keylock, flags);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
index a4669e79fdf9..66ea256fe560 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
@@ -327,12 +327,16 @@ static void mlxsw_afa_resource_add(struct mlxsw_afa_block *block,
327 list_add(&resource->list, &block->resource_list); 327 list_add(&resource->list, &block->resource_list);
328} 328}
329 329
330static void mlxsw_afa_resource_del(struct mlxsw_afa_resource *resource)
331{
332 list_del(&resource->list);
333}
334
330static void mlxsw_afa_resources_destroy(struct mlxsw_afa_block *block) 335static void mlxsw_afa_resources_destroy(struct mlxsw_afa_block *block)
331{ 336{
332 struct mlxsw_afa_resource *resource, *tmp; 337 struct mlxsw_afa_resource *resource, *tmp;
333 338
334 list_for_each_entry_safe(resource, tmp, &block->resource_list, list) { 339 list_for_each_entry_safe(resource, tmp, &block->resource_list, list) {
335 list_del(&resource->list);
336 resource->destructor(block, resource); 340 resource->destructor(block, resource);
337 } 341 }
338} 342}
@@ -565,6 +569,7 @@ static void
565mlxsw_afa_fwd_entry_ref_destroy(struct mlxsw_afa_block *block, 569mlxsw_afa_fwd_entry_ref_destroy(struct mlxsw_afa_block *block,
566 struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref) 570 struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref)
567{ 571{
572 mlxsw_afa_resource_del(&fwd_entry_ref->resource);
568 mlxsw_afa_fwd_entry_put(block->afa, fwd_entry_ref->fwd_entry); 573 mlxsw_afa_fwd_entry_put(block->afa, fwd_entry_ref->fwd_entry);
569 kfree(fwd_entry_ref); 574 kfree(fwd_entry_ref);
570} 575}
@@ -614,6 +619,7 @@ static void
614mlxsw_afa_counter_destroy(struct mlxsw_afa_block *block, 619mlxsw_afa_counter_destroy(struct mlxsw_afa_block *block,
615 struct mlxsw_afa_counter *counter) 620 struct mlxsw_afa_counter *counter)
616{ 621{
622 mlxsw_afa_resource_del(&counter->resource);
617 block->afa->ops->counter_index_put(block->afa->ops_priv, 623 block->afa->ops->counter_index_put(block->afa->ops_priv,
618 counter->counter_index); 624 counter->counter_index);
619 kfree(counter); 625 kfree(counter);
@@ -661,8 +667,8 @@ static char *mlxsw_afa_block_append_action(struct mlxsw_afa_block *block,
661 char *oneact; 667 char *oneact;
662 char *actions; 668 char *actions;
663 669
664 if (WARN_ON(block->finished)) 670 if (block->finished)
665 return NULL; 671 return ERR_PTR(-EINVAL);
666 if (block->cur_act_index + action_size > 672 if (block->cur_act_index + action_size >
667 block->afa->max_acts_per_set) { 673 block->afa->max_acts_per_set) {
668 struct mlxsw_afa_set *set; 674 struct mlxsw_afa_set *set;
@@ -672,7 +678,7 @@ static char *mlxsw_afa_block_append_action(struct mlxsw_afa_block *block,
672 */ 678 */
673 set = mlxsw_afa_set_create(false); 679 set = mlxsw_afa_set_create(false);
674 if (!set) 680 if (!set)
675 return NULL; 681 return ERR_PTR(-ENOBUFS);
676 set->prev = block->cur_set; 682 set->prev = block->cur_set;
677 block->cur_act_index = 0; 683 block->cur_act_index = 0;
678 block->cur_set->next = set; 684 block->cur_set->next = set;
@@ -760,9 +766,9 @@ int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block,
760 MLXSW_AFA_VLAN_CODE, 766 MLXSW_AFA_VLAN_CODE,
761 MLXSW_AFA_VLAN_SIZE); 767 MLXSW_AFA_VLAN_SIZE);
762 768
763 if (!act) { 769 if (IS_ERR(act)) {
764 NL_SET_ERR_MSG_MOD(extack, "Cannot append vlan_modify action"); 770 NL_SET_ERR_MSG_MOD(extack, "Cannot append vlan_modify action");
765 return -ENOBUFS; 771 return PTR_ERR(act);
766 } 772 }
767 mlxsw_afa_vlan_pack(act, MLXSW_AFA_VLAN_VLAN_TAG_CMD_NOP, 773 mlxsw_afa_vlan_pack(act, MLXSW_AFA_VLAN_VLAN_TAG_CMD_NOP,
768 MLXSW_AFA_VLAN_CMD_SET_OUTER, vid, 774 MLXSW_AFA_VLAN_CMD_SET_OUTER, vid,
@@ -844,8 +850,8 @@ int mlxsw_afa_block_append_drop(struct mlxsw_afa_block *block)
844 MLXSW_AFA_TRAPDISC_CODE, 850 MLXSW_AFA_TRAPDISC_CODE,
845 MLXSW_AFA_TRAPDISC_SIZE); 851 MLXSW_AFA_TRAPDISC_SIZE);
846 852
847 if (!act) 853 if (IS_ERR(act))
848 return -ENOBUFS; 854 return PTR_ERR(act);
849 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_NOP, 855 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_NOP,
850 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_DISCARD, 0); 856 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_DISCARD, 0);
851 return 0; 857 return 0;
@@ -858,8 +864,8 @@ int mlxsw_afa_block_append_trap(struct mlxsw_afa_block *block, u16 trap_id)
858 MLXSW_AFA_TRAPDISC_CODE, 864 MLXSW_AFA_TRAPDISC_CODE,
859 MLXSW_AFA_TRAPDISC_SIZE); 865 MLXSW_AFA_TRAPDISC_SIZE);
860 866
861 if (!act) 867 if (IS_ERR(act))
862 return -ENOBUFS; 868 return PTR_ERR(act);
863 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_TRAP, 869 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_TRAP,
864 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_DISCARD, 870 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_DISCARD,
865 trap_id); 871 trap_id);
@@ -874,8 +880,8 @@ int mlxsw_afa_block_append_trap_and_forward(struct mlxsw_afa_block *block,
874 MLXSW_AFA_TRAPDISC_CODE, 880 MLXSW_AFA_TRAPDISC_CODE,
875 MLXSW_AFA_TRAPDISC_SIZE); 881 MLXSW_AFA_TRAPDISC_SIZE);
876 882
877 if (!act) 883 if (IS_ERR(act))
878 return -ENOBUFS; 884 return PTR_ERR(act);
879 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_TRAP, 885 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_TRAP,
880 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_FORWARD, 886 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_FORWARD,
881 trap_id); 887 trap_id);
@@ -894,6 +900,7 @@ static void
894mlxsw_afa_mirror_destroy(struct mlxsw_afa_block *block, 900mlxsw_afa_mirror_destroy(struct mlxsw_afa_block *block,
895 struct mlxsw_afa_mirror *mirror) 901 struct mlxsw_afa_mirror *mirror)
896{ 902{
903 mlxsw_afa_resource_del(&mirror->resource);
897 block->afa->ops->mirror_del(block->afa->ops_priv, 904 block->afa->ops->mirror_del(block->afa->ops_priv,
898 mirror->local_in_port, 905 mirror->local_in_port,
899 mirror->span_id, 906 mirror->span_id,
@@ -946,8 +953,8 @@ mlxsw_afa_block_append_allocated_mirror(struct mlxsw_afa_block *block,
946 char *act = mlxsw_afa_block_append_action(block, 953 char *act = mlxsw_afa_block_append_action(block,
947 MLXSW_AFA_TRAPDISC_CODE, 954 MLXSW_AFA_TRAPDISC_CODE,
948 MLXSW_AFA_TRAPDISC_SIZE); 955 MLXSW_AFA_TRAPDISC_SIZE);
949 if (!act) 956 if (IS_ERR(act))
950 return -ENOBUFS; 957 return PTR_ERR(act);
951 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_NOP, 958 mlxsw_afa_trapdisc_pack(act, MLXSW_AFA_TRAPDISC_TRAP_ACTION_NOP,
952 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_FORWARD, 0); 959 MLXSW_AFA_TRAPDISC_FORWARD_ACTION_FORWARD, 0);
953 mlxsw_afa_trapdisc_mirror_pack(act, true, mirror_agent); 960 mlxsw_afa_trapdisc_mirror_pack(act, true, mirror_agent);
@@ -1043,9 +1050,9 @@ int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
1043 1050
1044 act = mlxsw_afa_block_append_action(block, MLXSW_AFA_FORWARD_CODE, 1051 act = mlxsw_afa_block_append_action(block, MLXSW_AFA_FORWARD_CODE,
1045 MLXSW_AFA_FORWARD_SIZE); 1052 MLXSW_AFA_FORWARD_SIZE);
1046 if (!act) { 1053 if (IS_ERR(act)) {
1047 err = -ENOBUFS;
1048 NL_SET_ERR_MSG_MOD(extack, "Cannot append forward action"); 1054 NL_SET_ERR_MSG_MOD(extack, "Cannot append forward action");
1055 err = PTR_ERR(act);
1049 goto err_append_action; 1056 goto err_append_action;
1050 } 1057 }
1051 mlxsw_afa_forward_pack(act, MLXSW_AFA_FORWARD_TYPE_PBS, 1058 mlxsw_afa_forward_pack(act, MLXSW_AFA_FORWARD_TYPE_PBS,
@@ -1100,8 +1107,8 @@ int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block,
1100{ 1107{
1101 char *act = mlxsw_afa_block_append_action(block, MLXSW_AFA_POLCNT_CODE, 1108 char *act = mlxsw_afa_block_append_action(block, MLXSW_AFA_POLCNT_CODE,
1102 MLXSW_AFA_POLCNT_SIZE); 1109 MLXSW_AFA_POLCNT_SIZE);
1103 if (!act) 1110 if (IS_ERR(act))
1104 return -ENOBUFS; 1111 return PTR_ERR(act);
1105 mlxsw_afa_polcnt_pack(act, MLXSW_AFA_POLCNT_COUNTER_SET_TYPE_PACKETS_BYTES, 1112 mlxsw_afa_polcnt_pack(act, MLXSW_AFA_POLCNT_COUNTER_SET_TYPE_PACKETS_BYTES,
1106 counter_index); 1113 counter_index);
1107 return 0; 1114 return 0;
@@ -1176,9 +1183,9 @@ int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid,
1176 char *act = mlxsw_afa_block_append_action(block, 1183 char *act = mlxsw_afa_block_append_action(block,
1177 MLXSW_AFA_VIRFWD_CODE, 1184 MLXSW_AFA_VIRFWD_CODE,
1178 MLXSW_AFA_VIRFWD_SIZE); 1185 MLXSW_AFA_VIRFWD_SIZE);
1179 if (!act) { 1186 if (IS_ERR(act)) {
1180 NL_SET_ERR_MSG_MOD(extack, "Cannot append fid_set action"); 1187 NL_SET_ERR_MSG_MOD(extack, "Cannot append fid_set action");
1181 return -ENOBUFS; 1188 return PTR_ERR(act);
1182 } 1189 }
1183 mlxsw_afa_virfwd_pack(act, MLXSW_AFA_VIRFWD_FID_CMD_SET, fid); 1190 mlxsw_afa_virfwd_pack(act, MLXSW_AFA_VIRFWD_FID_CMD_SET, fid);
1184 return 0; 1191 return 0;
@@ -1248,8 +1255,8 @@ int mlxsw_afa_block_append_mcrouter(struct mlxsw_afa_block *block,
1248 char *act = mlxsw_afa_block_append_action(block, 1255 char *act = mlxsw_afa_block_append_action(block,
1249 MLXSW_AFA_MCROUTER_CODE, 1256 MLXSW_AFA_MCROUTER_CODE,
1250 MLXSW_AFA_MCROUTER_SIZE); 1257 MLXSW_AFA_MCROUTER_SIZE);
1251 if (!act) 1258 if (IS_ERR(act))
1252 return -ENOBUFS; 1259 return PTR_ERR(act);
1253 mlxsw_afa_mcrouter_pack(act, MLXSW_AFA_MCROUTER_RPF_ACTION_TRAP, 1260 mlxsw_afa_mcrouter_pack(act, MLXSW_AFA_MCROUTER_RPF_ACTION_TRAP,
1254 expected_irif, min_mtu, rmid_valid, kvdl_index); 1261 expected_irif, min_mtu, rmid_valid, kvdl_index);
1255 return 0; 1262 return 0;
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 093bd21f574d..4907453f17f5 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1362,7 +1362,7 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/
1362 case 0x001: 1362 case 0x001:
1363 printk(KERN_WARNING "%s: Master Abort (naughty)\n", dev->name); 1363 printk(KERN_WARNING "%s: Master Abort (naughty)\n", dev->name);
1364 break; 1364 break;
1365 case 0x010: 1365 case 0x002:
1366 printk(KERN_WARNING "%s: Target Abort (not so naughty)\n", dev->name); 1366 printk(KERN_WARNING "%s: Target Abort (not so naughty)\n", dev->name);
1367 break; 1367 break;
1368 default: 1368 default:
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 35b7fc87eac5..5cb40b2518f9 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -330,7 +330,7 @@ void pci_bus_add_device(struct pci_dev *dev)
330 return; 330 return;
331 } 331 }
332 332
333 dev->is_added = 1; 333 pci_dev_assign_added(dev, true);
334} 334}
335EXPORT_SYMBOL_GPL(pci_bus_add_device); 335EXPORT_SYMBOL_GPL(pci_bus_add_device);
336 336
@@ -347,14 +347,14 @@ void pci_bus_add_devices(const struct pci_bus *bus)
347 347
348 list_for_each_entry(dev, &bus->devices, bus_list) { 348 list_for_each_entry(dev, &bus->devices, bus_list) {
349 /* Skip already-added devices */ 349 /* Skip already-added devices */
350 if (dev->is_added) 350 if (pci_dev_is_added(dev))
351 continue; 351 continue;
352 pci_bus_add_device(dev); 352 pci_bus_add_device(dev);
353 } 353 }
354 354
355 list_for_each_entry(dev, &bus->devices, bus_list) { 355 list_for_each_entry(dev, &bus->devices, bus_list) {
356 /* Skip if device attach failed */ 356 /* Skip if device attach failed */
357 if (!dev->is_added) 357 if (!pci_dev_is_added(dev))
358 continue; 358 continue;
359 child = dev->subordinate; 359 child = dev->subordinate;
360 if (child) 360 if (child)
diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c
index 4d6c20e47bed..cf0aa7cee5b0 100644
--- a/drivers/pci/controller/pcie-mobiveil.c
+++ b/drivers/pci/controller/pcie-mobiveil.c
@@ -107,7 +107,7 @@
107#define CFG_WINDOW_TYPE 0 107#define CFG_WINDOW_TYPE 0
108#define IO_WINDOW_TYPE 1 108#define IO_WINDOW_TYPE 1
109#define MEM_WINDOW_TYPE 2 109#define MEM_WINDOW_TYPE 2
110#define IB_WIN_SIZE (256 * 1024 * 1024 * 1024) 110#define IB_WIN_SIZE ((u64)256 * 1024 * 1024 * 1024)
111#define MAX_PIO_WINDOWS 8 111#define MAX_PIO_WINDOWS 8
112 112
113/* Parameters for the waiting for link up routine */ 113/* Parameters for the waiting for link up routine */
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 3a17b290df5d..ef0b1b6ba86f 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -509,7 +509,7 @@ static void enable_slot(struct acpiphp_slot *slot)
509 509
510 list_for_each_entry(dev, &bus->devices, bus_list) { 510 list_for_each_entry(dev, &bus->devices, bus_list) {
511 /* Assume that newly added devices are powered on already. */ 511 /* Assume that newly added devices are powered on already. */
512 if (!dev->is_added) 512 if (!pci_dev_is_added(dev))
513 dev->current_state = PCI_D0; 513 dev->current_state = PCI_D0;
514 } 514 }
515 515
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 882f1f9596df..08817253c8a2 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -288,6 +288,7 @@ struct pci_sriov {
288 288
289/* pci_dev priv_flags */ 289/* pci_dev priv_flags */
290#define PCI_DEV_DISCONNECTED 0 290#define PCI_DEV_DISCONNECTED 0
291#define PCI_DEV_ADDED 1
291 292
292static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) 293static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)
293{ 294{
@@ -300,6 +301,16 @@ static inline bool pci_dev_is_disconnected(const struct pci_dev *dev)
300 return test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); 301 return test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags);
301} 302}
302 303
304static inline void pci_dev_assign_added(struct pci_dev *dev, bool added)
305{
306 assign_bit(PCI_DEV_ADDED, &dev->priv_flags, added);
307}
308
309static inline bool pci_dev_is_added(const struct pci_dev *dev)
310{
311 return test_bit(PCI_DEV_ADDED, &dev->priv_flags);
312}
313
303#ifdef CONFIG_PCI_ATS 314#ifdef CONFIG_PCI_ATS
304void pci_restore_ats_state(struct pci_dev *dev); 315void pci_restore_ats_state(struct pci_dev *dev);
305#else 316#else
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ac876e32de4b..611adcd9c169 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2433,13 +2433,13 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
2433 dev = pci_scan_single_device(bus, devfn); 2433 dev = pci_scan_single_device(bus, devfn);
2434 if (!dev) 2434 if (!dev)
2435 return 0; 2435 return 0;
2436 if (!dev->is_added) 2436 if (!pci_dev_is_added(dev))
2437 nr++; 2437 nr++;
2438 2438
2439 for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { 2439 for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) {
2440 dev = pci_scan_single_device(bus, devfn + fn); 2440 dev = pci_scan_single_device(bus, devfn + fn);
2441 if (dev) { 2441 if (dev) {
2442 if (!dev->is_added) 2442 if (!pci_dev_is_added(dev))
2443 nr++; 2443 nr++;
2444 dev->multifunction = 1; 2444 dev->multifunction = 1;
2445 } 2445 }
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 6f072eae4f7a..5e3d0dced2b8 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -19,11 +19,12 @@ static void pci_stop_dev(struct pci_dev *dev)
19{ 19{
20 pci_pme_active(dev, false); 20 pci_pme_active(dev, false);
21 21
22 if (dev->is_added) { 22 if (pci_dev_is_added(dev)) {
23 device_release_driver(&dev->dev); 23 device_release_driver(&dev->dev);
24 pci_proc_detach_device(dev); 24 pci_proc_detach_device(dev);
25 pci_remove_sysfs_dev_files(dev); 25 pci_remove_sysfs_dev_files(dev);
26 dev->is_added = 0; 26
27 pci_dev_assign_added(dev, false);
27 } 28 }
28 29
29 if (dev->bus->self) 30 if (dev->bus->self)
diff --git a/fs/iomap.c b/fs/iomap.c
index 77397b5a96ef..0d0bd8845586 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -1443,7 +1443,7 @@ iomap_bmap(struct address_space *mapping, sector_t bno,
1443 const struct iomap_ops *ops) 1443 const struct iomap_ops *ops)
1444{ 1444{
1445 struct inode *inode = mapping->host; 1445 struct inode *inode = mapping->host;
1446 loff_t pos = bno >> inode->i_blkbits; 1446 loff_t pos = bno << inode->i_blkbits;
1447 unsigned blocksize = i_blocksize(inode); 1447 unsigned blocksize = i_blocksize(inode);
1448 1448
1449 if (filemap_write_and_wait(mapping)) 1449 if (filemap_write_and_wait(mapping))
diff --git a/fs/jfs/jfs_dinode.h b/fs/jfs/jfs_dinode.h
index 395c4c0d0f06..1682a87c00b2 100644
--- a/fs/jfs/jfs_dinode.h
+++ b/fs/jfs/jfs_dinode.h
@@ -115,6 +115,13 @@ struct dinode {
115 dxd_t _dxd; /* 16: */ 115 dxd_t _dxd; /* 16: */
116 union { 116 union {
117 __le32 _rdev; /* 4: */ 117 __le32 _rdev; /* 4: */
118 /*
119 * The fast symlink area
120 * is expected to overflow
121 * into _inlineea when
122 * needed (which will clear
123 * INLINEEA).
124 */
118 u8 _fastsymlink[128]; 125 u8 _fastsymlink[128];
119 } _u; 126 } _u;
120 u8 _inlineea[128]; 127 u8 _inlineea[128];
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index 1f26d1910409..9940a1e04cbf 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -87,6 +87,7 @@ struct jfs_inode_info {
87 struct { 87 struct {
88 unchar _unused[16]; /* 16: */ 88 unchar _unused[16]; /* 16: */
89 dxd_t _dxd; /* 16: */ 89 dxd_t _dxd; /* 16: */
90 /* _inline may overflow into _inline_ea when needed */
90 unchar _inline[128]; /* 128: inline symlink */ 91 unchar _inline[128]; /* 128: inline symlink */
91 /* _inline_ea may overlay the last part of 92 /* _inline_ea may overlay the last part of
92 * file._xtroot if maxentry = XTROOTINITSLOT 93 * file._xtroot if maxentry = XTROOTINITSLOT
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 1b9264fd54b6..f08571433aba 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -967,8 +967,7 @@ static int __init init_jfs_fs(void)
967 jfs_inode_cachep = 967 jfs_inode_cachep =
968 kmem_cache_create_usercopy("jfs_ip", sizeof(struct jfs_inode_info), 968 kmem_cache_create_usercopy("jfs_ip", sizeof(struct jfs_inode_info),
969 0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_ACCOUNT, 969 0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_ACCOUNT,
970 offsetof(struct jfs_inode_info, i_inline), 970 offsetof(struct jfs_inode_info, i_inline), IDATASIZE,
971 sizeof_field(struct jfs_inode_info, i_inline),
972 init_once); 971 init_once);
973 if (jfs_inode_cachep == NULL) 972 if (jfs_inode_cachep == NULL)
974 return -ENOMEM; 973 return -ENOMEM;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6dd146885da9..f6c4ccd693f4 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6466,34 +6466,34 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
6466 if (data->arg.new_lock && !data->cancelled) { 6466 if (data->arg.new_lock && !data->cancelled) {
6467 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); 6467 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS);
6468 if (locks_lock_inode_wait(lsp->ls_state->inode, &data->fl) < 0) 6468 if (locks_lock_inode_wait(lsp->ls_state->inode, &data->fl) < 0)
6469 break; 6469 goto out_restart;
6470 } 6470 }
6471
6472 if (data->arg.new_lock_owner != 0) { 6471 if (data->arg.new_lock_owner != 0) {
6473 nfs_confirm_seqid(&lsp->ls_seqid, 0); 6472 nfs_confirm_seqid(&lsp->ls_seqid, 0);
6474 nfs4_stateid_copy(&lsp->ls_stateid, &data->res.stateid); 6473 nfs4_stateid_copy(&lsp->ls_stateid, &data->res.stateid);
6475 set_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags); 6474 set_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags);
6476 goto out_done; 6475 } else if (!nfs4_update_lock_stateid(lsp, &data->res.stateid))
6477 } else if (nfs4_update_lock_stateid(lsp, &data->res.stateid)) 6476 goto out_restart;
6478 goto out_done;
6479
6480 break; 6477 break;
6481 case -NFS4ERR_BAD_STATEID: 6478 case -NFS4ERR_BAD_STATEID:
6482 case -NFS4ERR_OLD_STATEID: 6479 case -NFS4ERR_OLD_STATEID:
6483 case -NFS4ERR_STALE_STATEID: 6480 case -NFS4ERR_STALE_STATEID:
6484 case -NFS4ERR_EXPIRED: 6481 case -NFS4ERR_EXPIRED:
6485 if (data->arg.new_lock_owner != 0) { 6482 if (data->arg.new_lock_owner != 0) {
6486 if (nfs4_stateid_match(&data->arg.open_stateid, 6483 if (!nfs4_stateid_match(&data->arg.open_stateid,
6487 &lsp->ls_state->open_stateid)) 6484 &lsp->ls_state->open_stateid))
6488 goto out_done; 6485 goto out_restart;
6489 } else if (nfs4_stateid_match(&data->arg.lock_stateid, 6486 } else if (!nfs4_stateid_match(&data->arg.lock_stateid,
6490 &lsp->ls_stateid)) 6487 &lsp->ls_stateid))
6491 goto out_done; 6488 goto out_restart;
6492 } 6489 }
6493 if (!data->cancelled)
6494 rpc_restart_call_prepare(task);
6495out_done: 6490out_done:
6496 dprintk("%s: done, ret = %d!\n", __func__, data->rpc_status); 6491 dprintk("%s: done, ret = %d!\n", __func__, data->rpc_status);
6492 return;
6493out_restart:
6494 if (!data->cancelled)
6495 rpc_restart_call_prepare(task);
6496 goto out_done;
6497} 6497}
6498 6498
6499static void nfs4_lock_release(void *calldata) 6499static void nfs4_lock_release(void *calldata)
@@ -6502,7 +6502,7 @@ static void nfs4_lock_release(void *calldata)
6502 6502
6503 dprintk("%s: begin!\n", __func__); 6503 dprintk("%s: begin!\n", __func__);
6504 nfs_free_seqid(data->arg.open_seqid); 6504 nfs_free_seqid(data->arg.open_seqid);
6505 if (data->cancelled) { 6505 if (data->cancelled && data->rpc_status == 0) {
6506 struct rpc_task *task; 6506 struct rpc_task *task;
6507 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, 6507 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
6508 data->arg.lock_seqid); 6508 data->arg.lock_seqid);
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 594d192b2331..bad9cea37f12 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -633,8 +633,10 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
633 /* the various vma->vm_userfaultfd_ctx still points to it */ 633 /* the various vma->vm_userfaultfd_ctx still points to it */
634 down_write(&mm->mmap_sem); 634 down_write(&mm->mmap_sem);
635 for (vma = mm->mmap; vma; vma = vma->vm_next) 635 for (vma = mm->mmap; vma; vma = vma->vm_next)
636 if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) 636 if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) {
637 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; 637 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
638 vma->vm_flags &= ~(VM_UFFD_WP | VM_UFFD_MISSING);
639 }
638 up_write(&mm->mmap_sem); 640 up_write(&mm->mmap_sem);
639 641
640 userfaultfd_ctx_put(release_new_ctx); 642 userfaultfd_ctx_put(release_new_ctx);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index abd5d5e17aee..c133ccfa002e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -368,7 +368,6 @@ struct pci_dev {
368 unsigned int transparent:1; /* Subtractive decode bridge */ 368 unsigned int transparent:1; /* Subtractive decode bridge */
369 unsigned int multifunction:1; /* Multi-function device */ 369 unsigned int multifunction:1; /* Multi-function device */
370 370
371 unsigned int is_added:1;
372 unsigned int is_busmaster:1; /* Is busmaster */ 371 unsigned int is_busmaster:1; /* Is busmaster */
373 unsigned int no_msi:1; /* May not use MSI */ 372 unsigned int no_msi:1; /* May not use MSI */
374 unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */ 373 unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */
diff --git a/ipc/shm.c b/ipc/shm.c
index d4daf78df6da..fa1d322daa27 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -428,6 +428,17 @@ static int shm_split(struct vm_area_struct *vma, unsigned long addr)
428 return 0; 428 return 0;
429} 429}
430 430
431static unsigned long shm_pagesize(struct vm_area_struct *vma)
432{
433 struct file *file = vma->vm_file;
434 struct shm_file_data *sfd = shm_file_data(file);
435
436 if (sfd->vm_ops->pagesize)
437 return sfd->vm_ops->pagesize(vma);
438
439 return PAGE_SIZE;
440}
441
431#ifdef CONFIG_NUMA 442#ifdef CONFIG_NUMA
432static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new) 443static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
433{ 444{
@@ -555,6 +566,7 @@ static const struct vm_operations_struct shm_vm_ops = {
555 .close = shm_close, /* callback for when the vm-area is released */ 566 .close = shm_close, /* callback for when the vm-area is released */
556 .fault = shm_fault, 567 .fault = shm_fault,
557 .split = shm_split, 568 .split = shm_split,
569 .pagesize = shm_pagesize,
558#if defined(CONFIG_NUMA) 570#if defined(CONFIG_NUMA)
559 .set_policy = shm_set_policy, 571 .set_policy = shm_set_policy,
560 .get_policy = shm_get_policy, 572 .get_policy = shm_get_policy,
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index daeabd791d58..9a8b7ba9aa88 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1068,6 +1068,13 @@ static int irq_setup_forced_threading(struct irqaction *new)
1068 if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT)) 1068 if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))
1069 return 0; 1069 return 0;
1070 1070
1071 /*
1072 * No further action required for interrupts which are requested as
1073 * threaded interrupts already
1074 */
1075 if (new->handler == irq_default_primary_handler)
1076 return 0;
1077
1071 new->flags |= IRQF_ONESHOT; 1078 new->flags |= IRQF_ONESHOT;
1072 1079
1073 /* 1080 /*
@@ -1075,7 +1082,7 @@ static int irq_setup_forced_threading(struct irqaction *new)
1075 * thread handler. We force thread them as well by creating a 1082 * thread handler. We force thread them as well by creating a
1076 * secondary action. 1083 * secondary action.
1077 */ 1084 */
1078 if (new->handler != irq_default_primary_handler && new->thread_fn) { 1085 if (new->handler && new->thread_fn) {
1079 /* Allocate the secondary action */ 1086 /* Allocate the secondary action */
1080 new->secondary = kzalloc(sizeof(struct irqaction), GFP_KERNEL); 1087 new->secondary = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
1081 if (!new->secondary) 1088 if (!new->secondary)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 75ffc1d1a2e0..6f584861d329 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -390,7 +390,7 @@ static inline void tick_irq_exit(void)
390 390
391 /* Make sure that timer wheel updates are propagated */ 391 /* Make sure that timer wheel updates are propagated */
392 if ((idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) { 392 if ((idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) {
393 if (!in_interrupt()) 393 if (!in_irq())
394 tick_nohz_irq_exit(); 394 tick_nohz_irq_exit();
395 } 395 }
396#endif 396#endif
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index da9455a6b42b..5b33e2f5c0ed 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -642,7 +642,7 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
642 642
643static inline bool local_timer_softirq_pending(void) 643static inline bool local_timer_softirq_pending(void)
644{ 644{
645 return local_softirq_pending() & TIMER_SOFTIRQ; 645 return local_softirq_pending() & BIT(TIMER_SOFTIRQ);
646} 646}
647 647
648static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) 648static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 039ddbc574e9..3103099f64fd 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3167,6 +3167,13 @@ static vm_fault_t hugetlb_vm_op_fault(struct vm_fault *vmf)
3167 return 0; 3167 return 0;
3168} 3168}
3169 3169
3170/*
3171 * When a new function is introduced to vm_operations_struct and added
3172 * to hugetlb_vm_ops, please consider adding the function to shm_vm_ops.
3173 * This is because under System V memory model, mappings created via
3174 * shmget/shmat with "huge page" specified are backed by hugetlbfs files,
3175 * their original vm_ops are overwritten with shm_vm_ops.
3176 */
3170const struct vm_operations_struct hugetlb_vm_ops = { 3177const struct vm_operations_struct hugetlb_vm_ops = {
3171 .fault = hugetlb_vm_op_fault, 3178 .fault = hugetlb_vm_op_fault,
3172 .open = hugetlb_vm_op_open, 3179 .open = hugetlb_vm_op_open,
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8c0280b3143e..b2173f7e5164 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4037,6 +4037,14 @@ static struct cftype mem_cgroup_legacy_files[] = {
4037 4037
4038static DEFINE_IDR(mem_cgroup_idr); 4038static DEFINE_IDR(mem_cgroup_idr);
4039 4039
4040static void mem_cgroup_id_remove(struct mem_cgroup *memcg)
4041{
4042 if (memcg->id.id > 0) {
4043 idr_remove(&mem_cgroup_idr, memcg->id.id);
4044 memcg->id.id = 0;
4045 }
4046}
4047
4040static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) 4048static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n)
4041{ 4049{
4042 VM_BUG_ON(atomic_read(&memcg->id.ref) <= 0); 4050 VM_BUG_ON(atomic_read(&memcg->id.ref) <= 0);
@@ -4047,8 +4055,7 @@ static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
4047{ 4055{
4048 VM_BUG_ON(atomic_read(&memcg->id.ref) < n); 4056 VM_BUG_ON(atomic_read(&memcg->id.ref) < n);
4049 if (atomic_sub_and_test(n, &memcg->id.ref)) { 4057 if (atomic_sub_and_test(n, &memcg->id.ref)) {
4050 idr_remove(&mem_cgroup_idr, memcg->id.id); 4058 mem_cgroup_id_remove(memcg);
4051 memcg->id.id = 0;
4052 4059
4053 /* Memcg ID pins CSS */ 4060 /* Memcg ID pins CSS */
4054 css_put(&memcg->css); 4061 css_put(&memcg->css);
@@ -4185,8 +4192,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
4185 idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); 4192 idr_replace(&mem_cgroup_idr, memcg, memcg->id.id);
4186 return memcg; 4193 return memcg;
4187fail: 4194fail:
4188 if (memcg->id.id > 0) 4195 mem_cgroup_id_remove(memcg);
4189 idr_remove(&mem_cgroup_idr, memcg->id.id);
4190 __mem_cgroup_free(memcg); 4196 __mem_cgroup_free(memcg);
4191 return NULL; 4197 return NULL;
4192} 4198}
@@ -4245,6 +4251,7 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
4245 4251
4246 return &memcg->css; 4252 return &memcg->css;
4247fail: 4253fail:
4254 mem_cgroup_id_remove(memcg);
4248 mem_cgroup_free(memcg); 4255 mem_cgroup_free(memcg);
4249 return ERR_PTR(-ENOMEM); 4256 return ERR_PTR(-ENOMEM);
4250} 4257}
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index b403728e2757..6e2c8e7595e0 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1139,13 +1139,18 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
1139 l2tp_session_get(sock_net(sk), tunnel, 1139 l2tp_session_get(sock_net(sk), tunnel,
1140 stats.session_id); 1140 stats.session_id);
1141 1141
1142 if (session && session->pwtype == L2TP_PWTYPE_PPP) { 1142 if (!session) {
1143 err = pppol2tp_session_ioctl(session, cmd, 1143 err = -EBADR;
1144 arg); 1144 break;
1145 }
1146 if (session->pwtype != L2TP_PWTYPE_PPP) {
1145 l2tp_session_dec_refcount(session); 1147 l2tp_session_dec_refcount(session);
1146 } else {
1147 err = -EBADR; 1148 err = -EBADR;
1149 break;
1148 } 1150 }
1151
1152 err = pppol2tp_session_ioctl(session, cmd, arg);
1153 l2tp_session_dec_refcount(session);
1149 break; 1154 break;
1150 } 1155 }
1151#ifdef CONFIG_XFRM 1156#ifdef CONFIG_XFRM
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 505bf36474ba..930d17fa906c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1013,8 +1013,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
1013 1013
1014 if (nlk->ngroups == 0) 1014 if (nlk->ngroups == 0)
1015 groups = 0; 1015 groups = 0;
1016 else 1016 else if (nlk->ngroups < 8*sizeof(groups))
1017 groups &= (1ULL << nlk->ngroups) - 1; 1017 groups &= (1UL << nlk->ngroups) - 1;
1018 1018
1019 bound = nlk->bound; 1019 bound = nlk->bound;
1020 if (bound) { 1020 if (bound) {
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index a7af2289cdff..ed5dcf03fe0b 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -278,7 +278,8 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
278 /* force immediate tx of current consumer cursor, but 278 /* force immediate tx of current consumer cursor, but
279 * under send_lock to guarantee arrival in seqno-order 279 * under send_lock to guarantee arrival in seqno-order
280 */ 280 */
281 smc_tx_sndbuf_nonempty(conn); 281 if (smc->sk.sk_state != SMC_INIT)
282 smc_tx_sndbuf_nonempty(conn);
282 } 283 }
283 } 284 }
284 285
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 72335c2e8108..4e937cd7c17d 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -84,10 +84,8 @@ static int __xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
84{ 84{
85 int err = xskq_produce_batch_desc(xs->rx, (u64)xdp->handle, len); 85 int err = xskq_produce_batch_desc(xs->rx, (u64)xdp->handle, len);
86 86
87 if (err) { 87 if (err)
88 xdp_return_buff(xdp);
89 xs->rx_dropped++; 88 xs->rx_dropped++;
90 }
91 89
92 return err; 90 return err;
93} 91}
diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h
index ac5ba55066dd..985534d0b448 100644
--- a/tools/arch/powerpc/include/uapi/asm/unistd.h
+++ b/tools/arch/powerpc/include/uapi/asm/unistd.h
@@ -399,5 +399,6 @@
399#define __NR_pkey_free 385 399#define __NR_pkey_free 385
400#define __NR_pkey_mprotect 386 400#define __NR_pkey_mprotect 386
401#define __NR_rseq 387 401#define __NR_rseq 387
402#define __NR_io_pgetevents 388
402 403
403#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 404#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/tools/arch/x86/include/asm/mcsafe_test.h b/tools/arch/x86/include/asm/mcsafe_test.h
new file mode 100644
index 000000000000..2ccd588fbad4
--- /dev/null
+++ b/tools/arch/x86/include/asm/mcsafe_test.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _MCSAFE_TEST_H_
3#define _MCSAFE_TEST_H_
4
5.macro MCSAFE_TEST_CTL
6.endm
7
8.macro MCSAFE_TEST_SRC reg count target
9.endm
10
11.macro MCSAFE_TEST_DST reg count target
12.endm
13#endif /* _MCSAFE_TEST_H_ */
diff --git a/tools/arch/x86/lib/memcpy_64.S b/tools/arch/x86/lib/memcpy_64.S
index 9a53a06e5a3e..298ef1479240 100644
--- a/tools/arch/x86/lib/memcpy_64.S
+++ b/tools/arch/x86/lib/memcpy_64.S
@@ -3,6 +3,7 @@
3#include <linux/linkage.h> 3#include <linux/linkage.h>
4#include <asm/errno.h> 4#include <asm/errno.h>
5#include <asm/cpufeatures.h> 5#include <asm/cpufeatures.h>
6#include <asm/mcsafe_test.h>
6#include <asm/alternative-asm.h> 7#include <asm/alternative-asm.h>
7#include <asm/export.h> 8#include <asm/export.h>
8 9
@@ -183,12 +184,15 @@ ENTRY(memcpy_orig)
183ENDPROC(memcpy_orig) 184ENDPROC(memcpy_orig)
184 185
185#ifndef CONFIG_UML 186#ifndef CONFIG_UML
187
188MCSAFE_TEST_CTL
189
186/* 190/*
187 * memcpy_mcsafe_unrolled - memory copy with machine check exception handling 191 * __memcpy_mcsafe - memory copy with machine check exception handling
188 * Note that we only catch machine checks when reading the source addresses. 192 * Note that we only catch machine checks when reading the source addresses.
189 * Writes to target are posted and don't generate machine checks. 193 * Writes to target are posted and don't generate machine checks.
190 */ 194 */
191ENTRY(memcpy_mcsafe_unrolled) 195ENTRY(__memcpy_mcsafe)
192 cmpl $8, %edx 196 cmpl $8, %edx
193 /* Less than 8 bytes? Go to byte copy loop */ 197 /* Less than 8 bytes? Go to byte copy loop */
194 jb .L_no_whole_words 198 jb .L_no_whole_words
@@ -204,58 +208,33 @@ ENTRY(memcpy_mcsafe_unrolled)
204 subl $8, %ecx 208 subl $8, %ecx
205 negl %ecx 209 negl %ecx
206 subl %ecx, %edx 210 subl %ecx, %edx
207.L_copy_leading_bytes: 211.L_read_leading_bytes:
208 movb (%rsi), %al 212 movb (%rsi), %al
213 MCSAFE_TEST_SRC %rsi 1 .E_leading_bytes
214 MCSAFE_TEST_DST %rdi 1 .E_leading_bytes
215.L_write_leading_bytes:
209 movb %al, (%rdi) 216 movb %al, (%rdi)
210 incq %rsi 217 incq %rsi
211 incq %rdi 218 incq %rdi
212 decl %ecx 219 decl %ecx
213 jnz .L_copy_leading_bytes 220 jnz .L_read_leading_bytes
214 221
215.L_8byte_aligned: 222.L_8byte_aligned:
216 /* Figure out how many whole cache lines (64-bytes) to copy */
217 movl %edx, %ecx
218 andl $63, %edx
219 shrl $6, %ecx
220 jz .L_no_whole_cache_lines
221
222 /* Loop copying whole cache lines */
223.L_cache_w0: movq (%rsi), %r8
224.L_cache_w1: movq 1*8(%rsi), %r9
225.L_cache_w2: movq 2*8(%rsi), %r10
226.L_cache_w3: movq 3*8(%rsi), %r11
227 movq %r8, (%rdi)
228 movq %r9, 1*8(%rdi)
229 movq %r10, 2*8(%rdi)
230 movq %r11, 3*8(%rdi)
231.L_cache_w4: movq 4*8(%rsi), %r8
232.L_cache_w5: movq 5*8(%rsi), %r9
233.L_cache_w6: movq 6*8(%rsi), %r10
234.L_cache_w7: movq 7*8(%rsi), %r11
235 movq %r8, 4*8(%rdi)
236 movq %r9, 5*8(%rdi)
237 movq %r10, 6*8(%rdi)
238 movq %r11, 7*8(%rdi)
239 leaq 64(%rsi), %rsi
240 leaq 64(%rdi), %rdi
241 decl %ecx
242 jnz .L_cache_w0
243
244 /* Are there any trailing 8-byte words? */
245.L_no_whole_cache_lines:
246 movl %edx, %ecx 223 movl %edx, %ecx
247 andl $7, %edx 224 andl $7, %edx
248 shrl $3, %ecx 225 shrl $3, %ecx
249 jz .L_no_whole_words 226 jz .L_no_whole_words
250 227
251 /* Copy trailing words */ 228.L_read_words:
252.L_copy_trailing_words:
253 movq (%rsi), %r8 229 movq (%rsi), %r8
254 mov %r8, (%rdi) 230 MCSAFE_TEST_SRC %rsi 8 .E_read_words
255 leaq 8(%rsi), %rsi 231 MCSAFE_TEST_DST %rdi 8 .E_write_words
256 leaq 8(%rdi), %rdi 232.L_write_words:
233 movq %r8, (%rdi)
234 addq $8, %rsi
235 addq $8, %rdi
257 decl %ecx 236 decl %ecx
258 jnz .L_copy_trailing_words 237 jnz .L_read_words
259 238
260 /* Any trailing bytes? */ 239 /* Any trailing bytes? */
261.L_no_whole_words: 240.L_no_whole_words:
@@ -264,38 +243,55 @@ ENTRY(memcpy_mcsafe_unrolled)
264 243
265 /* Copy trailing bytes */ 244 /* Copy trailing bytes */
266 movl %edx, %ecx 245 movl %edx, %ecx
267.L_copy_trailing_bytes: 246.L_read_trailing_bytes:
268 movb (%rsi), %al 247 movb (%rsi), %al
248 MCSAFE_TEST_SRC %rsi 1 .E_trailing_bytes
249 MCSAFE_TEST_DST %rdi 1 .E_trailing_bytes
250.L_write_trailing_bytes:
269 movb %al, (%rdi) 251 movb %al, (%rdi)
270 incq %rsi 252 incq %rsi
271 incq %rdi 253 incq %rdi
272 decl %ecx 254 decl %ecx
273 jnz .L_copy_trailing_bytes 255 jnz .L_read_trailing_bytes
274 256
275 /* Copy successful. Return zero */ 257 /* Copy successful. Return zero */
276.L_done_memcpy_trap: 258.L_done_memcpy_trap:
277 xorq %rax, %rax 259 xorq %rax, %rax
278 ret 260 ret
279ENDPROC(memcpy_mcsafe_unrolled) 261ENDPROC(__memcpy_mcsafe)
280EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled) 262EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
281 263
282 .section .fixup, "ax" 264 .section .fixup, "ax"
283 /* Return -EFAULT for any failure */ 265 /*
284.L_memcpy_mcsafe_fail: 266 * Return number of bytes not copied for any failure. Note that
285 mov $-EFAULT, %rax 267 * there is no "tail" handling since the source buffer is 8-byte
268 * aligned and poison is cacheline aligned.
269 */
270.E_read_words:
271 shll $3, %ecx
272.E_leading_bytes:
273 addl %edx, %ecx
274.E_trailing_bytes:
275 mov %ecx, %eax
286 ret 276 ret
287 277
278 /*
279 * For write fault handling, given the destination is unaligned,
280 * we handle faults on multi-byte writes with a byte-by-byte
281 * copy up to the write-protected page.
282 */
283.E_write_words:
284 shll $3, %ecx
285 addl %edx, %ecx
286 movl %ecx, %edx
287 jmp mcsafe_handle_tail
288
288 .previous 289 .previous
289 290
290 _ASM_EXTABLE_FAULT(.L_copy_leading_bytes, .L_memcpy_mcsafe_fail) 291 _ASM_EXTABLE_FAULT(.L_read_leading_bytes, .E_leading_bytes)
291 _ASM_EXTABLE_FAULT(.L_cache_w0, .L_memcpy_mcsafe_fail) 292 _ASM_EXTABLE_FAULT(.L_read_words, .E_read_words)
292 _ASM_EXTABLE_FAULT(.L_cache_w1, .L_memcpy_mcsafe_fail) 293 _ASM_EXTABLE_FAULT(.L_read_trailing_bytes, .E_trailing_bytes)
293 _ASM_EXTABLE_FAULT(.L_cache_w2, .L_memcpy_mcsafe_fail) 294 _ASM_EXTABLE(.L_write_leading_bytes, .E_leading_bytes)
294 _ASM_EXTABLE_FAULT(.L_cache_w3, .L_memcpy_mcsafe_fail) 295 _ASM_EXTABLE(.L_write_words, .E_write_words)
295 _ASM_EXTABLE_FAULT(.L_cache_w4, .L_memcpy_mcsafe_fail) 296 _ASM_EXTABLE(.L_write_trailing_bytes, .E_trailing_bytes)
296 _ASM_EXTABLE_FAULT(.L_cache_w5, .L_memcpy_mcsafe_fail)
297 _ASM_EXTABLE_FAULT(.L_cache_w6, .L_memcpy_mcsafe_fail)
298 _ASM_EXTABLE_FAULT(.L_cache_w7, .L_memcpy_mcsafe_fail)
299 _ASM_EXTABLE_FAULT(.L_copy_trailing_words, .L_memcpy_mcsafe_fail)
300 _ASM_EXTABLE_FAULT(.L_copy_trailing_bytes, .L_memcpy_mcsafe_fail)
301#endif 297#endif
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 9c8191845585..e860ca859b28 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -35,6 +35,7 @@
35#include <errno.h> 35#include <errno.h>
36#include <fcntl.h> 36#include <fcntl.h>
37#include <linux/err.h> 37#include <linux/err.h>
38#include <linux/kernel.h>
38#include <stdbool.h> 39#include <stdbool.h>
39#include <stdio.h> 40#include <stdio.h>
40#include <stdlib.h> 41#include <stdlib.h>
@@ -91,7 +92,8 @@ static bool map_is_map_of_progs(__u32 type)
91static void *alloc_value(struct bpf_map_info *info) 92static void *alloc_value(struct bpf_map_info *info)
92{ 93{
93 if (map_is_per_cpu(info->type)) 94 if (map_is_per_cpu(info->type))
94 return malloc(info->value_size * get_possible_cpus()); 95 return malloc(round_up(info->value_size, 8) *
96 get_possible_cpus());
95 else 97 else
96 return malloc(info->value_size); 98 return malloc(info->value_size);
97} 99}
@@ -273,9 +275,10 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
273 do_dump_btf(&d, info, key, value); 275 do_dump_btf(&d, info, key, value);
274 } 276 }
275 } else { 277 } else {
276 unsigned int i, n; 278 unsigned int i, n, step;
277 279
278 n = get_possible_cpus(); 280 n = get_possible_cpus();
281 step = round_up(info->value_size, 8);
279 282
280 jsonw_name(json_wtr, "key"); 283 jsonw_name(json_wtr, "key");
281 print_hex_data_json(key, info->key_size); 284 print_hex_data_json(key, info->key_size);
@@ -288,7 +291,7 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
288 jsonw_int_field(json_wtr, "cpu", i); 291 jsonw_int_field(json_wtr, "cpu", i);
289 292
290 jsonw_name(json_wtr, "value"); 293 jsonw_name(json_wtr, "value");
291 print_hex_data_json(value + i * info->value_size, 294 print_hex_data_json(value + i * step,
292 info->value_size); 295 info->value_size);
293 296
294 jsonw_end_object(json_wtr); 297 jsonw_end_object(json_wtr);
@@ -319,9 +322,10 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
319 322
320 printf("\n"); 323 printf("\n");
321 } else { 324 } else {
322 unsigned int i, n; 325 unsigned int i, n, step;
323 326
324 n = get_possible_cpus(); 327 n = get_possible_cpus();
328 step = round_up(info->value_size, 8);
325 329
326 printf("key:\n"); 330 printf("key:\n");
327 fprint_hex(stdout, key, info->key_size, " "); 331 fprint_hex(stdout, key, info->key_size, " ");
@@ -329,7 +333,7 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
329 for (i = 0; i < n; i++) { 333 for (i = 0; i < n; i++) {
330 printf("value (CPU %02d):%c", 334 printf("value (CPU %02d):%c",
331 i, info->value_size > 16 ? '\n' : ' '); 335 i, info->value_size > 16 ? '\n' : ' ');
332 fprint_hex(stdout, value + i * info->value_size, 336 fprint_hex(stdout, value + i * step,
333 info->value_size, " "); 337 info->value_size, " ");
334 printf("\n"); 338 printf("\n");
335 } 339 }
diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h
index b8e288a1f740..eeb787b1c53c 100644
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -143,6 +143,8 @@ enum perf_event_sample_format {
143 PERF_SAMPLE_PHYS_ADDR = 1U << 19, 143 PERF_SAMPLE_PHYS_ADDR = 1U << 19,
144 144
145 PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ 145 PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */
146
147 __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
146}; 148};
147 149
148/* 150/*
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index 63a74c32ddc5..e33ef5bc31c5 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -1,6 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include <string.h> 2#include <string.h>
3 3
4#include <linux/stddef.h>
4#include <linux/perf_event.h> 5#include <linux/perf_event.h>
5 6
6#include "../../util/intel-pt.h" 7#include "../../util/intel-pt.h"
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
index 06bae7023a51..950539f9a4f7 100644
--- a/tools/perf/arch/x86/util/tsc.c
+++ b/tools/perf/arch/x86/util/tsc.c
@@ -2,6 +2,7 @@
2#include <stdbool.h> 2#include <stdbool.h>
3#include <errno.h> 3#include <errno.h>
4 4
5#include <linux/stddef.h>
5#include <linux/perf_event.h> 6#include <linux/perf_event.h>
6 7
7#include "../../perf.h" 8#include "../../perf.h"
diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build
index 60bf11943047..eafce1a130a1 100644
--- a/tools/perf/bench/Build
+++ b/tools/perf/bench/Build
@@ -7,6 +7,7 @@ perf-y += futex-wake-parallel.o
7perf-y += futex-requeue.o 7perf-y += futex-requeue.o
8perf-y += futex-lock-pi.o 8perf-y += futex-lock-pi.o
9 9
10perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o
10perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o 11perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
11perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o 12perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
12 13
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S
index b43f8d2a34ec..9ad015a1e202 100644
--- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
+++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
@@ -6,6 +6,7 @@
6#define altinstr_replacement text 6#define altinstr_replacement text
7#define globl p2align 4; .globl 7#define globl p2align 4; .globl
8#define _ASM_EXTABLE_FAULT(x, y) 8#define _ASM_EXTABLE_FAULT(x, y)
9#define _ASM_EXTABLE(x, y)
9 10
10#include "../../arch/x86/lib/memcpy_64.S" 11#include "../../arch/x86/lib/memcpy_64.S"
11/* 12/*
diff --git a/tools/perf/bench/mem-memcpy-x86-64-lib.c b/tools/perf/bench/mem-memcpy-x86-64-lib.c
new file mode 100644
index 000000000000..4130734dde84
--- /dev/null
+++ b/tools/perf/bench/mem-memcpy-x86-64-lib.c
@@ -0,0 +1,24 @@
1/*
2 * From code in arch/x86/lib/usercopy_64.c, copied to keep tools/ copy
3 * of the kernel's arch/x86/lib/memcpy_64.s used in 'perf bench mem memcpy'
4 * happy.
5 */
6#include <linux/types.h>
7
8unsigned long __memcpy_mcsafe(void *dst, const void *src, size_t cnt);
9unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len);
10
11unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len)
12{
13 for (; len; --len, to++, from++) {
14 /*
15 * Call the assembly routine back directly since
16 * memcpy_mcsafe() may silently fallback to memcpy.
17 */
18 unsigned long rem = __memcpy_mcsafe(to, from, 1);
19
20 if (rem)
21 break;
22 }
23 return len;
24}
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index a1a97956136f..d215714f48df 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -5,6 +5,7 @@
5#include <time.h> 5#include <time.h>
6#include <stdbool.h> 6#include <stdbool.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/stddef.h>
8#include <linux/perf_event.h> 9#include <linux/perf_event.h>
9 10
10extern bool test_attr__enabled; 11extern bool test_attr__enabled;
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 90d4577a92dc..6d7fe44aadc0 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -2,6 +2,7 @@
2#ifndef __PERF_HEADER_H 2#ifndef __PERF_HEADER_H
3#define __PERF_HEADER_H 3#define __PERF_HEADER_H
4 4
5#include <linux/stddef.h>
5#include <linux/perf_event.h> 6#include <linux/perf_event.h>
6#include <sys/types.h> 7#include <sys/types.h>
7#include <stdbool.h> 8#include <stdbool.h>
diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h
index 760558dcfd18..cae1a9a39722 100644
--- a/tools/perf/util/namespaces.h
+++ b/tools/perf/util/namespaces.h
@@ -10,6 +10,7 @@
10#define __PERF_NAMESPACES_H 10#define __PERF_NAMESPACES_H
11 11
12#include <sys/types.h> 12#include <sys/types.h>
13#include <linux/stddef.h>
13#include <linux/perf_event.h> 14#include <linux/perf_event.h>
14#include <linux/refcount.h> 15#include <linux/refcount.h>
15#include <linux/types.h> 16#include <linux/types.h>
diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.sh b/tools/testing/selftests/bpf/test_lwt_seg6local.sh
index 270fa8f49573..785eabf2a593 100755
--- a/tools/testing/selftests/bpf/test_lwt_seg6local.sh
+++ b/tools/testing/selftests/bpf/test_lwt_seg6local.sh
@@ -115,14 +115,14 @@ ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj test_lwt_seg6local.o
115ip netns exec ns2 ip -6 route add fd00::1 dev veth3 via fb00::43 scope link 115ip netns exec ns2 ip -6 route add fd00::1 dev veth3 via fb00::43 scope link
116 116
117ip netns exec ns3 ip -6 route add fc42::1 dev veth5 via fb00::65 117ip netns exec ns3 ip -6 route add fc42::1 dev veth5 via fb00::65
118ip netns exec ns3 ip -6 route add fd00::1 encap seg6local action End.BPF obj test_lwt_seg6local.o sec add_egr_x dev veth4 118ip netns exec ns3 ip -6 route add fd00::1 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec add_egr_x dev veth4
119 119
120ip netns exec ns4 ip -6 route add fd00::2 encap seg6local action End.BPF obj test_lwt_seg6local.o sec pop_egr dev veth6 120ip netns exec ns4 ip -6 route add fd00::2 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec pop_egr dev veth6
121ip netns exec ns4 ip -6 addr add fc42::1 dev lo 121ip netns exec ns4 ip -6 addr add fc42::1 dev lo
122ip netns exec ns4 ip -6 route add fd00::3 dev veth7 via fb00::87 122ip netns exec ns4 ip -6 route add fd00::3 dev veth7 via fb00::87
123 123
124ip netns exec ns5 ip -6 route add fd00::4 table 117 dev veth9 via fb00::109 124ip netns exec ns5 ip -6 route add fd00::4 table 117 dev veth9 via fb00::109
125ip netns exec ns5 ip -6 route add fd00::3 encap seg6local action End.BPF obj test_lwt_seg6local.o sec inspect_t dev veth8 125ip netns exec ns5 ip -6 route add fd00::3 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec inspect_t dev veth8
126 126
127ip netns exec ns6 ip -6 addr add fb00::6/16 dev lo 127ip netns exec ns6 ip -6 addr add fb00::6/16 dev lo
128ip netns exec ns6 ip -6 addr add fd00::4/16 dev lo 128ip netns exec ns6 ip -6 addr add fd00::4/16 dev lo
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 77f762780199..e8c5dff448eb 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -402,7 +402,7 @@ int main(int argc, char *argv[])
402 exit(1); 402 exit(1);
403 } 403 }
404 404
405 fd = socket(AF_INET6, SOCK_STREAM, 0); 405 fd = socket(cfg_family, SOCK_STREAM, 0);
406 if (fd == -1) { 406 if (fd == -1) {
407 perror("socket"); 407 perror("socket");
408 exit(1); 408 exit(1);