Merge tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Nov 2020 20:21:33 +0000 (12:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Nov 2020 20:21:33 +0000 (12:21 -0800)
Pull s390 fixes from Heiko Carstens:

 - fix reference counting for ap devices

 - fix paes selftest

 - fix pmd_deref()/pud_deref() so they can also handle large pages

 - remove unused vdso file and defines

 - update defconfigs

 - call rcu_cpu_starting() early in smp init code to avoid lockdep
   warnings

 - fix hotplug of PCI function missing bus

* tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/pci: fix hot-plug of PCI function missing bus
  s390/smp: move rcu_cpu_starting() earlier
  s390/pkey: fix paes selftest failure with paes and pkey static build
  s390: update defconfigs
  s390/vdso: remove unused constants
  s390/vdso: remove empty unused file
  s390/mm: make pmd/pud_deref() large page aware
  s390/ap: fix ap devices reference counting

225 files changed:
Documentation/Makefile
Documentation/admin-guide/LSM/SafeSetID.rst
Documentation/admin-guide/pm/cpuidle.rst
Documentation/admin-guide/sysctl/net.rst
Documentation/arm/sunxi.rst
Documentation/conf.py
Documentation/dev-tools/kasan.rst
Documentation/dev-tools/kunit/start.rst
Documentation/dev-tools/kunit/usage.rst
Documentation/devicetree/bindings/clock/hi6220-clock.txt
Documentation/devicetree/bindings/net/can/can-controller.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt [deleted file]
Documentation/filesystems/api-summary.rst
Documentation/gpu/amdgpu.rst
Documentation/hwmon/adm1266.rst
Documentation/hwmon/index.rst
Documentation/hwmon/mp2975.rst
Documentation/locking/lockdep-design.rst
Documentation/networking/devlink/ice.rst
Documentation/networking/j1939.rst
Documentation/networking/statistics.rst
Documentation/sphinx/automarkup.py
Documentation/userspace-api/index.rst
MAINTAINERS
arch/arm/mm/init.c
arch/x86/boot/compressed/ident_map_64.c
arch/x86/boot/compressed/mem_encrypt.S
arch/x86/boot/compressed/misc.h
arch/x86/hyperv/hv_apic.c
arch/x86/kernel/head_64.S
arch/x86/kernel/sev-es-shared.c
arch/x86/kernel/sev-es.c
arch/x86/kernel/sev_verify_cbit.S [new file with mode: 0644]
arch/x86/mm/mem_encrypt.c
arch/xtensa/mm/init.c
drivers/base/core.c
drivers/base/dd.c
drivers/base/power/runtime.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-trng.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
drivers/hv/hv_balloon.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
drivers/infiniband/sw/rdmavt/vt.c
drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/siw/siw_main.c
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/infiniband/ulp/srpt/ib_srpt.h
drivers/net/can/dev.c
drivers/net/can/flexcan.c
drivers/net/can/peak_canfd/peak_canfd.c
drivers/net/can/rx-offload.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c
drivers/net/can/ti_hecc.c
drivers/net/can/usb/peak_usb/pcan_usb_core.c
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
drivers/net/can/xilinx_can.c
drivers/net/dsa/qca8k.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
drivers/net/ethernet/realtek/r8169_main.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/ti/cpsw_ethtool.c
drivers/net/ethernet/ti/cpsw_priv.c
drivers/net/phy/sfp.c
drivers/net/usb/qmi_wwan.c
drivers/of/device.c
drivers/opp/core.c
drivers/opp/of.c
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/pci-mvebu.c
drivers/pci/pci.c
drivers/powercap/intel_rapl_common.c
drivers/regulator/core.c
drivers/spi/spi-bcm2835.c
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-imx.c
drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
drivers/tty/vt/vt_ioctl.c
fs/afs/xattr.c
fs/afs/yfsclient.c
fs/gfs2/glock.c
fs/gfs2/glops.c
fs/gfs2/glops.h
fs/gfs2/inode.c
fs/gfs2/lops.c
fs/gfs2/lops.h
fs/gfs2/ops_fstype.c
fs/gfs2/recovery.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/proc/base.c
include/kunit/test.h
include/linux/blk-mq.h
include/linux/can/skb.h
include/linux/mm.h
include/linux/netfilter/nfnetlink.h
include/linux/netfilter_ipv4.h
include/linux/netfilter_ipv6.h
include/linux/pagemap.h
include/linux/pgtable.h
include/linux/phy.h
include/linux/pm_runtime.h
include/linux/refcount.h
include/net/cfg80211.h
include/net/mac80211.h
include/uapi/linux/icmpv6.h
kernel/hung_task.c
kernel/kprobes.c
kernel/kthread.c
kernel/sched/cpufreq_schedutil.c
kernel/signal.c
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events_synth.c
kernel/trace/trace_selftest.c
lib/crc32test.c
lib/test_kasan.c
mm/hugetlb.c
mm/memcontrol.c
mm/mempolicy.c
mm/memremap.c
mm/truncate.c
net/atm/lec.c
net/can/Kconfig
net/can/isotp.c
net/can/j1939/socket.c
net/can/proc.c
net/ipv4/ip_tunnel.c
net/ipv4/netfilter.c
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/netfilter/nf_reject_ipv4.c
net/ipv4/xfrm4_tunnel.c
net/ipv6/icmp.c
net/ipv6/ip6_tunnel.c
net/ipv6/netfilter.c
net/ipv6/netfilter/ip6table_mangle.c
net/ipv6/reassembly.c
net/ipv6/xfrm6_tunnel.c
net/mac80211/mlme.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h
net/mac80211/tx.c
net/mptcp/token.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/nf_nat_proto.c
net/netfilter/nf_synproxy_core.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink.c
net/netfilter/nft_chain_route.c
net/netfilter/utils.c
net/openvswitch/datapath.c
net/openvswitch/flow_table.c
net/sctp/sm_sideeffect.c
net/wireless/core.c
net/wireless/core.h
net/wireless/nl80211.c
net/wireless/reg.c
net/xfrm/xfrm_interface.c
net/xfrm/xfrm_state.c
scripts/kernel-doc
tools/arch/arm64/include/uapi/asm/kvm.h
tools/arch/s390/include/uapi/asm/sie.h
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/disabled-features.h
tools/arch/x86/include/asm/msr-index.h
tools/arch/x86/include/asm/required-features.h
tools/arch/x86/include/uapi/asm/kvm.h
tools/arch/x86/include/uapi/asm/svm.h
tools/build/feature/test-all.c
tools/include/linux/compiler-gcc.h
tools/include/linux/compiler.h
tools/include/uapi/asm-generic/unistd.h
tools/include/uapi/drm/i915_drm.h
tools/include/uapi/linux/fscrypt.h
tools/include/uapi/linux/kvm.h
tools/include/uapi/linux/mman.h
tools/include/uapi/linux/mount.h
tools/include/uapi/linux/perf_event.h
tools/include/uapi/linux/prctl.h
tools/include/uapi/linux/vhost.h
tools/perf/Makefile.config
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
tools/perf/builtin-trace.c
tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
tools/perf/tests/dwarf-unwind.c
tools/perf/ui/browsers/hists.c
tools/perf/util/build-id.c
tools/perf/util/hashmap.c
tools/perf/util/hashmap.h
tools/perf/util/machine.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/session.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/testing/kunit/kunit_parser.py
tools/testing/kunit/kunit_tool_test.py
tools/testing/kunit/test_data/test_config_printk_time.log
tools/testing/kunit/test_data/test_interrupted_tap_output.log
tools/testing/kunit/test_data/test_kernel_panic_interrupt.log
tools/testing/kunit/test_data/test_multiple_prefixes.log
tools/testing/kunit/test_data/test_pound_no_prefix.log
tools/testing/kunit/test_data/test_pound_sign.log
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
tools/testing/selftests/kselftest_harness.h
tools/testing/selftests/wireguard/netns.sh
tools/testing/selftests/wireguard/qemu/kernel.config

index 6a59a13d3c53361645b93e10ef42886de7e8ba54..61a7310b49e0ce355e8f73e4afa33d6026545387 100644 (file)
@@ -26,6 +26,10 @@ BUILDDIR      = $(obj)/output
 PDFLATEX      = xelatex
 LATEXOPTS     = -interaction=batchmode
 
+ifeq ($(KBUILD_VERBOSE),0)
+SPHINXOPTS    += "-q"
+endif
+
 # User-friendly check for sphinx-build
 HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)
 
index 17996c9070e23a8bbb0621c14ded21f729248100..0ec34863c6742b6b0a0a553ada9bf8269ff66000 100644 (file)
@@ -107,7 +107,7 @@ for a UID/GID will prevent that UID/GID from obtaining auxiliary setid
 privileges, such as allowing a user to set up user namespace UID/GID mappings.
 
 Note on GID policies and setgroups()
-==================
+====================================
 In v5.9 we are adding support for limiting CAP_SETGID privileges as was done
 previously for CAP_SETUID. However, for compatibility with common sandboxing
 related code conventions in userspace, we currently allow arbitrary
index 37940a0584ec188a686dbef917a9652f81f12af3..10fde58d086972701f732ec0d85fb5540c25a35b 100644 (file)
@@ -478,7 +478,7 @@ order to ask the hardware to enter that state.  Also, for each
 statistics of the given idle state.  That information is exposed by the kernel
 via ``sysfs``.
 
-For each CPU in the system, there is a :file:`/sys/devices/system/cpu<N>/cpuidle/`
+For each CPU in the system, there is a :file:`/sys/devices/system/cpu/cpu<N>/cpuidle/`
 directory in ``sysfs``, where the number ``<N>`` is assigned to the given
 CPU at the initialization time.  That directory contains a set of subdirectories
 called :file:`state0`, :file:`state1` and so on, up to the number of idle state
@@ -494,7 +494,7 @@ object corresponding to it, as follows:
        residency.
 
 ``below``
-       Total number of times this idle state had been asked for, but cerainly
+       Total number of times this idle state had been asked for, but certainly
        a deeper idle state would have been a better match for the observed idle
        duration.
 
index 57fd6ce68fe05d3b1df5cf705c81da98d50144e3..f2ab8a5b6a4b867e760026920929f68a19850194 100644 (file)
@@ -300,6 +300,7 @@ Note:
       0:    0     1     2     3     4     5     6     7
   RSS hash key:
   84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89
+
 netdev_tstamp_prequeue
 ----------------------
 
index 62b533d0ba9443ff3e8818947a1e846ebd044528..0c536ae1d7c2b20301fdfac04d237232e28d9f9c 100644 (file)
@@ -148,3 +148,13 @@ SunXi family
         * User Manual
 
           http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf
+
+      - Allwinner H6
+
+       * Datasheet
+
+         https://linux-sunxi.org/images/5/5c/Allwinner_H6_V200_Datasheet_V1.1.pdf
+
+       * User Manual
+
+         https://linux-sunxi.org/images/4/46/Allwinner_H6_V200_User_Manual_V1.1.pdf
index 1e44983853a208b5645c5322eb6b18c3b3d6a1f2..ed2b43ec7754e5b886c6edbda64332179ed5ea56 100644 (file)
@@ -51,7 +51,7 @@ if major >= 3:
         support for Sphinx v3.0 and above is brand new. Be prepared for
         possible issues in the generated output.
         ''')
-    if minor > 0 or patch >= 2:
+    if (major > 3) or (minor > 0 or patch >= 2):
         # Sphinx c function parser is more pedantic with regards to type
         # checking. Due to that, having macros at c:function cause problems.
         # Those needed to be scaped by using c_id_attributes[] array
index c09c9ca2ff1cbae16417bf92e05a6193e53641d4..2b68addaadcd756f4cb08eda4133fcae5710e5f0 100644 (file)
@@ -295,11 +295,13 @@ print the number of the test and the status of the test:
 pass::
 
         ok 28 - kmalloc_double_kzfree
+
 or, if kmalloc failed::
 
         # kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163
         Expected ptr is not null, but is
         not ok 4 - kmalloc_large_oob_right
+
 or, if a KASAN report was expected, but not found::
 
         # kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629
index d23385e3e1592bea6240287f0422bb94da629022..454f307813ea6689d5ee80954e5d32792a0c8627 100644 (file)
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``:
 
        config MISC_EXAMPLE_TEST
                bool "Test for my example"
-               depends on MISC_EXAMPLE && KUNIT
+               depends on MISC_EXAMPLE && KUNIT=y
 
 and the following to ``drivers/misc/Makefile``:
 
index 961d3ea3ca19ad2211252395a04f9519ede0161a..62142a47488cf21eb227a65bcdc1f948ccf8f01e 100644 (file)
@@ -561,6 +561,11 @@ Once the kernel is built and installed, a simple
 
 ...will run the tests.
 
+.. note::
+   Note that you should make sure your test depends on ``KUNIT=y`` in Kconfig
+   if the test does not support module build.  Otherwise, it will trigger
+   compile errors if ``CONFIG_KUNIT`` is ``m``.
+
 Writing new tests for other architectures
 -----------------------------------------
 
index ef3deb7b86eaf18468a2b779c9b7786c92d158d0..17ac4a3dd26aa841f53a60ce48806e8203499da8 100644 (file)
@@ -4,7 +4,7 @@ Clock control registers reside in different Hi6220 system controllers,
 please refer the following document to know more about the binding rules
 for these system controllers:
 
-Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
+Documentation/devicetree/bindings/arm/hisilicon/hisilicon.yaml
 
 Required Properties:
 
diff --git a/Documentation/devicetree/bindings/net/can/can-controller.yaml b/Documentation/devicetree/bindings/net/can/can-controller.yaml
new file mode 100644 (file)
index 0000000..9cf2ae0
--- /dev/null
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/can-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CAN Controller Generic Binding
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+properties:
+  $nodename:
+    pattern: "^can(@.*)?$"
+
+additionalProperties: true
+
+...
diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
new file mode 100644 (file)
index 0000000..43df15b
--- /dev/null
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/fsl,flexcan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title:
+  Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+allOf:
+  - $ref: can-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - fsl,imx8qm-flexcan
+          - fsl,imx8mp-flexcan
+          - fsl,imx6q-flexcan
+          - fsl,imx53-flexcan
+          - fsl,imx35-flexcan
+          - fsl,imx28-flexcan
+          - fsl,imx25-flexcan
+          - fsl,p1010-flexcan
+          - fsl,vf610-flexcan
+          - fsl,ls1021ar2-flexcan
+          - fsl,lx2160ar1-flexcan
+      - items:
+          - enum:
+              - fsl,imx7d-flexcan
+              - fsl,imx6ul-flexcan
+              - fsl,imx6sx-flexcan
+          - const: fsl,imx6q-flexcan
+      - items:
+          - enum:
+              - fsl,ls1028ar1-flexcan
+          - const: fsl,lx2160ar1-flexcan
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: ipg
+      - const: per
+
+  clock-frequency:
+    description: |
+      The oscillator frequency driving the flexcan device, filled in by the
+      boot loader. This property should only be used the used operating system
+      doesn't support the clocks and clock-names property.
+
+  xceiver-supply:
+    description: Regulator that powers the CAN transceiver.
+
+  big-endian:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: |
+      This means the registers of FlexCAN controller are big endian. This is
+      optional property.i.e. if this property is not present in device tree
+      node then controller is assumed to be little endian. If this property is
+      present then controller is assumed to be big endian.
+
+  fsl,stop-mode:
+    description: |
+      Register bits of stop mode control.
+
+      The format should be as follows:
+      <gpr req_gpr req_bit>
+      gpr is the phandle to general purpose register node.
+      req_gpr is the gpr register offset of CAN stop request.
+      req_bit is the bit offset of CAN stop request.
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - description: The 'gpr' is the phandle to general purpose register node.
+      - description: The 'req_gpr' is the gpr register offset of CAN stop request.
+        maximum: 0xff
+      - description: The 'req_bit' is the bit offset of CAN stop request.
+        maximum: 0x1f
+
+  fsl,clk-source:
+    description: |
+      Select the clock source to the CAN Protocol Engine (PE). It's SoC
+      implementation dependent. Refer to RM for detailed definition. If this
+      property is not set in device tree node then driver selects clock source 1
+      by default.
+      0: clock source 0 (oscillator clock)
+      1: clock source 1 (peripheral clock)
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 1
+    minimum: 0
+    maximum: 1
+
+  wakeup-source:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Enable CAN remote wakeup.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    can@1c000 {
+        compatible = "fsl,p1010-flexcan";
+        reg = <0x1c000 0x1000>;
+        interrupts = <48 0x2>;
+        interrupt-parent = <&mpic>;
+        clock-frequency = <200000000>;
+        fsl,clk-source = <0>;
+    };
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    can@2090000 {
+        compatible = "fsl,imx6q-flexcan";
+        reg = <0x02090000 0x4000>;
+        interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clks 1>, <&clks 2>;
+        clock-names = "ipg", "per";
+        fsl,stop-mode = <&gpr 0x34 28>;
+    };
diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
deleted file mode 100644 (file)
index e10b6eb..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
-
-Required properties:
-
-- compatible : Should be "fsl,<processor>-flexcan"
-
-  where <processor> is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010,
-  vf610, ls1021ar2, lx2160ar1, ls1028ar1.
-
-  The ls1028ar1 must be followed by lx2160ar1, e.g.
-   - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan"
-
-  An implementation should also claim any of the following compatibles
-  that it is fully backwards compatible with:
-
-  - fsl,p1010-flexcan
-
-- reg : Offset and length of the register set for this device
-- interrupts : Interrupt tuple for this device
-
-Optional properties:
-
-- clock-frequency : The oscillator frequency driving the flexcan device
-
-- xceiver-supply: Regulator that powers the CAN transceiver
-
-- big-endian: This means the registers of FlexCAN controller are big endian.
-              This is optional property.i.e. if this property is not present in
-              device tree node then controller is assumed to be little endian.
-              if this property is present then controller is assumed to be big
-              endian.
-
-- fsl,stop-mode: register bits of stop mode control, the format is
-                <&gpr req_gpr req_bit>.
-                gpr is the phandle to general purpose register node.
-                req_gpr is the gpr register offset of CAN stop request.
-                req_bit is the bit offset of CAN stop request.
-
-- fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE).
-                 It's SoC Implementation dependent. Refer to RM for detailed
-                 definition. If this property is not set in device tree node
-                 then driver selects clock source 1 by default.
-                 0: clock source 0 (oscillator clock)
-                 1: clock source 1 (peripheral clock)
-
-- wakeup-source: enable CAN remote wakeup
-
-Example:
-
-       can@1c000 {
-               compatible = "fsl,p1010-flexcan";
-               reg = <0x1c000 0x1000>;
-               interrupts = <48 0x2>;
-               interrupt-parent = <&mpic>;
-               clock-frequency = <200000000>; // filled in by bootloader
-               fsl,clk-source = <0>; // select clock source 0 for PE
-       };
index bbb0c1c0e5cf980ac059728a4d8b07771289e733..a94f17d9b8365fddc44eb32df1fc50507e908577 100644 (file)
@@ -86,9 +86,6 @@ Other Functions
 .. kernel-doc:: fs/dax.c
    :export:
 
-.. kernel-doc:: fs/direct-io.c
-   :export:
-
 .. kernel-doc:: fs/libfs.c
    :export:
 
index 1f9ea8221f80c5307d6dfc7cb88cc0b6d30494b0..2062a6023678d04b86abb096ebb7c9bfd9b418ad 100644 (file)
@@ -83,10 +83,6 @@ AMDGPU XGMI Support
 ===================
 
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
-   :doc: AMDGPU XGMI Support
-
-.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
-   :internal:
 
 AMDGPU RAS Support
 ==================
@@ -124,9 +120,6 @@ RAS VRAM Bad Pages sysfs Interface
 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
    :doc: AMDGPU RAS sysfs gpu_vram_bad_pages Interface
 
-.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
-   :internal:
-
 Sample Code
 -----------
 Sample code for testing error injection can be found here:
index 9257f8a48650d99caaef9b8ca4e8fcf185a1ad5d..2b877011cfdf0b511805bd8a4fe09c7b056cd15c 100644 (file)
@@ -20,7 +20,7 @@ ADM1266 is a sequencer that features voltage readback from 17 channels via an
 integrated 12 bit SAR ADC, accessed using a PMBus interface.
 
 The driver is a client driver to the core PMBus driver. Please see
-Documentation/hwmon/pmbus for details on PMBus client drivers.
+Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
 
 
 Sysfs entries
index e6b91ab1297850c86d5905ef77d6219c7de49d16..b797db73822524867b9cd2d55e3a8d1303cb33f1 100644 (file)
@@ -132,6 +132,7 @@ Hardware Monitoring Kernel Drivers
    mcp3021
    menf21bmc
    mlxreg-fan
+   mp2975
    nct6683
    nct6775
    nct7802
index 5b0609c62f4843e005b82ac5a75a6e41ab81957b..81d816b71490d7cb9608450553166985a22a5411 100644 (file)
@@ -20,6 +20,7 @@ This driver implements support for Monolithic Power Systems, Inc. (MPS)
 vendor dual-loop, digital, multi-phase controller MP2975.
 
 This device:
+
 - Supports up to two power rail.
 - Provides 8 pulse-width modulations (PWMs), and can be configured up
   to 8-phase operation for rail 1 and up to 4-phase operation for rail
@@ -32,10 +33,12 @@ This device:
   10-mV DAC, IMVP9 mode with 5-mV DAC.
 
 Device supports:
+
 - SVID interface.
 - AVSBus interface.
 
 Device complaint with:
+
 - PMBus rev 1.3 interface.
 
 Device supports direct format for reading output current, output voltage,
@@ -45,11 +48,14 @@ Device supports VID and direct formats for reading output voltage.
 The below VID modes are supported: VR12, VR13, IMVP9.
 
 The driver provides the next attributes for the current:
+
 - for current in: input, maximum alarm;
 - for current out input, maximum alarm and highest values;
 - for phase current: input and label.
-attributes.
+  attributes.
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - 'k' is number of configured phases (from 1 to 8);
 - indexes 1, 1*n for "iin";
@@ -65,11 +71,14 @@ The driver exports the following attributes via the 'sysfs' files, where
 **curr[1-{2n+k}]_label**
 
 The driver provides the next attributes for the voltage:
+
 - for voltage in: input, high critical threshold, high critical alarm, all only
   from page 0;
 - for voltage out: input, low and high critical thresholds, low and high
   critical alarms, from pages 0 and 1;
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - indexes 1 for "iin";
 - indexes n+1, n+2 for "vout";
@@ -87,9 +96,12 @@ The driver exports the following attributes via the 'sysfs' files, where
 **in[2-{n+1}1_lcrit_alarm**
 
 The driver provides the next attributes for the power:
+
 - for power in alarm and input.
 - for power out: highest and input.
+
 The driver exports the following attributes via the 'sysfs' files, where
+
 - 'n' is number of telemetry pages (from 1 to 2);
 - indexes 1 for "pin";
 - indexes n+1, n+2 for "pout";
index cec03bd1294aabf6d07cd7e8fcc0d919d0847ece..9f3cfca9f8a4547349205d7d53859fdb4e314d77 100644 (file)
@@ -42,6 +42,7 @@ The validator tracks lock-class usage history and divides the usage into
 (4 usages * n STATEs + 1) categories:
 
 where the 4 usages can be:
+
 - 'ever held in STATE context'
 - 'ever held as readlock in STATE context'
 - 'ever held with STATE enabled'
@@ -49,10 +50,12 @@ where the 4 usages can be:
 
 where the n STATEs are coded in kernel/locking/lockdep_states.h and as of
 now they include:
+
 - hardirq
 - softirq
 
 where the last 1 category is:
+
 - 'ever used'                                       [ == !unused        ]
 
 When locking rules are violated, these usage bits are presented in the
@@ -96,9 +99,9 @@ exact case is for the lock as of the reporting time.
   +--------------+-------------+--------------+
   |              | irq enabled | irq disabled |
   +--------------+-------------+--------------+
-  | ever in irq  |      ?      |       -      |
+  | ever in irq  |     '?'     |      '-'     |
   +--------------+-------------+--------------+
-  | never in irq |      +      |       .      |
+  | never in irq |     '+'     |      '.'     |
   +--------------+-------------+--------------+
 
 The character '-' suggests irq is disabled because if otherwise the
@@ -216,7 +219,7 @@ looks like this::
        BD_MUTEX_PARTITION
   };
 
-mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
+  mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
 
 In this case the locking is done on a bdev object that is known to be a
 partition.
@@ -334,7 +337,7 @@ Troubleshooting:
 ----------------
 
 The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes.
-Exceeding this number will trigger the following lockdep warning:
+Exceeding this number will trigger the following lockdep warning::
 
        (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))
 
@@ -420,7 +423,8 @@ the critical section of another reader of the same lock instance.
 
 The difference between recursive readers and non-recursive readers is because:
 recursive readers get blocked only by a write lock *holder*, while non-recursive
-readers could get blocked by a write lock *waiter*. Considering the follow example:
+readers could get blocked by a write lock *waiter*. Considering the follow
+example::
 
        TASK A:                 TASK B:
 
@@ -448,20 +452,22 @@ There are simply four block conditions:
 
 Block condition matrix, Y means the row blocks the column, and N means otherwise.
 
-           | E | r | R |
        +---+---+---+---+
-         E | Y | Y | Y |
+       |   | E | r | R |
+       +---+---+---+---+
+       | E | Y | Y | Y |
+       +---+---+---+---+
+       | r | Y | Y | N |
        +---+---+---+---+
-         r | Y | Y | N |
+       | R | Y | Y | N |
        +---+---+---+---+
-         R | Y | Y | N |
 
        (W: writers, r: non-recursive readers, R: recursive readers)
 
 
 acquired recursively. Unlike non-recursive read locks, recursive read locks
 only get blocked by current write lock *holders* other than write lock
-*waiters*, for example:
+*waiters*, for example::
 
        TASK A:                 TASK B:
 
@@ -491,7 +497,7 @@ Recursive locks don't block each other, while non-recursive locks do (this is
 even true for two non-recursive read locks). A non-recursive lock can block the
 corresponding recursive lock, and vice versa.
 
-A deadlock case with recursive locks involved is as follow:
+A deadlock case with recursive locks involved is as follow::
 
        TASK A:                 TASK B:
 
@@ -510,7 +516,7 @@ because there are 3 types for lockers, there are, in theory, 9 types of lock
 dependencies, but we can show that 4 types of lock dependencies are enough for
 deadlock detection.
 
-For each lock dependency:
+For each lock dependency::
 
        L1 -> L2
 
@@ -525,20 +531,25 @@ same types).
 With the above combination for simplification, there are 4 types of dependency edges
 in the lockdep graph:
 
-1) -(ER)->: exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
+1) -(ER)->:
+           exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
            X -> Y and X is a writer and Y is a recursive reader.
 
-2) -(EN)->: exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
+2) -(EN)->:
+           exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
            X -> Y and X is a writer and Y is either a writer or non-recursive reader.
 
-3) -(SR)->: shared reader to recursive reader dependency, "X -(SR)-> Y" means
+3) -(SR)->:
+           shared reader to recursive reader dependency, "X -(SR)-> Y" means
            X -> Y and X is a reader (recursive or not) and Y is a recursive reader.
 
-4) -(SN)->: shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
+4) -(SN)->:
+           shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
            X -> Y and X is a reader (recursive or not) and Y is either a writer or
            non-recursive reader.
 
-Note that given two locks, they may have multiple dependencies between them, for example:
+Note that given two locks, they may have multiple dependencies between them,
+for example::
 
        TASK A:
 
@@ -592,11 +603,11 @@ circles that won't cause deadlocks.
 
 Proof for sufficiency (Lemma 1):
 
-Let's say we have a strong circle:
+Let's say we have a strong circle::
 
        L1 -> L2 ... -> Ln -> L1
 
-, which means we have dependencies:
+, which means we have dependencies::
 
        L1 -> L2
        L2 -> L3
@@ -633,7 +644,7 @@ a lock held by P2, and P2 is waiting for a lock held by P3, ... and Pn is waitin
 for a lock held by P1. Let's name the lock Px is waiting as Lx, so since P1 is waiting
 for L1 and holding Ln, so we will have Ln -> L1 in the dependency graph. Similarly,
 we have L1 -> L2, L2 -> L3, ..., Ln-1 -> Ln in the dependency graph, which means we
-have a circle:
+have a circle::
 
        Ln -> L1 -> L2 -> ... -> Ln
 
index b165181d5d4daa68cb7cfc3dcecf75d4511c1653..a432dc419fa4031d2b7c82961d6708dd552f688c 100644 (file)
@@ -70,6 +70,7 @@ The ``ice`` driver reports the following versions
         that both the name (as reported by ``fw.app.name``) and version are
         required to uniquely identify the package.
     * - ``fw.app.bundle_id``
+      - running
       - 0xc0000001
       - Unique identifier for the DDP package loaded in the device. Also
         referred to as the DDP Track ID. Can be used to uniquely identify
index f5be243d250a40e75d8bdef11b2489b56d7af691..0a4b73b03b997105bec7f1fa0bb1857c165a928d 100644 (file)
@@ -10,9 +10,9 @@ Overview / What Is J1939
 SAE J1939 defines a higher layer protocol on CAN. It implements a more
 sophisticated addressing scheme and extends the maximum packet size above 8
 bytes. Several derived specifications exist, which differ from the original
-J1939 on the application level, like MilCAN A, NMEA2000 and especially
+J1939 on the application level, like MilCAN A, NMEA2000, and especially
 ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended
-Transport Protocol) which is has been included in this implementation. This
+Transport Protocol), which has been included in this implementation. This
 results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB.
 
 Specifications used
@@ -32,15 +32,15 @@ sockets, we found some reasons to justify a kernel implementation for the
 addressing and transport methods used by J1939.
 
 * **Addressing:** when a process on an ECU communicates via J1939, it should
-  not necessarily know its source address. Although at least one process per
+  not necessarily know its source address. Although, at least one process per
   ECU should know the source address. Other processes should be able to reuse
   that address. This way, address parameters for different processes
   cooperating for the same ECU, are not duplicated. This way of working is
-  closely related to the UNIX concept where programs do just one thing, and do
+  closely related to the UNIX concept, where programs do just one thing and do
   it well.
 
 * **Dynamic addressing:** Address Claiming in J1939 is time critical.
-  Furthermore data transport should be handled properly during the address
+  Furthermore, data transport should be handled properly during the address
   negotiation. Putting this functionality in the kernel eliminates it as a
   requirement for _every_ user space process that communicates via J1939. This
   results in a consistent J1939 bus with proper addressing.
@@ -58,7 +58,7 @@ Therefore, these parts are left to user space.
 
 The J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939
 user space library operating on CAN raw sockets will still operate properly.
-Since such library does not communicate with the in-kernel implementation, care
+Since such library does not communicate with the in-kernel implementation, care
 must be taken that these two do not interfere. In practice, this means they
 cannot share ECU addresses. A single ECU (or virtual ECU) address is used by
 the library exclusively, or by the in-kernel system exclusively.
@@ -77,13 +77,13 @@ is composed as follows:
 8 bits : PS (PDU Specific)
 
 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2
-format (where PF >= 240). Furthermore, when using PDU2 format, the PS-field
+format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field
 contains a so-called Group Extension, which is part of the PGN. When using PDU2
 format, the Group Extension is set in the PS-field.
 
 On the other hand, when using PDU1 format, the PS-field contains a so-called
 Destination Address, which is _not_ part of the PGN. When communicating a PGN
-from user space to kernel (or visa versa) and PDU2 format is used, the PS-field
+from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
 of the PGN shall be set to zero. The Destination Address shall be set
 elsewhere.
 
@@ -96,15 +96,15 @@ Addressing
 
 Both static and dynamic addressing methods can be used.
 
-For static addresses, no extra checks are made by the kernel, and provided
+For static addresses, no extra checks are made by the kernel and provided
 addresses are considered right. This responsibility is for the OEM or system
 integrator.
 
 For dynamic addressing, so-called Address Claiming, extra support is foreseen
-in the kernel. In J1939 any ECU is known by it's 64-bit NAME. At the moment of
+in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of
 a successful address claim, the kernel keeps track of both NAME and source
 address being claimed. This serves as a base for filter schemes. By default,
-packets with a destination that is not locally, will be rejected.
+packets with a destination that is not locally will be rejected.
 
 Mixed mode packets (from a static to a dynamic address or vice versa) are
 allowed. The BSD sockets define separate API calls for getting/setting the
@@ -131,31 +131,31 @@ API Calls
 ---------
 
 On CAN, you first need to open a socket for communicating over a CAN network.
-To use J1939, #include <linux/can/j1939.h>. From there, <linux/can.h> will be
+To use J1939, ``#include <linux/can/j1939.h>``. From there, ``<linux/can.h>`` will be
 included too. To open a socket, use:
 
 .. code-block:: C
 
     s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939);
 
-J1939 does use SOCK_DGRAM sockets. In the J1939 specification, connections are
+J1939 does use ``SOCK_DGRAM`` sockets. In the J1939 specification, connections are
 mentioned in the context of transport protocol sessions. These still deliver
-packets to the other end (using several CAN packets). SOCK_STREAM is not
+packets to the other end (using several CAN packets). ``SOCK_STREAM`` is not
 supported.
 
-After the successful creation of the socket, you would normally use the bind(2)
-and/or connect(2) system call to bind the socket to a CAN interface.  After
-binding and/or connecting the socket, you can read(2) and write(2) from/to the
-socket or use send(2), sendto(2), sendmsg(2) and the recv*() counterpart
+After the successful creation of the socket, you would normally use the ``bind(2)``
+and/or ``connect(2)`` system call to bind the socket to a CAN interface. After
+binding and/or connecting the socket, you can ``read(2)`` and ``write(2)`` from/to the
+socket or use ``send(2)``, ``sendto(2)``, ``sendmsg(2)`` and the ``recv*()`` counterpart
 operations on the socket as usual. There are also J1939 specific socket options
 described below.
 
-In order to send data, a bind(2) must have been successful. bind(2) assigns a
+In order to send data, a ``bind(2)`` must have been successful. ``bind(2)`` assigns a
 local address to a socket.
 
-Different from CAN is that the payload data is just the data that get send,
-without it's header info. The header info is derived from the sockaddr supplied
-to bind(2), connect(2), sendto(2) and recvfrom(2). A write(2) with size 4 will
+Different from CAN is that the payload data is just the data that get sends,
+without its header info. The header info is derived from the sockaddr supplied
+to ``bind(2)``, ``connect(2)``, ``sendto(2)`` and ``recvfrom(2)``. A ``write(2)`` with size 4 will
 result in a packet with 4 bytes.
 
 The sockaddr structure has extensions for use with J1939 as specified below:
@@ -180,47 +180,47 @@ The sockaddr structure has extensions for use with J1939 as specified below:
          } can_addr;
       }
 
-can_family & can_ifindex serve the same purpose as for other SocketCAN sockets.
+``can_family`` & ``can_ifindex`` serve the same purpose as for other SocketCAN sockets.
 
-can_addr.j1939.pgn specifies the PGN (max 0x3ffff). Individual bits are
+``can_addr.j1939.pgn`` specifies the PGN (max 0x3ffff). Individual bits are
 specified above.
 
-can_addr.j1939.name contains the 64-bit J1939 NAME.
+``can_addr.j1939.name`` contains the 64-bit J1939 NAME.
 
-can_addr.j1939.addr contains the address.
+``can_addr.j1939.addr`` contains the address.
 
-The bind(2) system call assigns the local address, i.e. the source address when
-sending packages. If a PGN during bind(2) is set, it's used as a RX filter.
-I.e.  only packets with a matching PGN are received. If an ADDR or NAME is set
+The ``bind(2)`` system call assigns the local address, i.e. the source address when
+sending packages. If a PGN during ``bind(2)`` is set, it's used as a RX filter.
+I.e. only packets with a matching PGN are received. If an ADDR or NAME is set
 it is used as a receive filter, too. It will match the destination NAME or ADDR
 of the incoming packet. The NAME filter will work only if appropriate Address
 Claiming for this name was done on the CAN bus and registered/cached by the
 kernel.
 
-On the other hand connect(2) assigns the remote address, i.e. the destination
-address. The PGN from connect(2) is used as the default PGN when sending
+On the other hand ``connect(2)`` assigns the remote address, i.e. the destination
+address. The PGN from ``connect(2)`` is used as the default PGN when sending
 packets. If ADDR or NAME is set it will be used as the default destination ADDR
-or NAME. Further a set ADDR or NAME during connect(2) is used as a receive
+or NAME. Further a set ADDR or NAME during ``connect(2)`` is used as a receive
 filter. It will match the source NAME or ADDR of the incoming packet.
 
-Both write(2) and send(2) will send a packet with local address from bind(2) and
-the remote address from connect(2). Use sendto(2) to overwrite the destination
+Both ``write(2)`` and ``send(2)`` will send a packet with local address from ``bind(2)`` and the
+remote address from ``connect(2)``. Use ``sendto(2)`` to overwrite the destination
 address.
 
-If can_addr.j1939.name is set (!= 0) the NAME is looked up by the kernel and
-the corresponding ADDR is used. If can_addr.j1939.name is not set (== 0),
-can_addr.j1939.addr is used.
+If ``can_addr.j1939.name`` is set (!= 0) the NAME is looked up by the kernel and
+the corresponding ADDR is used. If ``can_addr.j1939.name`` is not set (== 0),
+``can_addr.j1939.addr`` is used.
 
 When creating a socket, reasonable defaults are set. Some options can be
-modified with setsockopt(2) & getsockopt(2).
+modified with ``setsockopt(2)`` & ``getsockopt(2)``.
 
 RX path related options:
 
-- SO_J1939_FILTER - configure array of filters
-- SO_J1939_PROMISC - disable filters set by bind(2) and connect(2)
+- ``SO_J1939_FILTER`` - configure array of filters
+- ``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)``
 
 By default no broadcast packets can be send or received. To enable sending or
-receiving broadcast packets use the socket option SO_BROADCAST:
+receiving broadcast packets use the socket option ``SO_BROADCAST``:
 
 .. code-block:: C
 
@@ -261,26 +261,26 @@ The following diagram illustrates the RX path:
      +---------------------------+
 
 TX path related options:
-SO_J1939_SEND_PRIO - change default send priority for the socket
+``SO_J1939_SEND_PRIO`` - change default send priority for the socket
 
 Message Flags during send() and Related System Calls
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-send(2), sendto(2) and sendmsg(2) take a 'flags' argument. Currently
+``send(2)``, ``sendto(2)`` and ``sendmsg(2)`` take a 'flags' argument. Currently
 supported flags are:
 
-* MSG_DONTWAIT, i.e. non-blocking operation.
+* ``MSG_DONTWAIT``, i.e. non-blocking operation.
 
 recvmsg(2)
 ^^^^^^^^^^
 
-In most cases recvmsg(2) is needed if you want to extract more information than
-recvfrom(2) can provide. For example package priority and timestamp. The
+In most cases ``recvmsg(2)`` is needed if you want to extract more information than
+``recvfrom(2)`` can provide. For example package priority and timestamp. The
 Destination Address, name and packet priority (if applicable) are attached to
-the msghdr in the recvmsg(2) call. They can be extracted using cmsg(3) macros,
-with cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR,
-SCM_J1939_DEST_NAME or SCM_J1939_PRIO. The returned data is a uint8_t for
-priority and dst_addr, and uint64_t for dst_name.
+the msghdr in the ``recvmsg(2)`` call. They can be extracted using ``cmsg(3)`` macros,
+with ``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``,
+``SCM_J1939_DEST_NAME`` or ``SCM_J1939_PRIO``. The returned data is a ``uint8_t`` for
+``priority`` and ``dst_addr``, and ``uint64_t`` for ``dst_name``.
 
 .. code-block:: C
 
@@ -305,12 +305,12 @@ Dynamic Addressing
 
 Distinction has to be made between using the claimed address and doing an
 address claim. To use an already claimed address, one has to fill in the
-j1939.name member and provide it to bind(2). If the name had claimed an address
+``j1939.name`` member and provide it to ``bind(2)``. If the name had claimed an address
 earlier, all further messages being sent will use that address. And the
-j1939.addr member will be ignored.
+``j1939.addr`` member will be ignored.
 
 An exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim
-Address" message and the kernel will use the j1939.addr member for that PGN if
+Address" message and the kernel will use the ``j1939.addr`` member for that PGN if
 necessary.
 
 To claim an address following code example can be used:
@@ -371,12 +371,12 @@ NAME can send packets.
 
 If another ECU claims the address, the kernel will mark the NAME-SA expired.
 No socket bound to the NAME can send packets (other than address claims). To
-claim another address, some socket bound to NAME, must bind(2) again, but with
-only j1939.addr changed to the new SA, and must then send a valid address claim
+claim another address, some socket bound to NAME, must ``bind(2)`` again, but with
+only ``j1939.addr`` changed to the new SA, and must then send a valid address claim
 packet. This restarts the state machine in the kernel (and any other
 participant on the bus) for this NAME.
 
-can-utils also include the jacd tool, so it can be used as code example or as
+``can-utils`` also include the ``j1939acd`` tool, so it can be used as code example or as
 default Address Claiming daemon.
 
 Send Examples
@@ -403,8 +403,8 @@ Bind:
 
        bind(sock, (struct sockaddr *)&baddr, sizeof(baddr));
 
-Now, the socket 'sock' is bound to the SA 0x20. Since no connect(2) was called,
-at this point we can use only sendto(2) or sendmsg(2).
+Now, the socket 'sock' is bound to the SA 0x20. Since no ``connect(2)`` was called,
+at this point we can use only ``sendto(2)`` or ``sendmsg(2)``.
 
 Send:
 
@@ -414,8 +414,8 @@ Send:
                .can_family = AF_CAN,
                .can_addr.j1939 = {
                        .name = J1939_NO_NAME;
-                       .pgn = 0x30,
-                       .addr = 0x12300,
+                       .addr = 0x30,
+                       .pgn = 0x12300,
                },
        };
 
index 8e15bc98830b70bd5e51fd73e1f145c8e6dc9c36..234abedc29b2b525855c0db8f87d83268813ff9d 100644 (file)
@@ -175,5 +175,4 @@ The following structures are internal to the kernel, their members are
 translated to netlink attributes when dumped. Drivers must not overwrite
 the statistics they don't report with 0.
 
-.. kernel-doc:: include/linux/ethtool.h
-    :identifiers: ethtool_pause_stats
+- ethtool_pause_stats()
index 409dbc4100def91ee496d32f3a66efef1fe8993d..3e81ebab26ed3c4b18dbaae4e13481f724780268 100644 (file)
@@ -15,6 +15,14 @@ else:
 import re
 from itertools import chain
 
+#
+# Python 2 lacks re.ASCII...
+#
+try:
+    ascii_p3 = re.ASCII
+except AttributeError:
+    ascii_p3 = 0
+
 #
 # Regex nastiness.  Of course.
 # Try to identify "function()" that's not already marked up some
@@ -22,22 +30,22 @@ from itertools import chain
 # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last
 # bit tries to restrict matches to things that won't create trouble.
 #
-RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII)
+RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=ascii_p3)
 
 #
 # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef
 #
 RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)',
-                             flags=re.ASCII)
+                             flags=ascii_p3)
 
 #
 # Sphinx 3 uses a different C role for each one of struct, union, enum and
 # typedef
 #
-RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
-RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
+RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
+RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
 
 #
 # Detects a reference to a documentation page of the form Documentation/... with
index 69fc5167e6486b6c6378b80a08df7ce1651fb051..acd2cc2a538df5f9a4bb8343c423fa1ef4b7e6d4 100644 (file)
@@ -22,6 +22,7 @@ place where this information is gathered.
    spec_ctrl
    accelerators/ocxl
    ioctl/index
+   iommu
    media/index
 
 .. only::  subproject and html
index b516bb34a8d5a95f2be58fa2832c789a56fca450..78e908ed14f3f8841d8f27dc9688af79c2fe5247 100644 (file)
@@ -978,7 +978,7 @@ M:  Michael Hennerich <Michael.Hennerich@analog.com>
 L:     linux-iio@vger.kernel.org
 S:     Supported
 W:     http://ez.analog.com/community/linux-device-drivers
-F:     Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.txt
+F:     Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
 F:     drivers/iio/adc/ad7768-1.c
 
 ANALOG DEVICES INC AD7780 DRIVER
@@ -3857,7 +3857,7 @@ M:        Roger Quadros <rogerq@ti.com>
 L:     linux-usb@vger.kernel.org
 S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
-F:     Documentation/devicetree/bindings/usb/cdns-usb3.txt
+F:     Documentation/devicetree/bindings/usb/cdns,usb3.yaml
 F:     drivers/usb/cdns3/
 
 CADET FM/AM RADIO RECEIVER DRIVER
@@ -7916,7 +7916,7 @@ HISILICON LPC BUS DRIVER
 M:     john.garry@huawei.com
 S:     Maintained
 W:     http://www.hisilicon.com
-F:     Documentation/devicetree/bindings/arm/hisilicon/hisilicon-low-pin-count.txt
+F:     Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml
 F:     drivers/bus/hisi_lpc.c
 
 HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3)
@@ -14527,6 +14527,14 @@ F:     Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml
 F:     drivers/mailbox/qcom-ipcc.c
 F:     include/dt-bindings/mailbox/qcom-ipcc.h
 
+QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER
+M:     Robert Marko <robert.marko@sartura.hr>
+M:     Luka Perkov <luka.perkov@sartura.hr>
+L:     linux-arm-msm@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
+F:     drivers/regulator/vqmmc-ipq4019-regulator.c
+
 QUALCOMM RMNET DRIVER
 M:     Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
 M:     Sean Tranchetti <stranche@codeaurora.org>
@@ -14882,7 +14890,6 @@ RENESAS ETHERNET DRIVERS
 R:     Sergei Shtylyov <sergei.shtylyov@gmail.com>
 L:     netdev@vger.kernel.org
 L:     linux-renesas-soc@vger.kernel.org
-F:     Documentation/devicetree/bindings/net/renesas,*.txt
 F:     Documentation/devicetree/bindings/net/renesas,*.yaml
 F:     drivers/net/ethernet/renesas/
 F:     include/linux/sh_eth.h
@@ -18083,7 +18090,7 @@ M:      Yu Chen <chenyu56@huawei.com>
 M:     Binghui Wang <wangbinghui@hisilicon.com>
 L:     linux-usb@vger.kernel.org
 S:     Maintained
-F:     Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
+F:     Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml
 F:     drivers/phy/hisilicon/phy-hi3660-usb3.c
 
 USB ISP116X DRIVER
index d57112a276f5ac79da2100970e8ca8c6a78af54a..c23dbf8bebeeb7f4387b90e7827c6a570d940566 100644 (file)
@@ -354,8 +354,8 @@ static void __init free_highpages(void)
        /* set highmem page free */
        for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
                                &range_start, &range_end, NULL) {
-               unsigned long start = PHYS_PFN(range_start);
-               unsigned long end = PHYS_PFN(range_end);
+               unsigned long start = PFN_UP(range_start);
+               unsigned long end = PFN_DOWN(range_end);
 
                /* Ignore complete lowmem entries */
                if (end <= max_low)
index a5e5db6ada3c76c8132be74e420d77771c488e64..39b2eded7bc2b633c8fafa2bce50ed788b054a83 100644 (file)
@@ -164,6 +164,7 @@ void initialize_identity_maps(void *rmode)
        add_identity_map(cmdline, cmdline + COMMAND_LINE_SIZE);
 
        /* Load the new page-table. */
+       sev_verify_cbit(top_level_pgt);
        write_cr3(top_level_pgt);
 }
 
index dd07e7b41b115e65e9c762024bd77ae61de35b8f..aa561795efd16182fa185964045ec40571d0b71b 100644 (file)
@@ -68,6 +68,9 @@ SYM_FUNC_START(get_sev_encryption_bit)
 SYM_FUNC_END(get_sev_encryption_bit)
 
        .code64
+
+#include "../../kernel/sev_verify_cbit.S"
+
 SYM_FUNC_START(set_sev_encryption_mask)
 #ifdef CONFIG_AMD_MEM_ENCRYPT
        push    %rbp
@@ -81,6 +84,19 @@ SYM_FUNC_START(set_sev_encryption_mask)
 
        bts     %rax, sme_me_mask(%rip) /* Create the encryption mask */
 
+       /*
+        * Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in
+        * get_sev_encryption_bit() because this function is 32-bit code and
+        * shared between 64-bit and 32-bit boot path.
+        */
+       movl    $MSR_AMD64_SEV, %ecx    /* Read the SEV MSR */
+       rdmsr
+
+       /* Store MSR value in sev_status */
+       shlq    $32, %rdx
+       orq     %rdx, %rax
+       movq    %rax, sev_status(%rip)
+
 .Lno_sev_mask:
        movq    %rbp, %rsp              /* Restore original stack pointer */
 
@@ -96,5 +112,7 @@ SYM_FUNC_END(set_sev_encryption_mask)
 
 #ifdef CONFIG_AMD_MEM_ENCRYPT
        .balign 8
-SYM_DATA(sme_me_mask, .quad 0)
+SYM_DATA(sme_me_mask,          .quad 0)
+SYM_DATA(sev_status,           .quad 0)
+SYM_DATA(sev_check_data,       .quad 0)
 #endif
index 6d31f1b4c4d1085f3bee1d7fc495d29b3409bce0..d9a631c5973c7f6423299baae66167579a8bdcff 100644 (file)
@@ -159,4 +159,6 @@ void boot_page_fault(void);
 void boot_stage1_vc(void);
 void boot_stage2_vc(void);
 
+unsigned long sev_verify_cbit(unsigned long cr3);
+
 #endif /* BOOT_COMPRESSED_MISC_H */
index 40e0e322161d7bbc4b88e854c4a4e6f503e627f9..284e73661a18bde5d17ba6b03efd78d9be1cd309 100644 (file)
@@ -273,11 +273,15 @@ void __init hv_apic_init(void)
                pr_info("Hyper-V: Using enlightened APIC (%s mode)",
                        x2apic_enabled() ? "x2apic" : "xapic");
                /*
-                * With x2apic, architectural x2apic MSRs are equivalent to the
-                * respective synthetic MSRs, so there's no need to override
-                * the apic accessors.  The only exception is
-                * hv_apic_eoi_write, because it benefits from lazy EOI when
-                * available, but it works for both xapic and x2apic modes.
+                * When in x2apic mode, don't use the Hyper-V specific APIC
+                * accessors since the field layout in the ICR register is
+                * different in x2apic mode. Furthermore, the architectural
+                * x2apic MSRs function just as well as the Hyper-V
+                * synthetic APIC MSRs, so there's no benefit in having
+                * separate Hyper-V accessors for x2apic mode. The only
+                * exception is hv_apic_eoi_write, because it benefits from
+                * lazy EOI when available, but the same accessor works for
+                * both xapic and x2apic because the field layout is the same.
                 */
                apic_set_eoi_write(hv_apic_eoi_write);
                if (!x2apic_enabled()) {
index 7eb2a1c879695dcf1712964eb546e77b26d5513a..3c417734790f0390089beaa9da01e612c750c54a 100644 (file)
@@ -161,6 +161,21 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 
        /* Setup early boot stage 4-/5-level pagetables. */
        addq    phys_base(%rip), %rax
+
+       /*
+        * For SEV guests: Verify that the C-bit is correct. A malicious
+        * hypervisor could lie about the C-bit position to perform a ROP
+        * attack on the guest by writing to the unencrypted stack and wait for
+        * the next RET instruction.
+        * %rsi carries pointer to realmode data and is callee-clobbered. Save
+        * and restore it.
+        */
+       pushq   %rsi
+       movq    %rax, %rdi
+       call    sev_verify_cbit
+       popq    %rsi
+
+       /* Switch to new page-table */
        movq    %rax, %cr3
 
        /* Ensure I am executing from virtual addresses */
@@ -279,6 +294,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 SYM_CODE_END(secondary_startup_64)
 
 #include "verify_cpu.S"
+#include "sev_verify_cbit.S"
 
 #ifdef CONFIG_HOTPLUG_CPU
 /*
index 5f83ccaab877b57c88412c38d7fa8b3532249cfa..7d04b356d44d3362b9d59c561f4c680514a56a2b 100644 (file)
@@ -178,6 +178,32 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
                goto fail;
        regs->dx = val >> 32;
 
+       /*
+        * This is a VC handler and the #VC is only raised when SEV-ES is
+        * active, which means SEV must be active too. Do sanity checks on the
+        * CPUID results to make sure the hypervisor does not trick the kernel
+        * into the no-sev path. This could map sensitive data unencrypted and
+        * make it accessible to the hypervisor.
+        *
+        * In particular, check for:
+        *      - Hypervisor CPUID bit
+        *      - Availability of CPUID leaf 0x8000001f
+        *      - SEV CPUID bit.
+        *
+        * The hypervisor might still report the wrong C-bit position, but this
+        * can't be checked here.
+        */
+
+       if ((fn == 1 && !(regs->cx & BIT(31))))
+               /* Hypervisor bit */
+               goto fail;
+       else if (fn == 0x80000000 && (regs->ax < 0x8000001f))
+               /* SEV leaf check */
+               goto fail;
+       else if ((fn == 0x8000001f && !(regs->ax & BIT(1))))
+               /* SEV bit */
+               goto fail;
+
        /* Skip over the CPUID two-byte opcode */
        regs->ip += 2;
 
index 4a96726fbaf88b4d079a7d1e3ca6857d51fc27ff..0bd1a0fc587e0f830e25e5b4199972ad1471ff96 100644 (file)
@@ -374,8 +374,8 @@ fault:
        return ES_EXCEPTION;
 }
 
-static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
-                                unsigned long vaddr, phys_addr_t *paddr)
+static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
+                                          unsigned long vaddr, phys_addr_t *paddr)
 {
        unsigned long va = (unsigned long)vaddr;
        unsigned int level;
@@ -394,15 +394,19 @@ static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
                if (user_mode(ctxt->regs))
                        ctxt->fi.error_code |= X86_PF_USER;
 
-               return false;
+               return ES_EXCEPTION;
        }
 
+       if (WARN_ON_ONCE(pte_val(*pte) & _PAGE_ENC))
+               /* Emulated MMIO to/from encrypted memory not supported */
+               return ES_UNSUPPORTED;
+
        pa = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
        pa |= va & ~page_level_mask(level);
 
        *paddr = pa;
 
-       return true;
+       return ES_OK;
 }
 
 /* Include code shared with pre-decompression boot stage */
@@ -731,6 +735,7 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
 {
        u64 exit_code, exit_info_1, exit_info_2;
        unsigned long ghcb_pa = __pa(ghcb);
+       enum es_result res;
        phys_addr_t paddr;
        void __user *ref;
 
@@ -740,11 +745,12 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
 
        exit_code = read ? SVM_VMGEXIT_MMIO_READ : SVM_VMGEXIT_MMIO_WRITE;
 
-       if (!vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr)) {
-               if (!read)
+       res = vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr);
+       if (res != ES_OK) {
+               if (res == ES_EXCEPTION && !read)
                        ctxt->fi.error_code |= X86_PF_WRITE;
 
-               return ES_EXCEPTION;
+               return res;
        }
 
        exit_info_1 = paddr;
diff --git a/arch/x86/kernel/sev_verify_cbit.S b/arch/x86/kernel/sev_verify_cbit.S
new file mode 100644 (file)
index 0000000..ee04941
--- /dev/null
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ *     sev_verify_cbit.S - Code for verification of the C-bit position reported
+ *                         by the Hypervisor when running with SEV enabled.
+ *
+ *     Copyright (c) 2020  Joerg Roedel (jroedel@suse.de)
+ *
+ * sev_verify_cbit() is called before switching to a new long-mode page-table
+ * at boot.
+ *
+ * Verify that the C-bit position is correct by writing a random value to
+ * an encrypted memory location while on the current page-table. Then it
+ * switches to the new page-table to verify the memory content is still the
+ * same. After that it switches back to the current page-table and when the
+ * check succeeded it returns. If the check failed the code invalidates the
+ * stack pointer and goes into a hlt loop. The stack-pointer is invalidated to
+ * make sure no interrupt or exception can get the CPU out of the hlt loop.
+ *
+ * New page-table pointer is expected in %rdi (first parameter)
+ *
+ */
+SYM_FUNC_START(sev_verify_cbit)
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+       /* First check if a C-bit was detected */
+       movq    sme_me_mask(%rip), %rsi
+       testq   %rsi, %rsi
+       jz      3f
+
+       /* sme_me_mask != 0 could mean SME or SEV - Check also for SEV */
+       movq    sev_status(%rip), %rsi
+       testq   %rsi, %rsi
+       jz      3f
+
+       /* Save CR4 in %rsi */
+       movq    %cr4, %rsi
+
+       /* Disable Global Pages */
+       movq    %rsi, %rdx
+       andq    $(~X86_CR4_PGE), %rdx
+       movq    %rdx, %cr4
+
+       /*
+        * Verified that running under SEV - now get a random value using
+        * RDRAND. This instruction is mandatory when running as an SEV guest.
+        *
+        * Don't bail out of the loop if RDRAND returns errors. It is better to
+        * prevent forward progress than to work with a non-random value here.
+        */
+1:     rdrand  %rdx
+       jnc     1b
+
+       /* Store value to memory and keep it in %rdx */
+       movq    %rdx, sev_check_data(%rip)
+
+       /* Backup current %cr3 value to restore it later */
+       movq    %cr3, %rcx
+
+       /* Switch to new %cr3 - This might unmap the stack */
+       movq    %rdi, %cr3
+
+       /*
+        * Compare value in %rdx with memory location. If C-bit is incorrect
+        * this would read the encrypted data and make the check fail.
+        */
+       cmpq    %rdx, sev_check_data(%rip)
+
+       /* Restore old %cr3 */
+       movq    %rcx, %cr3
+
+       /* Restore previous CR4 */
+       movq    %rsi, %cr4
+
+       /* Check CMPQ result */
+       je      3f
+
+       /*
+        * The check failed, prevent any forward progress to prevent ROP
+        * attacks, invalidate the stack and go into a hlt loop.
+        */
+       xorq    %rsp, %rsp
+       subq    $0x1000, %rsp
+2:     hlt
+       jmp 2b
+3:
+#endif
+       /* Return page-table pointer */
+       movq    %rdi, %rax
+       ret
+SYM_FUNC_END(sev_verify_cbit)
index efbb3de472df4613a32308b000cf9ee1300bd154..bc0833713be955444359d83ad013125f295f1dfd 100644 (file)
@@ -39,6 +39,7 @@
  */
 u64 sme_me_mask __section(".data") = 0;
 u64 sev_status __section(".data") = 0;
+u64 sev_check_data __section(".data") = 0;
 EXPORT_SYMBOL(sme_me_mask);
 DEFINE_STATIC_KEY_FALSE(sev_enable_key);
 EXPORT_SYMBOL_GPL(sev_enable_key);
index c6fc83efee0c94148a0da0608fec7d6e02ee140d..8731b7ad930884e26778e7c24751b0c1ce74877c 100644 (file)
@@ -89,8 +89,8 @@ static void __init free_highpages(void)
        /* set highmem page free */
        for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
                                &range_start, &range_end, NULL) {
-               unsigned long start = PHYS_PFN(range_start);
-               unsigned long end = PHYS_PFN(range_end);
+               unsigned long start = PFN_UP(range_start);
+               unsigned long end = PFN_DOWN(range_end);
 
                /* Ignore complete lowmem entries */
                if (end <= max_low)
index 78114ddac755e41e4c42f08849d56fb29a91f29a..d661ada1518fb49ceab77789043946abfa32d3d8 100644 (file)
@@ -773,8 +773,7 @@ static void __device_link_del(struct kref *kref)
        dev_dbg(link->consumer, "Dropping the link to %s\n",
                dev_name(link->supplier));
 
-       if (link->flags & DL_FLAG_PM_RUNTIME)
-               pm_runtime_drop_link(link->consumer);
+       pm_runtime_drop_link(link);
 
        list_del_rcu(&link->s_node);
        list_del_rcu(&link->c_node);
@@ -788,8 +787,7 @@ static void __device_link_del(struct kref *kref)
        dev_info(link->consumer, "Dropping the link to %s\n",
                 dev_name(link->supplier));
 
-       if (link->flags & DL_FLAG_PM_RUNTIME)
-               pm_runtime_drop_link(link->consumer);
+       pm_runtime_drop_link(link);
 
        list_del(&link->s_node);
        list_del(&link->c_node);
index b42229b74fd69688b1af2ea0de19008c8e169ba2..148e81969e04625ce1645c4c1857facb3360d1bd 100644 (file)
@@ -1117,6 +1117,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 
        drv = dev->driver;
        if (drv) {
+               pm_runtime_get_sync(dev);
+
                while (device_links_busy(dev)) {
                        __device_driver_unlock(dev, parent);
 
@@ -1128,13 +1130,12 @@ static void __device_release_driver(struct device *dev, struct device *parent)
                         * have released the driver successfully while this one
                         * was waiting, so check for that.
                         */
-                       if (dev->driver != drv)
+                       if (dev->driver != drv) {
+                               pm_runtime_put(dev);
                                return;
+                       }
                }
 
-               pm_runtime_get_sync(dev);
-               pm_runtime_clean_up_links(dev);
-
                driver_sysfs_remove(dev);
 
                if (dev->bus)
index 6f605f7820bb5fe55707645b7dea56eb70d21b5c..bfda153b1a41deed5a36ae53912fc7b0a4346980 100644 (file)
@@ -1642,42 +1642,6 @@ void pm_runtime_remove(struct device *dev)
        pm_runtime_reinit(dev);
 }
 
-/**
- * pm_runtime_clean_up_links - Prepare links to consumers for driver removal.
- * @dev: Device whose driver is going to be removed.
- *
- * Check links from this device to any consumers and if any of them have active
- * runtime PM references to the device, drop the usage counter of the device
- * (as many times as needed).
- *
- * Links with the DL_FLAG_MANAGED flag unset are ignored.
- *
- * Since the device is guaranteed to be runtime-active at the point this is
- * called, nothing else needs to be done here.
- *
- * Moreover, this is called after device_links_busy() has returned 'false', so
- * the status of each link is guaranteed to be DL_STATE_SUPPLIER_UNBIND and
- * therefore rpm_active can't be manipulated concurrently.
- */
-void pm_runtime_clean_up_links(struct device *dev)
-{
-       struct device_link *link;
-       int idx;
-
-       idx = device_links_read_lock();
-
-       list_for_each_entry_rcu(link, &dev->links.consumers, s_node,
-                               device_links_read_lock_held()) {
-               if (!(link->flags & DL_FLAG_MANAGED))
-                       continue;
-
-               while (refcount_dec_not_one(&link->rpm_active))
-                       pm_runtime_put_noidle(dev);
-       }
-
-       device_links_read_unlock(idx);
-}
-
 /**
  * pm_runtime_get_suppliers - Resume and reference-count supplier devices.
  * @dev: Consumer device.
@@ -1729,7 +1693,7 @@ void pm_runtime_new_link(struct device *dev)
        spin_unlock_irq(&dev->power.lock);
 }
 
-void pm_runtime_drop_link(struct device *dev)
+static void pm_runtime_drop_link_count(struct device *dev)
 {
        spin_lock_irq(&dev->power.lock);
        WARN_ON(dev->power.links_count == 0);
@@ -1737,6 +1701,25 @@ void pm_runtime_drop_link(struct device *dev)
        spin_unlock_irq(&dev->power.lock);
 }
 
+/**
+ * pm_runtime_drop_link - Prepare for device link removal.
+ * @link: Device link going away.
+ *
+ * Drop the link count of the consumer end of @link and decrement the supplier
+ * device's runtime PM usage counter as many times as needed to drop all of the
+ * PM runtime reference to it from the consumer.
+ */
+void pm_runtime_drop_link(struct device_link *link)
+{
+       if (!(link->flags & DL_FLAG_PM_RUNTIME))
+               return;
+
+       pm_runtime_drop_link_count(link->consumer);
+
+       while (refcount_dec_not_one(&link->rpm_active))
+               pm_runtime_put(link->supplier);
+}
+
 static bool pm_runtime_need_not_resume(struct device *dev)
 {
        return atomic_read(&dev->power.usage_count) <= 1 &&
index fa2f1b4fad7b4236214ed8c429fdb4dd8a461ea9..a94bf28f858a7f0fb513534c7190d1274d232348 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file add support for MD5 and SHA1/SHA224/SHA256/SHA384/SHA512.
  *
- * You could find the datasheet in Documentation/arm/sunxi/README
+ * You could find the datasheet in Documentation/arm/sunxi.rst
  */
 #include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
index 78503006949c8fb8647ea1c3035dd1f95d52e416..cfde9ee4356b138260ae51f110a991febb3d4b30 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file handle the PRNG
  *
- * You could find a link for the datasheet in Documentation/arm/sunxi/README
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
  */
 #include "sun8i-ce.h"
 #include <linux/dma-mapping.h>
index 654328160d19b2bef593803f945a82fa7928b8fb..5b7af4498bd5a6f937a5ae15caced491237f8c8e 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This file handle the TRNG
  *
- * You could find a link for the datasheet in Documentation/arm/sunxi/README
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
  */
 #include "sun8i-ce.h"
 #include <linux/dma-mapping.h>
index 37da3537ba2e723247b274eee8699ff9f5e62e04..5dbe93fe884c677cb1dc47411e0b7f36c0e3b3f4 100644 (file)
@@ -239,9 +239,11 @@ bool amdgpu_device_supports_baco(struct drm_device *dev)
        return amdgpu_asic_supports_baco(adev);
 }
 
+/*
+ * VRAM access helper functions
+ */
+
 /**
- * VRAM access helper functions.
- *
  * amdgpu_device_vram_access - read/write a buffer in vram
  *
  * @adev: amdgpu_device pointer
@@ -705,7 +707,7 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev,
 /**
  * amdgpu_invalid_rreg - dummy reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  *
  * Dummy register read function.  Used for register blocks
@@ -722,7 +724,7 @@ static uint32_t amdgpu_invalid_rreg(struct amdgpu_device *adev, uint32_t reg)
 /**
  * amdgpu_invalid_wreg - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  * @v: value to write to the register
  *
@@ -739,7 +741,7 @@ static void amdgpu_invalid_wreg(struct amdgpu_device *adev, uint32_t reg, uint32
 /**
  * amdgpu_invalid_rreg64 - dummy 64 bit reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  *
  * Dummy register read function.  Used for register blocks
@@ -756,7 +758,7 @@ static uint64_t amdgpu_invalid_rreg64(struct amdgpu_device *adev, uint32_t reg)
 /**
  * amdgpu_invalid_wreg64 - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @reg: offset of register
  * @v: value to write to the register
  *
@@ -773,7 +775,7 @@ static void amdgpu_invalid_wreg64(struct amdgpu_device *adev, uint32_t reg, uint
 /**
  * amdgpu_block_invalid_rreg - dummy reg read function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @block: offset of instance
  * @reg: offset of register
  *
@@ -793,7 +795,7 @@ static uint32_t amdgpu_block_invalid_rreg(struct amdgpu_device *adev,
 /**
  * amdgpu_block_invalid_wreg - dummy reg write function
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @block: offset of instance
  * @reg: offset of register
  * @v: value to write to the register
@@ -813,7 +815,7 @@ static void amdgpu_block_invalid_wreg(struct amdgpu_device *adev,
 /**
  * amdgpu_device_asic_init - Wrapper for atom asic_init
  *
- * @dev: drm_device pointer
+ * @adev: amdgpu_device pointer
  *
  * Does any asic specific work and then calls atom asic init.
  */
@@ -827,7 +829,7 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)
 /**
  * amdgpu_device_vram_scratch_init - allocate the VRAM scratch page
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Allocates a scratch page of VRAM for use by various things in the
  * driver.
@@ -844,7 +846,7 @@ static int amdgpu_device_vram_scratch_init(struct amdgpu_device *adev)
 /**
  * amdgpu_device_vram_scratch_fini - Free the VRAM scratch page
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Frees the VRAM scratch page.
  */
@@ -3011,7 +3013,7 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
 /**
  * amdgpu_device_has_dc_support - check if dc is supported
  *
- * @adev: amdgpu_device_pointer
+ * @adev: amdgpu_device pointer
  *
  * Returns true for supported, false for not supported
  */
@@ -4045,7 +4047,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 /**
  * amdgpu_device_reset_sriov - reset ASIC for SR-IOV vf
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @from_hypervisor: request from hypervisor
  *
  * do VF FLR and reinitialize Asic
@@ -4100,7 +4102,7 @@ error:
 /**
  * amdgpu_device_has_job_running - check if there is any job in mirror list
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * check if there is any job in mirror list
  */
@@ -4128,7 +4130,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)
 /**
  * amdgpu_device_should_recover_gpu - check if we should try GPU recovery
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  *
  * Check amdgpu_gpu_recovery and SRIOV status to see if we should try to recover
  * a hung GPU.
@@ -4477,7 +4479,7 @@ static int amdgpu_device_suspend_display_audio(struct amdgpu_device *adev)
 /**
  * amdgpu_device_gpu_recover - reset the asic and recover scheduler
  *
- * @adev: amdgpu device pointer
+ * @adev: amdgpu_device pointer
  * @job: which job trigger hang
  *
  * Attempt to reset the GPU if it has hung (all asics).
@@ -4497,7 +4499,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
        bool need_emergency_restart = false;
        bool audio_suspended = false;
 
-       /**
+       /*
         * Special case: RAS triggered and full reset isn't supported
         */
        need_emergency_restart = amdgpu_ras_need_emergency_restart(adev);
index f203e4a6a3f2b062dce032044229d109e817def3..731f3aa2e6ba64b6a5dcbd5a0af758b468f49a0a 100644 (file)
@@ -81,8 +81,8 @@ static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func;
 /**
  * amdgpu_gtt_mgr_init - init GTT manager and DRM MM
  *
- * @man: TTM memory type manager
- * @p_size: maximum size of GTT
+ * @adev: amdgpu_device pointer
+ * @gtt_size: maximum size of GTT
  *
  * Allocate and initialize the GTT manager.
  */
@@ -123,7 +123,7 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
 /**
  * amdgpu_gtt_mgr_fini - free and destroy GTT manager
  *
- * @man: TTM memory type manager
+ * @adev: amdgpu_device pointer
  *
  * Destroy and free the GTT manager, returns -EBUSY if ranges are still
  * allocated inside it.
index 01c1171afbe02f18208128f37b4e001cfffafc48..0c6b7c5ecfec897a4868475e3823b3f5f57a8522 100644 (file)
@@ -168,8 +168,7 @@ static const struct ttm_resource_manager_func amdgpu_vram_mgr_func;
 /**
  * amdgpu_vram_mgr_init - init VRAM manager and DRM MM
  *
- * @man: TTM memory type manager
- * @p_size: maximum size of VRAM
+ * @adev: amdgpu_device pointer
  *
  * Allocate and initialize the VRAM manager.
  */
@@ -199,7 +198,7 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
 /**
  * amdgpu_vram_mgr_fini - free and destroy VRAM manager
  *
- * @man: TTM memory type manager
+ * @adev: amdgpu_device pointer
  *
  * Destroy and free the VRAM manager, returns -EBUSY if ranges are still
  * allocated inside it.
@@ -229,7 +228,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
 /**
  * amdgpu_vram_mgr_vis_size - Calculate visible node size
  *
- * @adev: amdgpu device structure
+ * @adev: amdgpu_device pointer
  * @node: MM node structure
  *
  * Calculate how many bytes of the MM node are inside visible VRAM
index e2b23486ba4c9dac4f8f30570c07bc5e12327249..373b8481f76c7704e8ba4b6651c7417a4755b048 100644 (file)
@@ -583,7 +583,7 @@ static void amdgpu_dm_fbc_init(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
-       struct dm_comressor_info *compressor = &adev->dm.compressor;
+       struct dm_compressor_info *compressor = &adev->dm.compressor;
        struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(connector);
        struct drm_display_mode *mode;
        unsigned long max_size = 0;
index 34f6369bf51fb34d8fb27860928887a86568b21e..a8a0e8cb1a118f8da0bb0eec81ceb7aa730c3a77 100644 (file)
@@ -86,7 +86,7 @@ struct irq_list_head {
  * @bo_ptr: Pointer to the buffer object
  * @gpu_addr: MMIO gpu addr
  */
-struct dm_comressor_info {
+struct dm_compressor_info {
        void *cpu_addr;
        struct amdgpu_bo *bo_ptr;
        uint64_t gpu_addr;
@@ -148,7 +148,7 @@ struct amdgpu_dm_backlight_caps {
  * @soc_bounding_box: SOC bounding box values provided by gpu_info FW
  * @cached_state: Caches device atomic state for suspend/resume
  * @cached_dc_state: Cached state of content streams
- * @compressor: Frame buffer compression buffer. See &struct dm_comressor_info
+ * @compressor: Frame buffer compression buffer. See &struct dm_compressor_info
  * @force_timing_sync: set via debugfs. When set, indicates that all connected
  *                    displays will be forced to synchronize.
  */
@@ -324,7 +324,7 @@ struct amdgpu_display_manager {
        struct drm_atomic_state *cached_state;
        struct dc_state *cached_dc_state;
 
-       struct dm_comressor_info compressor;
+       struct dm_compressor_info compressor;
 
        const struct firmware *fw_dmcu;
        uint32_t dmcu_fw_version;
index b64d2efbefe71a5df31d1bd3c934faf19ecb515d..eb56e09ae15f3999478b0e75f601836c92ad175a 100644 (file)
@@ -1275,7 +1275,7 @@ static void balloon_up(struct work_struct *dummy)
 
        /* Refuse to balloon below the floor. */
        if (avail_pages < num_pages || avail_pages - num_pages < floor) {
-               pr_warn("Balloon request will be partially fulfilled. %s\n",
+               pr_info("Balloon request will be partially fulfilled. %s\n",
                        avail_pages < num_pages ? "Not enough memory." :
                        "Balloon floor reached.");
 
index f0e5ffba2d51d1544cf928011f2e64497c69657a..97ed8f952f6e94c750083333f4f17dfc03e764a0 100644 (file)
@@ -176,7 +176,7 @@ struct pvrdma_port_attr {
        u8                      subnet_timeout;
        u8                      init_type_reply;
        u8                      active_width;
-       u16                     active_speed;
+       u                     active_speed;
        u8                      phys_state;
        u8                      reserved[2];
 };
index 52218684ad4ab0f77ceb0d1bc4a0c2e81a550c8b..670a9623b46e1169fc978d74ea47236389474a56 100644 (file)
@@ -524,6 +524,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb)
 int rvt_register_device(struct rvt_dev_info *rdi)
 {
        int ret = 0, i;
+       u64 dma_mask;
 
        if (!rdi)
                return -EINVAL;
@@ -580,8 +581,10 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 
        /* DMA Operations */
        rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms;
-       dma_set_coherent_mask(&rdi->ibdev.dev,
-                             rdi->ibdev.dev.parent->coherent_dma_mask);
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       ret = dma_coerce_mask_and_coherent(&rdi->ibdev.dev, dma_mask);
+       if (ret)
+               goto bail_wss;
 
        /* Protection Domain */
        spin_lock_init(&rdi->n_pds_lock);
index 1fc022362fbe4973298623e164a4394f03a93378..f9c832e82552f9259d4926d02225458222e0f4cb 100644 (file)
@@ -1118,6 +1118,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
        int err;
        struct ib_device *dev = &rxe->ib_dev;
        struct crypto_shash *tfm;
+       u64 dma_mask;
 
        strlcpy(dev->node_desc, "rxe", sizeof(dev->node_desc));
 
@@ -1130,7 +1131,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
                            rxe->ndev->dev_addr);
        dev->dev.dma_parms = &rxe->dma_parms;
        dma_set_max_seg_size(&dev->dev, UINT_MAX);
-       dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev));
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       err = dma_coerce_mask_and_coherent(&dev->dev, dma_mask);
+       if (err)
+               return err;
 
        dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT)
            | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)
index ca8bc72968672f7cbcc3563db5db47fcaf3dc28f..181e06c1c43d7eb080c06246215bb32186575895 100644 (file)
@@ -306,6 +306,7 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
        struct siw_device *sdev = NULL;
        struct ib_device *base_dev;
        struct device *parent = netdev->dev.parent;
+       u64 dma_mask;
        int rv;
 
        if (!parent) {
@@ -384,8 +385,10 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
        base_dev->dev.parent = parent;
        base_dev->dev.dma_parms = &sdev->dma_parms;
        dma_set_max_seg_size(&base_dev->dev, UINT_MAX);
-       dma_set_coherent_mask(&base_dev->dev,
-                             dma_get_required_mask(&base_dev->dev));
+       dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
+       if (dma_coerce_mask_and_coherent(&base_dev->dev, dma_mask))
+               goto error;
+
        base_dev->num_comp_vectors = num_possible_cpus();
 
        xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
index 0065eb17ae36b49ebb9097cee09ff7688f3fbf8c..53a8becac82761f80860fdb9eb4b057cccaa2767 100644 (file)
@@ -622,10 +622,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
 /**
  * srpt_unregister_mad_agent - unregister MAD callback functions
  * @sdev: SRPT HCA pointer.
+ * @port_cnt: number of ports with registered MAD
  *
  * Note: It is safe to call this function more than once for the same device.
  */
-static void srpt_unregister_mad_agent(struct srpt_device *sdev)
+static void srpt_unregister_mad_agent(struct srpt_device *sdev, int port_cnt)
 {
        struct ib_port_modify port_modify = {
                .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP,
@@ -633,7 +634,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
        struct srpt_port *sport;
        int i;
 
-       for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
+       for (i = 1; i <= port_cnt; i++) {
                sport = &sdev->port[i - 1];
                WARN_ON(sport->port != i);
                if (sport->mad_agent) {
@@ -3185,7 +3186,8 @@ static int srpt_add_one(struct ib_device *device)
                if (ret) {
                        pr_err("MAD registration failed for %s-%d.\n",
                               dev_name(&sdev->device->dev), i);
-                       goto err_event;
+                       i--;
+                       goto err_port;
                }
        }
 
@@ -3197,7 +3199,8 @@ static int srpt_add_one(struct ib_device *device)
        pr_debug("added %s.\n", dev_name(&device->dev));
        return 0;
 
-err_event:
+err_port:
+       srpt_unregister_mad_agent(sdev, i);
        ib_unregister_event_handler(&sdev->event_handler);
 err_cm:
        if (sdev->cm_id)
@@ -3221,7 +3224,7 @@ static void srpt_remove_one(struct ib_device *device, void *client_data)
        struct srpt_device *sdev = client_data;
        int i;
 
-       srpt_unregister_mad_agent(sdev);
+       srpt_unregister_mad_agent(sdev, sdev->device->phys_port_cnt);
 
        ib_unregister_event_handler(&sdev->event_handler);
 
index 41435a699b53e81b5bb7daa860b8c6f62c4c0316..bdeb010efee680a3e160f862344a3e1e81c59801 100644 (file)
@@ -256,6 +256,7 @@ enum rdma_ch_state {
  * @rdma_cm:      See below.
  * @rdma_cm.cm_id: RDMA CM ID associated with the channel.
  * @cq:            IB completion queue for this channel.
+ * @cq_size:      Number of CQEs in @cq.
  * @zw_cqe:       Zero-length write CQE.
  * @rcu:           RCU head.
  * @kref:         kref for this channel.
index b70ded3760f28cdb65d9372b4b0cf26f3afdc567..6dee4f8f2024744bfa241eab9a31ca92deb72456 100644 (file)
@@ -512,9 +512,13 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr)
                 */
                struct sk_buff *skb = priv->echo_skb[idx];
                struct canfd_frame *cf = (struct canfd_frame *)skb->data;
-               u8 len = cf->len;
 
-               *len_ptr = len;
+               /* get the real payload length for netdev statistics */
+               if (cf->can_id & CAN_RTR_FLAG)
+                       *len_ptr = 0;
+               else
+                       *len_ptr = cf->len;
+
                priv->echo_skb[idx] = NULL;
 
                return skb;
@@ -538,7 +542,11 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
        if (!skb)
                return 0;
 
-       netif_rx(skb);
+       skb_get(skb);
+       if (netif_rx(skb) == NET_RX_SUCCESS)
+               dev_consume_skb_any(skb);
+       else
+               dev_kfree_skb_any(skb);
 
        return len;
 }
index 4d594e9774972b07fc414961494f67c491472a14..881799bd9c5ea0dfff2e468f2fe67c227f4bb070 100644 (file)
  *   MX8MP FlexCAN3  03.00.17.01    yes       yes        no      yes       yes          yes
  *   VF610 FlexCAN3  ?               no       yes        no      yes       yes?          no
  * LS1021A FlexCAN2  03.00.04.00     no       yes        no       no       yes           no
- * LX2160A FlexCAN3  03.00.23.00     no       yes        no       no       yes          yes
+ * LX2160A FlexCAN3  03.00.23.00     no       yes        no      yes       yes          yes
  *
  * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected.
  */
@@ -400,19 +400,19 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
 static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
                FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |
-               FLEXCAN_QUIRK_BROKEN_PERR_STATE,
+               FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC,
 };
 
 static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
-               FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
-               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
+               FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
 };
 
 static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = {
        .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
                FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
-               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD,
+               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD |
+               FLEXCAN_QUIRK_SUPPORT_ECC,
 };
 
 static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -2062,6 +2062,8 @@ static int flexcan_remove(struct platform_device *pdev)
 {
        struct net_device *dev = platform_get_drvdata(pdev);
 
+       device_set_wakeup_enable(&pdev->dev, false);
+       device_set_wakeup_capable(&pdev->dev, false);
        unregister_flexcandev(dev);
        pm_runtime_disable(&pdev->dev);
        free_candev(dev);
index 10aa3e457c33d48fe2055a422c6399b56798b9e3..40c33b8a5fda3af93013c0e524f66d1ba6288907 100644 (file)
@@ -262,8 +262,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
                cf_len = get_can_dlc(pucan_msg_get_dlc(msg));
 
        /* if this frame is an echo, */
-       if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
-           !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
+       if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) {
                unsigned long flags;
 
                spin_lock_irqsave(&priv->echo_lock, flags);
@@ -277,7 +276,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
                netif_wake_queue(priv->ndev);
 
                spin_unlock_irqrestore(&priv->echo_lock, flags);
-               return 0;
+
+               /* if this frame is only an echo, stop here. Otherwise,
+                * continue to push this application self-received frame into
+                * its own rx queue.
+                */
+               if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE))
+                       return 0;
        }
 
        /* otherwise, it should be pushed into rx fifo */
index 3b180269a92d944db7e37017e846d16cef0cf2e4..6e95193b215ba4725ced3724ac006cb2acb1986b 100644 (file)
@@ -245,7 +245,7 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload,
 
        if (skb_queue_len(&offload->skb_queue) >
            offload->skb_queue_len_max) {
-               kfree_skb(skb);
+               dev_kfree_skb_any(skb);
                return -ENOBUFS;
        }
 
@@ -290,7 +290,7 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload,
 {
        if (skb_queue_len(&offload->skb_queue) >
            offload->skb_queue_len_max) {
-               kfree_skb(skb);
+               dev_kfree_skb_any(skb);
                return -ENOBUFS;
        }
 
index c3f49543ff269546ec9343323fce3cb2b9b44269..9c215f7c5f81b84652505fb982ab176972875ed9 100644 (file)
@@ -75,11 +75,11 @@ static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model)
 {
        switch (model) {
        case MCP251XFD_MODEL_MCP2517FD:
-               return "MCP2517FD"; break;
+               return "MCP2517FD";
        case MCP251XFD_MODEL_MCP2518FD:
-               return "MCP2518FD"; break;
+               return "MCP2518FD";
        case MCP251XFD_MODEL_MCP251XFD:
-               return "MCP251xFD"; break;
+               return "MCP251xFD";
        }
 
        return "<unknown>";
@@ -95,21 +95,21 @@ static const char *mcp251xfd_get_mode_str(const u8 mode)
 {
        switch (mode) {
        case MCP251XFD_REG_CON_MODE_MIXED:
-               return "Mixed (CAN FD/CAN 2.0)"; break;
+               return "Mixed (CAN FD/CAN 2.0)";
        case MCP251XFD_REG_CON_MODE_SLEEP:
-               return "Sleep"; break;
+               return "Sleep";
        case MCP251XFD_REG_CON_MODE_INT_LOOPBACK:
-               return "Internal Loopback"; break;
+               return "Internal Loopback";
        case MCP251XFD_REG_CON_MODE_LISTENONLY:
-               return "Listen Only"; break;
+               return "Listen Only";
        case MCP251XFD_REG_CON_MODE_CONFIG:
-               return "Configuration"; break;
+               return "Configuration";
        case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK:
-               return "External Loopback"; break;
+               return "External Loopback";
        case MCP251XFD_REG_CON_MODE_CAN2_0:
-               return "CAN 2.0"; break;
+               return "CAN 2.0";
        case MCP251XFD_REG_CON_MODE_RESTRICTED:
-               return "Restricted Operation"; break;
+               return "Restricted Operation";
        }
 
        return "<unknown>";
index ba25902dd78c7584e6ab93ee4ae59fbc35a71d26..314f868b34658a40e7906a247cf5029084e2c19f 100644 (file)
@@ -173,7 +173,7 @@ mcp251xfd_regmap_nocrc_read(void *context,
                memcpy(&buf_tx->cmd, reg, sizeof(buf_tx->cmd));
                if (MCP251XFD_SANITIZE_SPI)
                        memset(buf_tx->data, 0x0, val_len);
-       };
+       }
 
        err = spi_sync(spi, &msg);
        if (err)
@@ -330,17 +330,17 @@ mcp251xfd_regmap_crc_read(void *context,
                        goto out;
                }
 
-               netdev_dbg(priv->ndev,
-                          "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
-                          reg, val_len, (int)val_len, buf_rx->data,
-                          get_unaligned_be16(buf_rx->data + val_len));
-       }
-
-       if (err) {
                netdev_info(priv->ndev,
-                           "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
+                           "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
                            reg, val_len, (int)val_len, buf_rx->data,
                            get_unaligned_be16(buf_rx->data + val_len));
+       }
+
+       if (err) {
+               netdev_err(priv->ndev,
+                          "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
+                          reg, val_len, (int)val_len, buf_rx->data,
+                          get_unaligned_be16(buf_rx->data + val_len));
 
                return err;
        }
index 1d63006c97bcd84a6f4cb0ca77a22d34b2cedb8e..9913f5458279b66a4d02774838e23c0d2657e3fd 100644 (file)
@@ -933,7 +933,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
        err = clk_prepare_enable(priv->clk);
        if (err) {
                dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
-               goto probe_exit_clk;
+               goto probe_exit_release_clk;
        }
 
        priv->offload.mailbox_read = ti_hecc_mailbox_read;
@@ -942,7 +942,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
        err = can_rx_offload_add_timestamp(ndev, &priv->offload);
        if (err) {
                dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
-               goto probe_exit_clk;
+               goto probe_exit_disable_clk;
        }
 
        err = register_candev(ndev);
@@ -960,7 +960,9 @@ static int ti_hecc_probe(struct platform_device *pdev)
 
 probe_exit_offload:
        can_rx_offload_del(&priv->offload);
-probe_exit_clk:
+probe_exit_disable_clk:
+       clk_disable_unprepare(priv->clk);
+probe_exit_release_clk:
        clk_put(priv->clk);
 probe_exit_candev:
        free_candev(ndev);
index d91df34e7fa8800f6931e7d4dade99c05a62dea4..c2764799f9efbcd4d57adee2271378e6179ccc78 100644 (file)
@@ -130,14 +130,55 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
        /* protect from getting time before setting now */
        if (ktime_to_ns(time_ref->tv_host)) {
                u64 delta_us;
+               s64 delta_ts = 0;
+
+               /* General case: dev_ts_1 < dev_ts_2 < ts, with:
+                *
+                * - dev_ts_1 = previous sync timestamp
+                * - dev_ts_2 = last sync timestamp
+                * - ts = event timestamp
+                * - ts_period = known sync period (theoretical)
+                *             ~ dev_ts2 - dev_ts1
+                * *but*:
+                *
+                * - time counters wrap (see adapter->ts_used_bits)
+                * - sometimes, dev_ts_1 < ts < dev_ts2
+                *
+                * "normal" case (sync time counters increase):
+                * must take into account case when ts wraps (tsw)
+                *
+                *      < ts_period > <          >
+                *     |             |            |
+                *  ---+--------+----+-------0-+--+-->
+                *     ts_dev_1 |    ts_dev_2  |
+                *              ts             tsw
+                */
+               if (time_ref->ts_dev_1 < time_ref->ts_dev_2) {
+                       /* case when event time (tsw) wraps */
+                       if (ts < time_ref->ts_dev_1)
+                               delta_ts = 1 << time_ref->adapter->ts_used_bits;
+
+               /* Otherwise, sync time counter (ts_dev_2) has wrapped:
+                * handle case when event time (tsn) hasn't.
+                *
+                *      < ts_period > <          >
+                *     |             |            |
+                *  ---+--------+--0-+---------+--+-->
+                *     ts_dev_1 |    ts_dev_2  |
+                *              tsn            ts
+                */
+               } else if (time_ref->ts_dev_1 < ts) {
+                       delta_ts = -(1 << time_ref->adapter->ts_used_bits);
+               }
 
-               delta_us = ts - time_ref->ts_dev_2;
-               if (ts < time_ref->ts_dev_2)
-                       delta_us &= (1 << time_ref->adapter->ts_used_bits) - 1;
+               /* add delay between last sync and event timestamps */
+               delta_ts += (signed int)(ts - time_ref->ts_dev_2);
 
-               delta_us += time_ref->ts_total;
+               /* add time from beginning to last sync */
+               delta_ts += time_ref->ts_total;
 
-               delta_us *= time_ref->adapter->us_per_ts_scale;
+               /* convert ticks number into microseconds */
+               delta_us = delta_ts * time_ref->adapter->us_per_ts_scale;
                delta_us >>= time_ref->adapter->us_per_ts_shift;
 
                *time = ktime_add_us(time_ref->tv_host_0, delta_us);
index ab63fd9eb982df5c30e7fd12a04de59a52379a04..d29d20525588c621a80c2afbc56d8c0be48a4faa 100644 (file)
@@ -468,12 +468,18 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if,
                                     struct pucan_msg *rx_msg)
 {
        struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)];
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct canfd_frame *cfd;
        struct sk_buff *skb;
        const u16 rx_msg_flags = le16_to_cpu(rm->flags);
 
+       if (pucan_msg_get_channel(rm) >= ARRAY_SIZE(usb_if->dev))
+               return -ENOMEM;
+
+       dev = usb_if->dev[pucan_msg_get_channel(rm)];
+       netdev = dev->netdev;
+
        if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) {
                /* CANFD frame case */
                skb = alloc_canfd_skb(netdev, &cfd);
@@ -519,15 +525,21 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
                                     struct pucan_msg *rx_msg)
 {
        struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
-       struct pcan_usb_fd_device *pdev =
-                       container_of(dev, struct pcan_usb_fd_device, dev);
+       struct pcan_usb_fd_device *pdev;
        enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
        enum can_state rx_state, tx_state;
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct can_frame *cf;
        struct sk_buff *skb;
 
+       if (pucan_stmsg_get_channel(sm) >= ARRAY_SIZE(usb_if->dev))
+               return -ENOMEM;
+
+       dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
+       pdev = container_of(dev, struct pcan_usb_fd_device, dev);
+       netdev = dev->netdev;
+
        /* nothing should be sent while in BUS_OFF state */
        if (dev->can.state == CAN_STATE_BUS_OFF)
                return 0;
@@ -579,9 +591,14 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if,
                                    struct pucan_msg *rx_msg)
 {
        struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)];
-       struct pcan_usb_fd_device *pdev =
-                       container_of(dev, struct pcan_usb_fd_device, dev);
+       struct pcan_usb_fd_device *pdev;
+       struct peak_usb_device *dev;
+
+       if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev))
+               return -EINVAL;
+
+       dev = usb_if->dev[pucan_ermsg_get_channel(er)];
+       pdev = container_of(dev, struct pcan_usb_fd_device, dev);
 
        /* keep a trace of tx and rx error counters for later use */
        pdev->bec.txerr = er->tx_err_cnt;
@@ -595,11 +612,17 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
                                      struct pucan_msg *rx_msg)
 {
        struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg;
-       struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)];
-       struct net_device *netdev = dev->netdev;
+       struct peak_usb_device *dev;
+       struct net_device *netdev;
        struct can_frame *cf;
        struct sk_buff *skb;
 
+       if (pufd_omsg_get_channel(ov) >= ARRAY_SIZE(usb_if->dev))
+               return -EINVAL;
+
+       dev = usb_if->dev[pufd_omsg_get_channel(ov)];
+       netdev = dev->netdev;
+
        /* allocate an skb to store the error frame */
        skb = alloc_can_err_skb(netdev, &cf);
        if (!skb)
@@ -716,6 +739,9 @@ static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev,
        u16 tx_msg_size, tx_msg_flags;
        u8 can_dlc;
 
+       if (cfd->len > CANFD_MAX_DLEN)
+               return -EINVAL;
+
        tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4);
        tx_msg->size = cpu_to_le16(tx_msg_size);
        tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX);
index 6c4d00d2dbdcc3c2ec5a36defdcb7b883dd93abb..48d746e18f30219e49ed04c24165a789d0bc71fc 100644 (file)
@@ -1395,7 +1395,7 @@ static int xcan_open(struct net_device *ndev)
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
-               return ret;
+               goto err;
        }
 
        ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
@@ -1479,6 +1479,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev,
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
+               pm_runtime_put(priv->dev);
                return ret;
        }
 
@@ -1793,7 +1794,7 @@ static int xcan_probe(struct platform_device *pdev)
        if (ret < 0) {
                netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
                           __func__, ret);
-               goto err_pmdisable;
+               goto err_disableclks;
        }
 
        if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) {
@@ -1828,7 +1829,6 @@ static int xcan_probe(struct platform_device *pdev)
 
 err_disableclks:
        pm_runtime_put(priv->dev);
-err_pmdisable:
        pm_runtime_disable(&pdev->dev);
 err_free:
        free_candev(ndev);
index 53064e0e161873eb4bf1b82b9c4acb37daceeba5..5bdac669a3392e69e340744c4fe5dd4bcdb6aacb 100644 (file)
@@ -1219,8 +1219,8 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
        priv->port_mtu[port] = new_mtu;
 
        for (i = 0; i < QCA8K_NUM_PORTS; i++)
-               if (priv->port_mtu[port] > mtu)
-                       mtu = priv->port_mtu[port];
+               if (priv->port_mtu[i] > mtu)
+                       mtu = priv->port_mtu[i];
 
        /* Include L2 header / FCS length */
        qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN);
index 883e47c5b1a7852062ab196ebc3fb80743f128d1..286f0341bdf83a32781730151b27a4a9e831cafb 100644 (file)
@@ -1929,7 +1929,8 @@ static inline int macb_clear_csum(struct sk_buff *skb)
 
 static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev)
 {
-       bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb);
+       bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
+                     skb_is_nonlinear(*skb);
        int padlen = ETH_ZLEN - (*skb)->len;
        int headroom = skb_headroom(*skb);
        int tailroom = skb_tailroom(*skb);
index d581c4e623f8a3bd2864fdb8a4d3beae19d76e2c..96d5616534963e298660f39782febd9744340c93 100644 (file)
@@ -212,7 +212,7 @@ static struct sk_buff *alloc_ctrl_skb(struct sk_buff *skb, int len)
 {
        if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) {
                __skb_trim(skb, 0);
-               refcount_add(2, &skb->users);
+               refcount_inc(&skb->users);
        } else {
                skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL);
        }
index f1820aca0d336902a1228db69e4f5c40b2e056f9..62c829023da564f46be598d7bc6fec13aebe3896 100644 (file)
@@ -383,6 +383,9 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen,
        if (ret)
                goto out_notcb;
 
+       if (unlikely(csk_flag(sk, CSK_ABORT_SHUTDOWN)))
+               goto out_notcb;
+
        set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid);
        csk->wr_credits -= DIV_ROUND_UP(len, 16);
        csk->wr_unacked += DIV_ROUND_UP(len, 16);
index 06cc863f4dd63258556f18af04bf8898b3a76ff5..d9c285948fc21d0f4269c65d26234b685c6d3641 100644 (file)
@@ -174,12 +174,17 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms");
 #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result)
 #define DPAA_TIME_STAMP_SIZE 8
 #define DPAA_HASH_RESULTS_SIZE 8
+#define DPAA_HWA_SIZE (DPAA_PARSE_RESULTS_SIZE + DPAA_TIME_STAMP_SIZE \
+                      + DPAA_HASH_RESULTS_SIZE)
+#define DPAA_RX_PRIV_DATA_DEFAULT_SIZE (DPAA_TX_PRIV_DATA_SIZE + \
+                                       dpaa_rx_extra_headroom)
 #ifdef CONFIG_DPAA_ERRATUM_A050385
-#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
-        + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
+#define DPAA_RX_PRIV_DATA_A050385_SIZE (DPAA_A050385_ALIGN - DPAA_HWA_SIZE)
+#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
+                               DPAA_RX_PRIV_DATA_A050385_SIZE : \
+                               DPAA_RX_PRIV_DATA_DEFAULT_SIZE)
 #else
-#define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \
-                                       dpaa_rx_extra_headroom)
+#define DPAA_RX_PRIV_DATA_SIZE DPAA_RX_PRIV_DATA_DEFAULT_SIZE
 #endif
 
 #define DPAA_ETH_PCD_RXQ_NUM   128
@@ -2840,7 +2845,8 @@ out_error:
        return err;
 }
 
-static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
+static u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
+                            enum port_type port)
 {
        u16 headroom;
 
@@ -2854,10 +2860,12 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
         *
         * Also make sure the headroom is a multiple of data_align bytes
         */
-       headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
-               DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
+       headroom = (u16)(bl[port].priv_data_size + DPAA_HWA_SIZE);
 
-       return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
+       if (port == RX)
+               return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
+       else
+               return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }
 
 static int dpaa_eth_probe(struct platform_device *pdev)
@@ -3025,8 +3033,8 @@ static int dpaa_eth_probe(struct platform_device *pdev)
                        goto free_dpaa_fqs;
        }
 
-       priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
-       priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[RX]);
+       priv->tx_headroom = dpaa_get_headroom(priv->buf_layout, TX);
+       priv->rx_headroom = dpaa_get_headroom(priv->buf_layout, RX);
 
        /* All real interfaces need their ports initialized */
        err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
index 832a2175636d69b7a29ecd560b8b8804fa4c759f..c527f4ee1d3aed313124d2befbb6a536801e5594 100644 (file)
@@ -456,6 +456,12 @@ struct bufdesc_ex {
  */
 #define FEC_QUIRK_HAS_FRREG            (1 << 16)
 
+/* Some FEC hardware blocks need the MMFR cleared at setup time to avoid
+ * the generation of an MII event. This must be avoided in the older
+ * FEC blocks where it will stop MII events being generated.
+ */
+#define FEC_QUIRK_CLEAR_SETUP_MII      (1 << 17)
+
 struct bufdesc_prop {
        int qid;
        /* Address of Rx and Tx buffers */
index 8f7eca1e7716c9bbaddb28f9b541a339ef326a8c..d7919555250dd34fcf372c85dd1c03aa13d76d03 100644 (file)
@@ -100,14 +100,14 @@ static const struct fec_devinfo fec_imx27_info = {
 static const struct fec_devinfo fec_imx28_info = {
        .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
                  FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
-                 FEC_QUIRK_HAS_FRREG,
+                 FEC_QUIRK_HAS_FRREG | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_imx6q_info = {
        .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
-                 FEC_QUIRK_HAS_RACC,
+                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_mvf600_info = {
@@ -119,7 +119,8 @@ static const struct fec_devinfo fec_imx6x_info = {
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
                  FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
-                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE,
+                 FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE |
+                 FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static const struct fec_devinfo fec_imx6ul_info = {
@@ -127,7 +128,7 @@ static const struct fec_devinfo fec_imx6ul_info = {
                  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
                  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 |
                  FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC |
-                 FEC_QUIRK_HAS_COALESCE,
+                 FEC_QUIRK_HAS_COALESCE | FEC_QUIRK_CLEAR_SETUP_MII,
 };
 
 static struct platform_device_id fec_devtype[] = {
@@ -2134,15 +2135,17 @@ static int fec_enet_mii_init(struct platform_device *pdev)
        if (suppress_preamble)
                fep->phy_speed |= BIT(7);
 
-       /* Clear MMFR to avoid to generate MII event by writing MSCR.
-        * MII event generation condition:
-        * - writing MSCR:
-        *      - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
-        *        mscr_reg_data_in[7:0] != 0
-        * - writing MMFR:
-        *      - mscr[7:0]_not_zero
-        */
-       writel(0, fep->hwp + FEC_MII_DATA);
+       if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) {
+               /* Clear MMFR to avoid to generate MII event by writing MSCR.
+                * MII event generation condition:
+                * - writing MSCR:
+                *      - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
+                *        mscr_reg_data_in[7:0] != 0
+                * - writing MMFR:
+                *      - mscr[7:0]_not_zero
+                */
+               writel(0, fep->hwp + FEC_MII_DATA);
+       }
 
        writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 
index 41dd3d0f3452442d60383e15b84cdac050673d6d..d391a45cebb661c7b94084648433c77c27484a99 100644 (file)
@@ -1829,20 +1829,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
                fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
 
        /* make space for additional header when fcb is needed */
-       if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) {
-               struct sk_buff *skb_new;
-
-               skb_new = skb_realloc_headroom(skb, fcb_len);
-               if (!skb_new) {
+       if (fcb_len) {
+               if (unlikely(skb_cow_head(skb, fcb_len))) {
                        dev->stats.tx_errors++;
                        dev_kfree_skb_any(skb);
                        return NETDEV_TX_OK;
                }
-
-               if (skb->sk)
-                       skb_set_owner_w(skb_new, skb->sk);
-               dev_consume_skb_any(skb);
-               skb = skb_new;
        }
 
        /* total number of fragments in the SKB */
@@ -3380,7 +3372,7 @@ static int gfar_probe(struct platform_device *ofdev)
 
        if (dev->features & NETIF_F_IP_CSUM ||
            priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
-               dev->needed_headroom = GMAC_FCB_LEN;
+               dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
 
        /* Initializing some of the rx/tx queue level parameters */
        for (i = 0; i < priv->num_tx_queues; i++) {
index af4dfbe28d5616568d6baa230bc63585e6478368..da15913879f8e7d8c89f22823b70cb27342f479e 100644 (file)
@@ -1185,18 +1185,27 @@ static int ibmvnic_open(struct net_device *netdev)
        if (adapter->state != VNIC_CLOSED) {
                rc = ibmvnic_login(netdev);
                if (rc)
-                       return rc;
+                       goto out;
 
                rc = init_resources(adapter);
                if (rc) {
                        netdev_err(netdev, "failed to initialize resources\n");
                        release_resources(adapter);
-                       return rc;
+                       goto out;
                }
        }
 
        rc = __ibmvnic_open(netdev);
 
+out:
+       /*
+        * If open fails due to a pending failover, set device state and
+        * return. Device operation will be handled by reset routine.
+        */
+       if (rc && adapter->failover_pending) {
+               adapter->state = VNIC_OPEN;
+               rc = 0;
+       }
        return rc;
 }
 
@@ -1922,6 +1931,13 @@ static int do_reset(struct ibmvnic_adapter *adapter,
                   rwi->reset_reason);
 
        rtnl_lock();
+       /*
+        * Now that we have the rtnl lock, clear any pending failover.
+        * This will ensure ibmvnic_open() has either completed or will
+        * block until failover is complete.
+        */
+       if (rwi->reset_reason == VNIC_RESET_FAILOVER)
+               adapter->failover_pending = false;
 
        netif_carrier_off(netdev);
        adapter->reset_reason = rwi->reset_reason;
@@ -2202,6 +2218,13 @@ static void __ibmvnic_reset(struct work_struct *work)
                        /* CHANGE_PARAM requestor holds rtnl_lock */
                        rc = do_change_param_reset(adapter, rwi, reset_state);
                } else if (adapter->force_reset_recovery) {
+                       /*
+                        * Since we are doing a hard reset now, clear the
+                        * failover_pending flag so we don't ignore any
+                        * future MOBILITY or other resets.
+                        */
+                       adapter->failover_pending = false;
+
                        /* Transport event occurred during previous reset */
                        if (adapter->wait_for_reset) {
                                /* Previous was CHANGE_PARAM; caller locked */
@@ -2266,9 +2289,15 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
        unsigned long flags;
        int ret;
 
+       /*
+        * If failover is pending don't schedule any other reset.
+        * Instead let the failover complete. If there is already a
+        * a failover reset scheduled, we will detect and drop the
+        * duplicate reset when walking the ->rwi_list below.
+        */
        if (adapter->state == VNIC_REMOVING ||
            adapter->state == VNIC_REMOVED ||
-           adapter->failover_pending) {
+           (adapter->failover_pending && reason != VNIC_RESET_FAILOVER)) {
                ret = EBUSY;
                netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n");
                goto err;
@@ -4713,7 +4742,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                case IBMVNIC_CRQ_INIT:
                        dev_info(dev, "Partner initialized\n");
                        adapter->from_passive_init = true;
-                       adapter->failover_pending = false;
                        if (!completion_done(&adapter->init_done)) {
                                complete(&adapter->init_done);
                                adapter->init_done_rc = -EIO;
index ed9808fc743b218fa280d28d3ffb72d1c7c0ddd3..35c72d4a78b3f9ed37c4ae173346848790362484 100644 (file)
@@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev,
 
        ethtool_link_ksettings_zero_link_mode(ks, supported);
 
+       if (!idev->port_info) {
+               netdev_err(netdev, "port_info not initialized\n");
+               return -EOPNOTSUPP;
+       }
+
        /* The port_info data is found in a DMA space that the NIC keeps
         * up-to-date, so there's no need to request the data from the
         * NIC, we already have it in our memory space.
index 00f13805c6f753e5f9fedcc82a36f0cdc988c3af..7766d73823eb6ac814adde3db25e74c8d49b5d32 100644 (file)
@@ -4080,9 +4080,17 @@ err_out:
        return -EIO;
 }
 
-static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
+static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp)
 {
-       return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
+       switch (tp->mac_version) {
+       case RTL_GIGA_MAC_VER_34:
+       case RTL_GIGA_MAC_VER_60:
+       case RTL_GIGA_MAC_VER_61:
+       case RTL_GIGA_MAC_VER_63:
+               return true;
+       default:
+               return false;
+       }
 }
 
 static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)
@@ -4154,7 +4162,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
 
                opts[1] |= transport_offset << TCPHO_SHIFT;
        } else {
-               if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
+               if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp)))
                        return !eth_skb_pad(skb);
        }
 
index b6e5e3e36b63a182701189a6120923f28f39aad6..81ee0a071b4e96156c93b516c354d26a540e2cf6 100644 (file)
@@ -625,13 +625,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
        if (ret)
                return ret;
 
-       if (plat->eee_usecs_rate > 0) {
-               u32 tx_lpi_usec;
-
-               tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
-               writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
-       }
-
        ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
        if (ret < 0)
                return ret;
@@ -641,6 +634,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
        res.wol_irq = pci_irq_vector(pdev, 0);
        res.irq = pci_irq_vector(pdev, 0);
 
+       if (plat->eee_usecs_rate > 0) {
+               u32 tx_lpi_usec;
+
+               tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
+               writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
+       }
+
        ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
        if (ret) {
                pci_free_irq_vectors(pdev);
index 220626a8d499eb22376051d82fd752e02987c480..d833908b660a489d4b5e102f8e0db38a4ab4f61f 100644 (file)
@@ -4757,6 +4757,7 @@ static void stmmac_napi_add(struct net_device *dev)
 
                ch->priv_data = priv;
                ch->index = queue;
+               spin_lock_init(&ch->lock);
 
                if (queue < priv->plat->rx_queues_to_use) {
                        netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx,
index 4d02c51356112f291ba22953b370b297960db08c..4619c3a950b01ef19f24e9283e80f5dc3d72b2d4 100644 (file)
@@ -728,7 +728,6 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)
                (1 << HWTSTAMP_TX_ON);
        info->rx_filters =
                (1 << HWTSTAMP_FILTER_NONE) |
-               (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
                (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
        return 0;
 }
index 51cc29f39038b30321e24103d20e0628beb18c35..31c5e36ff7069f545f0ce9a4e05a72a3db64e428 100644 (file)
@@ -639,13 +639,10 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
                break;
        case HWTSTAMP_FILTER_ALL:
        case HWTSTAMP_FILTER_NTP_ALL:
-               return -ERANGE;
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
-               priv->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
-               cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
-               break;
+               return -ERANGE;
        case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
index 1d18c10e8f82fcc0867d8114173f77e26a48f50c..34aa196b7465c6460d6268b6bce3864f4d45fee4 100644 (file)
@@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_device *pdev)
                        continue;
 
                sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
-               if (!sfp->gpio_irq[i]) {
+               if (sfp->gpio_irq[i] < 0) {
+                       sfp->gpio_irq[i] = 0;
                        sfp->need_poll = true;
                        continue;
                }
index a322f51873d011dfd0272fcdc6e2253b38bf6c66..581ed51abb53293a49edac567d6e25a67e4fbaae 100644 (file)
@@ -1309,6 +1309,7 @@ static const struct usb_device_id products[] = {
        {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)},    /* Telit ME910 dual modem */
        {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},    /* Telit LE920 */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
+       {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
        {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
index 3a469c79e6b05de483f9340b6bf24ce6d1f8ddc2..aedfaaafd3e7edb73a4468cba26cf2c177ea1164 100644 (file)
@@ -112,7 +112,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
                u64 dma_end = 0;
 
                /* Determine the overall bounds of all DMA regions */
-               for (dma_start = ~0ULL; r->size; r++) {
+               for (dma_start = ~0; r->size; r++) {
                        /* Take lower and upper limits */
                        if (r->dma_start < dma_start)
                                dma_start = r->dma_start;
index 2483e765318a3c01c3d4466a45322698f6f293d0..0e0a5269dc82f8314e936bcc71d457e51d24fb48 100644 (file)
@@ -1181,6 +1181,10 @@ static void _opp_table_kref_release(struct kref *kref)
        struct opp_device *opp_dev, *temp;
        int i;
 
+       /* Drop the lock as soon as we can */
+       list_del(&opp_table->node);
+       mutex_unlock(&opp_table_lock);
+
        _of_clear_opp_table(opp_table);
 
        /* Release clk */
@@ -1208,10 +1212,7 @@ static void _opp_table_kref_release(struct kref *kref)
 
        mutex_destroy(&opp_table->genpd_virt_dev_lock);
        mutex_destroy(&opp_table->lock);
-       list_del(&opp_table->node);
        kfree(opp_table);
-
-       mutex_unlock(&opp_table_lock);
 }
 
 void dev_pm_opp_put_opp_table(struct opp_table *opp_table)
@@ -1930,7 +1931,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
                return ERR_PTR(-EINVAL);
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!IS_ERR(opp_table))
+       if (IS_ERR(opp_table))
                return opp_table;
 
        /* This should be called before OPPs are initialized */
index 874b587562202219babd72ce0e7c9236a7c9ee75..9faeb83e4b326217e538d570f29e7e333d5888d5 100644 (file)
@@ -944,6 +944,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
                nr -= 2;
        }
 
+       return 0;
+
 remove_static_opp:
        _opp_remove_all_static(opp_table);
 
index 674f32db85ca4ccf5935eb4b3ba59ecdbd7401a7..44c2a6572199c341d9108e2b9243035215722ae7 100644 (file)
@@ -586,8 +586,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
         * ATU, so we should not program the ATU here.
         */
        if (pp->bridge->child_ops == &dw_child_pcie_ops) {
-               struct resource_entry *entry =
-                       resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM);
+               struct resource_entry *tmp, *entry = NULL;
+
+               /* Get last memory resource entry */
+               resource_list_for_each_entry(tmp, &pp->bridge->windows)
+                       if (resource_type(tmp->res) == IORESOURCE_MEM)
+                               entry = tmp;
 
                dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0,
                                          PCIE_ATU_TYPE_MEM, entry->res->start,
index eee82838f4bace3309541ae14d1b516b9000bf70..ed13e81cd691d461708f2d7b798037fee15f8449 100644 (file)
@@ -958,25 +958,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
 }
 
 /*
- * We can't use devm_of_pci_get_host_bridge_resources() because we
- * need to parse our special DT properties encoding the MEM and IO
- * apertures.
+ * devm_of_pci_get_host_bridge_resources() only sets up translateable resources,
+ * so we need extra resource setup parsing our special DT properties encoding
+ * the MEM and IO apertures.
  */
 static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 {
        struct device *dev = &pcie->pdev->dev;
-       struct device_node *np = dev->of_node;
        struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
        int ret;
 
-       /* Get the bus range */
-       ret = of_pci_parse_bus_range(np, &pcie->busn);
-       if (ret) {
-               dev_err(dev, "failed to parse bus-range property: %d\n", ret);
-               return ret;
-       }
-       pci_add_resource(&bridge->windows, &pcie->busn);
-
        /* Get the PCIe memory aperture */
        mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
        if (resource_size(&pcie->mem) == 0) {
@@ -986,6 +977,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 
        pcie->mem.name = "PCI MEM";
        pci_add_resource(&bridge->windows, &pcie->mem);
+       ret = devm_request_resource(dev, &iomem_resource, &pcie->mem);
+       if (ret)
+               return ret;
 
        /* Get the PCIe IO aperture */
        mvebu_mbus_get_pcie_io_aperture(&pcie->io);
@@ -999,9 +993,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
                pcie->realio.name = "PCI I/O";
 
                pci_add_resource(&bridge->windows, &pcie->realio);
+               ret = devm_request_resource(dev, &ioport_resource, &pcie->realio);
+               if (ret)
+                       return ret;
        }
 
-       return devm_request_pci_bus_resources(dev, &bridge->windows);
+       return 0;
 }
 
 /*
index 6d4d5a2f923d9ef291eb7f09d5af3b452fe487df..e578d34095e91a1dea6731314d364bf981e1c697 100644 (file)
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev)
 {
        dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
 
-       if (dev->acs_cap)
-               pci_enable_acs(dev);
+       /*
+        * Attempt to enable ACS regardless of capability because some Root
+        * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
+        * the standard ACS capability but still support ACS via those
+        * quirks.
+        */
+       pci_enable_acs(dev);
 }
 
 /**
index 0b2830efc574993ea22dd3959b6196710f009295..70d6d52bc1e2175b38397f79ee3c58a552ab1b97 100644 (file)
@@ -620,7 +620,7 @@ static u64 rapl_unit_xlate(struct rapl_domain *rd, enum unit_type type,
        case ARBITRARY_UNIT:
        default:
                return value;
-       };
+       }
 
        if (to_raw)
                return div64_u64(value, units) * scale;
index a4ffd71696da67782f11b3fce1648f60c2cfa8fb..a5ad553da8cd4972f963a46deab46401e3d5f2cf 100644 (file)
@@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)
                ret = rdev->desc->fixed_uV;
        } else if (rdev->supply) {
                ret = regulator_get_voltage_rdev(rdev->supply->rdev);
+       } else if (rdev->supply_name) {
+               return -EPROBE_DEFER;
        } else {
                return -EINVAL;
        }
index b87116e9b41368d5bf29c6708b28a8426cec2054..9b6ba94fe878ae4575cedf5de42c6d4893761530 100644 (file)
@@ -1259,18 +1259,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
        if (!chip)
                return 0;
 
-       /*
-        * Retrieve the corresponding GPIO line used for CS.
-        * The inversion semantics will be handled by the GPIO core
-        * code, so we pass GPIOD_OUT_LOW for "unasserted" and
-        * the correct flag for inversion semantics. The SPI_CS_HIGH
-        * on spi->mode cannot be checked for polarity in this case
-        * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
-        */
-       if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
-               lflags = GPIO_ACTIVE_HIGH;
-       else
-               lflags = GPIO_ACTIVE_LOW;
        spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
                                                  DRV_NAME,
                                                  lflags,
index 3967afa465f0ec29e29f361216f87640ab474ec7..1a08c1d584abe08b9b068d0217fe765371ece2cf 100644 (file)
@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
 #ifdef CONFIG_PM_SLEEP
 static int dspi_suspend(struct device *dev)
 {
-       struct spi_controller *ctlr = dev_get_drvdata(dev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = dev_get_drvdata(dev);
 
        if (dspi->irq)
                disable_irq(dspi->irq);
-       spi_controller_suspend(ctlr);
+       spi_controller_suspend(dspi->ctlr);
        clk_disable_unprepare(dspi->clk);
 
        pinctrl_pm_select_sleep_state(dev);
@@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev)
 
 static int dspi_resume(struct device *dev)
 {
-       struct spi_controller *ctlr = dev_get_drvdata(dev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = dev_get_drvdata(dev);
        int ret;
 
        pinctrl_pm_select_default_state(dev);
@@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev)
        ret = clk_prepare_enable(dspi->clk);
        if (ret)
                return ret;
-       spi_controller_resume(ctlr);
+       spi_controller_resume(dspi->ctlr);
        if (dspi->irq)
                enable_irq(dspi->irq);
 
index 060b1f5c9b048bbc85139d64b88586dd2bd88bec..4b80e27ecdbf9aed3cf4bdecab7e7c0e7f74974e 100644 (file)
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev)
                goto out_master_put;
        }
 
-       pm_runtime_enable(spi_imx->dev);
+       ret = clk_prepare_enable(spi_imx->clk_per);
+       if (ret)
+               goto out_master_put;
+
+       ret = clk_prepare_enable(spi_imx->clk_ipg);
+       if (ret)
+               goto out_put_per;
+
        pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
        pm_runtime_use_autosuspend(spi_imx->dev);
-
-       ret = pm_runtime_get_sync(spi_imx->dev);
-       if (ret < 0) {
-               dev_err(spi_imx->dev, "failed to enable clock\n");
-               goto out_runtime_pm_put;
-       }
+       pm_runtime_set_active(spi_imx->dev);
+       pm_runtime_enable(spi_imx->dev);
 
        spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
        /*
@@ -1722,8 +1725,12 @@ out_bitbang_start:
                spi_imx_sdma_exit(spi_imx);
 out_runtime_pm_put:
        pm_runtime_dont_use_autosuspend(spi_imx->dev);
-       pm_runtime_put_sync(spi_imx->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_disable(spi_imx->dev);
+
+       clk_disable_unprepare(spi_imx->clk_ipg);
+out_put_per:
+       clk_disable_unprepare(spi_imx->clk_per);
 out_master_put:
        spi_master_put(master);
 
index 43b5630c0407a29daa9688fe016cd482829a1b2d..510edd12ed19249559ae1b6e8ed11a0810053ad5 100644 (file)
@@ -24,7 +24,7 @@ description:
     In addition, it is recommended to declare a mmc-pwrseq on SDIO host above
     WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq
     should be compatible with mmc-pwrseq-simple. Please consult
-    Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more
+    Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more
     information.
 
   For SPI':'
index 2321775ef098275cb2b2881055e0df46bb34bd23..5f61b25a9aaa89208bd565e51c44ff2fde530620 100644 (file)
@@ -484,7 +484,7 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned int cmd,
        return 0;
 }
 
-static inline int do_fontx_ioctl(int cmd,
+static inline int do_fontx_ioctl(struct vc_data *vc, int cmd,
                struct consolefontdesc __user *user_cfd,
                struct console_font_op *op)
 {
@@ -502,15 +502,16 @@ static inline int do_fontx_ioctl(int cmd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = cfdarg.chardata;
-               return con_font_op(vc_cons[fg_console].d, op);
-       case GIO_FONTX: {
+               return con_font_op(vc, op);
+
+       case GIO_FONTX:
                op->op = KD_FONT_OP_GET;
                op->flags = KD_FONT_FLAG_OLD;
                op->width = 8;
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = cfdarg.chardata;
-               i = con_font_op(vc_cons[fg_console].d, op);
+               i = con_font_op(vc, op);
                if (i)
                        return i;
                cfdarg.charheight = op->height;
@@ -518,12 +519,11 @@ static inline int do_fontx_ioctl(int cmd,
                if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc)))
                        return -EFAULT;
                return 0;
-               }
        }
        return -EINVAL;
 }
 
-static int vt_io_fontreset(struct console_font_op *op)
+static int vt_io_fontreset(struct vc_data *vc, struct console_font_op *op)
 {
        int ret;
 
@@ -537,12 +537,12 @@ static int vt_io_fontreset(struct console_font_op *op)
 
        op->op = KD_FONT_OP_SET_DEFAULT;
        op->data = NULL;
-       ret = con_font_op(vc_cons[fg_console].d, op);
+       ret = con_font_op(vc, op);
        if (ret)
                return ret;
 
        console_lock();
-       con_set_default_unimap(vc_cons[fg_console].d);
+       con_set_default_unimap(vc);
        console_unlock();
 
        return 0;
@@ -584,7 +584,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
                op.height = 0;
                op.charcount = 256;
                op.data = up;
-               return con_font_op(vc_cons[fg_console].d, &op);
+               return con_font_op(vc, &op);
 
        case GIO_FONT:
                op.op = KD_FONT_OP_GET;
@@ -593,7 +593,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
                op.height = 32;
                op.charcount = 256;
                op.data = up;
-               return con_font_op(vc_cons[fg_console].d, &op);
+               return con_font_op(vc, &op);
 
        case PIO_CMAP:
                 if (!perm)
@@ -609,13 +609,13 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up,
 
                fallthrough;
        case GIO_FONTX:
-               return do_fontx_ioctl(cmd, up, &op);
+               return do_fontx_ioctl(vc, cmd, up, &op);
 
        case PIO_FONTRESET:
                if (!perm)
                        return -EPERM;
 
-               return vt_io_fontreset(&op);
+               return vt_io_fontreset(vc, &op);
 
        case PIO_SCRNMAP:
                if (!perm)
@@ -1066,8 +1066,9 @@ struct compat_consolefontdesc {
 };
 
 static inline int
-compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
-                        int perm, struct console_font_op *op)
+compat_fontx_ioctl(struct vc_data *vc, int cmd,
+                  struct compat_consolefontdesc __user *user_cfd,
+                  int perm, struct console_font_op *op)
 {
        struct compat_consolefontdesc cfdarg;
        int i;
@@ -1085,7 +1086,8 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = compat_ptr(cfdarg.chardata);
-               return con_font_op(vc_cons[fg_console].d, op);
+               return con_font_op(vc, op);
+
        case GIO_FONTX:
                op->op = KD_FONT_OP_GET;
                op->flags = KD_FONT_FLAG_OLD;
@@ -1093,7 +1095,7 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
                op->height = cfdarg.charheight;
                op->charcount = cfdarg.charcount;
                op->data = compat_ptr(cfdarg.chardata);
-               i = con_font_op(vc_cons[fg_console].d, op);
+               i = con_font_op(vc, op);
                if (i)
                        return i;
                cfdarg.charheight = op->height;
@@ -1183,7 +1185,7 @@ long vt_compat_ioctl(struct tty_struct *tty,
         */
        case PIO_FONTX:
        case GIO_FONTX:
-               return compat_fontx_ioctl(cmd, up, perm, &op);
+               return compat_fontx_ioctl(vc, cmd, up, perm, &op);
 
        case KDFONTOP:
                return compat_kdfontop_ioctl(up, perm, &op, vc);
index 38884d6c57cdc1c7e4169ef06b14c58cd5b0caf7..95c573dcda1169d24438775fb143a94dbd1706a2 100644 (file)
@@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = {
        .set    = afs_xattr_set_acl,
 };
 
-static void yfs_acl_put(struct afs_operation *op)
-{
-       yfs_free_opaque_acl(op->yacl);
-}
-
 static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = {
        .issue_yfs_rpc  = yfs_fs_fetch_opaque_acl,
        .success        = afs_acl_success,
@@ -246,7 +241,7 @@ error:
 static const struct afs_operation_ops yfs_store_opaque_acl2_operation = {
        .issue_yfs_rpc  = yfs_fs_store_opaque_acl2,
        .success        = afs_acl_success,
-       .put            = yfs_acl_put,
+       .put            = afs_acl_put,
 };
 
 /*
index 3b1239b7e90d8cffaa957e30a507dad2b8174afd..bd787e71a657f9b683922eeb7cd2ac5b655eb620 100644 (file)
@@ -1990,6 +1990,7 @@ void yfs_fs_store_opaque_acl2(struct afs_operation *op)
        memcpy(bp, acl->data, acl->size);
        if (acl->size != size)
                memset((void *)bp + acl->size, 0, size - acl->size);
+       bp += size / sizeof(__be32);
        yfs_check_req(call, bp);
 
        trace_afs_make_fs_call(call, &vp->fid);
index 5441c17562c569e40a981e66e27554fa6a7c10cb..d98a2e5dab9fded142bd81bdea45ed5eeb2e4792 100644 (file)
@@ -1078,7 +1078,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
 out_free:
        kfree(gl->gl_lksb.sb_lvbptr);
        kmem_cache_free(cachep, gl);
-       atomic_dec(&sdp->sd_glock_disposal);
+       if (atomic_dec_and_test(&sdp->sd_glock_disposal))
+               wake_up(&sdp->sd_glock_wait);
 
 out:
        return ret;
index aa3f5236befb4d5b23a59c8f4384812118756cbb..6c1432d78dce656fc1eec8b49bece5fd452a47c9 100644 (file)
@@ -164,6 +164,31 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
                       GFS2_LFC_AIL_FLUSH);
 }
 
+/**
+ * gfs2_rgrp_metasync - sync out the metadata of a resource group
+ * @gl: the glock protecting the resource group
+ *
+ */
+
+static int gfs2_rgrp_metasync(struct gfs2_glock *gl)
+{
+       struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
+       struct address_space *metamapping = &sdp->sd_aspace;
+       struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
+       const unsigned bsize = sdp->sd_sb.sb_bsize;
+       loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
+       loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
+       int error;
+
+       filemap_fdatawrite_range(metamapping, start, end);
+       error = filemap_fdatawait_range(metamapping, start, end);
+       WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
+       mapping_set_error(metamapping, error);
+       if (error)
+               gfs2_io_error(sdp);
+       return error;
+}
+
 /**
  * rgrp_go_sync - sync out the metadata for this glock
  * @gl: the glock
@@ -176,11 +201,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
 static int rgrp_go_sync(struct gfs2_glock *gl)
 {
        struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
-       struct address_space *mapping = &sdp->sd_aspace;
        struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
-       const unsigned bsize = sdp->sd_sb.sb_bsize;
-       loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
-       loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
        int error;
 
        if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
@@ -189,10 +210,7 @@ static int rgrp_go_sync(struct gfs2_glock *gl)
 
        gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL |
                       GFS2_LFC_RGRP_GO_SYNC);
-       filemap_fdatawrite_range(mapping, start, end);
-       error = filemap_fdatawait_range(mapping, start, end);
-       WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
-       mapping_set_error(mapping, error);
+       error = gfs2_rgrp_metasync(gl);
        if (!error)
                error = gfs2_ail_empty_gl(gl);
        gfs2_free_clones(rgd);
@@ -266,7 +284,24 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip)
 }
 
 /**
- * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
+ * gfs2_inode_metasync - sync out the metadata of an inode
+ * @gl: the glock protecting the inode
+ *
+ */
+int gfs2_inode_metasync(struct gfs2_glock *gl)
+{
+       struct address_space *metamapping = gfs2_glock2aspace(gl);
+       int error;
+
+       filemap_fdatawrite(metamapping);
+       error = filemap_fdatawait(metamapping);
+       if (error)
+               gfs2_io_error(gl->gl_name.ln_sbd);
+       return error;
+}
+
+/**
+ * inode_go_sync - Sync the dirty metadata of an inode
  * @gl: the glock protecting the inode
  *
  */
@@ -297,8 +332,7 @@ static int inode_go_sync(struct gfs2_glock *gl)
                error = filemap_fdatawait(mapping);
                mapping_set_error(mapping, error);
        }
-       ret = filemap_fdatawait(metamapping);
-       mapping_set_error(metamapping, ret);
+       ret = gfs2_inode_metasync(gl);
        if (!error)
                error = ret;
        gfs2_ail_empty_gl(gl);
index 2dd192e8561825920ac24d9b4931e9f3fcc71104..695898afcaf1fbf6c9d3be048a1cfa90ce11e225 100644 (file)
@@ -22,6 +22,7 @@ extern const struct gfs2_glock_operations gfs2_quota_glops;
 extern const struct gfs2_glock_operations gfs2_journal_glops;
 extern const struct gfs2_glock_operations *gfs2_glops_list[];
 
+extern int gfs2_inode_metasync(struct gfs2_glock *gl);
 extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync);
 
 #endif /* __GLOPS_DOT_H__ */
index 6774865f5b5b5c5f8b468d85abc9cd4cb912afa4..077ccb1b3ccc6ea59c4a4963c96e39af6a4cc07a 100644 (file)
@@ -180,7 +180,8 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
                error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh);
                if (unlikely(error))
                        goto fail;
-               gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
+               if (blktype != GFS2_BLKST_UNLINKED)
+                       gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
                glock_set_object(ip->i_iopen_gh.gh_gl, ip);
                gfs2_glock_put(io_gl);
                io_gl = NULL;
index ed69298dd824a23c53cf6a83e7dad64c011ecf3c..3922b26264f5a87cec611ab2e6b01cf4827cde44 100644 (file)
@@ -22,6 +22,7 @@
 #include "incore.h"
 #include "inode.h"
 #include "glock.h"
+#include "glops.h"
 #include "log.h"
 #include "lops.h"
 #include "meta_io.h"
@@ -817,41 +818,19 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
        return error;
 }
 
-/**
- * gfs2_meta_sync - Sync all buffers associated with a glock
- * @gl: The glock
- *
- */
-
-void gfs2_meta_sync(struct gfs2_glock *gl)
-{
-       struct address_space *mapping = gfs2_glock2aspace(gl);
-       struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
-       int error;
-
-       if (mapping == NULL)
-               mapping = &sdp->sd_aspace;
-
-       filemap_fdatawrite(mapping);
-       error = filemap_fdatawait(mapping);
-
-       if (error)
-               gfs2_io_error(gl->gl_name.ln_sbd);
-}
-
 static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
 {
        struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
        struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
 
        if (error) {
-               gfs2_meta_sync(ip->i_gl);
+               gfs2_inode_metasync(ip->i_gl);
                return;
        }
        if (pass != 1)
                return;
 
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
        fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
                jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
@@ -1060,14 +1039,14 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
        struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
 
        if (error) {
-               gfs2_meta_sync(ip->i_gl);
+               gfs2_inode_metasync(ip->i_gl);
                return;
        }
        if (pass != 1)
                return;
 
        /* data sync? */
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
        fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
                jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
index 4a3d8aecdf82765a22dd655c7e8913ff8a3a289d..fbdbb08dcec6af19057a4f4181e10f2441295c11 100644 (file)
@@ -27,8 +27,6 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf);
 extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
 extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
                           struct gfs2_log_header_host *head, bool keep_cache);
-extern void gfs2_meta_sync(struct gfs2_glock *gl);
-
 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
 {
        unsigned int limit;
index 7a7e3c10a9a92947d7ef86b4dbcd3fa1f63d06ed..61fce59cb4d3839512974bc679bd1db4e7ecec87 100644 (file)
@@ -633,8 +633,10 @@ static int init_statfs(struct gfs2_sbd *sdp)
        if (IS_ERR(sdp->sd_statfs_inode)) {
                error = PTR_ERR(sdp->sd_statfs_inode);
                fs_err(sdp, "can't read in statfs inode: %d\n", error);
-               goto fail;
+               goto out;
        }
+       if (sdp->sd_args.ar_spectator)
+               goto out;
 
        pn = gfs2_lookup_simple(master, "per_node");
        if (IS_ERR(pn)) {
@@ -682,15 +684,17 @@ free_local:
        iput(pn);
 put_statfs:
        iput(sdp->sd_statfs_inode);
-fail:
+out:
        return error;
 }
 
 /* Uninitialize and free up memory used by the list of statfs inodes */
 static void uninit_statfs(struct gfs2_sbd *sdp)
 {
-       gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
-       free_local_statfs_inodes(sdp);
+       if (!sdp->sd_args.ar_spectator) {
+               gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
+               free_local_statfs_inodes(sdp);
+       }
        iput(sdp->sd_statfs_inode);
 }
 
@@ -704,7 +708,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
 
        if (undo) {
                jindex = 0;
-               goto fail_jinode_gh;
+               goto fail_statfs;
        }
 
        sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
index b5cbe21efdfb3b5608b1fb35dd8fc5329604c051..c26c68ebd29d4be67b3015838fca25068e6c0641 100644 (file)
@@ -349,7 +349,7 @@ static int update_statfs_inode(struct gfs2_jdesc *jd,
 
        mark_buffer_dirty(bh);
        brelse(bh);
-       gfs2_meta_sync(ip->i_gl);
+       gfs2_inode_metasync(ip->i_gl);
 
 out:
        return error;
index ee491bb9c1ccdcdef39bf233830cd82519f87963..92d799a193b816bbb975dbd4bdc8383e66d17632 100644 (file)
@@ -719,9 +719,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
                }
 
                gfs2_free_clones(rgd);
+               return_all_reservations(rgd);
                kfree(rgd->rd_bits);
                rgd->rd_bits = NULL;
-               return_all_reservations(rgd);
                kmem_cache_free(gfs2_rgrpd_cachep, rgd);
        }
 }
@@ -1370,6 +1370,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
+       if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
+               return -EROFS;
+
        if (!blk_queue_discard(q))
                return -EOPNOTSUPP;
 
index b285192bd6b3136e3ab40096e05ef59b16bdfb96..b3d951ab806806574bb2407c8bba1e11c05fe66a 100644 (file)
@@ -738,6 +738,7 @@ restart:
        gfs2_jindex_free(sdp);
        /*  Take apart glock structures and buffer lists  */
        gfs2_gl_hash_clear(sdp);
+       truncate_inode_pages_final(&sdp->sd_aspace);
        gfs2_delete_debugfs_file(sdp);
        /*  Unmount the locking protocol  */
        gfs2_lm_unmount(sdp);
index 0f707003dda53fb722f6566b2d3a9eb69c386d9a..b362523a9829ace0f2df2a93a2bd2e8e47a7bdd5 100644 (file)
@@ -1049,6 +1049,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
                oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
                          OOM_SCORE_ADJ_MAX;
        put_task_struct(task);
+       if (oom_adj > OOM_ADJUST_MAX)
+               oom_adj = OOM_ADJUST_MAX;
        len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
        return simple_read_from_buffer(buf, count, ppos, buffer, len);
 }
index 9197da7923361a8a4e20674e547f7f8a036b56b4..db1b0ae666c4618a4396bcb80f68d314fb22362f 100644 (file)
@@ -252,13 +252,14 @@ static inline int kunit_run_all_tests(void)
 }
 #endif /* IS_BUILTIN(CONFIG_KUNIT) */
 
+#ifdef MODULE
 /**
- * kunit_test_suites() - used to register one or more &struct kunit_suite
- *                      with KUnit.
+ * kunit_test_suites_for_module() - used to register one or more
+ *                      &struct kunit_suite with KUnit.
  *
- * @suites_list...: a statically allocated list of &struct kunit_suite.
+ * @__suites: a statically allocated list of &struct kunit_suite.
  *
- * Registers @suites_list with the test framework. See &struct kunit_suite for
+ * Registers @__suites with the test framework. See &struct kunit_suite for
  * more information.
  *
  * If a test suite is built-in, module_init() gets translated into
@@ -267,7 +268,6 @@ static inline int kunit_run_all_tests(void)
  * module_{init|exit} functions for the builtin case when registering
  * suites via kunit_test_suites() below.
  */
-#ifdef MODULE
 #define kunit_test_suites_for_module(__suites)                         \
        static int __init kunit_test_suites_init(void)                  \
        {                                                               \
@@ -294,7 +294,7 @@ static inline int kunit_run_all_tests(void)
  * kunit_test_suites() - used to register one or more &struct kunit_suite
  *                      with KUnit.
  *
- * @suites: a statically allocated list of &struct kunit_suite.
+ * @__suites: a statically allocated list of &struct kunit_suite.
  *
  * Registers @suites with the test framework. See &struct kunit_suite for
  * more information.
@@ -308,10 +308,10 @@ static inline int kunit_run_all_tests(void)
  * module.
  *
  */
-#define kunit_test_suites(...)                                         \
+#define kunit_test_suites(__suites...)                                         \
        __kunit_test_suites(__UNIQUE_ID(array),                         \
                            __UNIQUE_ID(suites),                        \
-                           __VA_ARGS__)
+                           ##__suites)
 
 #define kunit_test_suite(suite)        kunit_test_suites(&suite)
 
index b23eeca4d67729c14e95a1a2ce082922939ebfcd..794b2a33a2c36c8f4c335a9868fbccdb11d2e99a 100644 (file)
@@ -235,6 +235,8 @@ enum hctx_type {
  * @flags:        Zero or more BLK_MQ_F_* flags.
  * @driver_data:   Pointer to data owned by the block driver that created this
  *                tag set.
+ * @active_queues_shared_sbitmap:
+ *                number of active request queues per tag set.
  * @__bitmap_tags: A shared tags sbitmap, used over all hctx's
  * @__breserved_tags:
  *                A shared reserved tags sbitmap, used over all hctx's
index 900b9f4e060540ce09d5cf6cd5081fee9af733e0..fc61cf4eff1c9af159ab25a37a8041de156034ef 100644 (file)
@@ -61,21 +61,17 @@ static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
  */
 static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
 {
-       if (skb_shared(skb)) {
-               struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+       struct sk_buff *nskb;
 
-               if (likely(nskb)) {
-                       can_skb_set_owner(nskb, skb->sk);
-                       consume_skb(skb);
-                       return nskb;
-               } else {
-                       kfree_skb(skb);
-                       return NULL;
-               }
+       nskb = skb_clone(skb, GFP_ATOMIC);
+       if (unlikely(!nskb)) {
+               kfree_skb(skb);
+               return NULL;
        }
 
-       /* we can assume to have an unshared skb with proper owner */
-       return skb;
+       can_skb_set_owner(nskb, skb->sk);
+       consume_skb(skb);
+       return nskb;
 }
 
 #endif /* !_CAN_SKB_H */
index ef360fe70aafcf6d2e40bc5b89a4cd0fc82a1bc9..db6ae4d3fb4edc82ad0c7ccf80eac47726862b20 100644 (file)
@@ -2759,6 +2759,15 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma,
        return VM_FAULT_NOPAGE;
 }
 
+#ifndef io_remap_pfn_range
+static inline int io_remap_pfn_range(struct vm_area_struct *vma,
+                                    unsigned long addr, unsigned long pfn,
+                                    unsigned long size, pgprot_t prot)
+{
+       return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot));
+}
+#endif
+
 static inline vm_fault_t vmf_error(int err)
 {
        if (err == -ENOMEM)
index 89016d08f6a278d9a7703cc4256c277f05fa7173..f6267e2883f261e0bd533a349759fad1b7e8d656 100644 (file)
@@ -24,6 +24,12 @@ struct nfnl_callback {
        const u_int16_t attr_count;             /* number of nlattr's */
 };
 
+enum nfnl_abort_action {
+       NFNL_ABORT_NONE         = 0,
+       NFNL_ABORT_AUTOLOAD,
+       NFNL_ABORT_VALIDATE,
+};
+
 struct nfnetlink_subsystem {
        const char *name;
        __u8 subsys_id;                 /* nfnetlink subsystem ID */
@@ -31,7 +37,8 @@ struct nfnetlink_subsystem {
        const struct nfnl_callback *cb; /* callback for individual types */
        struct module *owner;
        int (*commit)(struct net *net, struct sk_buff *skb);
-       int (*abort)(struct net *net, struct sk_buff *skb, bool autoload);
+       int (*abort)(struct net *net, struct sk_buff *skb,
+                    enum nfnl_abort_action action);
        void (*cleanup)(struct net *net);
        bool (*valid_genid)(struct net *net, u32 genid);
 };
index 082e2c41b7ff90a8e03c55f2f78c4d1129345760..5b70ca868bb1907165cc68b364534849a3a37f0c 100644 (file)
@@ -16,7 +16,7 @@ struct ip_rt_info {
        u_int32_t mark;
 };
 
-int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned addr_type);
+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type);
 
 struct nf_queue_entry;
 
index 9b67394471e1c63462327d5cefdd7ab2701e0acf..48314ade1506f2108e32a56a9bab93599ba67152 100644 (file)
@@ -42,7 +42,7 @@ struct nf_ipv6_ops {
 #if IS_MODULE(CONFIG_IPV6)
        int (*chk_addr)(struct net *net, const struct in6_addr *addr,
                        const struct net_device *dev, int strict);
-       int (*route_me_harder)(struct net *net, struct sk_buff *skb);
+       int (*route_me_harder)(struct net *net, struct sock *sk, struct sk_buff *skb);
        int (*dev_get_saddr)(struct net *net, const struct net_device *dev,
                       const struct in6_addr *daddr, unsigned int srcprefs,
                       struct in6_addr *saddr);
@@ -143,9 +143,9 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk,
 #endif
 }
 
-int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
+int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);
 
-static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
+static inline int nf_ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
 #if IS_MODULE(CONFIG_IPV6)
        const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
@@ -153,9 +153,9 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
        if (!v6_ops)
                return -EHOSTUNREACH;
 
-       return v6_ops->route_me_harder(net, skb);
+       return v6_ops->route_me_harder(net, sk, skb);
 #elif IS_BUILTIN(CONFIG_IPV6)
-       return ip6_route_me_harder(net, skb);
+       return ip6_route_me_harder(net, sk, skb);
 #else
        return -EHOSTUNREACH;
 #endif
index c77b7c31b2e49563a5c5d853bbd9c55cc725a29b..e1e19c1f9ec9a34f449028b43f0008f9507c4b60 100644 (file)
@@ -344,9 +344,9 @@ static inline struct page *find_get_page_flags(struct address_space *mapping,
 /**
  * find_lock_page - locate, pin and lock a pagecache page
  * @mapping: the address_space to search
- * @offset: the page index
+ * @index: the page index
  *
- * Looks up the page cache entry at @mapping & @offset.  If there is a
+ * Looks up the page cache entry at @mapping & @index.  If there is a
  * page cache page, it is returned locked and with an increased
  * refcount.
  *
@@ -363,9 +363,9 @@ static inline struct page *find_lock_page(struct address_space *mapping,
 /**
  * find_lock_head - Locate, pin and lock a pagecache page.
  * @mapping: The address_space to search.
- * @offset: The page index.
+ * @index: The page index.
  *
- * Looks up the page cache entry at @mapping & @offset.  If there is a
+ * Looks up the page cache entry at @mapping & @index.  If there is a
  * page cache page, its head page is returned locked and with an increased
  * refcount.
  *
index 38c33eabea8942bb09e09d4976f0203d61f70246..71125a4676c4a65cc6d9a67f31c0e3a1e11c0438 100644 (file)
@@ -1427,10 +1427,6 @@ typedef unsigned int pgtbl_mod_mask;
 
 #endif /* !__ASSEMBLY__ */
 
-#ifndef io_remap_pfn_range
-#define io_remap_pfn_range remap_pfn_range
-#endif
-
 #ifndef has_transparent_hugepage
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #define has_transparent_hugepage() 1
index eb3cb1a98b450267b248d51d90de46b8883aca10..56563e5e0dc7513706bb6a856cf671d1f099c044 100644 (file)
@@ -147,16 +147,8 @@ typedef enum {
        PHY_INTERFACE_MODE_MAX,
 } phy_interface_t;
 
-/**
+/*
  * phy_supported_speeds - return all speeds currently supported by a PHY device
- * @phy: The PHY device to return supported speeds of.
- * @speeds: buffer to store supported speeds in.
- * @size: size of speeds buffer.
- *
- * Description: Returns the number of supported speeds, and fills
- * the speeds buffer with the supported speeds. If speeds buffer is
- * too small to contain all currently supported speeds, will return as
- * many speeds as can fit.
  */
 unsigned int phy_supported_speeds(struct phy_device *phy,
                                      unsigned int *speeds,
@@ -1022,14 +1014,9 @@ static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum,
                                        regnum, mask, set);
 }
 
-/**
+/*
  * phy_read_mmd - Convenience function for reading a register
  * from an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to read from
- * @regnum: The register on the MMD to read
- *
- * Same rules as for phy_read();
  */
 int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
 
@@ -1064,38 +1051,21 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
        __ret; \
 })
 
-/**
+/*
  * __phy_read_mmd - Convenience function for reading a register
  * from an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to read from
- * @regnum: The register on the MMD to read
- *
- * Same rules as for __phy_read();
  */
 int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
 
-/**
+/*
  * phy_write_mmd - Convenience function for writing a register
  * on an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to write to
- * @regnum: The register on the MMD to read
- * @val: value to write to @regnum
- *
- * Same rules as for phy_write();
  */
 int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
 
-/**
+/*
  * __phy_write_mmd - Convenience function for writing a register
  * on an MMD on a given PHY.
- * @phydev: The phy_device struct
- * @devad: The MMD to write to
- * @regnum: The register on the MMD to read
- * @val: value to write to @regnum
- *
- * Same rules as for __phy_write();
  */
 int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
 
index 18b02dcc168e54fb1036877d55f2c1e6a42fae0d..4b708f4e8eed9df4d7f98ddcc8482f97dba63d2f 100644 (file)
@@ -54,11 +54,10 @@ extern u64 pm_runtime_autosuspend_expiration(struct device *dev);
 extern void pm_runtime_update_max_time_suspended(struct device *dev,
                                                 s64 delta_ns);
 extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
-extern void pm_runtime_clean_up_links(struct device *dev);
 extern void pm_runtime_get_suppliers(struct device *dev);
 extern void pm_runtime_put_suppliers(struct device *dev);
 extern void pm_runtime_new_link(struct device *dev);
-extern void pm_runtime_drop_link(struct device *dev);
+extern void pm_runtime_drop_link(struct device_link *link);
 
 /**
  * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter.
@@ -276,11 +275,10 @@ static inline u64 pm_runtime_autosuspend_expiration(
                                struct device *dev) { return 0; }
 static inline void pm_runtime_set_memalloc_noio(struct device *dev,
                                                bool enable){}
-static inline void pm_runtime_clean_up_links(struct device *dev) {}
 static inline void pm_runtime_get_suppliers(struct device *dev) {}
 static inline void pm_runtime_put_suppliers(struct device *dev) {}
 static inline void pm_runtime_new_link(struct device *dev) {}
-static inline void pm_runtime_drop_link(struct device *dev) {}
+static inline void pm_runtime_drop_link(struct device_link *link) {}
 
 #endif /* !CONFIG_PM */
 
index 7fabb1af18e042e2aa126f132eed2d5a4d994e43..497990c69b0bf1352d47ecf7a79e30ff5cc71090 100644 (file)
@@ -147,24 +147,6 @@ static inline unsigned int refcount_read(const refcount_t *r)
        return atomic_read(&r->refs);
 }
 
-/**
- * refcount_add_not_zero - add a value to a refcount unless it is 0
- * @i: the value to add to the refcount
- * @r: the refcount
- *
- * Will saturate at REFCOUNT_SATURATED and WARN.
- *
- * Provides no memory ordering, it is assumed the caller has guaranteed the
- * object memory to be stable (RCU, etc.). It does provide a control dependency
- * and thereby orders future stores. See the comment on top.
- *
- * Use of this function is not recommended for the normal reference counting
- * use case in which references are taken and released one at a time.  In these
- * cases, refcount_inc(), or one of its variants, should instead be used to
- * increment a reference count.
- *
- * Return: false if the passed refcount is 0, true otherwise
- */
 static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp)
 {
        int old = refcount_read(r);
@@ -183,17 +165,12 @@ static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, in
        return old;
 }
 
-static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
-{
-       return __refcount_add_not_zero(i, r, NULL);
-}
-
 /**
- * refcount_add - add a value to a refcount
+ * refcount_add_not_zero - add a value to a refcount unless it is 0
  * @i: the value to add to the refcount
  * @r: the refcount
  *
- * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
+ * Will saturate at REFCOUNT_SATURATED and WARN.
  *
  * Provides no memory ordering, it is assumed the caller has guaranteed the
  * object memory to be stable (RCU, etc.). It does provide a control dependency
@@ -203,7 +180,14 @@ static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
  * use case in which references are taken and released one at a time.  In these
  * cases, refcount_inc(), or one of its variants, should instead be used to
  * increment a reference count.
+ *
+ * Return: false if the passed refcount is 0, true otherwise
  */
+static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
+{
+       return __refcount_add_not_zero(i, r, NULL);
+}
+
 static inline void __refcount_add(int i, refcount_t *r, int *oldp)
 {
        int old = atomic_fetch_add_relaxed(i, &r->refs);
@@ -217,11 +201,32 @@ static inline void __refcount_add(int i, refcount_t *r, int *oldp)
                refcount_warn_saturate(r, REFCOUNT_ADD_OVF);
 }
 
+/**
+ * refcount_add - add a value to a refcount
+ * @i: the value to add to the refcount
+ * @r: the refcount
+ *
+ * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
+ *
+ * Provides no memory ordering, it is assumed the caller has guaranteed the
+ * object memory to be stable (RCU, etc.). It does provide a control dependency
+ * and thereby orders future stores. See the comment on top.
+ *
+ * Use of this function is not recommended for the normal reference counting
+ * use case in which references are taken and released one at a time.  In these
+ * cases, refcount_inc(), or one of its variants, should instead be used to
+ * increment a reference count.
+ */
 static inline void refcount_add(int i, refcount_t *r)
 {
        __refcount_add(i, r, NULL);
 }
 
+static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
+{
+       return __refcount_add_not_zero(1, r, oldp);
+}
+
 /**
  * refcount_inc_not_zero - increment a refcount unless it is 0
  * @r: the refcount to increment
@@ -235,14 +240,14 @@ static inline void refcount_add(int i, refcount_t *r)
  *
  * Return: true if the increment was successful, false otherwise
  */
-static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
+static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
 {
-       return __refcount_add_not_zero(1, r, oldp);
+       return __refcount_inc_not_zero(r, NULL);
 }
 
-static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
+static inline void __refcount_inc(refcount_t *r, int *oldp)
 {
-       return __refcount_inc_not_zero(r, NULL);
+       __refcount_add(1, r, oldp);
 }
 
 /**
@@ -257,14 +262,27 @@ static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
  * Will WARN if the refcount is 0, as this represents a possible use-after-free
  * condition.
  */
-static inline void __refcount_inc(refcount_t *r, int *oldp)
+static inline void refcount_inc(refcount_t *r)
 {
-       __refcount_add(1, r, oldp);
+       __refcount_inc(r, NULL);
 }
 
-static inline void refcount_inc(refcount_t *r)
+static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
 {
-       __refcount_inc(r, NULL);
+       int old = atomic_fetch_sub_release(i, &r->refs);
+
+       if (oldp)
+               *oldp = old;
+
+       if (old == i) {
+               smp_acquire__after_ctrl_dep();
+               return true;
+       }
+
+       if (unlikely(old < 0 || old - i < 0))
+               refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
+
+       return false;
 }
 
 /**
@@ -287,27 +305,14 @@ static inline void refcount_inc(refcount_t *r)
  *
  * Return: true if the resulting refcount is 0, false otherwise
  */
-static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
+static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
 {
-       int old = atomic_fetch_sub_release(i, &r->refs);
-
-       if (oldp)
-               *oldp = old;
-
-       if (old == i) {
-               smp_acquire__after_ctrl_dep();
-               return true;
-       }
-
-       if (unlikely(old < 0 || old - i < 0))
-               refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
-
-       return false;
+       return __refcount_sub_and_test(i, r, NULL);
 }
 
-static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
+static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
 {
-       return __refcount_sub_and_test(i, r, NULL);
+       return __refcount_sub_and_test(1, r, oldp);
 }
 
 /**
@@ -323,26 +328,11 @@ static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
  *
  * Return: true if the resulting refcount is 0, false otherwise
  */
-static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
-{
-       return __refcount_sub_and_test(1, r, oldp);
-}
-
 static inline __must_check bool refcount_dec_and_test(refcount_t *r)
 {
        return __refcount_dec_and_test(r, NULL);
 }
 
-/**
- * refcount_dec - decrement a refcount
- * @r: the refcount
- *
- * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
- * when saturated at REFCOUNT_SATURATED.
- *
- * Provides release memory ordering, such that prior loads and stores are done
- * before.
- */
 static inline void __refcount_dec(refcount_t *r, int *oldp)
 {
        int old = atomic_fetch_sub_release(1, &r->refs);
@@ -354,6 +344,16 @@ static inline void __refcount_dec(refcount_t *r, int *oldp)
                refcount_warn_saturate(r, REFCOUNT_DEC_LEAK);
 }
 
+/**
+ * refcount_dec - decrement a refcount
+ * @r: the refcount
+ *
+ * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
+ * when saturated at REFCOUNT_SATURATED.
+ *
+ * Provides release memory ordering, such that prior loads and stores are done
+ * before.
+ */
 static inline void refcount_dec(refcount_t *r)
 {
        __refcount_dec(r, NULL);
index 661edfc8722e1cf205cceb836a851de40210e1a8..d5ab8d99739f1e3c2acf90f86fd6966d2df4c96d 100644 (file)
@@ -1444,7 +1444,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
                                  enum cfg80211_station_type statype);
 
 /**
- * enum station_info_rate_flags - bitrate info flags
+ * enum rate_info_flags - bitrate info flags
  *
  * Used by the driver to indicate the specific rate transmission
  * type for 802.11n transmissions.
@@ -1517,7 +1517,7 @@ struct rate_info {
 };
 
 /**
- * enum station_info_rate_flags - bitrate info flags
+ * enum bss_param_flags - bitrate info flags
  *
  * Used by the driver to indicate the specific rate transmission
  * type for 802.11n transmissions.
@@ -6467,7 +6467,8 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
                          struct ieee80211_channel *channel, gfp_t gfp);
 
 /**
- * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
+ * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
+ *                                     candidate
  *
  * @dev: network device
  * @macaddr: the MAC address of the new candidate
@@ -7606,7 +7607,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
 
 /**
- * struct cfg80211_ft_event - FT Information Elements
+ * struct cfg80211_ft_event_params - FT Information Elements
  * @ies: FT IEs
  * @ies_len: length of the FT IE in bytes
  * @target_ap: target AP's MAC address
index e8e295dae744e4dc8d86182d193e0e387206a6e9..dcdba96814a2bf59dab074668ad632c6bc814566 100644 (file)
@@ -3311,7 +3311,7 @@ enum ieee80211_roc_type {
 };
 
 /**
- * enum ieee80211_reconfig_complete_type - reconfig type
+ * enum ieee80211_reconfig_type - reconfig type
  *
  * This enum is used by the reconfig_complete() callback to indicate what
  * reconfiguration type was completed.
@@ -6334,7 +6334,8 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
                              int band, struct ieee80211_sta **sta);
 
 /**
- * Sanity-check and parse the radiotap header of injected frames
+ * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
+ *                              of injected frames
  * @skb: packet injected by userspace
  * @dev: the &struct device of this 802.11 device
  */
@@ -6389,7 +6390,7 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
 void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
 
 /**
- * ieee80211_tdls_oper - request userspace to perform a TDLS operation
+ * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
  * @vif: virtual interface
  * @peer: the peer's destination address
  * @oper: the requested TDLS operation
index c1661febc2dc4841304bb678e235475b79fa8ec1..0564fd7ccde4180da7911f473bf2e26f04c2051e 100644 (file)
@@ -138,6 +138,7 @@ struct icmp6hdr {
 #define ICMPV6_HDR_FIELD               0
 #define ICMPV6_UNK_NEXTHDR             1
 #define ICMPV6_UNK_OPTION              2
+#define ICMPV6_HDR_INCOMP              3
 
 /*
  *     constants for (set|get)sockopt
index ce76f490126cccb310750c6b32f2a7b67bd5eb60..396ebaebea3fea3578fe295c73cf041530a91d93 100644 (file)
@@ -225,8 +225,7 @@ static long hung_timeout_jiffies(unsigned long last_checked,
  * Process updating of timeout sysctl
  */
 int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
-                                 void __user *buffer,
-                                 size_t *lenp, loff_t *ppos)
+                                 void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret;
 
index 8a12a25fa40d5e1c12303a6d395949d0ad4c135d..41fdbb7953c60f878049b2a5807abb4aecf95320 100644 (file)
@@ -1249,7 +1249,13 @@ __acquires(hlist_lock)
 
        *head = &kretprobe_inst_table[hash];
        hlist_lock = kretprobe_table_lock_ptr(hash);
-       raw_spin_lock_irqsave(hlist_lock, *flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        * Differentiate when it is taken in NMI context.
+        */
+       raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
 }
 NOKPROBE_SYMBOL(kretprobe_hash_lock);
 
@@ -1258,7 +1264,13 @@ static void kretprobe_table_lock(unsigned long hash,
 __acquires(hlist_lock)
 {
        raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
-       raw_spin_lock_irqsave(hlist_lock, *flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        * Differentiate when it is taken in NMI context.
+        */
+       raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
 }
 NOKPROBE_SYMBOL(kretprobe_table_lock);
 
@@ -2028,7 +2040,12 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
 
        /* TODO: consider to only swap the RA after the last pre_handler fired */
        hash = hash_ptr(current, KPROBE_HASH_BITS);
-       raw_spin_lock_irqsave(&rp->lock, flags);
+       /*
+        * Nested is a workaround that will soon not be needed.
+        * There's other protections that make sure the same lock
+        * is not taken on the same CPU that lockdep is unaware of.
+        */
+       raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
        if (!hlist_empty(&rp->free_instances)) {
                ri = hlist_entry(rp->free_instances.first,
                                struct kretprobe_instance, hlist);
@@ -2039,7 +2056,7 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
                ri->task = current;
 
                if (rp->entry_handler && rp->entry_handler(ri, regs)) {
-                       raw_spin_lock_irqsave(&rp->lock, flags);
+                       raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
                        hlist_add_head(&ri->hlist, &rp->free_instances);
                        raw_spin_unlock_irqrestore(&rp->lock, flags);
                        return 0;
index e29773c82b70c26fff598f864642f7dee010efab..933a625621b8dbef0564919bf6f76aa30735372f 100644 (file)
@@ -897,7 +897,8 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
        /* Move the work from worker->delayed_work_list. */
        WARN_ON_ONCE(list_empty(&work->node));
        list_del_init(&work->node);
-       kthread_insert_work(worker, work, &worker->work_list);
+       if (!work->canceling)
+               kthread_insert_work(worker, work, &worker->work_list);
 
        raw_spin_unlock_irqrestore(&worker->lock, flags);
 }
index c03a5775d019ecf23c5164a02e148358ab86bcf7..d73bccde2720bcb7563dc6427692c0ab631c1bf3 100644 (file)
@@ -102,9 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
                                   unsigned int next_freq)
 {
-       if (sg_policy->next_freq == next_freq &&
-           !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
-               return false;
+       if (!sg_policy->need_freq_update) {
+               if (sg_policy->next_freq == next_freq)
+                       return false;
+       } else {
+               sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
+       }
 
        sg_policy->next_freq = next_freq;
        sg_policy->last_freq_update_time = time;
@@ -162,11 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
 
        freq = map_util_freq(util, freq, max);
 
-       if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update &&
-           !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
+       if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
                return sg_policy->next_freq;
 
-       sg_policy->need_freq_update = false;
        sg_policy->cached_raw_freq = freq;
        return cpufreq_driver_resolve_freq(policy, freq);
 }
@@ -442,7 +443,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
        struct sugov_policy *sg_policy = sg_cpu->sg_policy;
        unsigned long util, max;
        unsigned int next_f;
-       bool busy;
        unsigned int cached_freq = sg_policy->cached_raw_freq;
 
        sugov_iowait_boost(sg_cpu, time, flags);
@@ -453,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
        if (!sugov_should_update_freq(sg_policy, time))
                return;
 
-       /* Limits may have changed, don't skip frequency update */
-       busy = !sg_policy->need_freq_update && sugov_cpu_is_busy(sg_cpu);
-
        util = sugov_get_util(sg_cpu);
        max = sg_cpu->max;
        util = sugov_iowait_apply(sg_cpu, time, util, max);
@@ -464,7 +461,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
         * Do not reduce the frequency if the CPU has not been idle
         * recently, as the reduction is likely to be premature then.
         */
-       if (busy && next_f < sg_policy->next_freq) {
+       if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
                next_f = sg_policy->next_freq;
 
                /* Restore cached freq as next_freq has changed */
@@ -829,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy)
        sg_policy->next_freq                    = 0;
        sg_policy->work_in_progress             = false;
        sg_policy->limits_changed               = false;
-       sg_policy->need_freq_update             = false;
        sg_policy->cached_raw_freq              = 0;
 
+       sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
+
        for_each_cpu(cpu, policy->cpus) {
                struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
 
index a38b3edc68511c3419a68b96d9867f000bb18d83..ef8f2a28d37c525b0994701448c026469a533259 100644 (file)
@@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task)
 
 void task_join_group_stop(struct task_struct *task)
 {
+       unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK;
+       struct signal_struct *sig = current->signal;
+
+       if (sig->group_stop_count) {
+               sig->group_stop_count++;
+               mask |= JOBCTL_STOP_CONSUME;
+       } else if (!(sig->flags & SIGNAL_STOP_STOPPED))
+               return;
+
        /* Have the new thread join an on-going signal group stop */
-       unsigned long jobctl = current->jobctl;
-       if (jobctl & JOBCTL_STOP_PENDING) {
-               struct signal_struct *sig = current->signal;
-               unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK;
-               unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME;
-               if (task_set_jobctl_pending(task, signr | gstop)) {
-                       sig->group_stop_count++;
-               }
-       }
+       task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING);
 }
 
 /*
index 7f45fd9d5a4504286176045051c6ef73806abfb7..dc83b3fa9fe7498885205cd234a163b1ffd375ed 100644 (file)
@@ -438,14 +438,16 @@ enum {
 };
 /*
  * Used for which event context the event is in.
- *  NMI     = 0
- *  IRQ     = 1
- *  SOFTIRQ = 2
- *  NORMAL  = 3
+ *  TRANSITION = 0
+ *  NMI     = 1
+ *  IRQ     = 2
+ *  SOFTIRQ = 3
+ *  NORMAL  = 4
  *
  * See trace_recursive_lock() comment below for more details.
  */
 enum {
+       RB_CTX_TRANSITION,
        RB_CTX_NMI,
        RB_CTX_IRQ,
        RB_CTX_SOFTIRQ,
@@ -3014,10 +3016,10 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
  * a bit of overhead in something as critical as function tracing,
  * we use a bitmask trick.
  *
- *  bit 0 =  NMI context
- *  bit 1 =  IRQ context
- *  bit 2 =  SoftIRQ context
- *  bit 3 =  normal context.
+ *  bit 1 =  NMI context
+ *  bit 2 =  IRQ context
+ *  bit 3 =  SoftIRQ context
+ *  bit 4 =  normal context.
  *
  * This works because this is the order of contexts that can
  * preempt other contexts. A SoftIRQ never preempts an IRQ
@@ -3040,6 +3042,30 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer)
  * The least significant bit can be cleared this way, and it
  * just so happens that it is the same bit corresponding to
  * the current context.
+ *
+ * Now the TRANSITION bit breaks the above slightly. The TRANSITION bit
+ * is set when a recursion is detected at the current context, and if
+ * the TRANSITION bit is already set, it will fail the recursion.
+ * This is needed because there's a lag between the changing of
+ * interrupt context and updating the preempt count. In this case,
+ * a false positive will be found. To handle this, one extra recursion
+ * is allowed, and this is done by the TRANSITION bit. If the TRANSITION
+ * bit is already set, then it is considered a recursion and the function
+ * ends. Otherwise, the TRANSITION bit is set, and that bit is returned.
+ *
+ * On the trace_recursive_unlock(), the TRANSITION bit will be the first
+ * to be cleared. Even if it wasn't the context that set it. That is,
+ * if an interrupt comes in while NORMAL bit is set and the ring buffer
+ * is called before preempt_count() is updated, since the check will
+ * be on the NORMAL bit, the TRANSITION bit will then be set. If an
+ * NMI then comes in, it will set the NMI bit, but when the NMI code
+ * does the trace_recursive_unlock() it will clear the TRANSTION bit
+ * and leave the NMI bit set. But this is fine, because the interrupt
+ * code that set the TRANSITION bit will then clear the NMI bit when it
+ * calls trace_recursive_unlock(). If another NMI comes in, it will
+ * set the TRANSITION bit and continue.
+ *
+ * Note: The TRANSITION bit only handles a single transition between context.
  */
 
 static __always_inline int
@@ -3055,8 +3081,16 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer)
                bit = pc & NMI_MASK ? RB_CTX_NMI :
                        pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ;
 
-       if (unlikely(val & (1 << (bit + cpu_buffer->nest))))
-               return 1;
+       if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) {
+               /*
+                * It is possible that this was called by transitioning
+                * between interrupt context, and preempt_count() has not
+                * been updated yet. In this case, use the TRANSITION bit.
+                */
+               bit = RB_CTX_TRANSITION;
+               if (val & (1 << (bit + cpu_buffer->nest)))
+                       return 1;
+       }
 
        val |= (1 << (bit + cpu_buffer->nest));
        cpu_buffer->current_context = val;
@@ -3071,8 +3105,8 @@ trace_recursive_unlock(struct ring_buffer_per_cpu *cpu_buffer)
                cpu_buffer->current_context - (1 << cpu_buffer->nest);
 }
 
-/* The recursive locking above uses 4 bits */
-#define NESTED_BITS 4
+/* The recursive locking above uses 5 bits */
+#define NESTED_BITS 5
 
 /**
  * ring_buffer_nest_start - Allow to trace while nested
index 528971714fc65d30346c6fb0f4d2d05b0457f1a3..410cfeb16db518b4032b7fc997650adb0d8751dd 100644 (file)
@@ -2750,7 +2750,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
        /*
         * If tracing is off, but we have triggers enabled
         * we still need to look at the event data. Use the temp_buffer
-        * to store the trace event for the tigger to use. It's recusive
+        * to store the trace event for the trigger to use. It's recursive
         * safe and will not be recorded anywhere.
         */
        if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) {
@@ -2952,7 +2952,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
        stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1;
 
        /* This should never happen. If it does, yell once and skip */
-       if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING))
+       if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING))
                goto out;
 
        /*
@@ -3132,7 +3132,7 @@ static char *get_trace_buf(void)
 
        /* Interrupts must see nesting incremented before we use the buffer */
        barrier();
-       return &buffer->buffer[buffer->nesting][0];
+       return &buffer->buffer[buffer->nesting - 1][0];
 }
 
 static void put_trace_buf(void)
index f3f5e77123ad75d284fd99d7a3bf6e4e43386f39..1dadef445cd1e860cc68142fe8a6e657eae81fff 100644 (file)
@@ -637,6 +637,12 @@ enum {
         * function is called to clear it.
         */
        TRACE_GRAPH_NOTRACE_BIT,
+
+       /*
+        * When transitioning between context, the preempt_count() may
+        * not be correct. Allow for a single recursion to cover this case.
+        */
+       TRACE_TRANSITION_BIT,
 };
 
 #define trace_recursion_set(bit)       do { (current)->trace_recursion |= (1<<(bit)); } while (0)
@@ -691,14 +697,27 @@ static __always_inline int trace_test_and_set_recursion(int start, int max)
                return 0;
 
        bit = trace_get_context_bit() + start;
-       if (unlikely(val & (1 << bit)))
-               return -1;
+       if (unlikely(val & (1 << bit))) {
+               /*
+                * It could be that preempt_count has not been updated during
+                * a switch between contexts. Allow for a single recursion.
+                */
+               bit = TRACE_TRANSITION_BIT;
+               if (trace_recursion_test(bit))
+                       return -1;
+               trace_recursion_set(bit);
+               barrier();
+               return bit + 1;
+       }
+
+       /* Normal check passed, clear the transition to allow it again */
+       trace_recursion_clear(TRACE_TRANSITION_BIT);
 
        val |= 1 << bit;
        current->trace_recursion = val;
        barrier();
 
-       return bit;
+       return bit + 1;
 }
 
 static __always_inline void trace_clear_recursion(int bit)
@@ -708,6 +727,7 @@ static __always_inline void trace_clear_recursion(int bit)
        if (!bit)
                return;
 
+       bit--;
        bit = 1 << bit;
        val &= ~bit;
 
index 84b7cab55291dada1c710045e71fc6221cce73fc..881df991742ab18c3f38fbf86886e4ef5a6fec62 100644 (file)
@@ -584,7 +584,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
 {
        struct synth_field *field;
        const char *prefix = NULL, *field_type = argv[0], *field_name, *array;
-       int len, ret = 0;
+       int len, ret = -ENOMEM;
        struct seq_buf s;
        ssize_t size;
 
@@ -617,10 +617,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
                len--;
 
        field->name = kmemdup_nul(field_name, len, GFP_KERNEL);
-       if (!field->name) {
-               ret = -ENOMEM;
+       if (!field->name)
                goto free;
-       }
+
        if (!is_good_name(field->name)) {
                synth_err(SYNTH_ERR_BAD_NAME, errpos(field_name));
                ret = -EINVAL;
@@ -638,10 +637,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
                len += strlen(prefix);
 
        field->type = kzalloc(len, GFP_KERNEL);
-       if (!field->type) {
-               ret = -ENOMEM;
+       if (!field->type)
                goto free;
-       }
+
        seq_buf_init(&s, field->type, len);
        if (prefix)
                seq_buf_puts(&s, prefix);
@@ -653,6 +651,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
        }
        if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
                goto free;
+
        s.buffer[s.len] = '\0';
 
        size = synth_field_size(field->type);
@@ -666,10 +665,8 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
 
                        len = sizeof("__data_loc ") + strlen(field->type) + 1;
                        type = kzalloc(len, GFP_KERNEL);
-                       if (!type) {
-                               ret = -ENOMEM;
+                       if (!type)
                                goto free;
-                       }
 
                        seq_buf_init(&s, type, len);
                        seq_buf_puts(&s, "__data_loc ");
index b5e3496cf8033df69a33307db09a8bd0f34bca2e..4738ad48a66740fb72d77872a34b58f0a41f98f3 100644 (file)
@@ -492,8 +492,13 @@ trace_selftest_function_recursion(void)
        unregister_ftrace_function(&test_rec_probe);
 
        ret = -1;
-       if (trace_selftest_recursion_cnt != 1) {
-               pr_cont("*callback not called once (%d)* ",
+       /*
+        * Recursion allows for transitions between context,
+        * and may call the callback twice.
+        */
+       if (trace_selftest_recursion_cnt != 1 &&
+           trace_selftest_recursion_cnt != 2) {
+               pr_cont("*callback not called once (or twice) (%d)* ",
                        trace_selftest_recursion_cnt);
                goto out;
        }
index 97d6a57cefcc5d281a7c75e8fff8ae4bdbac1a05..61ddce2cff77749e254188ed07e339a4812274dd 100644 (file)
@@ -683,7 +683,6 @@ static int __init crc32c_test(void)
 
        /* reduce OS noise */
        local_irq_save(flags);
-       local_irq_disable();
 
        nsec = ktime_get_ns();
        for (i = 0; i < 100; i++) {
@@ -694,7 +693,6 @@ static int __init crc32c_test(void)
        nsec = ktime_get_ns() - nsec;
 
        local_irq_restore(flags);
-       local_irq_enable();
 
        pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS);
 
@@ -768,7 +766,6 @@ static int __init crc32_test(void)
 
        /* reduce OS noise */
        local_irq_save(flags);
-       local_irq_disable();
 
        nsec = ktime_get_ns();
        for (i = 0; i < 100; i++) {
@@ -783,7 +780,6 @@ static int __init crc32_test(void)
        nsec = ktime_get_ns() - nsec;
 
        local_irq_restore(flags);
-       local_irq_enable();
 
        pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n",
                 CRC_LE_BITS, CRC_BE_BITS);
index 63c26171a791cf69bc223865a9ea49e25a886f61..662f862702fc8da9f3180adc48636360c6edad71 100644 (file)
@@ -216,6 +216,12 @@ static void kmalloc_oob_16(struct kunit *test)
                u64 words[2];
        } *ptr1, *ptr2;
 
+       /* This test is specifically crafted for the generic mode. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
+               return;
+       }
+
        ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
 
@@ -227,6 +233,23 @@ static void kmalloc_oob_16(struct kunit *test)
        kfree(ptr2);
 }
 
+static void kmalloc_uaf_16(struct kunit *test)
+{
+       struct {
+               u64 words[2];
+       } *ptr1, *ptr2;
+
+       ptr1 = kmalloc(sizeof(*ptr1), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
+
+       ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
+       kfree(ptr2);
+
+       KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2);
+       kfree(ptr1);
+}
+
 static void kmalloc_oob_memset_2(struct kunit *test)
 {
        char *ptr;
@@ -429,6 +452,12 @@ static void kasan_global_oob(struct kunit *test)
        volatile int i = 3;
        char *p = &global_array[ARRAY_SIZE(global_array) + i];
 
+       /* Only generic mode instruments globals. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        KUNIT_EXPECT_KASAN_FAIL(test, *(volatile char *)p);
 }
 
@@ -467,6 +496,12 @@ static void kasan_alloca_oob_left(struct kunit *test)
        char alloca_array[i];
        char *p = alloca_array - 1;
 
+       /* Only generic mode instruments dynamic allocas. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
                kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
                return;
@@ -481,6 +516,12 @@ static void kasan_alloca_oob_right(struct kunit *test)
        char alloca_array[i];
        char *p = alloca_array + i;
 
+       /* Only generic mode instruments dynamic allocas. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required");
+               return;
+       }
+
        if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
                kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
                return;
@@ -551,6 +592,9 @@ static void kasan_memchr(struct kunit *test)
                return;
        }
 
+       if (OOB_TAG_OFF)
+               size = round_up(size, OOB_TAG_OFF);
+
        ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
 
@@ -573,6 +617,9 @@ static void kasan_memcmp(struct kunit *test)
                return;
        }
 
+       if (OOB_TAG_OFF)
+               size = round_up(size, OOB_TAG_OFF);
+
        ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
        memset(arr, 0, sizeof(arr));
@@ -619,13 +666,50 @@ static void kasan_strings(struct kunit *test)
        KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = strnlen(ptr, 1));
 }
 
-static void kasan_bitops(struct kunit *test)
+static void kasan_bitops_modify(struct kunit *test, int nr, void *addr)
+{
+       KUNIT_EXPECT_KASAN_FAIL(test, set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(nr, addr));
+}
+
+static void kasan_bitops_test_and_modify(struct kunit *test, int nr, void *addr)
+{
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_set_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit_lock(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_clear_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, test_and_change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, __test_and_change_bit(nr, addr));
+       KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = test_bit(nr, addr));
+
+#if defined(clear_bit_unlock_is_negative_byte)
+       KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result =
+                               clear_bit_unlock_is_negative_byte(nr, addr));
+#endif
+}
+
+static void kasan_bitops_generic(struct kunit *test)
 {
+       long *bits;
+
+       /* This test is specifically crafted for the generic mode. */
+       if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
+               return;
+       }
+
        /*
         * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes;
         * this way we do not actually corrupt other memory.
         */
-       long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
+       bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
 
        /*
@@ -633,55 +717,34 @@ static void kasan_bitops(struct kunit *test)
         * below accesses are still out-of-bounds, since bitops are defined to
         * operate on the whole long the bit is in.
         */
-       KUNIT_EXPECT_KASAN_FAIL(test, set_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, change_bit(BITS_PER_LONG, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(BITS_PER_LONG, bits));
+       kasan_bitops_modify(test, BITS_PER_LONG, bits);
 
        /*
         * Below calls try to access bit beyond allocated memory.
         */
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
-
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_set_bit_lock(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, bits);
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       kfree(bits);
+}
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+static void kasan_bitops_tags(struct kunit *test)
+{
+       long *bits;
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* This test is specifically crafted for the tag-based mode. */
+       if (IS_ENABLED(CONFIG_KASAN_GENERIC)) {
+               kunit_info(test, "CONFIG_KASAN_SW_TAGS required\n");
+               return;
+       }
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               __test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* Allocation size will be rounded to up granule size, which is 16. */
+       bits = kzalloc(sizeof(*bits), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
 
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               kasan_int_result =
-                       test_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
+       /* Do the accesses past the 16 allocated bytes. */
+       kasan_bitops_modify(test, BITS_PER_LONG, &bits[1]);
+       kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, &bits[1]);
 
-#if defined(clear_bit_unlock_is_negative_byte)
-       KUNIT_EXPECT_KASAN_FAIL(test,
-               kasan_int_result = clear_bit_unlock_is_negative_byte(
-                       BITS_PER_LONG + BITS_PER_BYTE, bits));
-#endif
        kfree(bits);
 }
 
@@ -728,6 +791,7 @@ static struct kunit_case kasan_kunit_test_cases[] = {
        KUNIT_CASE(kmalloc_oob_krealloc_more),
        KUNIT_CASE(kmalloc_oob_krealloc_less),
        KUNIT_CASE(kmalloc_oob_16),
+       KUNIT_CASE(kmalloc_uaf_16),
        KUNIT_CASE(kmalloc_oob_in_memset),
        KUNIT_CASE(kmalloc_oob_memset_2),
        KUNIT_CASE(kmalloc_oob_memset_4),
@@ -751,7 +815,8 @@ static struct kunit_case kasan_kunit_test_cases[] = {
        KUNIT_CASE(kasan_memchr),
        KUNIT_CASE(kasan_memcmp),
        KUNIT_CASE(kasan_strings),
-       KUNIT_CASE(kasan_bitops),
+       KUNIT_CASE(kasan_bitops_generic),
+       KUNIT_CASE(kasan_bitops_tags),
        KUNIT_CASE(kmalloc_double_kzfree),
        KUNIT_CASE(vmalloc_oob),
        {}
index fe76f8fd5a732c5f1301fab8600dd081cdc4498e..5a620f6909114792a7e1698adab010f1a59b4f6a 100644 (file)
@@ -648,6 +648,8 @@ retry:
                        }
 
                        del += t - f;
+                       hugetlb_cgroup_uncharge_file_region(
+                               resv, rg, t - f);
 
                        /* New entry for end of split region */
                        nrg->from = t;
@@ -660,9 +662,6 @@ retry:
                        /* Original entry is trimmed */
                        rg->to = f;
 
-                       hugetlb_cgroup_uncharge_file_region(
-                               resv, rg, nrg->to - nrg->from);
-
                        list_add(&nrg->link, &rg->link);
                        nrg = NULL;
                        break;
@@ -678,17 +677,17 @@ retry:
                }
 
                if (f <= rg->from) {    /* Trim beginning of region */
-                       del += t - rg->from;
-                       rg->from = t;
-
                        hugetlb_cgroup_uncharge_file_region(resv, rg,
                                                            t - rg->from);
-               } else {                /* Trim end of region */
-                       del += rg->to - f;
-                       rg->to = f;
 
+                       del += t - rg->from;
+                       rg->from = t;
+               } else {                /* Trim end of region */
                        hugetlb_cgroup_uncharge_file_region(resv, rg,
                                                            rg->to - f);
+
+                       del += rg->to - f;
+                       rg->to = f;
                }
        }
 
@@ -2443,6 +2442,9 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
 
                rsv_adjust = hugepage_subpool_put_pages(spool, 1);
                hugetlb_acct_memory(h, -rsv_adjust);
+               if (deferred_reserve)
+                       hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
+                                       pages_per_huge_page(h), page);
        }
        return page;
 
index 3a24e3b619f567efc5f0c5625974c0da854edcae..3dcbf24d2227a3350e855f5fd3015a0cbc20e070 100644 (file)
@@ -4110,11 +4110,17 @@ static int memcg_stat_show(struct seq_file *m, void *v)
                           (u64)memsw * PAGE_SIZE);
 
        for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
+               unsigned long nr;
+
                if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
                        continue;
+               nr = memcg_page_state(memcg, memcg1_stats[i]);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+               if (memcg1_stats[i] == NR_ANON_THPS)
+                       nr *= HPAGE_PMD_NR;
+#endif
                seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
-                          (u64)memcg_page_state(memcg, memcg1_stats[i]) *
-                          PAGE_SIZE);
+                                               (u64)nr * PAGE_SIZE);
        }
 
        for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
@@ -5339,17 +5345,22 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
                memcg->swappiness = mem_cgroup_swappiness(parent);
                memcg->oom_kill_disable = parent->oom_kill_disable;
        }
-       if (parent && parent->use_hierarchy) {
+       if (!parent) {
+               page_counter_init(&memcg->memory, NULL);
+               page_counter_init(&memcg->swap, NULL);
+               page_counter_init(&memcg->kmem, NULL);
+               page_counter_init(&memcg->tcpmem, NULL);
+       } else if (parent->use_hierarchy) {
                memcg->use_hierarchy = true;
                page_counter_init(&memcg->memory, &parent->memory);
                page_counter_init(&memcg->swap, &parent->swap);
                page_counter_init(&memcg->kmem, &parent->kmem);
                page_counter_init(&memcg->tcpmem, &parent->tcpmem);
        } else {
-               page_counter_init(&memcg->memory, NULL);
-               page_counter_init(&memcg->swap, NULL);
-               page_counter_init(&memcg->kmem, NULL);
-               page_counter_init(&memcg->tcpmem, NULL);
+               page_counter_init(&memcg->memory, &root_mem_cgroup->memory);
+               page_counter_init(&memcg->swap, &root_mem_cgroup->swap);
+               page_counter_init(&memcg->kmem, &root_mem_cgroup->kmem);
+               page_counter_init(&memcg->tcpmem, &root_mem_cgroup->tcpmem);
                /*
                 * Deeper hierachy with use_hierarchy == false doesn't make
                 * much sense so let cgroup subsystem know about this
index 3fde772ef5ef5bdb297869844ef4f616ebd90bae..3ca4898f3f249f3e18bcf7ed4f3d49cfdf0ef439 100644 (file)
@@ -525,7 +525,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
        unsigned long flags = qp->flags;
        int ret;
        bool has_unmovable = false;
-       pte_t *pte;
+       pte_t *pte, *mapped_pte;
        spinlock_t *ptl;
 
        ptl = pmd_trans_huge_lock(pmd, vma);
@@ -539,7 +539,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
        if (pmd_trans_unstable(pmd))
                return 0;
 
-       pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
+       mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
        for (; addr != end; pte++, addr += PAGE_SIZE) {
                if (!pte_present(*pte))
                        continue;
@@ -571,7 +571,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
                } else
                        break;
        }
-       pte_unmap_unlock(pte - 1, ptl);
+       pte_unmap_unlock(mapped_pte, ptl);
        cond_resched();
 
        if (has_unmovable)
index 73a206d0f64542e0f28a52da3b52ce3c7b4635ae..16b2fb482da11245092e732c858264ada92d2364 100644 (file)
@@ -41,28 +41,24 @@ EXPORT_SYMBOL_GPL(memremap_compat_align);
 DEFINE_STATIC_KEY_FALSE(devmap_managed_key);
 EXPORT_SYMBOL(devmap_managed_key);
 
-static void devmap_managed_enable_put(void)
+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
 {
-       static_branch_dec(&devmap_managed_key);
+       if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
+           pgmap->type == MEMORY_DEVICE_FS_DAX)
+               static_branch_dec(&devmap_managed_key);
 }
 
-static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
 {
-       if (pgmap->type == MEMORY_DEVICE_PRIVATE &&
-           (!pgmap->ops || !pgmap->ops->page_free)) {
-               WARN(1, "Missing page_free method\n");
-               return -EINVAL;
-       }
-
-       static_branch_inc(&devmap_managed_key);
-       return 0;
+       if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
+           pgmap->type == MEMORY_DEVICE_FS_DAX)
+               static_branch_inc(&devmap_managed_key);
 }
 #else
-static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
 {
-       return -EINVAL;
 }
-static void devmap_managed_enable_put(void)
+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
 {
 }
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
@@ -169,7 +165,7 @@ void memunmap_pages(struct dev_pagemap *pgmap)
                pageunmap_range(pgmap, i);
 
        WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n");
-       devmap_managed_enable_put();
+       devmap_managed_enable_put(pgmap);
 }
 EXPORT_SYMBOL_GPL(memunmap_pages);
 
@@ -307,7 +303,6 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                .pgprot = PAGE_KERNEL,
        };
        const int nr_range = pgmap->nr_range;
-       bool need_devmap_managed = true;
        int error, i;
 
        if (WARN_ONCE(!nr_range, "nr_range must be specified\n"))
@@ -323,6 +318,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                        WARN(1, "Missing migrate_to_ram method\n");
                        return ERR_PTR(-EINVAL);
                }
+               if (!pgmap->ops->page_free) {
+                       WARN(1, "Missing page_free method\n");
+                       return ERR_PTR(-EINVAL);
+               }
                if (!pgmap->owner) {
                        WARN(1, "Missing owner\n");
                        return ERR_PTR(-EINVAL);
@@ -336,11 +335,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                }
                break;
        case MEMORY_DEVICE_GENERIC:
-               need_devmap_managed = false;
                break;
        case MEMORY_DEVICE_PCI_P2PDMA:
                params.pgprot = pgprot_noncached(params.pgprot);
-               need_devmap_managed = false;
                break;
        default:
                WARN(1, "Invalid pgmap type %d\n", pgmap->type);
@@ -364,11 +361,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                }
        }
 
-       if (need_devmap_managed) {
-               error = devmap_managed_enable_get(pgmap);
-               if (error)
-                       return ERR_PTR(error);
-       }
+       devmap_managed_enable_get(pgmap);
 
        /*
         * Clear the pgmap nr_range as it will be incremented for each
index 18cec39a9f53e48447e278785c2e6443f9357afa..960edf5803ca97fa22e94d65ff76be49b8d4be3b 100644 (file)
@@ -528,7 +528,7 @@ void truncate_inode_pages_final(struct address_space *mapping)
 }
 EXPORT_SYMBOL(truncate_inode_pages_final);
 
-unsigned long __invalidate_mapping_pages(struct address_space *mapping,
+static unsigned long __invalidate_mapping_pages(struct address_space *mapping,
                pgoff_t start, pgoff_t end, unsigned long *nr_pagevec)
 {
        pgoff_t indices[PAGEVEC_SIZE];
index dbabb65d8b6773acc95fc9047453ec0118da2ce1..7226c784dbe0c70e4d6899634cb3821ff5a61960 100644 (file)
@@ -954,9 +954,8 @@ static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
        struct lec_state *state = seq->private;
 
-       v = lec_get_idx(state, 1);
-       *pos += !!PTR_ERR(v);
-       return v;
+       ++*pos;
+       return lec_get_idx(state, 1);
 }
 
 static int lec_seq_show(struct seq_file *seq, void *v)
index 224e5e0283a986d9444948122479977d8107d1e9..7c9958df91d353c8a86dcd61a0c99e557fbfa16a 100644 (file)
@@ -62,8 +62,9 @@ config CAN_ISOTP
          communication between CAN nodes via two defined CAN Identifiers.
          As CAN frames can only transport a small amount of data bytes
          (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this
-         segmentation is needed to transport longer PDUs as needed e.g. for
-         vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN traffic.
+         segmentation is needed to transport longer Protocol Data Units (PDU)
+         as needed e.g. for vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN
+         traffic.
          This protocol driver implements data transfers according to
          ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types.
          If you want to perform automotive vehicle diagnostic services (UDS),
index 4c2062875893fd14c4c814bb8f787be75f6d1393..d78ab13bd8be99554a5d4873e4d6b7081cf289d3 100644 (file)
@@ -252,14 +252,16 @@ static void isotp_rcv_skb(struct sk_buff *skb, struct sock *sk)
 
 static u8 padlen(u8 datalen)
 {
-       const u8 plen[] = {8, 8, 8, 8, 8, 8, 8, 8, 8,           /* 0 - 8 */
-                          12, 12, 12, 12,                      /* 9 - 12 */
-                          16, 16, 16, 16,                      /* 13 - 16 */
-                          20, 20, 20, 20,                      /* 17 - 20 */
-                          24, 24, 24, 24,                      /* 21 - 24 */
-                          32, 32, 32, 32, 32, 32, 32, 32,      /* 25 - 32 */
-                          48, 48, 48, 48, 48, 48, 48, 48,      /* 33 - 40 */
-                          48, 48, 48, 48, 48, 48, 48, 48};     /* 41 - 48 */
+       static const u8 plen[] = {
+               8, 8, 8, 8, 8, 8, 8, 8, 8,      /* 0 - 8 */
+               12, 12, 12, 12,                 /* 9 - 12 */
+               16, 16, 16, 16,                 /* 13 - 16 */
+               20, 20, 20, 20,                 /* 17 - 20 */
+               24, 24, 24, 24,                 /* 21 - 24 */
+               32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */
+               48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */
+               48, 48, 48, 48, 48, 48, 48, 48  /* 41 - 48 */
+       };
 
        if (datalen > 48)
                return 64;
@@ -569,10 +571,6 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
                return 0;
        }
 
-       /* no creation of flow control frames */
-       if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
-               return 0;
-
        /* perform blocksize handling, if enabled */
        if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) {
                /* start rx timeout watchdog */
@@ -581,6 +579,10 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
                return 0;
        }
 
+       /* no creation of flow control frames */
+       if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
+               return 0;
+
        /* we reached the specified blocksize so->rxfc.bs */
        isotp_send_fc(sk, ae, ISOTP_FC_CTS);
        return 0;
index 1be4c898b2fa884b96c3363a1dca09279f541e89..f23966526a88589d95fdc97143c0c4f8f4b99860 100644 (file)
@@ -475,6 +475,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
                        goto out_release_sock;
                }
 
+               if (!(ndev->flags & IFF_UP)) {
+                       dev_put(ndev);
+                       ret = -ENETDOWN;
+                       goto out_release_sock;
+               }
+
                priv = j1939_netdev_start(ndev);
                dev_put(ndev);
                if (IS_ERR(priv)) {
index 550928b8b8a2c988270411ffdad80ab1f5b9dc03..5ea8695f507eb650cb51e0a81ccd27bb67683e18 100644 (file)
@@ -462,6 +462,9 @@ void can_init_proc(struct net *net)
  */
 void can_remove_proc(struct net *net)
 {
+       if (!net->can.proc_dir)
+               return;
+
        if (net->can.pde_stats)
                remove_proc_entry(CAN_PROC_STATS, net->can.proc_dir);
 
@@ -486,6 +489,5 @@ void can_remove_proc(struct net *net)
        if (net->can.pde_rcvlist_sff)
                remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir);
 
-       if (net->can.proc_dir)
-               remove_proc_entry("can", net->proc_net);
+       remove_proc_entry("can", net->proc_net);
 }
index 8b04d1dcfec4eb5d0fb697497e0e5599ce8704f1..ee65c9225178d66948a7b70b3d243499eadbc168 100644 (file)
@@ -608,9 +608,6 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
                        ttl = ip4_dst_hoplimit(&rt->dst);
        }
 
-       if (!df && skb->protocol == htons(ETH_P_IP))
-               df = inner_iph->frag_off & htons(IP_DF);
-
        headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len;
        if (headroom > dev->needed_headroom)
                dev->needed_headroom = headroom;
index a058213b77a787a1aa1c0779ae9017932eaff785..7c841037c53349855f9711a70bd0ac333b8bd716 100644 (file)
 #include <net/netfilter/nf_queue.h>
 
 /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
-int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_type)
+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int addr_type)
 {
        const struct iphdr *iph = ip_hdr(skb);
        struct rtable *rt;
        struct flowi4 fl4 = {};
        __be32 saddr = iph->saddr;
-       const struct sock *sk = skb_to_full_sk(skb);
-       __u8 flags = sk ? inet_sk_flowi_flags(sk) : 0;
+       __u8 flags;
        struct net_device *dev = skb_dst(skb)->dev;
        unsigned int hh_len;
 
+       sk = sk_to_full_sk(sk);
+       flags = sk ? inet_sk_flowi_flags(sk) : 0;
+
        if (addr_type == RTN_UNSPEC)
                addr_type = inet_addr_type_dev_table(net, dev, saddr);
        if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
index f703a717ab1d23bdf94ee0b47d4182ddd7810a4c..83307958927307845951ef5cb2682f05e7b2024b 100644 (file)
@@ -62,7 +62,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state)
                    iph->daddr != daddr ||
                    skb->mark != mark ||
                    iph->tos != tos) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
index 9dcfa4e461b65aaada32b4d5e11946ae3ae919c8..93b07739807b270854e663b16ac103b159009d72 100644 (file)
@@ -145,7 +145,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
                                   ip4_dst_hoplimit(skb_dst(nskb)));
        nf_reject_ip_tcphdr_put(nskb, oldskb, oth);
 
-       if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
+       if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
                goto free_nskb;
 
        niph = ip_hdr(nskb);
index dc19aff7c2e0055711597d7dd423fd107cd21ef7..fb0648e7fb32f9b0715030b7eb0049df81f0deea 100644 (file)
@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
 static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
        .handler        =       xfrm_tunnel_rcv,
        .err_handler    =       xfrm_tunnel_err,
-       .priority       =       3,
+       .priority       =       4,
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
 static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
        .handler        =       xfrm_tunnel_rcv,
        .err_handler    =       xfrm_tunnel_err,
-       .priority       =       2,
+       .priority       =       3,
 };
 #endif
 
index ec448b71bf9ae7758c0d85a830bea5a408287e08..8956144ea65e8a8d64574cdb51fb09df41705170 100644 (file)
@@ -158,7 +158,13 @@ static bool is_ineligible(const struct sk_buff *skb)
                tp = skb_header_pointer(skb,
                        ptr+offsetof(struct icmp6hdr, icmp6_type),
                        sizeof(_type), &_type);
-               if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
+
+               /* Based on RFC 8200, Section 4.5 Fragment Header, return
+                * false if this is a fragment packet with no icmp header info.
+                */
+               if (!tp && frag_off != 0)
+                       return false;
+               else if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
                        return true;
        }
        return false;
index a0217e5bf3bc1132969e0ed7421cf5eceff54d69..648db3fe508f03f269b9a16bc2340f536ad6bb7c 100644 (file)
@@ -1271,6 +1271,8 @@ route_lookup:
        if (max_headroom > dev->needed_headroom)
                dev->needed_headroom = max_headroom;
 
+       skb_set_inner_ipproto(skb, proto);
+
        err = ip6_tnl_encap(skb, t, &proto, fl6);
        if (err)
                return err;
@@ -1280,8 +1282,6 @@ route_lookup:
                ipv6_push_frag_opts(skb, &opt.ops, &proto);
        }
 
-       skb_set_inner_ipproto(skb, proto);
-
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
        ipv6h = ipv6_hdr(skb);
index 6d0e942d082d4ec0f66cb97fb20a7c466a0a0dfa..ab9a279dd6d47d34a3ad68e7cb88d588f2c6eaef 100644 (file)
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
 #include "../bridge/br_private.h"
 
-int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
+int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff *skb)
 {
        const struct ipv6hdr *iph = ipv6_hdr(skb);
-       struct sock *sk = sk_to_full_sk(skb->sk);
+       struct sock *sk = sk_to_full_sk(sk_partial);
        unsigned int hh_len;
        struct dst_entry *dst;
        int strict = (ipv6_addr_type(&iph->daddr) &
@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
                if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
                    !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) ||
                    skb->mark != rt_info->mark)
-                       return ip6_route_me_harder(entry->state.net, skb);
+                       return ip6_route_me_harder(entry->state.net, entry->state.sk, skb);
        }
        return 0;
 }
index 1a2748611e00388abf30a4127a24adc516cdcd2e..cee74803d7a1ce649c01c71f4d7b6860ff156aa3 100644 (file)
@@ -57,7 +57,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state)
             skb->mark != mark ||
             ipv6_hdr(skb)->hop_limit != hop_limit ||
             flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
-               err = ip6_route_me_harder(state->net, skb);
+               err = ip6_route_me_harder(state->net, state->sk, skb);
                if (err < 0)
                        ret = NF_DROP_ERR(err);
        }
index 1f5d4d196dccee12ee979f305b1b904864ff246e..c8cf1bbad74a241f8867ca41328406bcd06e0c35 100644 (file)
@@ -42,6 +42,8 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -322,7 +324,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
        struct frag_queue *fq;
        const struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct net *net = dev_net(skb_dst(skb)->dev);
-       int iif;
+       __be16 frag_off;
+       int iif, offset;
+       u8 nexthdr;
 
        if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
                goto fail_hdr;
@@ -351,6 +355,33 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
                return 1;
        }
 
+       /* RFC 8200, Section 4.5 Fragment Header:
+        * If the first fragment does not include all headers through an
+        * Upper-Layer header, then that fragment should be discarded and
+        * an ICMP Parameter Problem, Code 3, message should be sent to
+        * the source of the fragment, with the Pointer field set to zero.
+        */
+       nexthdr = hdr->nexthdr;
+       offset = ipv6_skip_exthdr(skb, skb_transport_offset(skb), &nexthdr, &frag_off);
+       if (offset >= 0) {
+               /* Check some common protocols' header */
+               if (nexthdr == IPPROTO_TCP)
+                       offset += sizeof(struct tcphdr);
+               else if (nexthdr == IPPROTO_UDP)
+                       offset += sizeof(struct udphdr);
+               else if (nexthdr == IPPROTO_ICMPV6)
+                       offset += sizeof(struct icmp6hdr);
+               else
+                       offset += 1;
+
+               if (!(frag_off & htons(IP6_OFFSET)) && offset > skb->len) {
+                       __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
+                                       IPSTATS_MIB_INHDRERRORS);
+                       icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
+                       return -1;
+               }
+       }
+
        iif = skb->dev ? skb->dev->ifindex : 0;
        fq = fq_find(net, fhdr->identification, hdr, iif);
        if (fq) {
index 25b7ebda2fabf157ecd1a12972e6d1cd28a1cc48..f696d46e6910068d1c15b487f7e68feecad5452a 100644 (file)
@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = {
 static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
        .handler        = xfrm6_tunnel_rcv,
        .err_handler    = xfrm6_tunnel_err,
-       .priority       = 2,
+       .priority       = 3,
 };
 
 static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
        .handler        = xfrm6_tunnel_rcv,
        .err_handler    = xfrm6_tunnel_err,
-       .priority       = 2,
+       .priority       = 3,
 };
 
 static int __net_init xfrm6_tunnel_net_init(struct net *net)
index f400240a556f571229b5d1e9f112de3753971082..6adfcb9c06dcc516cf215cdc5b0ea7ed1524099e 100644 (file)
@@ -5464,6 +5464,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
                        struct cfg80211_assoc_request *req)
 {
        bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ;
+       bool is_5ghz = req->bss->channel->band == NL80211_BAND_5GHZ;
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        struct ieee80211_bss *bss = (void *)req->bss->priv;
@@ -5616,7 +5617,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        if (vht_ie && vht_ie[1] >= sizeof(struct ieee80211_vht_cap))
                memcpy(&assoc_data->ap_vht_cap, vht_ie + 2,
                       sizeof(struct ieee80211_vht_cap));
-       else if (!is_6ghz)
+       else if (is_5ghz)
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT |
                                IEEE80211_STA_DISABLE_HE;
        rcu_read_unlock();
index fb4f2b9b294f03cc3aa28dbf2f5d11e78c0936a0..4fe284ff1ea3d702e175fbedf689a276b0034941 100644 (file)
@@ -258,6 +258,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
  */
 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 {
+       /*
+        * If we had used sta_info_pre_move_state() then we might not
+        * have gone through the state transitions down again, so do
+        * it here now (and warn if it's inserted).
+        *
+        * This will clear state such as fast TX/RX that may have been
+        * allocated during state transitions.
+        */
+       while (sta->sta_state > IEEE80211_STA_NONE) {
+               int ret;
+
+               WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED));
+
+               ret = sta_info_move_state(sta, sta->sta_state - 1);
+               if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret))
+                       break;
+       }
+
        if (sta->rate_ctrl)
                rate_control_free_sta(sta);
 
index 00ae81e9e1a12d9756a39b490e53a6b300d1f28f..7afd07636b81da4fcc12b702a8af852d7eb80b2b 100644 (file)
@@ -785,7 +785,7 @@ int sta_info_init(struct ieee80211_local *local);
 void sta_info_stop(struct ieee80211_local *local);
 
 /**
- * sta_info_flush - flush matching STA entries from the STA table
+ * __sta_info_flush - flush matching STA entries from the STA table
  *
  * Returns the number of removed STA entries.
  *
@@ -794,6 +794,13 @@ void sta_info_stop(struct ieee80211_local *local);
  */
 int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans);
 
+/**
+ * sta_info_flush - flush matching STA entries from the STA table
+ *
+ * Returns the number of removed STA entries.
+ *
+ * @sdata: sdata to remove all stations from
+ */
 static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata)
 {
        return __sta_info_flush(sdata, false);
index 8ba10a48ded4cab1c80e7da7026b2c19a3941035..56a4d0d20a267a9cadf246945f0373ddea39a1a7 100644 (file)
@@ -1942,19 +1942,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
 
 /* device xmit handlers */
 
+enum ieee80211_encrypt {
+       ENCRYPT_NO,
+       ENCRYPT_MGMT,
+       ENCRYPT_DATA,
+};
+
 static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata,
                                struct sk_buff *skb,
-                               int head_need, bool may_encrypt)
+                               int head_need,
+                               enum ieee80211_encrypt encrypt)
 {
        struct ieee80211_local *local = sdata->local;
-       struct ieee80211_hdr *hdr;
        bool enc_tailroom;
        int tail_need = 0;
 
-       hdr = (struct ieee80211_hdr *) skb->data;
-       enc_tailroom = may_encrypt &&
-                      (sdata->crypto_tx_tailroom_needed_cnt ||
-                       ieee80211_is_mgmt(hdr->frame_control));
+       enc_tailroom = encrypt == ENCRYPT_MGMT ||
+                      (encrypt == ENCRYPT_DATA &&
+                       sdata->crypto_tx_tailroom_needed_cnt);
 
        if (enc_tailroom) {
                tail_need = IEEE80211_ENCRYPT_TAILROOM;
@@ -1985,23 +1990,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_hdr *hdr;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        int headroom;
-       bool may_encrypt;
+       enum ieee80211_encrypt encrypt;
 
-       may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT);
+       if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)
+               encrypt = ENCRYPT_NO;
+       else if (ieee80211_is_mgmt(hdr->frame_control))
+               encrypt = ENCRYPT_MGMT;
+       else
+               encrypt = ENCRYPT_DATA;
 
        headroom = local->tx_headroom;
-       if (may_encrypt)
+       if (encrypt != ENCRYPT_NO)
                headroom += sdata->encrypt_headroom;
        headroom -= skb_headroom(skb);
        headroom = max_t(int, 0, headroom);
 
-       if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
+       if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) {
                ieee80211_free_txskb(&local->hw, skb);
                return;
        }
 
+       /* reload after potential resize */
        hdr = (struct ieee80211_hdr *) skb->data;
        info->control.vif = &sdata->vif;
 
@@ -2828,7 +2839,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
                head_need += sdata->encrypt_headroom;
                head_need += local->tx_headroom;
                head_need = max_t(int, 0, head_need);
-               if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
+               if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) {
                        ieee80211_free_txskb(&local->hw, skb);
                        skb = NULL;
                        return ERR_PTR(-ENOMEM);
@@ -3502,7 +3513,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
        if (unlikely(ieee80211_skb_resize(sdata, skb,
                                          max_t(int, extra_head + hw_headroom -
                                                     skb_headroom(skb), 0),
-                                         false))) {
+                                         ENCRYPT_NO))) {
                kfree_skb(skb);
                return true;
        }
@@ -3619,13 +3630,14 @@ begin:
        tx.skb = skb;
        tx.sdata = vif_to_sdata(info->control.vif);
 
-       if (txq->sta && !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
+       if (txq->sta) {
                tx.sta = container_of(txq->sta, struct sta_info, sta);
                /*
                 * Drop unicast frames to unauthorised stations unless they are
-                * EAPOL frames from the local station.
+                * injected frames or EAPOL frames from the local station.
                 */
-               if (unlikely(ieee80211_is_data(hdr->frame_control) &&
+               if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
+                            ieee80211_is_data(hdr->frame_control) &&
                             !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
                             tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
                             !is_multicast_ether_addr(hdr->addr1) &&
index 8b47c4bb1c6bed37887f970b59eb5635586450d1..feb4b9ffd46258fed457742a25cbfbde8e0e87d4 100644 (file)
@@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot,
 {
        struct mptcp_sock *ret = NULL;
        struct hlist_nulls_node *pos;
-       int slot, num;
+       int slot, num = 0;
 
        for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) {
                struct token_bucket *bucket = &token_hash[slot];
index 6f35832f0de384b4f969b2e9a8ac0c3e54eaa0de..7cff6e5e74453e9e7e428e8badaaba558ae60240 100644 (file)
@@ -637,13 +637,14 @@ ip_set_match_extensions(struct ip_set *set, const struct ip_set_ext *ext,
        if (SET_WITH_COUNTER(set)) {
                struct ip_set_counter *counter = ext_counter(data, set);
 
+               ip_set_update_counter(counter, ext, flags);
+
                if (flags & IPSET_FLAG_MATCH_COUNTERS &&
                    !(ip_set_match_counter(ip_set_get_packets(counter),
                                mext->packets, mext->packets_op) &&
                      ip_set_match_counter(ip_set_get_bytes(counter),
                                mext->bytes, mext->bytes_op)))
                        return false;
-               ip_set_update_counter(counter, ext, flags);
        }
        if (SET_WITH_SKBINFO(set))
                ip_set_get_skbinfo(ext_skbinfo(data, set),
index cc3c275934f47f4817280897e1bc9f8b5424f178..c0b8215ab3d47a6719cbb0d57cffb7b73326ecad 100644 (file)
@@ -742,12 +742,12 @@ static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af,
                struct dst_entry *dst = skb_dst(skb);
 
                if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) &&
-                   ip6_route_me_harder(ipvs->net, skb) != 0)
+                   ip6_route_me_harder(ipvs->net, skb->sk, skb) != 0)
                        return 1;
        } else
 #endif
                if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
-                   ip_route_me_harder(ipvs->net, skb, RTN_LOCAL) != 0)
+                   ip_route_me_harder(ipvs->net, skb->sk, skb, RTN_LOCAL) != 0)
                        return 1;
 
        return 0;
index 59151dc07fdc14fe6fa640cdd0448723d96bcb48..e87b6bd6b3cdb6b79b2d229df4ce3d74f8e374d8 100644 (file)
@@ -715,7 +715,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb,
 
                if (ct->tuplehash[dir].tuple.dst.u3.ip !=
                    ct->tuplehash[!dir].tuple.src.u3.ip) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
@@ -953,7 +953,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb,
 
                if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3,
                                      &ct->tuplehash[!dir].tuple.src.u3)) {
-                       err = nf_ip6_route_me_harder(state->net, skb);
+                       err = nf_ip6_route_me_harder(state->net, state->sk, skb);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
index 9cca35d22927382e0323cc7cb8cd16913e8d3e87..d7d34a62d3bf5fb5d7919d855a02a2c1c935b8a0 100644 (file)
@@ -446,7 +446,7 @@ synproxy_send_tcp(struct net *net,
 
        skb_dst_set_noref(nskb, skb_dst(skb));
        nskb->protocol = htons(ETH_P_IP);
-       if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
+       if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
                goto free_nskb;
 
        if (nfct) {
index 65cb8e3c13d901e4c6b1b8d63f1c048d36dbb2cf..0f58e98542be269a8dffc8b0f5c740d6534b2b15 100644 (file)
@@ -7137,7 +7137,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx,
                        GFP_KERNEL);
        kfree(buf);
 
-       if (ctx->report &&
+       if (!ctx->report &&
            !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES))
                return;
 
@@ -7259,7 +7259,7 @@ static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb,
        audit_log_nfcfg("?:0;?:0", 0, net->nft.base_seq,
                        AUDIT_NFT_OP_GEN_REGISTER, GFP_KERNEL);
 
-       if (nlmsg_report(nlh) &&
+       if (!nlmsg_report(nlh) &&
            !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
                return;
 
@@ -8053,12 +8053,16 @@ static void nf_tables_abort_release(struct nft_trans *trans)
        kfree(trans);
 }
 
-static int __nf_tables_abort(struct net *net, bool autoload)
+static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 {
        struct nft_trans *trans, *next;
        struct nft_trans_elem *te;
        struct nft_hook *hook;
 
+       if (action == NFNL_ABORT_VALIDATE &&
+           nf_tables_validate(net) < 0)
+               return -EAGAIN;
+
        list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list,
                                         list) {
                switch (trans->msg_type) {
@@ -8190,7 +8194,7 @@ static int __nf_tables_abort(struct net *net, bool autoload)
                nf_tables_abort_release(trans);
        }
 
-       if (autoload)
+       if (action == NFNL_ABORT_AUTOLOAD)
                nf_tables_module_autoload(net);
        else
                nf_tables_module_autoload_cleanup(net);
@@ -8203,9 +8207,10 @@ static void nf_tables_cleanup(struct net *net)
        nft_validate_state_update(net, NFT_VALIDATE_SKIP);
 }
 
-static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload)
+static int nf_tables_abort(struct net *net, struct sk_buff *skb,
+                          enum nfnl_abort_action action)
 {
-       int ret = __nf_tables_abort(net, autoload);
+       int ret = __nf_tables_abort(net, action);
 
        mutex_unlock(&net->nft.commit_mutex);
 
@@ -8836,7 +8841,7 @@ static void __net_exit nf_tables_exit_net(struct net *net)
 {
        mutex_lock(&net->nft.commit_mutex);
        if (!list_empty(&net->nft.commit_list))
-               __nf_tables_abort(net, false);
+               __nf_tables_abort(net, NFNL_ABORT_NONE);
        __nft_release_tables(net);
        mutex_unlock(&net->nft.commit_mutex);
        WARN_ON_ONCE(!list_empty(&net->nft.tables));
index 2daa1f6ae344113b2031c4488595e9b9640dd9fe..d3df66a39b5e004b4e583d56ee4c0c40bbb2cdd9 100644 (file)
@@ -333,7 +333,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
                return netlink_ack(skb, nlh, -EINVAL, NULL);
 replay:
        status = 0;
-
+replay_abort:
        skb = netlink_skb_clone(oskb, GFP_KERNEL);
        if (!skb)
                return netlink_ack(oskb, nlh, -ENOMEM, NULL);
@@ -499,7 +499,7 @@ ack:
        }
 done:
        if (status & NFNL_BATCH_REPLAY) {
-               ss->abort(net, oskb, true);
+               ss->abort(net, oskb, NFNL_ABORT_AUTOLOAD);
                nfnl_err_reset(&err_list);
                kfree_skb(skb);
                module_put(ss->owner);
@@ -510,11 +510,25 @@ done:
                        status |= NFNL_BATCH_REPLAY;
                        goto done;
                } else if (err) {
-                       ss->abort(net, oskb, false);
+                       ss->abort(net, oskb, NFNL_ABORT_NONE);
                        netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL);
                }
        } else {
-               ss->abort(net, oskb, false);
+               enum nfnl_abort_action abort_action;
+
+               if (status & NFNL_BATCH_FAILURE)
+                       abort_action = NFNL_ABORT_NONE;
+               else
+                       abort_action = NFNL_ABORT_VALIDATE;
+
+               err = ss->abort(net, oskb, abort_action);
+               if (err == -EAGAIN) {
+                       nfnl_err_reset(&err_list);
+                       kfree_skb(skb);
+                       module_put(ss->owner);
+                       status |= NFNL_BATCH_FAILURE;
+                       goto replay_abort;
+               }
        }
        if (ss->cleanup)
                ss->cleanup(net);
index 8826bbe71136c86bd1020e0598bb4509aa793421..edd02cda57fca8713c29f749ceae7e26e83aa9ff 100644 (file)
@@ -42,7 +42,7 @@ static unsigned int nf_route_table_hook4(void *priv,
                    iph->daddr != daddr ||
                    skb->mark != mark ||
                    iph->tos != tos) {
-                       err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
+                       err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
                        if (err < 0)
                                ret = NF_DROP_ERR(err);
                }
@@ -92,7 +92,7 @@ static unsigned int nf_route_table_hook6(void *priv,
             skb->mark != mark ||
             ipv6_hdr(skb)->hop_limit != hop_limit ||
             flowlabel != *((u32 *)ipv6_hdr(skb)))) {
-               err = nf_ip6_route_me_harder(state->net, skb);
+               err = nf_ip6_route_me_harder(state->net, state->sk, skb);
                if (err < 0)
                        ret = NF_DROP_ERR(err);
        }
index cedf47ab3c6f98d13f0397e27a4beeca44d28854..2182d361e273f18818e312e47dda770bf9b4b625 100644 (file)
@@ -191,8 +191,8 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry
                      skb->mark == rt_info->mark &&
                      iph->daddr == rt_info->daddr &&
                      iph->saddr == rt_info->saddr))
-                       return ip_route_me_harder(entry->state.net, skb,
-                                                 RTN_UNSPEC);
+                       return ip_route_me_harder(entry->state.net, entry->state.sk,
+                                                 skb, RTN_UNSPEC);
        }
 #endif
        return 0;
index 832f898edb6adc46aed452f2224be683427e6e8e..9d6ef6cb9b26334fa1dc9036d336e44d07946370 100644 (file)
@@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
        parms.port_no = OVSP_LOCAL;
        parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
 
-       err = ovs_dp_change(dp, a);
-       if (err)
-               goto err_destroy_meters;
-
        /* So far only local changes have been made, now need the lock. */
        ovs_lock();
 
+       err = ovs_dp_change(dp, a);
+       if (err)
+               goto err_unlock_and_destroy_meters;
+
        vport = new_vport(&parms);
        if (IS_ERR(vport)) {
                err = PTR_ERR(vport);
@@ -1725,8 +1725,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
                                ovs_dp_reset_user_features(skb, info);
                }
 
-               ovs_unlock();
-               goto err_destroy_meters;
+               goto err_unlock_and_destroy_meters;
        }
 
        err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
@@ -1741,7 +1740,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
        ovs_notify(&dp_datapath_genl_family, reply, info);
        return 0;
 
-err_destroy_meters:
+err_unlock_and_destroy_meters:
+       ovs_unlock();
        ovs_meters_exit(dp);
 err_destroy_ports:
        kfree(dp->ports);
index f3486a37361a63875529f1250864ee18b836964d..c89c8da99f1a2ea234b5a5cbbc40c2635d181d4a 100644 (file)
@@ -390,7 +390,7 @@ static struct mask_cache *tbl_mask_cache_alloc(u32 size)
 }
 int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size)
 {
-       struct mask_cache *mc = rcu_dereference(table->mask_cache);
+       struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
        struct mask_cache *new;
 
        if (size == mc->cache_size)
index aa821e71f05e77532cd42237233820099dc2b80d..813d30767204158d53d2bfcf285c267453047f71 100644 (file)
@@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
                        break;
 
                case SCTP_CMD_INIT_FAILED:
-                       sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
+                       sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
                        break;
 
                case SCTP_CMD_ASSOC_FAILED:
                        sctp_cmd_assoc_failed(commands, asoc, event_type,
-                                             subtype, chunk, cmd->obj.u32);
+                                             subtype, chunk, cmd->obj.u16);
                        break;
 
                case SCTP_CMD_INIT_COUNTER_INC:
index 9f23923e8d29b781d66bd264da00ac7ef2807c94..240282c083aa746a55f5998dbfd6ec356a404985 100644 (file)
@@ -1250,8 +1250,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 EXPORT_SYMBOL(cfg80211_stop_iface);
 
-void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev)
+void cfg80211_init_wdev(struct wireless_dev *wdev)
 {
        mutex_init(&wdev->mtx);
        INIT_LIST_HEAD(&wdev->event_list);
@@ -1262,6 +1261,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
        spin_lock_init(&wdev->pmsr_lock);
        INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
 
+#ifdef CONFIG_CFG80211_WEXT
+       wdev->wext.default_key = -1;
+       wdev->wext.default_mgmt_key = -1;
+       wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+#endif
+
+       if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
+               wdev->ps = true;
+       else
+               wdev->ps = false;
+       /* allow mac80211 to determine the timeout */
+       wdev->ps_timeout = -1;
+
+       if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+            wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
+            wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
+               wdev->netdev->priv_flags |= IFF_DONT_BRIDGE;
+
+       INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
+}
+
+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
+                           struct wireless_dev *wdev)
+{
        /*
         * We get here also when the interface changes network namespaces,
         * as it's registered into the new one, but we don't want it to
@@ -1295,6 +1318,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
        switch (state) {
        case NETDEV_POST_INIT:
                SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+               wdev->netdev = dev;
+               /* can only change netns with wiphy */
+               dev->features |= NETIF_F_NETNS_LOCAL;
+
+               cfg80211_init_wdev(wdev);
                break;
        case NETDEV_REGISTER:
                /*
@@ -1302,35 +1330,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                 * called within code protected by it when interfaces
                 * are added with nl80211.
                 */
-               /* can only change netns with wiphy */
-               dev->features |= NETIF_F_NETNS_LOCAL;
-
                if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
                                      "phy80211")) {
                        pr_err("failed to add phy80211 symlink to netdev!\n");
                }
-               wdev->netdev = dev;
-#ifdef CONFIG_CFG80211_WEXT
-               wdev->wext.default_key = -1;
-               wdev->wext.default_mgmt_key = -1;
-               wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
-#endif
-
-               if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
-                       wdev->ps = true;
-               else
-                       wdev->ps = false;
-               /* allow mac80211 to determine the timeout */
-               wdev->ps_timeout = -1;
-
-               if ((wdev->iftype == NL80211_IFTYPE_STATION ||
-                    wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
-                    wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
-                       dev->priv_flags |= IFF_DONT_BRIDGE;
-
-               INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
 
-               cfg80211_init_wdev(rdev, wdev);
+               cfg80211_register_wdev(rdev, wdev);
                break;
        case NETDEV_GOING_DOWN:
                cfg80211_leave(rdev, wdev);
index e1ec9ac8e608bdf03962663dc3ecc8ef918a4502..e3e9686859d459d9d6750695695b05339a50d49a 100644 (file)
@@ -209,8 +209,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
 int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                          struct net *net);
 
-void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
-                       struct wireless_dev *wdev);
+void cfg80211_init_wdev(struct wireless_dev *wdev);
+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
+                           struct wireless_dev *wdev);
 
 static inline void wdev_lock(struct wireless_dev *wdev)
        __acquires(wdev)
index 554796a6c6fe5dcb3461d688f12a08a19a4a92cf..a77174b99b07e8fbd863e50c159501e5d26e0224 100644 (file)
@@ -3885,7 +3885,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                 * P2P Device and NAN do not have a netdev, so don't go
                 * through the netdev notifier and must be added here
                 */
-               cfg80211_init_wdev(rdev, wdev);
+               cfg80211_init_wdev(wdev);
+               cfg80211_register_wdev(rdev, wdev);
                break;
        default:
                break;
index 3dab859641e1a0e7f5a66ab1ca560d862754b1c5..a04fdfb35f070eeed7b558f8a696db27daf4afa9 100644 (file)
@@ -3616,7 +3616,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd)
                power_rule = &reg_rule->power_rule;
 
                if (reg_rule->flags & NL80211_RRF_AUTO_BW)
-                       snprintf(bw, sizeof(bw), "%d KHz, %d KHz AUTO",
+                       snprintf(bw, sizeof(bw), "%d KHz, %u KHz AUTO",
                                 freq_range->max_bandwidth_khz,
                                 reg_get_max_bandwidth(rd, reg_rule));
                else
index aa4cdcf69d471e63ec712810edaa78008572a9e9..9b8e292a7c6a7525f509d9ae730652769892f1ce 100644 (file)
@@ -803,14 +803,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
        .handler        =       xfrmi6_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi6_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 
 static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
        .handler        =       xfrmi6_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi6_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 #endif
 
@@ -848,14 +848,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
        .handler        =       xfrmi4_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi4_err,
-       .priority       =       -1,
+       .priority       =       3,
 };
 
 static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
        .handler        =       xfrmi4_rcv_tunnel,
        .cb_handler     =       xfrmi_rcv_cb,
        .err_handler    =       xfrmi4_err,
-       .priority       =       -1,
+       .priority       =       2,
 };
 #endif
 
index bbd4643d7e824f17d6d9e45e242b000239227b3b..a77da7aae6fe845a6fd1253a4e6d98be53ec6aec 100644 (file)
@@ -2004,6 +2004,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
        int err = -ENOENT;
        __be32 minspi = htonl(low);
        __be32 maxspi = htonl(high);
+       __be32 newspi = 0;
        u32 mark = x->mark.v & x->mark.m;
 
        spin_lock_bh(&x->lock);
@@ -2022,21 +2023,22 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
                        xfrm_state_put(x0);
                        goto unlock;
                }
-               x->id.spi = minspi;
+               newspi = minspi;
        } else {
                u32 spi = 0;
                for (h = 0; h < high-low+1; h++) {
                        spi = low + prandom_u32()%(high-low+1);
                        x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family);
                        if (x0 == NULL) {
-                               x->id.spi = htonl(spi);
+                               newspi = htonl(spi);
                                break;
                        }
                        xfrm_state_put(x0);
                }
        }
-       if (x->id.spi) {
+       if (newspi) {
                spin_lock_bh(&net->xfrm.xfrm_state_lock);
+               x->id.spi = newspi;
                h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family);
                hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
                spin_unlock_bh(&net->xfrm.xfrm_state_lock);
index c8f6b11d5da17125e6308fe1899f503a639b3a57..f699cf05d40985a79f1d54a9b51812f07bddfd98 100755 (executable)
@@ -1092,7 +1092,11 @@ sub output_struct_rst(%) {
        print "\n\n.. c:type:: " . $name . "\n\n";
     } else {
        my $name = $args{'struct'};
-       print "\n\n.. c:struct:: " . $name . "\n\n";
+       if ($args{'type'} eq 'union') {
+           print "\n\n.. c:union:: " . $name . "\n\n";
+       } else {
+           print "\n\n.. c:struct:: " . $name . "\n\n";
+       }
     }
     print_lineno($declaration_start_line);
     $lineprefix = "   ";
@@ -1427,20 +1431,25 @@ sub dump_enum($$) {
     }
 }
 
+my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x;
+my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
+my $typedef_args = qr { \s*\((.*)\); }x;
+
+my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
+my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;
+
 sub dump_typedef($$) {
     my $x = shift;
     my $file = shift;
 
     $x =~ s@/\*.*?\*/@@gos;    # strip comments.
 
-    # Parse function prototypes
-    if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
-       $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
-
-       # Function typedefs
+    # Parse function typedef prototypes
+    if ($x =~ $typedef1 || $x =~ $typedef2) {
        $return_type = $1;
        $declaration_name = $2;
        my $args = $3;
+       $return_type =~ s/^\s+//;
 
        create_parameterlist($args, ',', $file, $declaration_name);
 
index ba85bb23f06017b4ed401da32167c057d526b1d0..1c17c3a24411d6b0dfd33424d1b493d4750d0221 100644 (file)
@@ -159,6 +159,21 @@ struct kvm_sync_regs {
 struct kvm_arch_memory_slot {
 };
 
+/*
+ * PMU filter structure. Describe a range of events with a particular
+ * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
+ */
+struct kvm_pmu_event_filter {
+       __u16   base_event;
+       __u16   nevents;
+
+#define KVM_PMU_EVENT_ALLOW    0
+#define KVM_PMU_EVENT_DENY     1
+
+       __u8    action;
+       __u8    pad[3];
+};
+
 /* for KVM_GET/SET_VCPU_EVENTS */
 struct kvm_vcpu_events {
        struct {
@@ -242,6 +257,15 @@ struct kvm_vcpu_events {
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL          0
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL              1
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED       2
+
+/*
+ * Only two states can be presented by the host kernel:
+ * - NOT_REQUIRED: the guest doesn't need to do anything
+ * - NOT_AVAIL: the guest isn't mitigated (it can still use SSBS if available)
+ *
+ * All the other values are deprecated. The host still accepts all
+ * values (they are ABI), but will narrow them to the above two.
+ */
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2    KVM_REG_ARM_FW_REG(2)
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL          0
 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN            1
@@ -329,6 +353,7 @@ struct kvm_vcpu_events {
 #define KVM_ARM_VCPU_PMU_V3_CTRL       0
 #define   KVM_ARM_VCPU_PMU_V3_IRQ      0
 #define   KVM_ARM_VCPU_PMU_V3_INIT     1
+#define   KVM_ARM_VCPU_PMU_V3_FILTER   2
 #define KVM_ARM_VCPU_TIMER_CTRL                1
 #define   KVM_ARM_VCPU_TIMER_IRQ_VTIMER                0
 #define   KVM_ARM_VCPU_TIMER_IRQ_PTIMER                1
index 6ca1e68d7103139f1ef6029980aea2f3198072be..ede318653c87dd82ea64add7bec8ff8d38efaac7 100644 (file)
@@ -29,7 +29,7 @@
        { 0x13, "SIGP conditional emergency signal" },          \
        { 0x15, "SIGP sense running" },                         \
        { 0x16, "SIGP set multithreading"},                     \
-       { 0x17, "SIGP store additional status ait address"}
+       { 0x17, "SIGP store additional status at address"}
 
 #define icpt_prog_codes                                                \
        { 0x0001, "Prog Operation" },                           \
index 2901d5df4366c0409e6d295d0eb1585aa1568ea9..dad350d42ecfbf3063c64138375e81591729b092 100644 (file)
@@ -96,7 +96,7 @@
 #define X86_FEATURE_SYSCALL32          ( 3*32+14) /* "" syscall in IA32 userspace */
 #define X86_FEATURE_SYSENTER32         ( 3*32+15) /* "" sysenter in IA32 userspace */
 #define X86_FEATURE_REP_GOOD           ( 3*32+16) /* REP microcode works well */
-/* free                                        ( 3*32+17) */
+#define X86_FEATURE_SME_COHERENT       ( 3*32+17) /* "" AMD hardware-enforced cache coherency */
 #define X86_FEATURE_LFENCE_RDTSC       ( 3*32+18) /* "" LFENCE synchronizes RDTSC */
 #define X86_FEATURE_ACC_POWER          ( 3*32+19) /* AMD Accumulated Power Mechanism */
 #define X86_FEATURE_NOPL               ( 3*32+20) /* The NOPL (0F 1F) instructions */
 #define X86_FEATURE_EPT_AD             ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
 #define X86_FEATURE_VMCALL             ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
 #define X86_FEATURE_VMW_VMMCALL                ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */
+#define X86_FEATURE_SEV_ES             ( 8*32+20) /* AMD Secure Encrypted Virtualization - Encrypted State */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
 #define X86_FEATURE_FSGSBASE           ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
 #define X86_FEATURE_FENCE_SWAPGS_USER  (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
 #define X86_FEATURE_FENCE_SWAPGS_KERNEL        (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
 #define X86_FEATURE_SPLIT_LOCK_DETECT  (11*32+ 6) /* #AC for split lock */
+#define X86_FEATURE_PER_THREAD_MBA     (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
 #define X86_FEATURE_AVX512_BF16                (12*32+ 5) /* AVX512 BFLOAT16 instructions */
 #define X86_FEATURE_CLDEMOTE           (16*32+25) /* CLDEMOTE instruction */
 #define X86_FEATURE_MOVDIRI            (16*32+27) /* MOVDIRI instruction */
 #define X86_FEATURE_MOVDIR64B          (16*32+28) /* MOVDIR64B instruction */
+#define X86_FEATURE_ENQCMD             (16*32+29) /* ENQCMD and ENQCMDS instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
 #define X86_FEATURE_OVERFLOW_RECOV     (17*32+ 0) /* MCA overflow recovery support */
 #define X86_FEATURE_MD_CLEAR           (18*32+10) /* VERW clears CPU buffers */
 #define X86_FEATURE_TSX_FORCE_ABORT    (18*32+13) /* "" TSX_FORCE_ABORT */
 #define X86_FEATURE_SERIALIZE          (18*32+14) /* SERIALIZE instruction */
+#define X86_FEATURE_TSXLDTRK           (18*32+16) /* TSX Suspend Load Address Tracking */
 #define X86_FEATURE_PCONFIG            (18*32+18) /* Intel PCONFIG */
 #define X86_FEATURE_ARCH_LBR           (18*32+19) /* Intel ARCH LBR */
 #define X86_FEATURE_SPEC_CTRL          (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
index 4ea8584682f9982662e34db1f9df77377f4a3662..5861d34f977182983ab4d0834f109acaca323d0f 100644 (file)
 # define DISABLE_PTI           (1 << (X86_FEATURE_PTI & 31))
 #endif
 
+#ifdef CONFIG_IOMMU_SUPPORT
+# define DISABLE_ENQCMD        0
+#else
+# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
+#endif
+
 /*
  * Make sure to add features to the correct mask
  */
@@ -75,7 +81,8 @@
 #define DISABLED_MASK13        0
 #define DISABLED_MASK14        0
 #define DISABLED_MASK15        0
-#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP)
+#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \
+                        DISABLE_ENQCMD)
 #define DISABLED_MASK17        0
 #define DISABLED_MASK18        0
 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)
index 2859ee4f39a83fa4d73cc0f261e3effff7a455e7..972a34d935059aa49d01db8f20c3e598fffb22ac 100644 (file)
 #define MSR_IA32_LASTINTFROMIP         0x000001dd
 #define MSR_IA32_LASTINTTOIP           0x000001de
 
+#define MSR_IA32_PASID                 0x00000d93
+#define MSR_IA32_PASID_VALID           BIT_ULL(31)
+
 /* DEBUGCTLMSR bits (others vary by model): */
 #define DEBUGCTLMSR_LBR                        (1UL <<  0) /* last branch recording */
 #define DEBUGCTLMSR_BTF_SHIFT          1
 #define MSR_AMD64_IBSOP_REG_MASK       ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
 #define MSR_AMD64_IBSCTL               0xc001103a
 #define MSR_AMD64_IBSBRTARGET          0xc001103b
+#define MSR_AMD64_ICIBSEXTDCTL         0xc001103c
 #define MSR_AMD64_IBSOPDATA4           0xc001103d
 #define MSR_AMD64_IBS_REG_COUNT_MAX    8 /* includes MSR_AMD64_IBSBRTARGET */
+#define MSR_AMD64_SEV_ES_GHCB          0xc0010130
 #define MSR_AMD64_SEV                  0xc0010131
 #define MSR_AMD64_SEV_ENABLED_BIT      0
+#define MSR_AMD64_SEV_ES_ENABLED_BIT   1
 #define MSR_AMD64_SEV_ENABLED          BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT)
+#define MSR_AMD64_SEV_ES_ENABLED       BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT)
 
 #define MSR_AMD64_VIRT_SPEC_CTRL       0xc001011f
 
 #define MSR_CORE_PERF_FIXED_CTR0       0x00000309
 #define MSR_CORE_PERF_FIXED_CTR1       0x0000030a
 #define MSR_CORE_PERF_FIXED_CTR2       0x0000030b
+#define MSR_CORE_PERF_FIXED_CTR3       0x0000030c
 #define MSR_CORE_PERF_FIXED_CTR_CTRL   0x0000038d
 #define MSR_CORE_PERF_GLOBAL_STATUS    0x0000038e
 #define MSR_CORE_PERF_GLOBAL_CTRL      0x0000038f
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL  0x00000390
 
+#define MSR_PERF_METRICS               0x00000329
+
 /* PERF_GLOBAL_OVF_CTL bits */
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT       55
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI           (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT)
index 6847d85400a8b738ca2adf00ea95fdf8f349fafc..3ff0d48469f281fb104fe164c2b3c0b7dea9cae8 100644 (file)
@@ -54,7 +54,7 @@
 #endif
 
 #ifdef CONFIG_X86_64
-#ifdef CONFIG_PARAVIRT
+#ifdef CONFIG_PARAVIRT_XXL
 /* Paravirtualized systems may not have PSE or PGE available */
 #define NEED_PSE       0
 #define NEED_PGE       0
index 0780f97c185088ce214bf7f57d917fda7aff730b..89e5f3d1bba86b8bbb0e7a80cbed2d1373d093af 100644 (file)
@@ -192,6 +192,26 @@ struct kvm_msr_list {
        __u32 indices[0];
 };
 
+/* Maximum size of any access bitmap in bytes */
+#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
+
+/* for KVM_X86_SET_MSR_FILTER */
+struct kvm_msr_filter_range {
+#define KVM_MSR_FILTER_READ  (1 << 0)
+#define KVM_MSR_FILTER_WRITE (1 << 1)
+       __u32 flags;
+       __u32 nmsrs; /* number of msrs in bitmap */
+       __u32 base;  /* MSR index the bitmap starts at */
+       __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
+};
+
+#define KVM_MSR_FILTER_MAX_RANGES 16
+struct kvm_msr_filter {
+#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
+#define KVM_MSR_FILTER_DEFAULT_DENY  (1 << 0)
+       __u32 flags;
+       struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
+};
 
 struct kvm_cpuid_entry {
        __u32 function;
index 2e8a30f06c74641cead87f4f460089f081c63ea7..f1d8307454e0c166fa244e65e81261c78687c1aa 100644 (file)
@@ -29,6 +29,7 @@
 #define SVM_EXIT_WRITE_DR6     0x036
 #define SVM_EXIT_WRITE_DR7     0x037
 #define SVM_EXIT_EXCP_BASE     0x040
+#define SVM_EXIT_LAST_EXCP     0x05f
 #define SVM_EXIT_INTR          0x060
 #define SVM_EXIT_NMI           0x061
 #define SVM_EXIT_SMI           0x062
 #define SVM_EXIT_MWAIT_COND    0x08c
 #define SVM_EXIT_XSETBV        0x08d
 #define SVM_EXIT_RDPRU         0x08e
+#define SVM_EXIT_INVPCID       0x0a2
 #define SVM_EXIT_NPF           0x400
 #define SVM_EXIT_AVIC_INCOMPLETE_IPI           0x401
 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS     0x402
 
+/* SEV-ES software-defined VMGEXIT events */
+#define SVM_VMGEXIT_MMIO_READ                  0x80000001
+#define SVM_VMGEXIT_MMIO_WRITE                 0x80000002
+#define SVM_VMGEXIT_NMI_COMPLETE               0x80000003
+#define SVM_VMGEXIT_AP_HLT_LOOP                        0x80000004
+#define SVM_VMGEXIT_AP_JUMP_TABLE              0x80000005
+#define SVM_VMGEXIT_SET_AP_JUMP_TABLE          0
+#define SVM_VMGEXIT_GET_AP_JUMP_TABLE          1
+#define SVM_VMGEXIT_UNSUPPORTED_EVENT          0x8000ffff
+
 #define SVM_EXIT_ERR           -1
 
 #define SVM_EXIT_REASONS \
        { SVM_EXIT_MONITOR,     "monitor" }, \
        { SVM_EXIT_MWAIT,       "mwait" }, \
        { SVM_EXIT_XSETBV,      "xsetbv" }, \
+       { SVM_EXIT_INVPCID,     "invpcid" }, \
        { SVM_EXIT_NPF,         "npf" }, \
        { SVM_EXIT_AVIC_INCOMPLETE_IPI,         "avic_incomplete_ipi" }, \
        { SVM_EXIT_AVIC_UNACCELERATED_ACCESS,   "avic_unaccelerated_access" }, \
index a04e81321c665f195d129e25f5d6086a27e47cfe..464873883396e9c7e85795174f019ed8106a3192 100644 (file)
@@ -185,7 +185,6 @@ int main(int argc, char *argv[])
        main_test_libperl();
        main_test_hello();
        main_test_libelf();
-       main_test_libelf_mmap();
        main_test_get_current_dir_name();
        main_test_gettid();
        main_test_glibc();
index b9d4322e1e6551f3e987624073a08a9b3368b7f8..95c072b70d0e832f70a4ac07470bcd0d1ed46deb 100644 (file)
 #define  __pure                __attribute__((pure))
 #endif
 #define  noinline      __attribute__((noinline))
-#ifdef __has_attribute
-#if __has_attribute(disable_tail_calls)
-#define __no_tail_call __attribute__((disable_tail_calls))
-#endif
-#endif
-#ifndef __no_tail_call
-#if GCC_VERSION > 40201
-#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
-#else
-#define __no_tail_call
-#endif
-#endif
 #ifndef __packed
 #define __packed       __attribute__((packed))
 #endif
index 2b3f7353e891f5ad8ab63aae9ef78dab4a23449e..d22a974372c0e212433a512611ddbef78c2c74f5 100644 (file)
@@ -47,9 +47,6 @@
 #ifndef noinline
 #define noinline
 #endif
-#ifndef __no_tail_call
-#define __no_tail_call
-#endif
 
 /* Are two types/vars the same type (ignoring qualifiers)? */
 #ifndef __same_type
index f2b5d72a46c23b9f9abd6b439b29e1192bf59dff..2056318988f774931c4e0a3104144bf4a75ff52f 100644 (file)
@@ -857,9 +857,11 @@ __SYSCALL(__NR_openat2, sys_openat2)
 __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
 #define __NR_faccessat2 439
 __SYSCALL(__NR_faccessat2, sys_faccessat2)
+#define __NR_process_madvise 440
+__SYSCALL(__NR_process_madvise, sys_process_madvise)
 
 #undef __NR_syscalls
-#define __NR_syscalls 440
+#define __NR_syscalls 441
 
 /*
  * 32 bit systems traditionally used different
index 00546062e0235d9b445c5288573e3bd1854aa04a..fa1f3d62f9a6cebb300c63bf82955af91ab2a6ed 100644 (file)
@@ -619,6 +619,12 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_PERF_REVISION       54
 
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of
+ * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See
+ * I915_EXEC_USE_EXTENSIONS.
+ */
+#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
+
 /* Must be kept compact -- no holes and well documented */
 
 typedef struct drm_i915_getparam {
@@ -1046,6 +1052,38 @@ struct drm_i915_gem_exec_fence {
        __u32 flags;
 };
 
+/**
+ * See drm_i915_gem_execbuffer_ext_timeline_fences.
+ */
+#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
+
+/**
+ * This structure describes an array of drm_syncobj and associated points for
+ * timeline variants of drm_syncobj. It is invalid to append this structure to
+ * the execbuf if I915_EXEC_FENCE_ARRAY is set.
+ */
+struct drm_i915_gem_execbuffer_ext_timeline_fences {
+       struct i915_user_extension base;
+
+       /**
+        * Number of element in the handles_ptr & value_ptr arrays.
+        */
+       __u64 fence_count;
+
+       /**
+        * Pointer to an array of struct drm_i915_gem_exec_fence of length
+        * fence_count.
+        */
+       __u64 handles_ptr;
+
+       /**
+        * Pointer to an array of u64 values of length fence_count. Values
+        * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline
+        * drm_syncobj is invalid as it turns a drm_syncobj into a binary one.
+        */
+       __u64 values_ptr;
+};
+
 struct drm_i915_gem_execbuffer2 {
        /**
         * List of gem_exec_object2 structs
@@ -1062,8 +1100,14 @@ struct drm_i915_gem_execbuffer2 {
        __u32 num_cliprects;
        /**
         * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
-        * is not set.  If I915_EXEC_FENCE_ARRAY is set, then this is a
-        * struct drm_i915_gem_exec_fence *fences.
+        * & I915_EXEC_USE_EXTENSIONS are not set.
+        *
+        * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array
+        * of struct drm_i915_gem_exec_fence and num_cliprects is the length
+        * of the array.
+        *
+        * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a
+        * single struct i915_user_extension and num_cliprects is 0.
         */
        __u64 cliprects_ptr;
 #define I915_EXEC_RING_MASK              (0x3f)
@@ -1181,7 +1225,16 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_FENCE_SUBMIT         (1 << 20)
 
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1))
+/*
+ * Setting I915_EXEC_USE_EXTENSIONS implies that
+ * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked
+ * list of i915_user_extension. Each i915_user_extension node is the base of a
+ * larger structure. The list of supported structures are listed in the
+ * drm_i915_gem_execbuffer_ext enum.
+ */
+#define I915_EXEC_USE_EXTENSIONS       (1 << 21)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1))
 
 #define I915_EXEC_CONTEXT_ID_MASK      (0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
index 7875709ccfebff2a5903f73e753a015015729c5d..e5de60336938121f0584e0b43e9fc01fcb3d356c 100644 (file)
@@ -45,7 +45,6 @@ struct fscrypt_policy_v1 {
        __u8 flags;
        __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
 };
-#define fscrypt_policy fscrypt_policy_v1
 
 /*
  * Process-subscribed "logon" key description prefix and payload format.
@@ -156,9 +155,9 @@ struct fscrypt_get_key_status_arg {
        __u32 __out_reserved[13];
 };
 
-#define FS_IOC_SET_ENCRYPTION_POLICY           _IOR('f', 19, struct fscrypt_policy)
+#define FS_IOC_SET_ENCRYPTION_POLICY           _IOR('f', 19, struct fscrypt_policy_v1)
 #define FS_IOC_GET_ENCRYPTION_PWSALT           _IOW('f', 20, __u8[16])
-#define FS_IOC_GET_ENCRYPTION_POLICY           _IOW('f', 21, struct fscrypt_policy)
+#define FS_IOC_GET_ENCRYPTION_POLICY           _IOW('f', 21, struct fscrypt_policy_v1)
 #define FS_IOC_GET_ENCRYPTION_POLICY_EX                _IOWR('f', 22, __u8[9]) /* size + version */
 #define FS_IOC_ADD_ENCRYPTION_KEY              _IOWR('f', 23, struct fscrypt_add_key_arg)
 #define FS_IOC_REMOVE_ENCRYPTION_KEY           _IOWR('f', 24, struct fscrypt_remove_key_arg)
@@ -170,6 +169,7 @@ struct fscrypt_get_key_status_arg {
 
 /* old names; don't add anything new here! */
 #ifndef __KERNEL__
+#define fscrypt_policy                 fscrypt_policy_v1
 #define FS_KEY_DESCRIPTOR_SIZE         FSCRYPT_KEY_DESCRIPTOR_SIZE
 #define FS_POLICY_FLAGS_PAD_4          FSCRYPT_POLICY_FLAGS_PAD_4
 #define FS_POLICY_FLAGS_PAD_8          FSCRYPT_POLICY_FLAGS_PAD_8
index 7d8eced6f459b065c445ba8dcbc107f785dc24fa..ca41220b40b8b25c8f1044496f8024458768868b 100644 (file)
@@ -248,6 +248,8 @@ struct kvm_hyperv_exit {
 #define KVM_EXIT_IOAPIC_EOI       26
 #define KVM_EXIT_HYPERV           27
 #define KVM_EXIT_ARM_NISV         28
+#define KVM_EXIT_X86_RDMSR        29
+#define KVM_EXIT_X86_WRMSR        30
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 /* Emulate instruction failed. */
@@ -413,6 +415,17 @@ struct kvm_run {
                        __u64 esr_iss;
                        __u64 fault_ipa;
                } arm_nisv;
+               /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */
+               struct {
+                       __u8 error; /* user -> kernel */
+                       __u8 pad[7];
+#define KVM_MSR_EXIT_REASON_INVAL      (1 << 0)
+#define KVM_MSR_EXIT_REASON_UNKNOWN    (1 << 1)
+#define KVM_MSR_EXIT_REASON_FILTER     (1 << 2)
+                       __u32 reason; /* kernel -> user */
+                       __u32 index; /* kernel -> user */
+                       __u64 data; /* kernel <-> user */
+               } msr;
                /* Fix the size of the union. */
                char padding[256];
        };
@@ -1037,6 +1050,9 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_SMALLER_MAXPHYADDR 185
 #define KVM_CAP_S390_DIAG318 186
 #define KVM_CAP_STEAL_TIME 187
+#define KVM_CAP_X86_USER_SPACE_MSR 188
+#define KVM_CAP_X86_MSR_FILTER 189
+#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1538,6 +1554,9 @@ struct kvm_pv_cmd {
 /* Available with KVM_CAP_S390_PROTECTED */
 #define KVM_S390_PV_COMMAND            _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
 
+/* Available with KVM_CAP_X86_MSR_FILTER */
+#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO,  0xc6, struct kvm_msr_filter)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
        /* Guest initialization commands */
index 923cc162609c016dd6360d834b34abfe6e1ba459..f55bc680b5b0a45eefca46732e265a8bfe2f46aa 100644 (file)
@@ -27,6 +27,7 @@
 #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
 #define MAP_HUGE_MASK  HUGETLB_FLAG_ENCODE_MASK
 
+#define MAP_HUGE_16KB  HUGETLB_FLAG_ENCODE_16KB
 #define MAP_HUGE_64KB  HUGETLB_FLAG_ENCODE_64KB
 #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
 #define MAP_HUGE_1MB   HUGETLB_FLAG_ENCODE_1MB
index 96a0240f23fed37be9430b72d2f2d9ffd6d42237..dd8306ea336c19b695fa9a748c14f5ad92fe3e63 100644 (file)
@@ -16,6 +16,7 @@
 #define MS_REMOUNT     32      /* Alter flags of a mounted FS */
 #define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
 #define MS_DIRSYNC     128     /* Directory modifications are synchronous */
+#define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
 #define MS_NOATIME     1024    /* Do not update access times. */
 #define MS_NODIRATIME  2048    /* Do not update directory access times */
 #define MS_BIND                4096
index 3e5dcdd48a4998ddc3b59ee77b376d909e345e84..b95d3c485d27e10f5a1b04354a1bb4ba7cc41146 100644 (file)
@@ -1196,7 +1196,7 @@ union perf_mem_data_src {
 
 #define PERF_MEM_SNOOPX_FWD    0x01 /* forward */
 /* 1 free */
-#define PERF_MEM_SNOOPX_SHIFT  38
+#define PERF_MEM_SNOOPX_SHIFT  38
 
 /* locked instruction */
 #define PERF_MEM_LOCK_NA       0x01 /* not available */
index 07b4f8131e362bdc815f37cea0c9067a9464f256..7f0827705c9a461fcf0af8bf070a283f4bd708c1 100644 (file)
@@ -233,6 +233,15 @@ struct prctl_mm_map {
 #define PR_SET_TAGGED_ADDR_CTRL                55
 #define PR_GET_TAGGED_ADDR_CTRL                56
 # define PR_TAGGED_ADDR_ENABLE         (1UL << 0)
+/* MTE tag check fault modes */
+# define PR_MTE_TCF_SHIFT              1
+# define PR_MTE_TCF_NONE               (0UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_SYNC               (1UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_ASYNC              (2UL << PR_MTE_TCF_SHIFT)
+# define PR_MTE_TCF_MASK               (3UL << PR_MTE_TCF_SHIFT)
+/* MTE tag inclusion mask */
+# define PR_MTE_TAG_SHIFT              3
+# define PR_MTE_TAG_MASK               (0xffffUL << PR_MTE_TAG_SHIFT)
 
 /* Control reclaim behavior when allocating memory */
 #define PR_SET_IO_FLUSHER              57
index 75232185324abb8bf16521b525ed007306ab582f..c998860d7bbc4351c37c702ea69ea88a814b19cf 100644 (file)
 
 /* Set event fd for config interrupt*/
 #define VHOST_VDPA_SET_CONFIG_CALL     _IOW(VHOST_VIRTIO, 0x77, int)
+
+/* Get the valid iova range */
+#define VHOST_VDPA_GET_IOVA_RANGE      _IOR(VHOST_VIRTIO, 0x78, \
+                                            struct vhost_vdpa_iova_range)
 #endif
index 6890fc4b063a4a6021ad8530136745130349d483..ce8516e4de34fa60ee50c3fedc0190c625f8f3ac 100644 (file)
@@ -749,6 +749,7 @@ else
   PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
   PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
   PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
+  PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
   PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
   FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
index 347809649ba28fa15be86511d563ff9d427ecaea..379819244b91d275b2c98f7ff38a59049c24b42a 100644 (file)
 437    common  openat2                 sys_openat2
 438    common  pidfd_getfd             sys_pidfd_getfd
 439    common  faccessat2              sys_faccessat2
+440    common  process_madvise         sys_process_madvise
 
 #
-# x32-specific system call numbers start at 512 to avoid cache impact
-# for native 64-bit operation. The __x32_compat_sys stubs are created
-# on-the-fly for compat_sys_*() compatibility system calls if X86_X32
-# is defined.
+# Due to a historical design error, certain syscalls are numbered differently
+# in x32 as compared to native x86_64.  These syscalls have numbers 512-547.
+# Do not add new syscalls to this range.  Numbers 548 and above are available
+# for non-x32 use.
 #
 512    x32     rt_sigaction            compat_sys_rt_sigaction
 513    x32     rt_sigreturn            compat_sys_x32_rt_sigreturn
 545    x32     execveat                compat_sys_execveat
 546    x32     preadv2                 compat_sys_preadv64v2
 547    x32     pwritev2                compat_sys_pwritev64v2
+# This is the end of the legacy x32 range.  Numbers 548 and above are
+# not special and are not to be used for x32-specific syscalls.
index 44a75f234db17c6cb18e133521e0d0d9f112ec03..de80534473afa5fe9da8af543b438fcebd540bf3 100644 (file)
@@ -4639,9 +4639,9 @@ do_concat:
        err = 0;
 
        if (lists[0]) {
-               struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
-                                              "event selector. use 'perf list' to list available events",
-                                              parse_events_option);
+               struct option o = {
+                       .value = &trace->evlist,
+               };
                err = parse_events_option(&o, lists[0], 0);
        }
 out:
@@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u
 {
        struct trace *trace = opt->value;
 
-       if (!list_empty(&trace->evlist->core.entries))
-               return parse_cgroups(opt, str, unset);
-
+       if (!list_empty(&trace->evlist->core.entries)) {
+               struct option o = {
+                       .value = &trace->evlist,
+               };
+               return parse_cgroups(&o, str, unset);
+       }
        trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
 
        return 0;
index de3193552277c1ac892ed61daa6f6bf99fef3235..00f4fcffa81584bab4756537821551ba5dd725f3 100644 (file)
     },
     {
         "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
-        "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
+        "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
         "MetricGroup": "Memory_BW;SoC",
         "MetricName": "DRAM_BW_Use"
     },
index f31794d3b9261e78b8edda6e20431e8b868f3d4d..0dd8b13b5cfb07ee2494512c18b619da038e58d7 100644 (file)
     },
     {
         "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
-        "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
+        "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
         "MetricGroup": "Memory_BW;SoC",
         "MetricName": "DRAM_BW_Use"
     },
index 2491d167bf764f13d20a6f40e37068f0b7f30e6b..83638097c3bc19f8b9fc9e498432238548798aea 100644 (file)
@@ -95,7 +95,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
        return strcmp((const char *) symbol, funcs[idx]);
 }
 
-__no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
+noinline int test_dwarf_unwind__thread(struct thread *thread)
 {
        struct perf_sample sample;
        unsigned long cnt = 0;
@@ -126,7 +126,7 @@ __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
 
 static int global_unwind_retval = -INT_MAX;
 
-__no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
+noinline int test_dwarf_unwind__compare(void *p1, void *p2)
 {
        /* Any possible value should be 'thread' */
        struct thread *thread = *(struct thread **)p1;
@@ -145,7 +145,7 @@ __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
        return p1 - p2;
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
+noinline int test_dwarf_unwind__krava_3(struct thread *thread)
 {
        struct thread *array[2] = {thread, thread};
        void *fp = &bsearch;
@@ -164,12 +164,12 @@ __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
        return global_unwind_retval;
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_2(struct thread *thread)
+noinline int test_dwarf_unwind__krava_2(struct thread *thread)
 {
        return test_dwarf_unwind__krava_3(thread);
 }
 
-__no_tail_call noinline int test_dwarf_unwind__krava_1(struct thread *thread)
+noinline int test_dwarf_unwind__krava_1(struct thread *thread)
 {
        return test_dwarf_unwind__krava_2(thread);
 }
index a07626f072087d78738a81139a063597ccf0e02b..b0e1880cf992b15150ac645595aba7e86d4367e1 100644 (file)
@@ -2963,7 +2963,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,
        struct popup_action actions[MAX_OPTIONS];
        int nr_options = 0;
        int key = -1;
-       char buf[64];
+       char buf[128];
        int delay_secs = hbt ? hbt->refresh : 0;
 
 #define HIST_BROWSER_HELP_COMMON                                       \
index 8763772f1095e9774cfa30cafadaab6b180ac0c1..6b410c3d52dca948253eca99716536c4761a809a 100644 (file)
@@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf)
        const u8 *raw = build_id->data;
        size_t i;
 
+       bf[0] = 0x0;
+
        for (i = 0; i < build_id->size; ++i) {
                sprintf(bid, "%02x", *raw);
                ++raw;
index a405dad068f59dd6ab96a40759adc683fdcbf2c2..3c20b126d60d869aa136b24d4b01c93d6302938e 100644 (file)
@@ -15,6 +15,9 @@
 /* make sure libbpf doesn't use kernel-only integer typedefs */
 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
 
+/* prevent accidental re-addition of reallocarray() */
+#pragma GCC poison reallocarray
+
 /* start with 4 buckets */
 #define HASHMAP_MIN_CAP_BITS 2
 
index e0af36b0e5d839e2fdd57f0f921c8ba17e4a3629..d9b385fe808c695ebd473ea27903da1f343f658a 100644 (file)
@@ -25,6 +25,18 @@ static inline size_t hash_bits(size_t h, int bits)
 #endif
 }
 
+/* generic C-string hashing function */
+static inline size_t str_hash(const char *s)
+{
+       size_t h = 0;
+
+       while (*s) {
+               h = h * 31 + *s;
+               s++;
+       }
+       return h;
+}
+
 typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
 typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx);
 
index 7d4194ffc5b081bb805f259737f64057f5527f68..15385ea00190fe21125b748c7d11801c14a3ce22 100644 (file)
@@ -786,11 +786,20 @@ static int machine__process_ksymbol_unregister(struct machine *machine,
                                               union perf_event *event,
                                               struct perf_sample *sample __maybe_unused)
 {
+       struct symbol *sym;
        struct map *map;
 
        map = maps__find(&machine->kmaps, event->ksymbol.addr);
-       if (map)
+       if (!map)
+               return 0;
+
+       if (map != machine->vmlinux_map)
                maps__remove(&machine->kmaps, map);
+       else {
+               sym = dso__find_symbol(map->dso, map->map_ip(map, map->start));
+               if (sym)
+                       dso__delete_symbol(map->dso, sym);
+       }
 
        return 0;
 }
index 7cbd024e3e634433a22b105d746d147c69a66153..c83c2c6564e010895845a243f564750b15789eba 100644 (file)
@@ -1592,7 +1592,6 @@ static void _free_command_line(wchar_t **command_line, int num)
 static int python_start_script(const char *script, int argc, const char **argv)
 {
        struct tables *tables = &tables_global;
-       PyMODINIT_FUNC (*initfunc)(void);
 #if PY_MAJOR_VERSION < 3
        const char **command_line;
 #else
@@ -1607,20 +1606,18 @@ static int python_start_script(const char *script, int argc, const char **argv)
        FILE *fp;
 
 #if PY_MAJOR_VERSION < 3
-       initfunc = initperf_trace_context;
        command_line = malloc((argc + 1) * sizeof(const char *));
        command_line[0] = script;
        for (i = 1; i < argc + 1; i++)
                command_line[i] = argv[i - 1];
+       PyImport_AppendInittab(name, initperf_trace_context);
 #else
-       initfunc = PyInit_perf_trace_context;
        command_line = malloc((argc + 1) * sizeof(wchar_t *));
        command_line[0] = Py_DecodeLocale(script, NULL);
        for (i = 1; i < argc + 1; i++)
                command_line[i] = Py_DecodeLocale(argv[i - 1], NULL);
+       PyImport_AppendInittab(name, PyInit_perf_trace_context);
 #endif
-
-       PyImport_AppendInittab(name, initfunc);
        Py_Initialize();
 
 #if PY_MAJOR_VERSION < 3
index 7a5f03764702bfb56b470e5eb7a6958d2a0ec387..098080287c687697768e4fb27fb2ced4fe1e38a8 100644 (file)
@@ -595,6 +595,7 @@ static void perf_event__mmap2_swap(union perf_event *event,
        event->mmap2.maj   = bswap_32(event->mmap2.maj);
        event->mmap2.min   = bswap_32(event->mmap2.min);
        event->mmap2.ino   = bswap_64(event->mmap2.ino);
+       event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation);
 
        if (sample_id_all) {
                void *data = &event->mmap2.filename;
@@ -710,6 +711,18 @@ static void perf_event__namespaces_swap(union perf_event *event,
                swap_sample_id_all(event, &event->namespaces.link_info[i]);
 }
 
+static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all)
+{
+       event->cgroup.id = bswap_64(event->cgroup.id);
+
+       if (sample_id_all) {
+               void *data = &event->cgroup.path;
+
+               data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
+               swap_sample_id_all(event, data);
+       }
+}
+
 static u8 revbyte(u8 b)
 {
        int rev = (b >> 4) | ((b & 0xf) << 4);
@@ -952,6 +965,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
        [PERF_RECORD_SWITCH]              = perf_event__switch_swap,
        [PERF_RECORD_SWITCH_CPU_WIDE]     = perf_event__switch_swap,
        [PERF_RECORD_NAMESPACES]          = perf_event__namespaces_swap,
+       [PERF_RECORD_CGROUP]              = perf_event__cgroup_swap,
        [PERF_RECORD_TEXT_POKE]           = perf_event__text_poke_swap,
        [PERF_RECORD_HEADER_ATTR]         = perf_event__hdr_attr_swap,
        [PERF_RECORD_HEADER_EVENT_TYPE]   = perf_event__event_type_swap,
index 6138866665df0b105934c7e284e58139eceee19a..0d14abdf3d722f63031af608978891139d76e226 100644 (file)
@@ -515,6 +515,13 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym)
        }
 }
 
+void dso__delete_symbol(struct dso *dso, struct symbol *sym)
+{
+       rb_erase_cached(&sym->rb_node, &dso->symbols);
+       symbol__delete(sym);
+       dso__reset_find_symbol_cache(dso);
+}
+
 struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
 {
        if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) {
index f4801c488def850ba2da730925a494312f18795e..954d6a049ee2386fba1b648065e01117d6284b3c 100644 (file)
@@ -131,6 +131,8 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map);
 
 void dso__insert_symbol(struct dso *dso,
                        struct symbol *sym);
+void dso__delete_symbol(struct dso *dso,
+                       struct symbol *sym);
 
 struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
 struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name);
index 8019e3dd4c32f13e5e0f157fad059bef804d9499..84a1af2581f58c9ff82c036cd5098970f250884a 100644 (file)
@@ -66,7 +66,6 @@ def isolate_kunit_output(kernel_output):
 def raw_output(kernel_output):
        for line in kernel_output:
                print(line)
-               yield line
 
 DIVIDER = '=' * 60
 
@@ -242,7 +241,7 @@ def parse_test_suite(lines: List[str], expected_suite_index: int) -> TestSuite:
                return None
        test_suite.name = name
        expected_test_case_num = parse_subtest_plan(lines)
-       if not expected_test_case_num:
+       if expected_test_case_num is None:
                return None
        while expected_test_case_num > 0:
                test_case = parse_test_case(lines)
index 99c3c5671ea48a8a09d300f11db8218afad9dee7..0b60855fb8198b0183349e8c87d81d697d9c5845 100755 (executable)
@@ -179,7 +179,7 @@ class KUnitParserTest(unittest.TestCase):
                print_mock = mock.patch('builtins.print').start()
                result = kunit_parser.parse_run_tests(
                        kunit_parser.isolate_kunit_output(file.readlines()))
-               print_mock.assert_any_call(StrContains("no kunit output detected"))
+               print_mock.assert_any_call(StrContains('no tests run!'))
                print_mock.stop()
                file.close()
 
@@ -198,39 +198,57 @@ class KUnitParserTest(unittest.TestCase):
                        'test_data/test_config_printk_time.log')
                with open(prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_ignores_multiple_prefixes(self):
                prefix_log = get_absolute_path(
                        'test_data/test_multiple_prefixes.log')
                with open(prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_prefix_mixed_kernel_output(self):
                mixed_prefix_log = get_absolute_path(
                        'test_data/test_interrupted_tap_output.log')
                with open(mixed_prefix_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_prefix_poundsign(self):
                pound_log = get_absolute_path('test_data/test_pound_sign.log')
                with open(pound_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_kernel_panic_end(self):
                panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log')
                with open(panic_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.TEST_CRASHED,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
        def test_pound_no_prefix(self):
                pound_log = get_absolute_path('test_data/test_pound_no_prefix.log')
                with open(pound_log) as file:
                        result = kunit_parser.parse_run_tests(file.readlines())
-               self.assertEqual('kunit-resource-test', result.suites[0].name)
+                       self.assertEqual(
+                               kunit_parser.TestStatus.SUCCESS,
+                               result.status)
+                       self.assertEqual('kunit-resource-test', result.suites[0].name)
 
 class KUnitJsonTest(unittest.TestCase):
 
index c02ca773946d641291e27d44d73174cc16a17d9d..6bdb57f76eacef0396e68942cb3fa983b6992bab 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index 5c73fb3a1c6fd13a9b163a48d02eb33b0315a375..1fb677728abeb0fe6aa5edb3a0387c05906b9815 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -34,4 +35,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index c045eee75f27fefaabf3ba073d9e282721c19a67..a014ffe9725e3c4e81697f742cee2652a41b2108 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
@@ -22,4 +23,4 @@
 [    0.060000] Stack:
 [    0.060000]  602086f8 601bc260 705c0000 705c0000
 [    0.060000]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000]  6005fcec 601bc260 705c0000 3000000010
index bc48407dcc36c44665c7d2ac620e42e7caf98481..0ad78481a0b450bf463ca7aaab0ae739d4e43018 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000][    T1] printk: console [mc-1] enabled
 [    0.060000][    T1] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000][    T1] TAP version 14
+[    0.060000][    T1] 1..3
 [    0.060000][    T1]         # Subtest: kunit-resource-test
 [    0.060000][    T1]         1..5
 [    0.060000][    T1]         ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@
 [    0.060000][    T1] Stack:
 [    0.060000][    T1]  602086f8 601bc260 705c0000 705c0000
 [    0.060000][    T1]  602086f8 6005fcec 705c0000 6002c6ab
-[    0.060000][    T1]  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+[    0.060000][    T1]  6005fcec 601bc260 705c0000 3000000010
index 2ceb360be7d52cbee4b0a5a426456605ded7466e..dc4cf09a96d077bbc0b5fbcb312251742e390379 100644 (file)
@@ -1,6 +1,7 @@
  printk: console [mc-1] enabled
  random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
  TAP version 14
+ 1..3
        # Subtest: kunit-resource-test
        1..5
        ok 1 - kunit_resource_test_init_resources
@@ -30,4 +31,4 @@
  Stack:
   602086f8 601bc260 705c0000 705c0000
   602086f8 6005fcec 705c0000 6002c6ab
-  6005fcec 601bc260 705c0000 3000000010
\ No newline at end of file
+  6005fcec 601bc260 705c0000 3000000010
index 28ffa5ba03bfa81ea02ea9d38e7de7acf3dd9e5d..3f358e3a7ba0d118c1dc15e5f637fb8ffb5aa388 100644 (file)
@@ -1,6 +1,7 @@
 [    0.060000] printk: console [mc-1] enabled
 [    0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
 [    0.060000] TAP version 14
+[    0.060000] 1..3
 [    0.060000]         # Subtest: kunit-resource-test
 [    0.060000]         1..5
 [    0.060000]         ok 1 - kunit_resource_test_init_resources
index d979ff14775ad87a3a3077c487c6ca08906261c6..8f82f99f7748aff7596f2d6a4de4e4ce9be98bde 100644 (file)
@@ -3282,4 +3282,99 @@ TEST(epoll60)
        close(ctx.epfd);
 }
 
+struct epoll61_ctx {
+       int epfd;
+       int evfd;
+};
+
+static void *epoll61_write_eventfd(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       int64_t l = 1;
+
+       usleep(10950);
+       write(ctx->evfd, &l, sizeof(l));
+       return NULL;
+}
+
+static void *epoll61_epoll_with_timeout(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       struct epoll_event events[1];
+       int n;
+
+       n = epoll_wait(ctx->epfd, events, 1, 11);
+       /*
+        * If epoll returned the eventfd, write on the eventfd to wake up the
+        * blocking poller.
+        */
+       if (n == 1) {
+               int64_t l = 1;
+
+               write(ctx->evfd, &l, sizeof(l));
+       }
+       return NULL;
+}
+
+static void *epoll61_blocking_epoll(void *ctx_)
+{
+       struct epoll61_ctx *ctx = ctx_;
+       struct epoll_event events[1];
+
+       epoll_wait(ctx->epfd, events, 1, -1);
+       return NULL;
+}
+
+TEST(epoll61)
+{
+       struct epoll61_ctx ctx;
+       struct epoll_event ev;
+       int i, r;
+
+       ctx.epfd = epoll_create1(0);
+       ASSERT_GE(ctx.epfd, 0);
+       ctx.evfd = eventfd(0, EFD_NONBLOCK);
+       ASSERT_GE(ctx.evfd, 0);
+
+       ev.events = EPOLLIN | EPOLLET | EPOLLERR | EPOLLHUP;
+       ev.data.ptr = NULL;
+       r = epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd, &ev);
+       ASSERT_EQ(r, 0);
+
+       /*
+        * We are testing a race.  Repeat the test case 1000 times to make it
+        * more likely to fail in case of a bug.
+        */
+       for (i = 0; i < 1000; i++) {
+               pthread_t threads[3];
+               int n;
+
+               /*
+                * Start 3 threads:
+                * Thread 1 sleeps for 10.9ms and writes to the evenfd.
+                * Thread 2 calls epoll with a timeout of 11ms.
+                * Thread 3 calls epoll with a timeout of -1.
+                *
+                * The eventfd write by Thread 1 should either wakeup Thread 2
+                * or Thread 3.  If it wakes up Thread 2, Thread 2 writes on the
+                * eventfd to wake up Thread 3.
+                *
+                * If no events are missed, all three threads should eventually
+                * be joinable.
+                */
+               ASSERT_EQ(pthread_create(&threads[0], NULL,
+                                        epoll61_write_eventfd, &ctx), 0);
+               ASSERT_EQ(pthread_create(&threads[1], NULL,
+                                        epoll61_epoll_with_timeout, &ctx), 0);
+               ASSERT_EQ(pthread_create(&threads[2], NULL,
+                                        epoll61_blocking_epoll, &ctx), 0);
+
+               for (n = 0; n < ARRAY_SIZE(threads); ++n)
+                       ASSERT_EQ(pthread_join(threads[n], NULL), 0);
+       }
+
+       close(ctx.epfd);
+       close(ctx.evfd);
+}
+
 TEST_HARNESS_MAIN
index f19804df244c08669ef5241c18fa27efd5a6f100..d747d6b1da1a6078ee01abc037eeed01bee2533e 100644 (file)
  */
 
 /**
- * ASSERT_EQ(expected, seen)
+ * ASSERT_EQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, ==, 1)
 
 /**
- * ASSERT_NE(expected, seen)
+ * ASSERT_NE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, !=, 1)
 
 /**
- * ASSERT_LT(expected, seen)
+ * ASSERT_LT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <, 1)
 
 /**
- * ASSERT_LE(expected, seen)
+ * ASSERT_LE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <=, 1)
 
 /**
- * ASSERT_GT(expected, seen)
+ * ASSERT_GT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >, 1)
 
 /**
- * ASSERT_GE(expected, seen)
+ * ASSERT_GE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >=, 1)
 
 /**
- * ASSERT_NULL(seen)
+ * ASSERT_NULL()
  *
  * @seen: measured value
  *
        __EXPECT(NULL, "NULL", seen, #seen, ==, 1)
 
 /**
- * ASSERT_TRUE(seen)
+ * ASSERT_TRUE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, !=, 1)
 
 /**
- * ASSERT_FALSE(seen)
+ * ASSERT_FALSE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, ==, 1)
 
 /**
- * ASSERT_STREQ(expected, seen)
+ * ASSERT_STREQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, ==, 1)
 
 /**
- * ASSERT_STRNE(expected, seen)
+ * ASSERT_STRNE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, !=, 1)
 
 /**
- * EXPECT_EQ(expected, seen)
+ * EXPECT_EQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, ==, 0)
 
 /**
- * EXPECT_NE(expected, seen)
+ * EXPECT_NE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, !=, 0)
 
 /**
- * EXPECT_LT(expected, seen)
+ * EXPECT_LT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <, 0)
 
 /**
- * EXPECT_LE(expected, seen)
+ * EXPECT_LE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, <=, 0)
 
 /**
- * EXPECT_GT(expected, seen)
+ * EXPECT_GT()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >, 0)
 
 /**
- * EXPECT_GE(expected, seen)
+ * EXPECT_GE()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT(expected, #expected, seen, #seen, >=, 0)
 
 /**
- * EXPECT_NULL(seen)
+ * EXPECT_NULL()
  *
  * @seen: measured value
  *
        __EXPECT(NULL, "NULL", seen, #seen, ==, 0)
 
 /**
- * EXPECT_TRUE(seen)
+ * EXPECT_TRUE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, !=, 0)
 
 /**
- * EXPECT_FALSE(seen)
+ * EXPECT_FALSE()
  *
  * @seen: measured value
  *
        __EXPECT(0, "0", seen, #seen, ==, 0)
 
 /**
- * EXPECT_STREQ(expected, seen)
+ * EXPECT_STREQ()
  *
  * @expected: expected value
  * @seen: measured value
        __EXPECT_STR(expected, seen, ==, 0)
 
 /**
- * EXPECT_STRNE(expected, seen)
+ * EXPECT_STRNE()
  *
  * @expected: expected value
  * @seen: measured value
index d77f4829f1e0702fa63f4019683101df9fac9e60..74c69b75f6f5ab944c6f055692b3684ca1a554d2 100755 (executable)
@@ -316,6 +316,14 @@ pp sleep 3
 n2 ping -W 1 -c 1 192.168.241.1
 n1 wg set wg0 peer "$pub2" persistent-keepalive 0
 
+# Test that sk_bound_dev_if works
+n1 ping -I wg0 -c 1 -W 1 192.168.241.2
+# What about when the mark changes and the packet must be rerouted?
+n1 iptables -t mangle -I OUTPUT -j MARK --set-xmark 1
+n1 ping -c 1 -W 1 192.168.241.2 # First the boring case
+n1 ping -I wg0 -c 1 -W 1 192.168.241.2 # Then the sk_bound_dev_if case
+n1 iptables -t mangle -D OUTPUT -j MARK --set-xmark 1
+
 # Test that onion routing works, even when it loops
 n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5
 ip1 addr add 192.168.242.1/24 dev wg0
index d531de13c95b06aba2f3596627673a0482bdbd09..4eecb432a66c1c2c2c40e01149088a884bfc8679 100644 (file)
@@ -18,10 +18,12 @@ CONFIG_NF_NAT=y
 CONFIG_NETFILTER_XTABLES=y
 CONFIG_NETFILTER_XT_NAT=y
 CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MARK=y
 CONFIG_NF_CONNTRACK_IPV4=y
 CONFIG_NF_NAT_IPV4=y
 CONFIG_IP_NF_IPTABLES=y
 CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_MANGLE=y
 CONFIG_IP_NF_NAT=y
 CONFIG_IP_ADVANCED_ROUTER=y
 CONFIG_IP_MULTIPLE_TABLES=y