Kernel
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- 3 participants
- 17953 discussions
Backport 5.10.117 LTS patches from upstream.
git cherry-pick v5.10.116..v5.10.117~1 -s
Complicts:
Already merged(2):
e68b60ae29de1 SUNRPC: Ensure we flush any closed sockets before xs_xprt_free()
29f077d07051 io_uring: always use original task when preparing req identity
Context conflict:
7e849dbe604d cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in
cpuset_init_smp()
Total patches: 68 - 2 = 66
Alexandra Winter (3):
s390/ctcm: fix variable dereferenced before check
s390/ctcm: fix potential memory leak
s390/lcs: fix variable dereferenced before check
Andreas Gruenbacher (1):
gfs2: Fix filesystem block deallocation for short writes
AngeloGioacchino Del Regno (2):
serial: 8250_mtk: Fix UART_EFR register address
serial: 8250_mtk: Fix register address for XON/XOFF character
Camel Guo (1):
hwmon: (tmp401) Add OF device ID table
ChiYuan Huang (1):
usb: typec: tcpci_mt6360: Update for BMC PHY setting
Christophe JAILLET (1):
drm/nouveau: Fix a potential theorical leak in
nouveau_get_backlight_name()
Dan Aloni (1):
nfs: fix broken handling of the softreval mount option
Dan Vacura (1):
usb: gadget: uvc: allow for application to cleanly shutdown
Daniel Starke (1):
tty: n_gsm: fix mux activation issues in gsm_config()
Eric Dumazet (2):
netlink: do not reset transport header in netlink_recvmsg()
tcp: resalt the secret every 10 seconds
Ethan Yang (1):
USB: serial: qcserial: add support for Sierra Wireless EM7590
Florian Fainelli (2):
net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral
net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down()
Francesco Dolcini (1):
net: phy: Fix race condition on link status change
Guangguan Wang (1):
net/smc: non blocking recvmsg() return -EAGAIN when no data and
signal_pending
Guenter Roeck (1):
iwlwifi: iwl-dbg: Use del_timer_sync() before freeing
Gustavo A. R. Silva (1):
SUNRPC: Fix fall-through warnings for Clang
Jeff Layton (1):
ceph: fix setting of xattrs on async created inodes
Jesse Brandeburg (1):
dim: initialize all struct fields
Ji-Ze Hong (Peter Hong) (1):
hwmon: (f71882fg) Fix negative temperature
Jiapeng Chong (1):
sfc: Use swap() instead of open coding it
Joel Savitz (1):
selftests: vm: Makefile: rename TARGETS to VMTARGETS
Johannes Berg (1):
mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
Lokesh Dhoundiyal (1):
ipv4: drop dst in multicast routing path
Manikanta Pubbisetty (1):
mac80211: Reset MBSSID parameters upon connection
Manuel Ullmann (1):
net: atlantic: always deep reset on pm op, fixing up my null deref
regression
Mark Brown (3):
ASoC: max98090: Reject invalid values in custom control put()
ASoC: max98090: Generate notifications on changes for custom control
ASoC: ops: Validate input values in snd_soc_put_volsw_range()
Matthew Hagan (1):
net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
Maxim Mikityanskiy (1):
tls: Fix context leak on tls_device_down
Miaoqian Lin (1):
slimbus: qcom: Fix IRQ check in qcom_slim_probe
Michael Tretter (1):
usb: gadget: uvc: rename function to be more consistent
Mike Rapoport (1):
arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear
map
Nicolas Dichtel (1):
ping: fix address binding wrt vrf
Paolo Abeni (1):
net/sched: act_pedit: really ensure the skb is writable
Randy Dunlap (1):
hwmon: (ltq-cputemp) restrict it to SOC_XWAY
Robin Murphy (1):
drm/nouveau/tegra: Stop using iommu_present()
Scott Chen (1):
USB: serial: pl2303: add device id for HP LM930 Display
Sergey Ryazanov (1):
usb: cdc-wdm: fix reading stuck on device close
Shravya Kumbham (1):
net: emaclite: Don't advertise 1000BASE-T and do auto negotiation
Sven Eckelmann (1):
batman-adv: Don't skb_split skbuffs with frag_list
Sven Schnelle (1):
s390: disable -Warray-bounds
Sven Schwermer (2):
USB: serial: option: add Fibocom L610 modem
USB: serial: option: add Fibocom MA510 modem
Taehee Yoo (2):
net: sfc: fix memory leak due to ptp channel
net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
Tariq Toukan (1):
net: Fix features skip in for_each_netdev_feature()
Thiébaud Weksteen (1):
firmware_loader: use kernel credentials when reading firmware
Trond Myklebust (3):
SUNRPC: Clean up scheduling of autoclose
SUNRPC: Prevent immediate close+reconnect
SUNRPC: Don't call connect() more than once on a TCP socket
Uwe Kleine-König (1):
usb: typec: tcpci: Don't skip cleanup in .remove() on error
Vladimir Oltean (4):
net: mscc: ocelot: fix last VCAP IS1/IS2 filter persisting in hardware
when deleted
net: mscc: ocelot: fix VCAP IS2 filters matching on both lookups
net: mscc: ocelot: restrict tc-trap actions to VCAP IS2 lookup 0
net: mscc: ocelot: avoid corrupting hardware counters when moving VCAP
filters
Waiman Long (1):
cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in
cpuset_init_smp()
Xiaomeng Tong (1):
i40e: i40e_main: fix a missing check on list iterator
Yang Yingliang (2):
ionic: fix missing pci_release_regions() on error in ionic_probe()
tty/serial: digicolor: fix possible null-ptr-deref in
digicolor_uart_probe()
Zack Rusin (1):
drm/vmwgfx: Initialize drm_mode_fb_cmd2
arch/arm/include/asm/io.h | 3 ++
arch/arm/mm/ioremap.c | 8 ++++
arch/arm64/include/asm/io.h | 4 ++
arch/arm64/mm/ioremap.c | 9 ++++
arch/s390/Makefile | 10 +++++
drivers/base/firmware_loader/main.c | 17 +++++++
drivers/gpu/drm/nouveau/nouveau_backlight.c | 9 ++--
.../drm/nouveau/nvkm/engine/device/tegra.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
drivers/hwmon/Kconfig | 2 +-
drivers/hwmon/f71882fg.c | 5 ++-
drivers/hwmon/tmp401.c | 11 +++++
drivers/net/dsa/bcm_sf2.c | 3 ++
.../ethernet/aquantia/atlantic/aq_pci_func.c | 4 +-
.../net/ethernet/broadcom/genet/bcmgenet.c | 4 ++
drivers/net/ethernet/intel/i40e/i40e_main.c | 27 +++++------
drivers/net/ethernet/mscc/ocelot_flower.c | 5 ++-
drivers/net/ethernet/mscc/ocelot_vcap.c | 9 +++-
.../ethernet/pensando/ionic/ionic_bus_pci.c | 3 +-
drivers/net/ethernet/sfc/ef10.c | 5 +++
drivers/net/ethernet/sfc/efx_channels.c | 21 +++++----
drivers/net/ethernet/sfc/ptp.c | 14 +++++-
drivers/net/ethernet/sfc/ptp.h | 1 +
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 15 -------
drivers/net/phy/phy.c | 45 ++++++++++++++++---
drivers/net/phy/sfp.c | 12 ++++-
.../net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +-
drivers/net/wireless/mac80211_hwsim.c | 3 ++
drivers/s390/net/ctcm_mpc.c | 6 +--
drivers/s390/net/ctcm_sysfs.c | 5 ++-
drivers/s390/net/lcs.c | 7 +--
drivers/slimbus/qcom-ctrl.c | 4 +-
drivers/tty/n_gsm.c | 12 +++--
drivers/tty/serial/8250/8250_mtk.c | 22 +++++----
drivers/tty/serial/digicolor-usart.c | 5 +--
drivers/usb/class/cdc-wdm.c | 1 +
drivers/usb/gadget/function/f_uvc.c | 32 +++++++++++--
drivers/usb/gadget/function/uvc.h | 2 +
drivers/usb/gadget/function/uvc_v4l2.c | 3 +-
drivers/usb/serial/option.c | 4 ++
drivers/usb/serial/pl2303.c | 1 +
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/qcserial.c | 2 +
drivers/usb/typec/tcpm/tcpci.c | 2 +-
drivers/usb/typec/tcpm/tcpci_mt6360.c | 26 +++++++++++
fs/ceph/file.c | 16 +++++--
fs/gfs2/bmap.c | 11 +++--
fs/nfs/fs_context.c | 2 +-
include/linux/netdev_features.h | 4 +-
include/linux/sunrpc/xprtsock.h | 1 +
include/net/tc_act/tc_pedit.h | 1 +
kernel/cgroup/cpuset.c | 7 ++-
lib/dim/net_dim.c | 44 +++++++++---------
net/batman-adv/fragmentation.c | 11 +++++
net/core/secure_seq.c | 12 +++--
net/ipv4/ping.c | 15 ++++++-
net/ipv4/route.c | 1 +
net/mac80211/mlme.c | 6 +++
net/netlink/af_netlink.c | 1 -
net/sched/act_pedit.c | 26 +++++++++--
net/smc/smc_rx.c | 4 +-
net/sunrpc/rpc_pipe.c | 1 +
net/sunrpc/xprt.c | 29 +++++++-----
net/sunrpc/xprtsock.c | 21 +++++----
net/tls/tls_device.c | 3 ++
sound/soc/codecs/max98090.c | 5 ++-
sound/soc/soc-ops.c | 18 +++++++-
tools/testing/selftests/vm/Makefile | 10 ++---
68 files changed, 468 insertions(+), 171 deletions(-)
--
2.20.1
1
66

[PATCH openEuler-5.10-LTS 01/22] drivers/perf: hisi: Add driver for HiSilicon PCIe PMU
by Zheng Zengkai 16 Aug '22
by Zheng Zengkai 16 Aug '22
16 Aug '22
From: Qi Liu <liuqi115(a)huawei.com>
mainline inclusion
from mainline-v5.17-rc1
commit 8404b0fbc7fb
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5AZ87
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------------------------------------------------
PCIe PMU Root Complex Integrated End Point(RCiEP) device is supported
to sample bandwidth, latency, buffer occupation etc.
Each PMU RCiEP device monitors multiple Root Ports, and each RCiEP is
registered as a PMU in /sys/bus/event_source/devices, so users can
select target PMU, and use filter to do further sets.
Filtering options contains:
event - select the event.
port - select target Root Ports. Information of Root Ports are
shown under sysfs.
bdf - select requester_id of target EP device.
trig_len - set trigger condition for starting event statistics.
trig_mode - set trigger mode. 0 means starting to statistic when bigger
than trigger condition, and 1 means smaller.
thr_len - set threshold for statistics.
thr_mode - set threshold mode. 0 means count when bigger than threshold,
and 1 means smaller.
Acked-by: Krzysztof Wilczyński <kw(a)linux.com>
Reviewed-by: John Garry <john.garry(a)huawei.com>
Signed-off-by: Qi Liu <liuqi115(a)huawei.com>
Reviewed-by: Shaokun Zhang <zhangshaokun(a)hisilicon.com>
Link: https://lore.kernel.org/r/20211202080633.2919-3-liuqi115@huawei.com
Signed-off-by: Will Deacon <will(a)kernel.org>
Signed-off-by: Wangming Shao <shaowangming(a)h-partners.com>
Reviewed-by: Junhao He <hejunhao3(a)huawei.com>
Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com>
---
MAINTAINERS | 2 +
drivers/perf/hisilicon/Kconfig | 9 +
drivers/perf/hisilicon/Makefile | 2 +
drivers/perf/hisilicon/hisi_pcie_pmu.c | 951 +++++++++++++++++++++++++
include/linux/cpuhotplug.h | 3 +
5 files changed, 967 insertions(+)
create mode 100644 drivers/perf/hisilicon/hisi_pcie_pmu.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 23a23bd94c00..d3d6cad63b94 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7976,8 +7976,10 @@ F: Documentation/devicetree/bindings/misc/hisilicon-hikey-usb.yaml
HISILICON PMU DRIVER
M: Shaokun Zhang <zhangshaokun(a)hisilicon.com>
+M: Qi Liu <liuqi115(a)huawei.com>
S: Supported
W: http://www.hisilicon.com
+F: Documentation/admin-guide/perf/hisi-pcie-pmu.rst
F: Documentation/admin-guide/perf/hisi-pmu.rst
F: drivers/perf/hisilicon
diff --git a/drivers/perf/hisilicon/Kconfig b/drivers/perf/hisilicon/Kconfig
index c5d1b7019fff..5546218b5598 100644
--- a/drivers/perf/hisilicon/Kconfig
+++ b/drivers/perf/hisilicon/Kconfig
@@ -5,3 +5,12 @@ config HISI_PMU
help
Support for HiSilicon SoC L3 Cache performance monitor, Hydra Home
Agent performance monitor and DDR Controller performance monitor.
+
+config HISI_PCIE_PMU
+ tristate "HiSilicon PCIE PERF PMU"
+ depends on PCI && ARM64
+ help
+ Provide support for HiSilicon PCIe performance monitoring unit (PMU)
+ RCiEP devices.
+ Adds the PCIe PMU into perf events system for monitoring latency,
+ bandwidth etc.
diff --git a/drivers/perf/hisilicon/Makefile b/drivers/perf/hisilicon/Makefile
index 7643c9f93e36..506ed39e3266 100644
--- a/drivers/perf/hisilicon/Makefile
+++ b/drivers/perf/hisilicon/Makefile
@@ -2,3 +2,5 @@
obj-$(CONFIG_HISI_PMU) += hisi_uncore_pmu.o hisi_uncore_l3c_pmu.o \
hisi_uncore_hha_pmu.o hisi_uncore_ddrc_pmu.o hisi_uncore_sllc_pmu.o \
hisi_uncore_pa_pmu.o
+
+obj-$(CONFIG_HISI_PCIE_PMU) += hisi_pcie_pmu.o
diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c
new file mode 100644
index 000000000000..2f18838754ec
--- /dev/null
+++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * This driver adds support for PCIe PMU RCiEP device. Related
+ * perf events are bandwidth, latency etc.
+ *
+ * Copyright (C) 2021 HiSilicon Limited
+ * Author: Qi Liu <liuqi115(a)huawei.com>
+ */
+#include <linux/bitfield.h>
+#include <linux/bitmap.h>
+#include <linux/bug.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/perf_event.h>
+
+#define DRV_NAME "hisi_pcie_pmu"
+/* Define registers */
+#define HISI_PCIE_GLOBAL_CTRL 0x00
+#define HISI_PCIE_EVENT_CTRL 0x010
+#define HISI_PCIE_CNT 0x090
+#define HISI_PCIE_EXT_CNT 0x110
+#define HISI_PCIE_INT_STAT 0x150
+#define HISI_PCIE_INT_MASK 0x154
+#define HISI_PCIE_REG_BDF 0xfe0
+#define HISI_PCIE_REG_VERSION 0xfe4
+#define HISI_PCIE_REG_INFO 0xfe8
+
+/* Define command in HISI_PCIE_GLOBAL_CTRL */
+#define HISI_PCIE_GLOBAL_EN 0x01
+#define HISI_PCIE_GLOBAL_NONE 0
+
+/* Define command in HISI_PCIE_EVENT_CTRL */
+#define HISI_PCIE_EVENT_EN BIT_ULL(20)
+#define HISI_PCIE_RESET_CNT BIT_ULL(22)
+#define HISI_PCIE_INIT_SET BIT_ULL(34)
+#define HISI_PCIE_THR_EN BIT_ULL(26)
+#define HISI_PCIE_TARGET_EN BIT_ULL(32)
+#define HISI_PCIE_TRIG_EN BIT_ULL(52)
+
+/* Define offsets in HISI_PCIE_EVENT_CTRL */
+#define HISI_PCIE_EVENT_M GENMASK_ULL(15, 0)
+#define HISI_PCIE_THR_MODE_M GENMASK_ULL(27, 27)
+#define HISI_PCIE_THR_M GENMASK_ULL(31, 28)
+#define HISI_PCIE_TARGET_M GENMASK_ULL(52, 36)
+#define HISI_PCIE_TRIG_MODE_M GENMASK_ULL(53, 53)
+#define HISI_PCIE_TRIG_M GENMASK_ULL(59, 56)
+
+#define HISI_PCIE_MAX_COUNTERS 8
+#define HISI_PCIE_REG_STEP 8
+#define HISI_PCIE_THR_MAX_VAL 10
+#define HISI_PCIE_TRIG_MAX_VAL 10
+#define HISI_PCIE_MAX_PERIOD (GENMASK_ULL(63, 0))
+#define HISI_PCIE_INIT_VAL BIT_ULL(63)
+
+struct hisi_pcie_pmu {
+ struct perf_event *hw_events[HISI_PCIE_MAX_COUNTERS];
+ struct hlist_node node;
+ struct pci_dev *pdev;
+ struct pmu pmu;
+ void __iomem *base;
+ int irq;
+ u32 identifier;
+ /* Minimum and maximum BDF of root ports monitored by PMU */
+ u16 bdf_min;
+ u16 bdf_max;
+ int on_cpu;
+};
+
+struct hisi_pcie_reg_pair {
+ u16 lo;
+ u16 hi;
+};
+
+#define to_pcie_pmu(p) (container_of((p), struct hisi_pcie_pmu, pmu))
+#define GET_PCI_DEVFN(bdf) ((bdf) & 0xff)
+
+#define HISI_PCIE_PMU_FILTER_ATTR(_name, _config, _hi, _lo) \
+ static u64 hisi_pcie_get_##_name(struct perf_event *event) \
+ { \
+ return FIELD_GET(GENMASK(_hi, _lo), event->attr._config); \
+ } \
+
+HISI_PCIE_PMU_FILTER_ATTR(event, config, 16, 0);
+HISI_PCIE_PMU_FILTER_ATTR(thr_len, config1, 3, 0);
+HISI_PCIE_PMU_FILTER_ATTR(thr_mode, config1, 4, 4);
+HISI_PCIE_PMU_FILTER_ATTR(trig_len, config1, 8, 5);
+HISI_PCIE_PMU_FILTER_ATTR(trig_mode, config1, 9, 9);
+HISI_PCIE_PMU_FILTER_ATTR(port, config2, 15, 0);
+HISI_PCIE_PMU_FILTER_ATTR(bdf, config2, 31, 16);
+
+static ssize_t hisi_pcie_format_sysfs_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct dev_ext_attribute *eattr;
+
+ eattr = container_of(attr, struct dev_ext_attribute, attr);
+
+ return sysfs_emit(buf, "%s\n", (char *)eattr->var);
+}
+
+static ssize_t hisi_pcie_event_sysfs_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct perf_pmu_events_attr *pmu_attr =
+ container_of(attr, struct perf_pmu_events_attr, attr);
+
+ return sysfs_emit(buf, "config=0x%llx\n", pmu_attr->id);
+}
+
+#define HISI_PCIE_PMU_FORMAT_ATTR(_name, _format) \
+ (&((struct dev_ext_attribute[]){ \
+ { .attr = __ATTR(_name, 0444, hisi_pcie_format_sysfs_show, \
+ NULL), \
+ .var = (void *)_format } \
+ })[0].attr.attr)
+
+#define HISI_PCIE_PMU_EVENT_ATTR(_name, _id) \
+ (&((struct perf_pmu_events_attr[]) { \
+ { .attr = __ATTR(_name, 0444, hisi_pcie_event_sysfs_show, NULL), \
+ .id = _id, } \
+ })[0].attr.attr)
+
+static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(dev_get_drvdata(dev));
+
+ return cpumap_print_to_pagebuf(true, buf, cpumask_of(pcie_pmu->on_cpu));
+}
+static DEVICE_ATTR_RO(cpumask);
+
+static ssize_t identifier_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(dev_get_drvdata(dev));
+
+ return sysfs_emit(buf, "%#x\n", pcie_pmu->identifier);
+}
+static DEVICE_ATTR_RO(identifier);
+
+static ssize_t bus_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(dev_get_drvdata(dev));
+
+ return sysfs_emit(buf, "%#04x\n", PCI_BUS_NUM(pcie_pmu->bdf_min));
+}
+static DEVICE_ATTR_RO(bus);
+
+static struct hisi_pcie_reg_pair
+hisi_pcie_parse_reg_value(struct hisi_pcie_pmu *pcie_pmu, u32 reg_off)
+{
+ u32 val = readl_relaxed(pcie_pmu->base + reg_off);
+ struct hisi_pcie_reg_pair regs = {
+ .lo = val,
+ .hi = val >> 16,
+ };
+
+ return regs;
+}
+
+/*
+ * Hardware counter and ext_counter work together for bandwidth, latency, bus
+ * utilization and buffer occupancy events. For example, RX memory write latency
+ * events(index = 0x0010), counter counts total delay cycles and ext_counter
+ * counts RX memory write PCIe packets number.
+ *
+ * As we don't want PMU driver to process these two data, "delay cycles" can
+ * be treated as an independent event(index = 0x0010), "RX memory write packets
+ * number" as another(index = 0x10010). BIT 16 is used to distinguish and 0-15
+ * bits are "real" event index, which can be used to set HISI_PCIE_EVENT_CTRL.
+ */
+#define EXT_COUNTER_IS_USED(idx) ((idx) & BIT(16))
+
+static u32 hisi_pcie_get_real_event(struct perf_event *event)
+{
+ return hisi_pcie_get_event(event) & GENMASK(15, 0);
+}
+
+static u32 hisi_pcie_pmu_get_offset(u32 offset, u32 idx)
+{
+ return offset + HISI_PCIE_REG_STEP * idx;
+}
+
+static u32 hisi_pcie_pmu_readl(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset,
+ u32 idx)
+{
+ u32 offset = hisi_pcie_pmu_get_offset(reg_offset, idx);
+
+ return readl_relaxed(pcie_pmu->base + offset);
+}
+
+static void hisi_pcie_pmu_writel(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset, u32 idx, u32 val)
+{
+ u32 offset = hisi_pcie_pmu_get_offset(reg_offset, idx);
+
+ writel_relaxed(val, pcie_pmu->base + offset);
+}
+
+static u64 hisi_pcie_pmu_readq(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset, u32 idx)
+{
+ u32 offset = hisi_pcie_pmu_get_offset(reg_offset, idx);
+
+ return readq_relaxed(pcie_pmu->base + offset);
+}
+
+static void hisi_pcie_pmu_writeq(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset, u32 idx, u64 val)
+{
+ u32 offset = hisi_pcie_pmu_get_offset(reg_offset, idx);
+
+ writeq_relaxed(val, pcie_pmu->base + offset);
+}
+
+static void hisi_pcie_pmu_config_filter(struct perf_event *event)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+ u64 reg = HISI_PCIE_INIT_SET;
+ u64 port, trig_len, thr_len;
+
+ /* Config HISI_PCIE_EVENT_CTRL according to event. */
+ reg |= FIELD_PREP(HISI_PCIE_EVENT_M, hisi_pcie_get_real_event(event));
+
+ /* Config HISI_PCIE_EVENT_CTRL according to root port or EP device. */
+ port = hisi_pcie_get_port(event);
+ if (port)
+ reg |= FIELD_PREP(HISI_PCIE_TARGET_M, port);
+ else
+ reg |= HISI_PCIE_TARGET_EN |
+ FIELD_PREP(HISI_PCIE_TARGET_M, hisi_pcie_get_bdf(event));
+
+ /* Config HISI_PCIE_EVENT_CTRL according to trigger condition. */
+ trig_len = hisi_pcie_get_trig_len(event);
+ if (trig_len) {
+ reg |= FIELD_PREP(HISI_PCIE_TRIG_M, trig_len);
+ reg |= FIELD_PREP(HISI_PCIE_TRIG_MODE_M, hisi_pcie_get_trig_mode(event));
+ reg |= HISI_PCIE_TRIG_EN;
+ }
+
+ /* Config HISI_PCIE_EVENT_CTRL according to threshold condition. */
+ thr_len = hisi_pcie_get_thr_len(event);
+ if (thr_len) {
+ reg |= FIELD_PREP(HISI_PCIE_THR_M, thr_len);
+ reg |= FIELD_PREP(HISI_PCIE_THR_MODE_M, hisi_pcie_get_thr_mode(event));
+ reg |= HISI_PCIE_THR_EN;
+ }
+
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, hwc->idx, reg);
+}
+
+static void hisi_pcie_pmu_clear_filter(struct perf_event *event)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, hwc->idx, HISI_PCIE_INIT_SET);
+}
+
+static bool hisi_pcie_pmu_valid_requester_id(struct hisi_pcie_pmu *pcie_pmu, u32 bdf)
+{
+ struct pci_dev *root_port, *pdev;
+ u16 rp_bdf;
+
+ pdev = pci_get_domain_bus_and_slot(pci_domain_nr(pcie_pmu->pdev->bus), PCI_BUS_NUM(bdf),
+ GET_PCI_DEVFN(bdf));
+ if (!pdev)
+ return false;
+
+ root_port = pcie_find_root_port(pdev);
+ if (!root_port) {
+ pci_dev_put(pdev);
+ return false;
+ }
+
+ pci_dev_put(pdev);
+ rp_bdf = pci_dev_id(root_port);
+ return rp_bdf >= pcie_pmu->bdf_min && rp_bdf <= pcie_pmu->bdf_max;
+}
+
+static bool hisi_pcie_pmu_valid_filter(struct perf_event *event,
+ struct hisi_pcie_pmu *pcie_pmu)
+{
+ u32 requester_id = hisi_pcie_get_bdf(event);
+
+ if (hisi_pcie_get_thr_len(event) > HISI_PCIE_THR_MAX_VAL)
+ return false;
+
+ if (hisi_pcie_get_trig_len(event) > HISI_PCIE_TRIG_MAX_VAL)
+ return false;
+
+ if (requester_id) {
+ if (!hisi_pcie_pmu_valid_requester_id(pcie_pmu, requester_id))
+ return false;
+ }
+
+ return true;
+}
+
+static bool hisi_pcie_pmu_cmp_event(struct perf_event *target,
+ struct perf_event *event)
+{
+ return hisi_pcie_get_real_event(target) == hisi_pcie_get_real_event(event);
+}
+
+static bool hisi_pcie_pmu_validate_event_group(struct perf_event *event)
+{
+ struct perf_event *sibling, *leader = event->group_leader;
+ struct perf_event *event_group[HISI_PCIE_MAX_COUNTERS];
+ int counters = 1;
+ int num;
+
+ event_group[0] = leader;
+ if (!is_software_event(leader)) {
+ if (leader->pmu != event->pmu)
+ return false;
+
+ if (leader != event && !hisi_pcie_pmu_cmp_event(leader, event))
+ event_group[counters++] = event;
+ }
+
+ for_each_sibling_event(sibling, event->group_leader) {
+ if (is_software_event(sibling))
+ continue;
+
+ if (sibling->pmu != event->pmu)
+ return false;
+
+ for (num = 0; num < counters; num++) {
+ if (hisi_pcie_pmu_cmp_event(event_group[num], sibling))
+ break;
+ }
+
+ if (num == counters)
+ event_group[counters++] = sibling;
+ }
+
+ return counters <= HISI_PCIE_MAX_COUNTERS;
+}
+
+static int hisi_pcie_pmu_event_init(struct perf_event *event)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+
+ event->cpu = pcie_pmu->on_cpu;
+
+ if (EXT_COUNTER_IS_USED(hisi_pcie_get_event(event)))
+ hwc->event_base = HISI_PCIE_EXT_CNT;
+ else
+ hwc->event_base = HISI_PCIE_CNT;
+
+ if (event->attr.type != event->pmu->type)
+ return -ENOENT;
+
+ /* Sampling is not supported. */
+ if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
+ return -EOPNOTSUPP;
+
+ if (!hisi_pcie_pmu_valid_filter(event, pcie_pmu))
+ return -EINVAL;
+
+ if (!hisi_pcie_pmu_validate_event_group(event))
+ return -EINVAL;
+
+ return 0;
+}
+
+static u64 hisi_pcie_pmu_read_counter(struct perf_event *event)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ u32 idx = event->hw.idx;
+
+ return hisi_pcie_pmu_readq(pcie_pmu, event->hw.event_base, idx);
+}
+
+static int hisi_pcie_pmu_find_related_event(struct hisi_pcie_pmu *pcie_pmu,
+ struct perf_event *event)
+{
+ struct perf_event *sibling;
+ int idx;
+
+ for (idx = 0; idx < HISI_PCIE_MAX_COUNTERS; idx++) {
+ sibling = pcie_pmu->hw_events[idx];
+ if (!sibling)
+ continue;
+
+ if (!hisi_pcie_pmu_cmp_event(sibling, event))
+ continue;
+
+ /* Related events must be used in group */
+ if (sibling->group_leader == event->group_leader)
+ return idx;
+ else
+ return -EINVAL;
+ }
+
+ return idx;
+}
+
+static int hisi_pcie_pmu_get_event_idx(struct hisi_pcie_pmu *pcie_pmu)
+{
+ int idx;
+
+ for (idx = 0; idx < HISI_PCIE_MAX_COUNTERS; idx++) {
+ if (!pcie_pmu->hw_events[idx])
+ return idx;
+ }
+
+ return -EINVAL;
+}
+
+static void hisi_pcie_pmu_event_update(struct perf_event *event)
+{
+ struct hw_perf_event *hwc = &event->hw;
+ u64 new_cnt, prev_cnt, delta;
+
+ do {
+ prev_cnt = local64_read(&hwc->prev_count);
+ new_cnt = hisi_pcie_pmu_read_counter(event);
+ } while (local64_cmpxchg(&hwc->prev_count, prev_cnt,
+ new_cnt) != prev_cnt);
+
+ delta = (new_cnt - prev_cnt) & HISI_PCIE_MAX_PERIOD;
+ local64_add(delta, &event->count);
+}
+
+static void hisi_pcie_pmu_read(struct perf_event *event)
+{
+ hisi_pcie_pmu_event_update(event);
+}
+
+static void hisi_pcie_pmu_set_period(struct perf_event *event)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+ int idx = hwc->idx;
+
+ local64_set(&hwc->prev_count, HISI_PCIE_INIT_VAL);
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_CNT, idx, HISI_PCIE_INIT_VAL);
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EXT_CNT, idx, HISI_PCIE_INIT_VAL);
+}
+
+static void hisi_pcie_pmu_enable_counter(struct hisi_pcie_pmu *pcie_pmu, struct hw_perf_event *hwc)
+{
+ u32 idx = hwc->idx;
+ u64 val;
+
+ val = hisi_pcie_pmu_readq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx);
+ val |= HISI_PCIE_EVENT_EN;
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx, val);
+}
+
+static void hisi_pcie_pmu_disable_counter(struct hisi_pcie_pmu *pcie_pmu, struct hw_perf_event *hwc)
+{
+ u32 idx = hwc->idx;
+ u64 val;
+
+ val = hisi_pcie_pmu_readq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx);
+ val &= ~HISI_PCIE_EVENT_EN;
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx, val);
+}
+
+static void hisi_pcie_pmu_enable_int(struct hisi_pcie_pmu *pcie_pmu, struct hw_perf_event *hwc)
+{
+ u32 idx = hwc->idx;
+
+ hisi_pcie_pmu_writel(pcie_pmu, HISI_PCIE_INT_MASK, idx, 0);
+}
+
+static void hisi_pcie_pmu_disable_int(struct hisi_pcie_pmu *pcie_pmu, struct hw_perf_event *hwc)
+{
+ u32 idx = hwc->idx;
+
+ hisi_pcie_pmu_writel(pcie_pmu, HISI_PCIE_INT_MASK, idx, 1);
+}
+
+static void hisi_pcie_pmu_reset_counter(struct hisi_pcie_pmu *pcie_pmu, int idx)
+{
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx, HISI_PCIE_RESET_CNT);
+ hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, idx, HISI_PCIE_INIT_SET);
+}
+
+static void hisi_pcie_pmu_start(struct perf_event *event, int flags)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+ int idx = hwc->idx;
+ u64 prev_cnt;
+
+ if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
+ return;
+
+ WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
+ hwc->state = 0;
+
+ hisi_pcie_pmu_config_filter(event);
+ hisi_pcie_pmu_enable_counter(pcie_pmu, hwc);
+ hisi_pcie_pmu_enable_int(pcie_pmu, hwc);
+ hisi_pcie_pmu_set_period(event);
+
+ if (flags & PERF_EF_RELOAD) {
+ prev_cnt = local64_read(&hwc->prev_count);
+ hisi_pcie_pmu_writeq(pcie_pmu, hwc->event_base, idx, prev_cnt);
+ }
+
+ perf_event_update_userpage(event);
+}
+
+static void hisi_pcie_pmu_stop(struct perf_event *event, int flags)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+
+ hisi_pcie_pmu_event_update(event);
+ hisi_pcie_pmu_disable_int(pcie_pmu, hwc);
+ hisi_pcie_pmu_disable_counter(pcie_pmu, hwc);
+ hisi_pcie_pmu_clear_filter(event);
+ WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
+ hwc->state |= PERF_HES_STOPPED;
+
+ if (hwc->state & PERF_HES_UPTODATE)
+ return;
+
+ hwc->state |= PERF_HES_UPTODATE;
+}
+
+static int hisi_pcie_pmu_add(struct perf_event *event, int flags)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+ int idx;
+
+ hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
+
+ /* Check all working events to find a related event. */
+ idx = hisi_pcie_pmu_find_related_event(pcie_pmu, event);
+ if (idx < 0)
+ return idx;
+
+ /* Current event shares an enabled counter with the related event */
+ if (idx < HISI_PCIE_MAX_COUNTERS) {
+ hwc->idx = idx;
+ goto start_count;
+ }
+
+ idx = hisi_pcie_pmu_get_event_idx(pcie_pmu);
+ if (idx < 0)
+ return idx;
+
+ hwc->idx = idx;
+ pcie_pmu->hw_events[idx] = event;
+ /* Reset Counter to avoid previous statistic interference. */
+ hisi_pcie_pmu_reset_counter(pcie_pmu, idx);
+
+start_count:
+ if (flags & PERF_EF_START)
+ hisi_pcie_pmu_start(event, PERF_EF_RELOAD);
+
+ return 0;
+}
+
+static void hisi_pcie_pmu_del(struct perf_event *event, int flags)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
+ struct hw_perf_event *hwc = &event->hw;
+
+ hisi_pcie_pmu_stop(event, PERF_EF_UPDATE);
+ pcie_pmu->hw_events[hwc->idx] = NULL;
+ perf_event_update_userpage(event);
+}
+
+static void hisi_pcie_pmu_enable(struct pmu *pmu)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(pmu);
+ int num;
+
+ for (num = 0; num < HISI_PCIE_MAX_COUNTERS; num++) {
+ if (pcie_pmu->hw_events[num])
+ break;
+ }
+
+ if (num == HISI_PCIE_MAX_COUNTERS)
+ return;
+
+ writel(HISI_PCIE_GLOBAL_EN, pcie_pmu->base + HISI_PCIE_GLOBAL_CTRL);
+}
+
+static void hisi_pcie_pmu_disable(struct pmu *pmu)
+{
+ struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(pmu);
+
+ writel(HISI_PCIE_GLOBAL_NONE, pcie_pmu->base + HISI_PCIE_GLOBAL_CTRL);
+}
+
+static irqreturn_t hisi_pcie_pmu_irq(int irq, void *data)
+{
+ struct hisi_pcie_pmu *pcie_pmu = data;
+ irqreturn_t ret = IRQ_NONE;
+ struct perf_event *event;
+ u32 overflown;
+ int idx;
+
+ for (idx = 0; idx < HISI_PCIE_MAX_COUNTERS; idx++) {
+ overflown = hisi_pcie_pmu_readl(pcie_pmu, HISI_PCIE_INT_STAT, idx);
+ if (!overflown)
+ continue;
+
+ /* Clear status of interrupt. */
+ hisi_pcie_pmu_writel(pcie_pmu, HISI_PCIE_INT_STAT, idx, 1);
+ event = pcie_pmu->hw_events[idx];
+ if (!event)
+ continue;
+
+ hisi_pcie_pmu_event_update(event);
+ hisi_pcie_pmu_set_period(event);
+ ret = IRQ_HANDLED;
+ }
+
+ return ret;
+}
+
+static int hisi_pcie_pmu_irq_register(struct pci_dev *pdev, struct hisi_pcie_pmu *pcie_pmu)
+{
+ int irq, ret;
+
+ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
+ if (ret < 0) {
+ pci_err(pdev, "Failed to enable MSI vectors: %d\n", ret);
+ return ret;
+ }
+
+ irq = pci_irq_vector(pdev, 0);
+ ret = request_irq(irq, hisi_pcie_pmu_irq, IRQF_NOBALANCING | IRQF_NO_THREAD, DRV_NAME,
+ pcie_pmu);
+ if (ret) {
+ pci_err(pdev, "Failed to register IRQ: %d\n", ret);
+ pci_free_irq_vectors(pdev);
+ return ret;
+ }
+
+ pcie_pmu->irq = irq;
+
+ return 0;
+}
+
+static void hisi_pcie_pmu_irq_unregister(struct pci_dev *pdev, struct hisi_pcie_pmu *pcie_pmu)
+{
+ free_irq(pcie_pmu->irq, pcie_pmu);
+ pci_free_irq_vectors(pdev);
+}
+
+static int hisi_pcie_pmu_online_cpu(unsigned int cpu, struct hlist_node *node)
+{
+ struct hisi_pcie_pmu *pcie_pmu = hlist_entry_safe(node, struct hisi_pcie_pmu, node);
+
+ if (pcie_pmu->on_cpu == -1) {
+ pcie_pmu->on_cpu = cpu;
+ WARN_ON(irq_set_affinity(pcie_pmu->irq, cpumask_of(cpu)));
+ }
+
+ return 0;
+}
+
+static int hisi_pcie_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
+{
+ struct hisi_pcie_pmu *pcie_pmu = hlist_entry_safe(node, struct hisi_pcie_pmu, node);
+ unsigned int target;
+
+ /* Nothing to do if this CPU doesn't own the PMU */
+ if (pcie_pmu->on_cpu != cpu)
+ return 0;
+
+ pcie_pmu->on_cpu = -1;
+ /* Choose a new CPU from all online cpus. */
+ target = cpumask_first(cpu_online_mask);
+ if (target >= nr_cpu_ids) {
+ pci_err(pcie_pmu->pdev, "There is no CPU to set\n");
+ return 0;
+ }
+
+ perf_pmu_migrate_context(&pcie_pmu->pmu, cpu, target);
+ /* Use this CPU for event counting */
+ pcie_pmu->on_cpu = target;
+ WARN_ON(irq_set_affinity(pcie_pmu->irq, cpumask_of(target)));
+
+ return 0;
+}
+
+static struct attribute *hisi_pcie_pmu_events_attr[] = {
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mwr_latency, 0x0010),
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mwr_cnt, 0x10010),
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_latency, 0x0210),
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_cnt, 0x10210),
+ HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_latency, 0x0011),
+ HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_cnt, 0x10011),
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_flux, 0x1005),
+ HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_time, 0x11005),
+ HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_flux, 0x2004),
+ HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_time, 0x12004),
+ NULL
+};
+
+static struct attribute_group hisi_pcie_pmu_events_group = {
+ .name = "events",
+ .attrs = hisi_pcie_pmu_events_attr,
+};
+
+static struct attribute *hisi_pcie_pmu_format_attr[] = {
+ HISI_PCIE_PMU_FORMAT_ATTR(event, "config:0-16"),
+ HISI_PCIE_PMU_FORMAT_ATTR(thr_len, "config1:0-3"),
+ HISI_PCIE_PMU_FORMAT_ATTR(thr_mode, "config1:4"),
+ HISI_PCIE_PMU_FORMAT_ATTR(trig_len, "config1:5-8"),
+ HISI_PCIE_PMU_FORMAT_ATTR(trig_mode, "config1:9"),
+ HISI_PCIE_PMU_FORMAT_ATTR(port, "config2:0-15"),
+ HISI_PCIE_PMU_FORMAT_ATTR(bdf, "config2:16-31"),
+ NULL
+};
+
+static const struct attribute_group hisi_pcie_pmu_format_group = {
+ .name = "format",
+ .attrs = hisi_pcie_pmu_format_attr,
+};
+
+static struct attribute *hisi_pcie_pmu_bus_attrs[] = {
+ &dev_attr_bus.attr,
+ NULL
+};
+
+static const struct attribute_group hisi_pcie_pmu_bus_attr_group = {
+ .attrs = hisi_pcie_pmu_bus_attrs,
+};
+
+static struct attribute *hisi_pcie_pmu_cpumask_attrs[] = {
+ &dev_attr_cpumask.attr,
+ NULL
+};
+
+static const struct attribute_group hisi_pcie_pmu_cpumask_attr_group = {
+ .attrs = hisi_pcie_pmu_cpumask_attrs,
+};
+
+static struct attribute *hisi_pcie_pmu_identifier_attrs[] = {
+ &dev_attr_identifier.attr,
+ NULL
+};
+
+static const struct attribute_group hisi_pcie_pmu_identifier_attr_group = {
+ .attrs = hisi_pcie_pmu_identifier_attrs,
+};
+
+static const struct attribute_group *hisi_pcie_pmu_attr_groups[] = {
+ &hisi_pcie_pmu_events_group,
+ &hisi_pcie_pmu_format_group,
+ &hisi_pcie_pmu_bus_attr_group,
+ &hisi_pcie_pmu_cpumask_attr_group,
+ &hisi_pcie_pmu_identifier_attr_group,
+ NULL
+};
+
+static int hisi_pcie_alloc_pmu(struct pci_dev *pdev, struct hisi_pcie_pmu *pcie_pmu)
+{
+ struct hisi_pcie_reg_pair regs;
+ u16 sicl_id, core_id;
+ char *name;
+
+ regs = hisi_pcie_parse_reg_value(pcie_pmu, HISI_PCIE_REG_BDF);
+ pcie_pmu->bdf_min = regs.lo;
+ pcie_pmu->bdf_max = regs.hi;
+
+ regs = hisi_pcie_parse_reg_value(pcie_pmu, HISI_PCIE_REG_INFO);
+ sicl_id = regs.hi;
+ core_id = regs.lo;
+
+ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "hisi_pcie%u_core%u", sicl_id, core_id);
+ if (!name)
+ return -ENOMEM;
+
+ pcie_pmu->pdev = pdev;
+ pcie_pmu->on_cpu = -1;
+ pcie_pmu->identifier = readl(pcie_pmu->base + HISI_PCIE_REG_VERSION);
+ pcie_pmu->pmu = (struct pmu) {
+ .name = name,
+ .module = THIS_MODULE,
+ .event_init = hisi_pcie_pmu_event_init,
+ .pmu_enable = hisi_pcie_pmu_enable,
+ .pmu_disable = hisi_pcie_pmu_disable,
+ .add = hisi_pcie_pmu_add,
+ .del = hisi_pcie_pmu_del,
+ .start = hisi_pcie_pmu_start,
+ .stop = hisi_pcie_pmu_stop,
+ .read = hisi_pcie_pmu_read,
+ .task_ctx_nr = perf_invalid_context,
+ .attr_groups = hisi_pcie_pmu_attr_groups,
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
+ };
+
+ return 0;
+}
+
+static int hisi_pcie_init_pmu(struct pci_dev *pdev, struct hisi_pcie_pmu *pcie_pmu)
+{
+ int ret;
+
+ pcie_pmu->base = pci_ioremap_bar(pdev, 2);
+ if (!pcie_pmu->base) {
+ pci_err(pdev, "Ioremap failed for pcie_pmu resource\n");
+ return -ENOMEM;
+ }
+
+ ret = hisi_pcie_alloc_pmu(pdev, pcie_pmu);
+ if (ret)
+ goto err_iounmap;
+
+ ret = hisi_pcie_pmu_irq_register(pdev, pcie_pmu);
+ if (ret)
+ goto err_iounmap;
+
+ ret = cpuhp_state_add_instance(CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE, &pcie_pmu->node);
+ if (ret) {
+ pci_err(pdev, "Failed to register hotplug: %d\n", ret);
+ goto err_irq_unregister;
+ }
+
+ ret = perf_pmu_register(&pcie_pmu->pmu, pcie_pmu->pmu.name, -1);
+ if (ret) {
+ pci_err(pdev, "Failed to register PCIe PMU: %d\n", ret);
+ goto err_hotplug_unregister;
+ }
+
+ return ret;
+
+err_hotplug_unregister:
+ cpuhp_state_remove_instance_nocalls(
+ CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE, &pcie_pmu->node);
+
+err_irq_unregister:
+ hisi_pcie_pmu_irq_unregister(pdev, pcie_pmu);
+
+err_iounmap:
+ iounmap(pcie_pmu->base);
+
+ return ret;
+}
+
+static void hisi_pcie_uninit_pmu(struct pci_dev *pdev)
+{
+ struct hisi_pcie_pmu *pcie_pmu = pci_get_drvdata(pdev);
+
+ perf_pmu_unregister(&pcie_pmu->pmu);
+ cpuhp_state_remove_instance_nocalls(
+ CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE, &pcie_pmu->node);
+ hisi_pcie_pmu_irq_unregister(pdev, pcie_pmu);
+ iounmap(pcie_pmu->base);
+}
+
+static int hisi_pcie_init_dev(struct pci_dev *pdev)
+{
+ int ret;
+
+ ret = pcim_enable_device(pdev);
+ if (ret) {
+ pci_err(pdev, "Failed to enable PCI device: %d\n", ret);
+ return ret;
+ }
+
+ ret = pcim_iomap_regions(pdev, BIT(2), DRV_NAME);
+ if (ret < 0) {
+ pci_err(pdev, "Failed to request PCI mem regions: %d\n", ret);
+ return ret;
+ }
+
+ pci_set_master(pdev);
+
+ return 0;
+}
+
+static int hisi_pcie_pmu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ struct hisi_pcie_pmu *pcie_pmu;
+ int ret;
+
+ pcie_pmu = devm_kzalloc(&pdev->dev, sizeof(*pcie_pmu), GFP_KERNEL);
+ if (!pcie_pmu)
+ return -ENOMEM;
+
+ ret = hisi_pcie_init_dev(pdev);
+ if (ret)
+ return ret;
+
+ ret = hisi_pcie_init_pmu(pdev, pcie_pmu);
+ if (ret)
+ return ret;
+
+ pci_set_drvdata(pdev, pcie_pmu);
+
+ return ret;
+}
+
+static void hisi_pcie_pmu_remove(struct pci_dev *pdev)
+{
+ hisi_pcie_uninit_pmu(pdev);
+ pci_set_drvdata(pdev, NULL);
+}
+
+static const struct pci_device_id hisi_pcie_pmu_ids[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, 0xa12d) },
+ { 0, }
+};
+MODULE_DEVICE_TABLE(pci, hisi_pcie_pmu_ids);
+
+static struct pci_driver hisi_pcie_pmu_driver = {
+ .name = DRV_NAME,
+ .id_table = hisi_pcie_pmu_ids,
+ .probe = hisi_pcie_pmu_probe,
+ .remove = hisi_pcie_pmu_remove,
+};
+
+static int __init hisi_pcie_module_init(void)
+{
+ int ret;
+
+ ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE,
+ "AP_PERF_ARM_HISI_PCIE_PMU_ONLINE",
+ hisi_pcie_pmu_online_cpu,
+ hisi_pcie_pmu_offline_cpu);
+ if (ret) {
+ pr_err("Failed to setup PCIe PMU hotplug: %d\n", ret);
+ return ret;
+ }
+
+ ret = pci_register_driver(&hisi_pcie_pmu_driver);
+ if (ret)
+ cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE);
+
+ return ret;
+}
+module_init(hisi_pcie_module_init);
+
+static void __exit hisi_pcie_module_exit(void)
+{
+ pci_unregister_driver(&hisi_pcie_pmu_driver);
+ cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE);
+}
+module_exit(hisi_pcie_module_exit);
+
+MODULE_DESCRIPTION("HiSilicon PCIe PMU driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Qi Liu <liuqi115(a)huawei.com>");
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index b98b9eb7d5f8..24e7be132046 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -178,6 +178,9 @@ enum cpuhp_state {
CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
CPUHP_AP_PERF_ARM_HISI_PA_ONLINE,
CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE,
+ #ifndef __GENKSYMS__
+ CPUHP_AP_PERF_ARM_HISI_PCIE_PMU_ONLINE,
+ #endif
CPUHP_AP_PERF_ARM_L2X0_ONLINE,
CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE,
CPUHP_AP_PERF_ARM_QCOM_L3_ONLINE,
--
2.20.1
1
21

[PATCH openEuler-1.0-LTS] blk-mq: fix null pointer dereference in blk_mq_queue_tag_busy_ite
by Yongqiang Liu 16 Aug '22
by Yongqiang Liu 16 Aug '22
16 Aug '22
From: Li Nan <linan122(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: 187489, https://gitee.com/openeuler/kernel/issues/I5MKPP
CVE: NA
--------------------------------
The q->tag_set can be NULL in blk_mq_queue_tag_busy_ite() while queue
has not been initialized:
CPU0 CPU1
dm_mq_init_request_queue
md->tag_set = kzalloc_node
blk_mq_init_allocated_queue
q->mq_ops = set->ops;
diskstats_show
part_get_stat_info
if(q->mq_ops)
blk_mq_in_flight_with_stat
blk_mq_queue_tag_busy_ite
if (blk_mq_is_shared_tags(q->tag_set->flags))
//q->tag_set is null here
q->tag_set = set
blk_register_queue
blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q)
There is same bug when cat /sys/block/[device]/inflight. Fix it by checking
the flag 'QUEUE_FLAG_REGISTERED'. Althrough this may cause some io not to
be counted temporarily, it doesn't hurt in real user case.
Signed-off-by: Li Nan <linan122(a)huawei.com>
Reviewed-by: Jason Yan <yanaijie(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
block/blk-mq-tag.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index bee92ab06a5e..c24802fe6ab2 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -374,6 +374,13 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn,
struct blk_mq_hw_ctx *hctx;
int i;
+ /*
+ * For dm, it can run here after register_disk, but the queue has not
+ * been initialized yet. Check QUEUE_FLAG_REGISTERED prevent null point
+ * access.
+ */
+ if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags))
+ return;
/*
* __blk_mq_update_nr_hw_queues will update the nr_hw_queues and
* queue_hw_ctx after freeze the queue, so we use q_usage_counter
--
2.25.1
1
0

[PATCH openEuler-1.0-LTS] arm64: Avoid premature usercopy failure for __arch_copy_to_user_generic_read
by Yongqiang Liu 16 Aug '22
by Yongqiang Liu 16 Aug '22
16 Aug '22
From: Tong Tiangen <tongtiangen(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5MJU8
CVE: NA
---------------------------------
Commit 1b1b4dede457 ("arm64: Avoid premature usercopy failure") fixes an
usercopy failure issues, it introduced a variable srcin and used it in
fixup routine, but the variable is not initialized in
__arch_copy_to_user_generic_read(), this will cause an illegal pointer
issue in fixup.
Fixes: 1b1b4dede457 ("arm64: Avoid premature usercopy failure")
Signed-off-by: Tong Tiangen <tongtiangen(a)huawei.com>
Tested-by: yongqiang Liu <liuyongqiang13(a)huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
arch/arm64/lib/copy_to_user.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
index 84b7a16e82b5..6214e4972141 100644
--- a/arch/arm64/lib/copy_to_user.S
+++ b/arch/arm64/lib/copy_to_user.S
@@ -77,6 +77,7 @@ ENDPROC(__arch_copy_to_user)
ENTRY(__arch_copy_to_user_generic_read)
uaccess_enable_not_uao x3, x4, x5
add end, x0, x2
+ mov srcin, x1
#include "copy_template_generic_read.S"
uaccess_disable_not_uao x3, x4
--
2.25.1
1
0

[PATCH openEuler-1.0-LTS] net_sched: cls_route: remove from list when handle is 0
by Yongqiang Liu 16 Aug '22
by Yongqiang Liu 16 Aug '22
16 Aug '22
From: Thadeu Lima de Souza Cascardo <cascardo(a)canonical.com>
mainline inclusion
from mainline-v6.0-rc1
commit 9ad36309e2719a884f946678e0296be10f0bb4c1
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I5LJLR
CVE: CVE-2022-2588
--------------------------------
When a route filter is replaced and the old filter has a 0 handle, the old
one won't be removed from the hashtable, while it will still be freed.
The test was there since before commit 1109c00547fc ("net: sched: RCU
cls_route"), when a new filter was not allocated when there was an old one.
The old filter was reused and the reinserting would only be necessary if an
old filter was replaced. That was still wrong for the same case where the
old handle was 0.
Remove the old filter from the list independently from its handle value.
This fixes CVE-2022-2588, also reported as ZDI-CAN-17440.
Reported-by: Zhenpeng Lin <zplin(a)u.northwestern.edu>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo(a)canonical.com>
Reviewed-by: Kamal Mostafa <kamal(a)canonical.com>
Cc: <stable(a)vger.kernel.org>
Acked-by: Jamal Hadi Salim <jhs(a)mojatatu.com>
Link: https://lore.kernel.org/r/20220809170518.164662-1-cascardo@canonical.com
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Signed-off-by: Xu Jia <xujia39(a)huawei.com>
Reviewed-by: Yue Haibing <yuehaibing(a)huawei.com>
Reviewed-by: Wei Yongjun <weiyongjun1(a)huawei.com>
Reviewed-by: Wang Weiyang <wangweiyang2(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
net/sched/cls_route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 0a0a22a0666d..c13903441ac1 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -528,7 +528,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
rcu_assign_pointer(f->next, f1);
rcu_assign_pointer(*fp, f);
- if (fold && fold->handle && f->handle != fold->handle) {
+ if (fold) {
th = to_hash(fold->handle);
h = from_hash(fold->handle >> 16);
b = rtnl_dereference(head->table[th]);
--
2.25.1
1
0

[PATCH openEuler-1.0-LTS] Revert "x86/unwind/orc: Change REG_SP_INDIRECT"
by Yongqiang Liu 15 Aug '22
by Yongqiang Liu 15 Aug '22
15 Aug '22
From: Yipeng Zou <zouyipeng(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5MC71
CVE: NA
---------------------------------
This reverts commit 657a6bec17a04e9223a099608084ab5adc2582df.
This patch was backport from mainline and intend to fix REG_SP_INDIRECT
type in orc unwinder.The patch was fix an objtools problem on mainline,
which The upstream commit havn't been merged in hulk-4.19,and it led to
parse the sp value form orc data was wrong. So we need revert this patch.
Signed-off-by: Yipeng Zou <zouyipeng(a)huawei.com>
Reviewed-by: Zhang Jianhua <chris.zjh(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
arch/x86/kernel/unwind_orc.c | 5 +----
tools/objtool/orc_dump.c | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 3ff76f88e220..6c5d3b22ac61 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -450,7 +450,7 @@ bool unwind_next_frame(struct unwind_state *state)
break;
case ORC_REG_SP_INDIRECT:
- sp = state->sp;
+ sp = state->sp + orc->sp_offset;
indirect = true;
break;
@@ -500,9 +500,6 @@ bool unwind_next_frame(struct unwind_state *state)
if (indirect) {
if (!deref_stack_reg(state, sp, &sp))
goto err;
-
- if (orc->sp_reg == ORC_REG_SP_INDIRECT)
- sp += orc->sp_offset;
}
/* Find IP, SP and possibly regs: */
diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c
index ba28830aace2..faa444270ee3 100644
--- a/tools/objtool/orc_dump.c
+++ b/tools/objtool/orc_dump.c
@@ -64,7 +64,7 @@ static void print_reg(unsigned int reg, int offset)
if (reg == ORC_REG_BP_INDIRECT)
printf("(bp%+d)", offset);
else if (reg == ORC_REG_SP_INDIRECT)
- printf("(sp)%+d", offset);
+ printf("(sp%+d)", offset);
else if (reg == ORC_REG_UNDEFINED)
printf("(und)");
else
--
2.25.1
1
0

[PATCH openEuler-1.0-LTS 1/3] scsi: iscsi: Add helper functions to manage iscsi_cls_conn
by Yongqiang Liu 15 Aug '22
by Yongqiang Liu 15 Aug '22
15 Aug '22
From: Wenchao Hao <haowenchao(a)huawei.com>
mainline inclusion
from mainline-v5.18-rc1
commit ad515cada7dac3cdf5e1ad77a0ed696f5f34e0ab
category: bugfix
bugzilla: 187381, https://gitee.com/openeuler/kernel/issues/I5LBFL
CVE: NA
--------------------------------
- iscsi_alloc_conn(): Allocate and initialize iscsi_cls_conn
- iscsi_add_conn(): Expose iscsi_cls_conn to userspace via sysfs
- iscsi_remove_conn(): Remove iscsi_cls_conn from sysfs
Link: https://lore.kernel.org/r/20220310015759.3296841-2-haowenchao@huawei.com
Reviewed-by: Mike Christie <michael.christie(a)oracle.com>
Signed-off-by: Wenchao Hao <haowenchao(a)huawei.com>
Signed-off-by: Wu Bo <wubo40(a)huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Conflict: drivers/scsi/scsi_transport_iscsi.c
Signed-off-by: Yu Kuai <yukuai3(a)huawei.com>
Reviewed-by: Jason Yan <yanaijie(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
drivers/scsi/scsi_transport_iscsi.c | 89 +++++++++++++++++++++++++++++
include/scsi/scsi_transport_iscsi.h | 4 ++
2 files changed, 93 insertions(+)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index bd699906828f..eba74ac58735 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2201,6 +2201,95 @@ void iscsi_free_session(struct iscsi_cls_session *session)
}
EXPORT_SYMBOL_GPL(iscsi_free_session);
+/**
+ * iscsi_alloc_conn - alloc iscsi class connection
+ * @session: iscsi cls session
+ * @dd_size: private driver data size
+ * @cid: connection id
+ */
+struct iscsi_cls_conn *
+iscsi_alloc_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid)
+{
+ struct iscsi_transport *transport = session->transport;
+ struct iscsi_cls_conn *conn;
+
+ conn = kzalloc(sizeof(*conn) + dd_size, GFP_KERNEL);
+ if (!conn)
+ return NULL;
+ if (dd_size)
+ conn->dd_data = &conn[1];
+
+ mutex_init(&conn->ep_mutex);
+ INIT_LIST_HEAD(&conn->conn_list);
+ conn->transport = transport;
+ conn->cid = cid;
+
+ /* this is released in the dev's release function */
+ if (!get_device(&session->dev))
+ goto free_conn;
+
+ dev_set_name(&conn->dev, "connection%d:%u", session->sid, cid);
+ device_initialize(&conn->dev);
+ conn->dev.parent = &session->dev;
+ conn->dev.release = iscsi_conn_release;
+
+ return conn;
+
+free_conn:
+ kfree(conn);
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(iscsi_alloc_conn);
+
+/**
+ * iscsi_add_conn - add iscsi class connection
+ * @conn: iscsi cls connection
+ *
+ * This will expose iscsi_cls_conn to sysfs so make sure the related
+ * resources for sysfs attributes are initialized before calling this.
+ */
+int iscsi_add_conn(struct iscsi_cls_conn *conn)
+{
+ int err;
+ unsigned long flags;
+ struct iscsi_cls_session *session = iscsi_dev_to_session(conn->dev.parent);
+
+ err = device_add(&conn->dev);
+ if (err) {
+ iscsi_cls_session_printk(KERN_ERR, session,
+ "could not register connection's dev\n");
+ return err;
+ }
+ transport_register_device(&conn->dev);
+
+ spin_lock_irqsave(&connlock, flags);
+ list_add(&conn->conn_list, &connlist);
+ spin_unlock_irqrestore(&connlock, flags);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(iscsi_add_conn);
+
+/**
+ * iscsi_remove_conn - remove iscsi class connection from sysfs
+ * @conn: iscsi cls connection
+ *
+ * Remove iscsi_cls_conn from sysfs, and wait for previous
+ * read/write of iscsi_cls_conn's attributes in sysfs to finish.
+ */
+void iscsi_remove_conn(struct iscsi_cls_conn *conn)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&connlock, flags);
+ list_del(&conn->conn_list);
+ spin_unlock_irqrestore(&connlock, flags);
+
+ transport_unregister_device(&conn->dev);
+ device_del(&conn->dev);
+}
+EXPORT_SYMBOL_GPL(iscsi_remove_conn);
+
/**
* iscsi_create_conn - create iscsi class connection
* @session: iscsi cls session
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 848ba2822a21..105458b20cd8 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -446,6 +446,10 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
unsigned int target_id);
extern void iscsi_remove_session(struct iscsi_cls_session *session);
extern void iscsi_free_session(struct iscsi_cls_session *session);
+extern struct iscsi_cls_conn *iscsi_alloc_conn(struct iscsi_cls_session *sess,
+ int dd_size, uint32_t cid);
+extern int iscsi_add_conn(struct iscsi_cls_conn *conn);
+extern void iscsi_remove_conn(struct iscsi_cls_conn *conn);
extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
int dd_size, uint32_t cid);
extern void iscsi_put_conn(struct iscsi_cls_conn *conn);
--
2.25.1
1
2
From: Zheng Zengkai <zhengzengkai(a)huawei.com>
phytium inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I41AUQ
--------------------------------------
Use CONFIG_ARCH_PHYTIUM to control phytium ACS quirks.
Signed-off-by: Zheng Zengkai <zhengzengkai(a)huawei.com>
Reviewed-by: Hanjun Guo <guohanjun(a)huawei.com>
Reviewed-by: Xiongfeng Wang <wangxiongfeng2(a)huawei.com>
Signed-off-by: Laibin Qiu <qiulaibin(a)huawei.com>
---
drivers/pci/quirks.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 99657b9bc82e..c389cef5c7bd 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4646,10 +4646,12 @@ static const struct pci_dev_acs_enabled {
{ PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs },
/* Zhaoxin Root/Downstream Ports */
{ PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
+#ifdef CONFIG_ARCH_PHYTIUM
/* because PLX switch Vendor id is 0x10b5 on phytium cpu */
{ 0x10b5, PCI_ANY_ID, pci_quirk_xgene_acs },
/* because rootcomplex Vendor id is 0x17cd on phytium cpu */
{ 0x17cd, PCI_ANY_ID, pci_quirk_xgene_acs },
+#endif
{ 0 }
};
--
2.25.1
1
1

[PATCH openEuler-1.0-LTS 1/2] sched: Fix null-ptr-deref in free_fair_sched_group
by Yongqiang Liu 15 Aug '22
by Yongqiang Liu 15 Aug '22
15 Aug '22
From: Hui Tang <tanghui20(a)huawei.com>
hulk inclusion
category: bugfix
bugzilla: 187419, https://gitee.com/openeuler/kernel/issues/I5LIPL
CVE: NA
-------------------------------
do_el0_svc+0x50/0x11c arch/arm64/kernel/syscall.c:217
el0_svc+0x20/0x30 arch/arm64/kernel/entry-common.c:353
el0_sync_handler+0xe4/0x1e0 arch/arm64/kernel/entry-common.c:369
el0_sync+0x148/0x180 arch/arm64/kernel/entry.S:683
==================================================================
BUG: KASAN: null-ptr-deref in rq_of kernel/sched/sched.h:1118 [inline]
BUG: KASAN: null-ptr-deref in unthrottle_qos_sched_group kernel/sched/fair.c:7619 [inline]
BUG: KASAN: null-ptr-deref in free_fair_sched_group+0x124/0x320 kernel/sched/fair.c:12131
Read of size 8 at addr 0000000000000130 by task syz-executor100/223
CPU: 3 PID: 223 Comm: syz-executor100 Not tainted 5.10.0 #6
Hardware name: linux,dummy-virt (DT)
Call trace:
dump_backtrace+0x0/0x40c arch/arm64/kernel/stacktrace.c:132
show_stack+0x30/0x40 arch/arm64/kernel/stacktrace.c:196
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1b4/0x248 lib/dump_stack.c:118
__kasan_report mm/kasan/report.c:551 [inline]
kasan_report+0x18c/0x210 mm/kasan/report.c:564
check_memory_region_inline mm/kasan/generic.c:187 [inline]
__asan_load8+0x98/0xc0 mm/kasan/generic.c:253
rq_of kernel/sched/sched.h:1118 [inline]
unthrottle_qos_sched_group kernel/sched/fair.c:7619 [inline]
free_fair_sched_group+0x124/0x320 kernel/sched/fair.c:12131
sched_free_group kernel/sched/core.c:7767 [inline]
sched_create_group+0x48/0xc0 kernel/sched/core.c:7798
cpu_cgroup_css_alloc+0x18/0x40 kernel/sched/core.c:7930
css_create+0x7c/0x4a0 kernel/cgroup/cgroup.c:5328
cgroup_apply_control_enable+0x288/0x340 kernel/cgroup/cgroup.c:3135
cgroup_apply_control kernel/cgroup/cgroup.c:3217 [inline]
cgroup_subtree_control_write+0x668/0x8b0 kernel/cgroup/cgroup.c:3375
cgroup_file_write+0x1a8/0x37c kernel/cgroup/cgroup.c:3909
kernfs_fop_write_iter+0x220/0x2f4 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:1960 [inline]
new_sync_write+0x260/0x370 fs/read_write.c:515
vfs_write+0x3dc/0x4ac fs/read_write.c:602
ksys_write+0xfc/0x200 fs/read_write.c:655
__do_sys_write fs/read_write.c:667 [inline]
__se_sys_write fs/read_write.c:664 [inline]
__arm64_sys_write+0x50/0x60 fs/read_write.c:664
__invoke_syscall arch/arm64/kernel/syscall.c:36 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:48 [inline]
el0_svc_common.constprop.0+0xf4/0x414 arch/arm64/kernel/syscall.c:155
do_el0_svc+0x50/0x11c arch/arm64/kernel/syscall.c:217
el0_svc+0x20/0x30 arch/arm64/kernel/entry-common.c:353
el0_sync_handler+0xe4/0x1e0 arch/arm64/kernel/entry-common.c:369
el0_sync+0x148/0x180 arch/arm64/kernel/entry.S:683
So add check for tg->cfs_rq[i] before unthrottle_qos_sched_group() called.
Signed-off-by: Hui Tang <tanghui20(a)huawei.com>
Reviewed-by: Zhang Qiao <zhangqiao22(a)huawei.com>
Signed-off-by: Yongqiang Liu <liuyongqiang13(a)huawei.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bcc72537b6fa..a34ca843bf0a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10878,7 +10878,7 @@ void free_fair_sched_group(struct task_group *tg)
for_each_possible_cpu(i) {
#ifdef CONFIG_QOS_SCHED
- if (tg->cfs_rq)
+ if (tg->cfs_rq && tg->cfs_rq[i])
unthrottle_qos_sched_group(tg->cfs_rq[i]);
#endif
if (tg->cfs_rq)
--
2.25.1
1
1
Backport BPF CO-RE support patches for openEuler-22.09
Alan Maguire (5):
libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()
libbpf: BTF dumper support for typed data
libbpf: Clarify/fix unaligned data issues for btf typed dump
libbpf: Avoid use of __int128 in typed dump display
libbpf: Propagate errors when retrieving enum value for typed data
display
Alexei Starovoitov (47):
bpf: Optimize program stats
bpf: Run sleepable programs with migration disabled
bpf: Compute program stats for sleepable programs
bpf: Add per-program recursion prevention mechanism
selftest/bpf: Add a recursion test
bpf: Count the number of times recursion was prevented
selftests/bpf: Improve recursion selftest
bpf: Allows per-cpu maps and map-in-map in sleepable programs
selftests/bpf: Add a test for map-in-map and per-cpu maps in sleepable
progs
bpf: Clear per_cpu pointers during bpf_prog_realloc
bpf: Dont allow vmlinux BTF to be used in map_create and prog_load.
libbpf: Remove unused field.
bpf: Introduce bpf_sys_bpf() helper and program type.
bpf: Introduce bpfptr_t user/kernel pointer.
bpf: Prepare bpf syscall to be used from kernel and user space.
libbpf: Support for syscall program type
bpf: Make btf_load command to be bpfptr_t compatible.
bpf: Introduce fd_idx
bpf: Add bpf_btf_find_by_name_kind() helper.
bpf: Add bpf_sys_close() helper.
libbpf: Change the order of data and text relocations.
libbpf: Add bpf_object pointer to kernel_supports().
libbpf: Preliminary support for fd_idx
libbpf: Generate loader program out of BPF ELF file.
libbpf: Cleanup temp FDs when intermediate sys_bpf fails.
libbpf: Introduce bpf_map__initial_value().
bpftool: Use syscall/loader program in "prog load" and "gen skeleton"
command.
bpf: Add cmd alias BPF_PROG_RUN
bpf: Prepare bpf_prog_put() to be called from irq context.
bpf: Factor out bpf_spin_lock into helpers.
libbpf: Cleanup the layering between CORE and bpf_program.
libbpf: Split bpf_core_apply_relo() into bpf_program independent
helper.
libbpf: Move CO-RE types into relo_core.h.
libbpf: Split CO-RE logic into relo_core.c.
libbpf: Make gen_loader data aligned.
libbpf: Replace btf__type_by_id() with btf_type_by_id().
bpf: Rename btf_member accessors.
bpf: Prepare relo_core.c for kernel duty.
bpf: Define enum bpf_core_relo_kind as uapi.
bpf: Pass a set of bpf_core_relo-s to prog_load command.
bpf: Add bpf_core_add_cands() and wire it into
bpf_core_apply_relo_insn().
libbpf: Use CO-RE in the kernel in light skeleton.
libbpf: Support init of inner maps in light skeleton.
libbpf: Clean gen_loader's attach kind.
libbpf: Reduce bpf_core_apply_relo_insn() stack usage.
bpf: Silence purge_cand_cache build warning.
libbpf: Fix gen_loader assumption on number of programs.
Andrei Matei (1):
libbpf: Fail early when loading programs with unspecified type
Andrew Delgadillo (1):
selftests/bpf: Drop the need for LLVM's llc
Andrii Nakryiko (149):
libbpf: Factor out common operations in BTF writing APIs
selftest/bpf: Relax btf_dedup test checks
libbpf: Unify and speed up BTF string deduplication
libbpf: Implement basic split BTF support
selftests/bpf: Add split BTF basic test
selftests/bpf: Add checking of raw type dump in BTF writer APIs
selftests
libbpf: Support BTF dedup of split BTFs
libbpf: Accomodate DWARF/compiler bug with duplicated identical arrays
selftests/bpf: Add split BTF dedup selftests
tools/bpftool: Add bpftool support for split BTF
bpf: Add in-kernel split BTF support
bpf: Assign ID to vmlinux BTF and return extra info for BTF in
GET_OBJ_INFO
kbuild: Build kernel module BTFs if BTF is enabled and pahole supports
it
bpf: Load and verify kernel module BTFs
tools/bpftool: Add support for in-kernel and named BTF in `btf show`
bpf: Compile out btf_parse_module() if module BTF is not enabled
bpf: Sanitize BTF data pointer after module is loaded
tools/bpftool: Emit name <anon> for anonymous BTFs
libbpf: Add base BTF accessor
tools/bpftool: Auto-detect split BTFs in common cases
bpf: Keep module's btf_data_size intact after load
libbpf: Add internal helper to load BTF data by FD
libbpf: Refactor CO-RE relocs to not assume a single BTF object
libbpf: Add kernel module BTF support for CO-RE relocations
selftests/bpf: Add bpf_testmod kernel module for testing
selftests/bpf: Add support for marking sub-tests as skipped
selftests/bpf: Add CO-RE relocs selftest relying on kernel module BTF
bpf: Remove hard-coded btf_vmlinux assumption from BPF verifier
bpf: Allow to specify kernel module BTFs when attaching BPF programs
libbpf: Factor out low-level BPF program loading helper
libbpf: Support attachment of BPF tracing programs to kernel modules
selftests/bpf: Add tp_btf CO-RE reloc test for modules
selftests/bpf: Add fentry/fexit/fmod_ret selftest for kernel module
kbuild: Skip module BTF generation for out-of-tree external modules
selftests/bpf: fix bpf_testmod.ko recompilation logic
libbpf: Support modules in bpf_program__set_attach_target() API
selftests/bpf: Work-around EBUSY errors from hashmap update/delete
bpf: Allow empty module BTFs
libbpf: Add user-space variants of BPF_CORE_READ() family of macros
libbpf: Add non-CO-RE variants of BPF_CORE_READ() macro family
selftests/bpf: Add tests for user- and non-CO-RE BPF_CORE_READ()
variants
libbpf: Clarify kernel type use with USER variants of CORE reading
macros
selftests/bpf: Sync RCU before unloading bpf_testmod
bpf: Support BPF ksym variables in kernel modules
libbpf: Support kernel module ksym externs
selftests/bpf: Test kernel module ksym externs
selftests/bpf: Don't exit on failed bpf_testmod unload
libbpf: Stop using feature-detection Makefiles
libbpf: provide NULL and KERNEL_VERSION macros in bpf_helpers.h
libbpf: Expose btf_type_by_id() internally
libbpf: Generalize BTF and BTF.ext type ID and strings iteration
libbpf: Rename internal memory-management helpers
libbpf: Extract internal set-of-strings datastructure APIs
libbpf: Add generic BTF type shallow copy API
libbpf: Add BPF static linker APIs
libbpf: Add BPF static linker BTF and BTF.ext support
bpftool: Add ability to specify custom skeleton object name
bpftool: Add `gen object` command to perform BPF static linking
selftests/bpf: Pass all BPF .o's through BPF static linker
selftests/bpf: Add multi-file statically linked BPF object file test
libbpf: Skip BTF fixup if object file has no BTF
libbpf: Constify few bpf_program getters
libbpf: Preserve empty DATASEC BTFs during static linking
libbpf: Fix memory leak when emitting final btf_ext
libbpf: Add bpf_map__inner_map API
libbpf: Suppress compiler warning when using SEC() macro with externs
libbpf: Mark BPF subprogs with hidden visibility as static for BPF
verifier
libbpf: Allow gaps in BPF program sections to support overriden weak
functions
libbpf: Refactor BTF map definition parsing
libbpf: Factor out symtab and relos sanity checks
libbpf: Make few internal helpers available outside of libbpf.c
libbpf: Extend sanity checking ELF symbols with externs validation
libbpf: Tighten BTF type ID rewriting with error checking
libbpf: Add linker extern resolution support for functions and global
variables
libbpf: Support extern resolution for BTF-defined maps in .maps
section
libbpf: Support BTF_KIND_FLOAT during type compatibility checks in
CO-RE
bpftool: Strip const/volatile/restrict modifiers from .bss and .data
vars
libbpf: Add per-file linker opts
selftests/bpf: Stop using static variables for passing data to/from
user-space
bpftool: Stop emitting static variables in BPF skeleton
libbpf: Fix ELF symbol visibility update logic
libbpf: Treat STV_INTERNAL same as STV_HIDDEN for functions
libbpf: Reject static maps
libbpf: Reject static entry-point BPF programs
libbpf: Add libbpf_set_strict_mode() API to turn on libbpf 1.0
behaviors
libbpf: Streamline error reporting for low-level APIs
libbpf: Streamline error reporting for high-level APIs
bpftool: Set errno on skeleton failures and propagate errors
libbpf: Move few APIs from 0.4 to 0.5 version
libbpf: Refactor header installation portions of Makefile
libbpf: Install skel_internal.h header used from light skeletons
selftests/bpf: Add remaining ASSERT_xxx() variants
libbpf: Fix build with latest gcc/binutils with LTO
libbpf: Make libbpf_version.h non-auto-generated
selftests/bpf: Update selftests to always provide "struct_ops" SEC
libbpf: Ensure BPF prog types are set before relocations
libbpf: Simplify BPF program auto-attach code
libbpf: Minimize explicit iterator of section definition array
libbpf: Use pre-setup sec_def in libbpf_find_attach_btf_id()
selftests/bpf: Stop using relaxed_core_relocs which has no effect
libbpf: Deprecated bpf_object_open_opts.relaxed_core_relocs
libbpf: Allow skipping attach_func_name in
bpf_program__set_attach_target()
libbpf: Schedule open_opts.attach_prog_fd deprecation since v0.7
libbpf: Constify all high-level program attach APIs
selftests/bpf: Turn on libbpf 1.0 mode and fix all IS_ERR checks
selftests/bpf: Switch fexit_bpf2bpf selftest to set_attach_target()
API
libbpf: Add "tc" SEC_DEF which is a better name for "classifier"
libbpf: Add API that copies all BTF types from one BTF object to
another
libbpf: Deprecate btf__finalize_data() and move it into libbpf.c
libbpf: Extract ELF processing state into separate struct
libbpf: Refactor internal sec_def handling to enable pluggability
libbpf: Reduce reliance of attach_fns on sec_def internals
libbpf: Use Elf64-specific types explicitly for dealing with ELF
libbpf: Remove assumptions about uniqueness of .rodata/.data/.bss maps
bpftool: Support multiple .rodata/.data internal maps in skeleton
bpftool: Improve skeleton generation for data maps without DATASEC
type
libbpf: Support multiple .rodata.* and .data.* BPF maps
selftests/bpf: Demonstrate use of custom .rodata/.data sections
libbpf: Simplify look up by name of internal maps
selftests/bpf: Switch to ".bss"/".rodata"/".data" lookups for internal
maps
libbpf: Fix off-by-one bug in bpf_core_apply_relo()
libbpf: Add ability to fetch bpf_program's underlying instructions
libbpf: Deprecate multi-instance bpf_program APIs
libbpf: Deprecate ambiguously-named bpf_program__size() API
libbpf: Detect corrupted ELF symbols section
libbpf: Improve sanity checking during BTF fix up
libbpf: Validate that .BTF and .BTF.ext sections contain data
libbpf: Fix section counting logic
libbpf: Improve ELF relo sanitization
libbpf: Deprecate bpf_program__load() API
libbpf: Rename DECLARE_LIBBPF_OPTS into LIBBPF_OPTS
selftests/bpf: Pass sanitizer flags to linker through LDFLAGS
libbpf: Free up resources used by inner map definition
selftests/bpf: Fix memory leaks in btf_type_c_dump() helper
selftests/bpf: Free per-cpu values array in bpf_iter selftest
selftests/bpf: Free inner strings index in btf selftest
selftests/bpf: Avoid duplicate btf__parse() call
libbpf: Load global data maps lazily on legacy kernels
libbpf: Fix potential misaligned memory access in btf_ext__new()
libbpf: Don't call libc APIs with NULL pointers
libbpf: Fix glob_syms memory leak in bpf_linker
libbpf: Fix using invalidated memory in bpf_linker
selftests/bpf: Fix possible NULL passed to memcpy() with zero size
selftests/bpf: Prevent misaligned memory access in get_stack_raw_tp
test
selftests/bpf: Fix misaligned memory access in queue_stack_map test
selftests/bpf: Prevent out-of-bounds stack access in test_bpffs
selftests/bpf: Fix misaligned accesses in xdp and xdp_bpf2bpf tests
libbpf: Cleanup struct bpf_core_cand.
libbpf: Fix non-C89 loop variable declaration in gen_loader.c
Arnaldo Carvalho de Melo (1):
libbpf: Provide GELF_ST_VISIBILITY() define for older libelf
Brendan Jackman (15):
tools/resolve_btfids: Fix some error messages
bpf: Fix cold build of test_progs-no_alu32
bpf: Clarify return value of probe str helpers
bpf: x86: Factor out emission of ModR/M for *(reg + off)
bpf: x86: Factor out emission of REX byte
bpf: x86: Factor out a lookup table for some ALU opcodes
bpf: Rename BPF_XADD and prepare to encode other atomics in .imm
bpf: Move BPF_STX reserved field check into BPF_STX verifier code
bpf: Add BPF_FETCH field / create atomic_fetch_add instruction
bpf: Add instructions for atomic_[cmp]xchg
bpf: Pull out a macro for interpreting atomic ALU operations
bpf: Add bitwise atomic instructions
bpf: Add tests for new BPF atomic operations
bpf: Document new atomic instructions
bpf: Rename fixup_bpf_calls and add some comments
Cong Wang (1):
bpf: Clear percpu pointers in bpf_prog_clone_free()
Daniel Xu (1):
libbpf: Do not close un-owned FD 0 on errors
Dave Marchevsky (1):
bpf: Add verified_insns to bpf_prog_info and fdinfo
Dmitrii Banshchikov (7):
bpf: Rename bpf_reg_state variables
bpf: Extract nullable reg type conversion into a helper function
bpf: Support pointers in global func args
selftests/bpf: Add unit tests for pointers in global functions
bpf: Drop imprecise log message
selftests/bpf: Fix a compiler warning in global func test
bpf: Use MAX_BPF_FUNC_REG_ARGS macro
Florent Revest (7):
bpf: Be less specific about socket cookies guarantees
selftests/bpf: Fix the ASSERT_ERR_PTR macro
bpf: Factorize bpf_trace_printk and bpf_seq_printf
bpf: Add a ARG_PTR_TO_CONST_STR argument type
bpf: Add a bpf_snprintf helper
libbpf: Introduce a BPF_SNPRINTF helper macro
libbpf: Move BPF_SEQ_PRINTF and BPF_SNPRINTF to bpf_helpers.h
Florian Lehner (2):
selftests/bpf: Print reason when a tester could not run a program
selftests/bpf: Avoid errno clobbering
Gary Lin (3):
bpf,x64: Pad NOPs to make images converge more easily
test_bpf: Remove EXPECTED_FAIL flag from bpf_fill_maxinsns11
selftests/bpf: Add verifier tests for x64 jit jump padding
Hao Luo (1):
libbpf: Support weak typed ksyms.
Hengqi Chen (8):
libbpf: Fix KERNEL_VERSION macro
tools/resolve_btfids: Emit warnings and patch zero id for missing
symbols
libbpf: Add btf__load_vmlinux_btf/btf__load_module_btf
libbpf: Support uniform BTF-defined key/value specification across all
BPF maps
libbpf: Deprecate bpf_object__unload() API since v0.6
libbpf: Deprecate bpf_{map,program}__{prev,next} APIs since v0.7
selftests/bpf: Switch to new bpf_object__next_{map,program} APIs
libbpf: Support static initialization of BPF_MAP_TYPE_PROG_ARRAY
Ian Rogers (3):
bpf, libbpf: Avoid unused function warning on bpf_tail_call_static
tools/bpftool: Add -Wall when building BPF programs
libbpf: Add NULL check to add_dummy_ksym_var
Ilya Leoshkevich (5):
selftests/bpf: Copy extras in out-of-srctree builds
bpf: Add BTF_KIND_FLOAT to uapi
libbpf: Fix whitespace in btf_add_composite() comment
libbpf: Add BTF_KIND_FLOAT support
bpf: Generate BTF_KIND_FLOAT when linking vmlinux
Jason Wang (1):
libbpf: Fix comment typo
Jean-Philippe Brucker (12):
tools: Factor HOSTCC, HOSTLD, HOSTAR definitions
tools/runqslower: Use Makefile.include
tools/runqslower: Enable out-of-tree build
tools/runqslower: Build bpftool using HOSTCC
tools/bpftool: Fix build slowdown
selftests/bpf: Enable cross-building
selftests/bpf: Fix out-of-tree build
selftests/bpf: Move generated test files to $(TEST_GEN_FILES)
selftests/bpf: Fix installation of urandom_read
selftests/bpf: Install btf_dump test cases
tools/bpftool: Fix cross-build
tools/runqslower: Fix cross-build
Jiri Olsa (3):
tools/resolve_btfids: Warn when having multiple IDs for single type
libbpf: Use string table index from index table if needed
perf build: Move feature cleanup under tools/build
Joe Stringer (1):
tools: Sync uapi bpf.h header with latest changes
Jonathan Edwards (1):
libbpf: Add extra BPF_PROG_TYPE check to bpf_object__probe_loading
Kumar Kartikeya Dwivedi (14):
libbpf: Add various netlink helpers
libbpf: Add low level TC-BPF management API
libbpf: Remove unneeded check for flags during tc detach
libbpf: Set NLM_F_EXCL when creating qdisc
libbpf: Fix segfault in static linker for objects without BTF
libbpf: Fix segfault in light skeleton for objects without BTF
libbpf: Update gen_loader to emit BTF_KIND_FUNC relocations
bpf: Add bpf_kallsyms_lookup_name helper
libbpf: Add typeless ksym support to gen_loader
libbpf: Add weak ksym support to gen_loader
libbpf: Perform map fd cleanup for gen_loader in case of error
bpf: Change bpf_kallsyms_lookup_name size type to
ARG_CONST_SIZE_OR_ZERO
libbpf: Avoid double stores for success/failure case of ksym
relocations
libbpf: Avoid reload of imm for weak, unresolved, repeating ksym
Lorenz Bauer (2):
bpf: Consolidate shared test timing code
bpf: Add PROG_TEST_RUN support for sk_lookup programs
Martin KaFai Lau (9):
bpf: Simplify freeing logic in linfo and jited_linfo
bpf: Refactor btf_check_func_arg_match
bpf: Support bpf program calling kernel function
bpf: Support kernel function call in x86-32
libbpf: Refactor bpf_object__resolve_ksyms_btf_id
libbpf: Refactor codes for finding btf id of a kernel symbol
libbpf: Rename RELO_EXTERN to RELO_EXTERN_VAR
libbpf: Record extern sym relocation first
libbpf: Support extern kernel function
Martynas Pumputis (1):
selftests/bpf: Check inner map deletion
Matt Smith (3):
libbpf: Change bpf_object_skeleton data field to const pointer
bpftool: Provide a helper method for accessing skeleton's embedded ELF
data
selftests/bpf: Add checks for X__elf_bytes() skeleton helper
Mauricio Vásquez (1):
libbpf: Fix memory leak in btf__dedup()
Michal Suchanek (1):
libbpf: Fix pr_warn type warnings on 32bit
Pedro Tammela (2):
libbpf: Avoid inline hint definition from 'linux/stddef.h'
libbpf: Clarify flags in ringbuf helpers
Quentin Monnet (17):
libbpf: Return non-null error on failures in libbpf_find_prog_btf_id()
libbpf: Rename btf__load() as btf__load_into_kernel()
libbpf: Rename btf__get_from_id() as btf__load_from_kernel_by_id()
tools: Free BTF objects at various locations
tools: Replace btf__get_from_id() with btf__load_from_kernel_by_id()
libbpf: Add split BTF support for btf__load_from_kernel_by_id()
tools: bpftool: Support dumping split BTF by id
libbpf: Add LIBBPF_DEPRECATED_SINCE macro for scheduling API
deprecations
libbpf: Skip re-installing headers file if source is older than target
bpftool: Remove unused includes to <bpf/bpf_gen_internal.h>
bpftool: Install libbpf headers instead of including the dir
tools/resolve_btfids: Install libbpf headers when building
tools/runqslower: Install libbpf headers when building
bpf: preload: Install libbpf headers when building
bpf: iterators: Install libbpf headers when building
selftests/bpf: Better clean up for runqslower in test_bpftool_build.sh
bpftool: Add install-bin target to install binary only
Rafael David Tinoco (1):
libbpf: Add bpf object kern_version attribute setter
Sedat Dilek (1):
tools: Factor Clang, LLC and LLVM utils definitions
Shuyi Cheng (2):
libbpf: Introduce 'btf_custom_path' to 'bpf_obj_open_opts'
libbpf: Add "bool skipped" to struct bpf_map
Song Liu (5):
bpf: Use separate lockdep class for each hashtab
bpf: Avoid hashtab deadlock with map_locked
bpftool: Add Makefile target bootstrap
perf build: Support build BPF skeletons with perf
perf stat: Enable counting events for BPF programs
Stanislav Fomichev (2):
libbpf: Cap retries in sys_bpf_prog_load
libbpf: Skip bpf_object__probe_loading for light skeleton
Toke Høiland-Jørgensen (5):
bpf: Return target info when a tracing bpf_link is queried
libbpf: Restore errno return for functions that were already returning
it
libbpf: Don't crash on object files with no symbol tables
libbpf: Ignore STT_SECTION symbols in 'maps' section
libbpf: Properly ignore STT_SECTION symbols in legacy map definitions
Wang Hai (1):
libbpf: Simplify the return expression of bpf_object__init_maps
function
Wang Qing (1):
bpf, btf: Remove the duplicate btf_ids.h include
Wedson Almeida Filho (1):
bpf: Refactor check_cfg to use a structured loop.
Yauheni Kaliuta (7):
selftests/bpf: test_progs/sockopt_sk: Remove version
selftests/bpf: test_progs/sockopt_sk: Convert to use BPF skeleton
selftests/bpf: Pass page size from userspace in sockopt_sk
selftests/bpf: Pass page size from userspace in map_ptr
selftests/bpf: mmap: Use runtime page size
selftests/bpf: ringbuf: Use runtime page size
selftests/bpf: ringbuf_multi: Use runtime page size
Yonghong Song (27):
bpf: Permit cond_resched for some iterators
bpf: Permit size-0 datasec
bpf: Refactor BPF_PSEUDO_CALL checking as a helper function
bpf: Factor out visit_func_call_insn() in check_cfg()
bpf: Factor out verbose_invalid_scalar()
bpf: Refactor check_func_call() to allow callback function
bpf: Change return value of verifier function add_subprog()
bpf: Add bpf_for_each_map_elem() helper
libbpf: Move function is_ldimm64() earlier in libbpf.c
libbpf: Support subprog address relocation
selftests/bpf: Fix test_cpp compilation failure with clang
bpftool: Fix a clang compilation warning
libbpf: Add support for new llvm bpf relocations
bpf: Emit better log message if bpf_iter ctx arg btf_id == 0
btf: Change BTF_KIND_* macros to enums
bpf: Support for new btf kind BTF_KIND_TAG
libbpf: Rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag
libbpf: Add support for BTF_KIND_TAG
bpftool: Add support for BTF_KIND_TAG
bpf: Add BTF_KIND_DECL_TAG typedef support
docs/bpf: Update documentation for BTF_KIND_DECL_TAG typedef support
bpf: Rename BTF_KIND_TAG to BTF_KIND_DECL_TAG
bpf: Support BTF_KIND_TYPE_TAG for btf_type_tag attributes
libbpf: Support BTF_KIND_TYPE_TAG
bpftool: Support BTF_KIND_TYPE_TAG
docs/bpf: Update documentation for BTF_KIND_TYPE_TAG support
libbpf: Fix a couple of missed btf_type_tag handling in btf.c
Documentation/ABI/testing/sysfs-kernel-btf | 8 +
Documentation/bpf/btf.rst | 40 +-
Documentation/networking/filter.rst | 61 +-
arch/arm/net/bpf_jit_32.c | 7 +-
arch/arm64/net/bpf_jit_comp.c | 16 +-
arch/mips/net/ebpf_jit.c | 11 +-
arch/powerpc/net/bpf_jit_comp64.c | 25 +-
arch/riscv/net/bpf_jit_comp32.c | 20 +-
arch/riscv/net/bpf_jit_comp64.c | 16 +-
arch/s390/net/bpf_jit_comp.c | 27 +-
arch/sparc/net/bpf_jit_comp_64.c | 17 +-
arch/x86/net/bpf_jit_comp.c | 408 +-
arch/x86/net/bpf_jit_comp32.c | 204 +-
drivers/net/ethernet/netronome/nfp/bpf/fw.h | 4 +-
drivers/net/ethernet/netronome/nfp/bpf/jit.c | 14 +-
drivers/net/ethernet/netronome/nfp/bpf/main.h | 4 +-
.../net/ethernet/netronome/nfp/bpf/verifier.c | 15 +-
include/linux/bpf.h | 150 +-
include/linux/bpf_types.h | 2 +
include/linux/bpf_verifier.h | 46 +-
include/linux/bpfptr.h | 75 +
include/linux/btf.h | 106 +-
include/linux/filter.h | 45 +-
include/linux/module.h | 4 +
include/uapi/linux/bpf.h | 265 +-
include/uapi/linux/btf.h | 57 +-
kernel/bpf/Makefile | 4 +
kernel/bpf/bpf_iter.c | 43 +-
kernel/bpf/bpf_struct_ops.c | 6 +-
kernel/bpf/btf.c | 1403 ++++-
kernel/bpf/core.c | 153 +-
kernel/bpf/disasm.c | 56 +-
kernel/bpf/hashtab.c | 130 +-
kernel/bpf/helpers.c | 326 +-
kernel/bpf/preload/Makefile | 25 +-
kernel/bpf/preload/iterators/Makefile | 38 +-
kernel/bpf/preload/iterators/iterators.bpf.c | 1 -
kernel/bpf/syscall.c | 363 +-
kernel/bpf/sysfs_btf.c | 2 +-
kernel/bpf/task_iter.c | 2 +
kernel/bpf/trampoline.c | 77 +-
kernel/bpf/verifier.c | 1508 ++++-
kernel/module.c | 36 +
kernel/trace/bpf_trace.c | 375 +-
lib/Kconfig.debug | 9 +
lib/test_bpf.c | 21 +-
net/bpf/test_run.c | 290 +-
net/core/filter.c | 1 +
net/ipv4/bpf_tcp_ca.c | 7 +-
samples/bpf/bpf_insn.h | 4 +-
samples/bpf/cookie_uid_helper_example.c | 8 +-
samples/bpf/sock_example.c | 2 +-
samples/bpf/test_cgrp2_attach.c | 5 +-
samples/bpf/xdp1_user.c | 2 +-
samples/bpf/xdp_sample_pkts_user.c | 2 +-
scripts/Makefile.modfinal | 25 +-
scripts/link-vmlinux.sh | 7 +-
.../bpf/bpftool/Documentation/bpftool-gen.rst | 78 +-
tools/bpf/bpftool/Makefile | 55 +-
tools/bpf/bpftool/bash-completion/bpftool | 17 +-
tools/bpf/bpftool/btf.c | 80 +-
tools/bpf/bpftool/btf_dumper.c | 6 +-
tools/bpf/bpftool/gen.c | 651 +-
tools/bpf/bpftool/iter.c | 2 +-
tools/bpf/bpftool/main.c | 20 +-
tools/bpf/bpftool/main.h | 2 +
tools/bpf/bpftool/map.c | 14 +-
tools/bpf/bpftool/net.c | 2 +-
tools/bpf/bpftool/prog.c | 141 +-
tools/bpf/bpftool/xlated_dumper.c | 3 +
tools/bpf/resolve_btfids/Makefile | 19 +-
tools/bpf/resolve_btfids/main.c | 38 +-
tools/bpf/runqslower/Makefile | 71 +-
tools/build/Makefile | 8 +-
tools/build/Makefile.feature | 4 +-
tools/build/feature/Makefile | 4 +-
tools/include/linux/filter.h | 24 +-
tools/include/uapi/linux/bpf.h | 977 ++-
tools/include/uapi/linux/btf.h | 57 +-
tools/lib/bpf/.gitignore | 2 -
tools/lib/bpf/Build | 2 +-
tools/lib/bpf/Makefile | 104 +-
tools/lib/bpf/bpf.c | 272 +-
tools/lib/bpf/bpf.h | 1 +
tools/lib/bpf/bpf_core_read.h | 169 +-
tools/lib/bpf/bpf_gen_internal.h | 65 +
tools/lib/bpf/bpf_helpers.h | 108 +-
tools/lib/bpf/bpf_prog_linfo.c | 18 +-
tools/lib/bpf/bpf_tracing.h | 44 +-
tools/lib/bpf/btf.c | 2085 ++++---
tools/lib/bpf/btf.h | 99 +-
tools/lib/bpf/btf_dump.c | 910 ++-
tools/lib/bpf/gen_loader.c | 1126 ++++
tools/lib/bpf/libbpf.c | 5436 +++++++++--------
tools/lib/bpf/libbpf.h | 212 +-
tools/lib/bpf/libbpf.map | 54 +
tools/lib/bpf/libbpf_common.h | 26 +-
tools/lib/bpf/libbpf_errno.c | 7 +-
tools/lib/bpf/libbpf_internal.h | 299 +-
tools/lib/bpf/libbpf_legacy.h | 60 +
tools/lib/bpf/libbpf_version.h | 9 +
tools/lib/bpf/linker.c | 2901 +++++++++
tools/lib/bpf/netlink.c | 593 +-
tools/lib/bpf/nlattr.h | 48 +
tools/lib/bpf/relo_core.c | 1322 ++++
tools/lib/bpf/relo_core.h | 57 +
tools/lib/bpf/ringbuf.c | 26 +-
tools/lib/bpf/skel_internal.h | 123 +
tools/lib/bpf/strset.c | 176 +
tools/lib/bpf/strset.h | 21 +
tools/lib/bpf/xsk.c | 4 +-
tools/perf/Documentation/perf-stat.txt | 18 +
tools/perf/Makefile.config | 9 +
tools/perf/Makefile.perf | 58 +-
tools/perf/builtin-stat.c | 82 +-
tools/perf/util/Build | 1 +
tools/perf/util/bpf-event.c | 11 +-
tools/perf/util/bpf_counter.c | 320 +
tools/perf/util/bpf_counter.h | 72 +
tools/perf/util/bpf_skel/.gitignore | 3 +
.../util/bpf_skel/bpf_prog_profiler.bpf.c | 93 +
tools/perf/util/evsel.c | 5 +
tools/perf/util/evsel.h | 5 +
tools/perf/util/python.c | 21 +
tools/perf/util/stat-display.c | 4 +-
tools/perf/util/stat.c | 2 +-
tools/perf/util/target.c | 34 +-
tools/perf/util/target.h | 10 +
tools/scripts/Makefile.include | 18 +
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/Makefile | 183 +-
tools/testing/selftests/bpf/bench.c | 1 +
.../selftests/bpf/benchs/bench_rename.c | 2 +-
.../selftests/bpf/benchs/bench_ringbufs.c | 6 +-
.../selftests/bpf/benchs/bench_trigger.c | 2 +-
.../selftests/bpf/bpf_testmod/.gitignore | 6 +
.../selftests/bpf/bpf_testmod/Makefile | 20 +
.../bpf/bpf_testmod/bpf_testmod-events.h | 36 +
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 55 +
.../selftests/bpf/bpf_testmod/bpf_testmod.h | 14 +
tools/testing/selftests/bpf/btf_helpers.c | 264 +
tools/testing/selftests/bpf/btf_helpers.h | 19 +
.../selftests/bpf/prog_tests/atomics.c | 246 +
.../selftests/bpf/prog_tests/attach_probe.c | 12 +-
.../selftests/bpf/prog_tests/bpf_iter.c | 34 +-
.../selftests/bpf/prog_tests/bpf_tcp_ca.c | 8 +-
tools/testing/selftests/bpf/prog_tests/btf.c | 166 +-
.../bpf/prog_tests/btf_dedup_split.c | 325 +
.../selftests/bpf/prog_tests/btf_dump.c | 10 +-
.../selftests/bpf/prog_tests/btf_endian.c | 4 +-
.../selftests/bpf/prog_tests/btf_map_in_map.c | 33 -
.../selftests/bpf/prog_tests/btf_split.c | 99 +
.../selftests/bpf/prog_tests/btf_write.c | 47 +-
.../bpf/prog_tests/cg_storage_multi.c | 84 +-
.../bpf/prog_tests/cgroup_attach_multi.c | 6 +-
.../selftests/bpf/prog_tests/cgroup_link.c | 16 +-
.../bpf/prog_tests/cgroup_skb_sk_lookup.c | 2 +-
.../selftests/bpf/prog_tests/core_autosize.c | 2 +-
.../bpf/prog_tests/core_read_macros.c | 64 +
.../selftests/bpf/prog_tests/core_reloc.c | 105 +-
.../selftests/bpf/prog_tests/fexit_bpf2bpf.c | 68 +-
.../selftests/bpf/prog_tests/fexit_stress.c | 4 +-
.../selftests/bpf/prog_tests/flow_dissector.c | 2 +-
.../bpf/prog_tests/flow_dissector_reattach.c | 10 +-
.../bpf/prog_tests/get_stack_raw_tp.c | 24 +-
.../prog_tests/get_stackid_cannot_attach.c | 9 +-
.../selftests/bpf/prog_tests/global_data.c | 11 +-
.../bpf/prog_tests/global_data_init.c | 2 +-
.../bpf/prog_tests/global_func_args.c | 60 +
.../selftests/bpf/prog_tests/hashmap.c | 9 +-
.../selftests/bpf/prog_tests/kfree_skb.c | 23 +-
.../selftests/bpf/prog_tests/ksyms_btf.c | 34 +-
.../selftests/bpf/prog_tests/ksyms_module.c | 31 +
.../selftests/bpf/prog_tests/link_pinning.c | 7 +-
.../selftests/bpf/prog_tests/map_ptr.c | 15 +-
tools/testing/selftests/bpf/prog_tests/mmap.c | 24 +-
.../selftests/bpf/prog_tests/module_attach.c | 53 +
.../selftests/bpf/prog_tests/obj_name.c | 8 +-
.../selftests/bpf/prog_tests/perf_branches.c | 4 +-
.../selftests/bpf/prog_tests/perf_buffer.c | 2 +-
.../bpf/prog_tests/perf_event_stackmap.c | 3 +-
.../selftests/bpf/prog_tests/probe_user.c | 7 +-
.../selftests/bpf/prog_tests/prog_run_xattr.c | 2 +-
.../bpf/prog_tests/queue_stack_map.c | 12 +-
.../bpf/prog_tests/raw_tp_test_run.c | 4 +-
.../selftests/bpf/prog_tests/rdonly_maps.c | 9 +-
.../selftests/bpf/prog_tests/recursion.c | 41 +
.../bpf/prog_tests/reference_tracking.c | 2 +-
.../selftests/bpf/prog_tests/resolve_btfids.c | 9 +-
.../selftests/bpf/prog_tests/ringbuf.c | 17 +-
.../selftests/bpf/prog_tests/ringbuf_multi.c | 23 +-
.../bpf/prog_tests/select_reuseport.c | 55 +-
.../selftests/bpf/prog_tests/send_signal.c | 5 +-
.../selftests/bpf/prog_tests/sk_lookup.c | 2 +-
.../selftests/bpf/prog_tests/skeleton.c | 41 +-
.../selftests/bpf/prog_tests/snprintf_btf.c | 4 +-
.../selftests/bpf/prog_tests/sock_fields.c | 14 +-
.../selftests/bpf/prog_tests/sockmap_basic.c | 6 +-
.../selftests/bpf/prog_tests/sockmap_ktls.c | 2 +-
.../selftests/bpf/prog_tests/sockmap_listen.c | 10 +-
.../selftests/bpf/prog_tests/sockopt_sk.c | 66 +-
.../bpf/prog_tests/stacktrace_build_id_nmi.c | 3 +-
.../selftests/bpf/prog_tests/stacktrace_map.c | 2 +-
.../bpf/prog_tests/stacktrace_map_raw_tp.c | 5 +-
.../selftests/bpf/prog_tests/static_linked.c | 35 +
.../bpf/prog_tests/tcp_hdr_options.c | 15 +-
.../selftests/bpf/prog_tests/tcp_rtt.c | 2 +-
.../selftests/bpf/prog_tests/test_bpffs.c | 4 +-
.../bpf/prog_tests/test_global_funcs.c | 8 +
.../selftests/bpf/prog_tests/test_overhead.c | 12 +-
.../bpf/prog_tests/trampoline_count.c | 18 +-
.../selftests/bpf/prog_tests/udp_limit.c | 7 +-
tools/testing/selftests/bpf/prog_tests/xdp.c | 11 +-
.../selftests/bpf/prog_tests/xdp_bpf2bpf.c | 8 +-
.../selftests/bpf/prog_tests/xdp_link.c | 8 +-
tools/testing/selftests/bpf/progs/atomics.c | 154 +
tools/testing/selftests/bpf/progs/bpf_cubic.c | 6 +-
.../bpf/progs/bpf_iter_bpf_hash_map.c | 1 -
.../selftests/bpf/progs/bpf_iter_bpf_map.c | 1 -
.../selftests/bpf/progs/bpf_iter_ipv6_route.c | 1 -
.../selftests/bpf/progs/bpf_iter_netlink.c | 1 -
.../selftests/bpf/progs/bpf_iter_task.c | 1 -
.../selftests/bpf/progs/bpf_iter_task_btf.c | 1 -
.../selftests/bpf/progs/bpf_iter_task_file.c | 1 -
.../selftests/bpf/progs/bpf_iter_task_stack.c | 1 -
.../selftests/bpf/progs/bpf_iter_tcp4.c | 1 -
.../selftests/bpf/progs/bpf_iter_tcp6.c | 1 -
.../selftests/bpf/progs/bpf_iter_test_kern4.c | 4 +-
.../selftests/bpf/progs/bpf_iter_udp4.c | 1 -
.../selftests/bpf/progs/bpf_iter_udp6.c | 1 -
.../selftests/bpf/progs/core_reloc_types.h | 17 +
tools/testing/selftests/bpf/progs/kfree_skb.c | 4 +-
tools/testing/selftests/bpf/progs/lsm.c | 69 +
.../selftests/bpf/progs/map_ptr_kern.c | 4 +-
tools/testing/selftests/bpf/progs/recursion.c | 46 +
.../testing/selftests/bpf/progs/sockopt_sk.c | 11 +-
tools/testing/selftests/bpf/progs/tailcall3.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall4.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall5.c | 2 +-
.../selftests/bpf/progs/tailcall_bpf2bpf2.c | 2 +-
.../selftests/bpf/progs/tailcall_bpf2bpf4.c | 2 +-
.../selftests/bpf/progs/test_cls_redirect.c | 4 +-
.../bpf/progs/test_core_read_macros.c | 50 +
.../bpf/progs/test_core_reloc_module.c | 96 +
.../selftests/bpf/progs/test_global_func10.c | 29 +
.../selftests/bpf/progs/test_global_func11.c | 19 +
.../selftests/bpf/progs/test_global_func12.c | 21 +
.../selftests/bpf/progs/test_global_func13.c | 24 +
.../selftests/bpf/progs/test_global_func14.c | 21 +
.../selftests/bpf/progs/test_global_func15.c | 22 +
.../selftests/bpf/progs/test_global_func16.c | 22 +
.../selftests/bpf/progs/test_global_func9.c | 132 +
.../bpf/progs/test_global_func_args.c | 91 +
.../selftests/bpf/progs/test_ksyms_module.c | 26 +
.../selftests/bpf/progs/test_ksyms_weak.c | 56 +
.../bpf/progs/test_map_in_map_invalid.c | 26 +
tools/testing/selftests/bpf/progs/test_mmap.c | 2 -
.../selftests/bpf/progs/test_module_attach.c | 66 +
.../selftests/bpf/progs/test_rdonly_maps.c | 6 +-
.../selftests/bpf/progs/test_ringbuf.c | 1 -
.../selftests/bpf/progs/test_ringbuf_multi.c | 1 -
.../selftests/bpf/progs/test_skeleton.c | 20 +-
.../selftests/bpf/progs/test_sockmap_listen.c | 2 +-
.../selftests/bpf/progs/test_static_linked1.c | 30 +
.../selftests/bpf/progs/test_static_linked2.c | 31 +
.../selftests/bpf/progs/test_subprogs.c | 13 +
.../selftests/bpf/test_bpftool_build.sh | 4 +
tools/testing/selftests/bpf/test_btf.h | 3 +
.../selftests/bpf/test_cgroup_storage.c | 2 +-
tools/testing/selftests/bpf/test_maps.c | 279 +-
tools/testing/selftests/bpf/test_progs.c | 79 +-
tools/testing/selftests/bpf/test_progs.h | 72 +-
.../selftests/bpf/test_tcpnotify_user.c | 7 +-
tools/testing/selftests/bpf/test_verifier.c | 103 +-
.../selftests/bpf/verifier/atomic_and.c | 77 +
.../selftests/bpf/verifier/atomic_cmpxchg.c | 96 +
.../selftests/bpf/verifier/atomic_fetch_add.c | 106 +
.../selftests/bpf/verifier/atomic_or.c | 77 +
.../selftests/bpf/verifier/atomic_xchg.c | 46 +
.../selftests/bpf/verifier/atomic_xor.c | 77 +
tools/testing/selftests/bpf/verifier/calls.c | 12 +-
tools/testing/selftests/bpf/verifier/ctx.c | 7 +-
.../selftests/bpf/verifier/dead_code.c | 10 +-
.../bpf/verifier/direct_packet_access.c | 4 +-
tools/testing/selftests/bpf/verifier/jit.c | 24 +
.../testing/selftests/bpf/verifier/leak_ptr.c | 10 +-
.../selftests/bpf/verifier/meta_access.c | 4 +-
tools/testing/selftests/bpf/verifier/unpriv.c | 3 +-
.../bpf/verifier/value_illegal_alu.c | 2 +-
tools/testing/selftests/bpf/verifier/xadd.c | 18 +-
tools/testing/selftests/bpf/xdping.c | 2 +-
tools/testing/selftests/tc-testing/Makefile | 3 +-
292 files changed, 24645 insertions(+), 6370 deletions(-)
create mode 100644 include/linux/bpfptr.h
create mode 100644 tools/lib/bpf/bpf_gen_internal.h
create mode 100644 tools/lib/bpf/gen_loader.c
create mode 100644 tools/lib/bpf/libbpf_legacy.h
create mode 100644 tools/lib/bpf/libbpf_version.h
create mode 100644 tools/lib/bpf/linker.c
create mode 100644 tools/lib/bpf/relo_core.c
create mode 100644 tools/lib/bpf/relo_core.h
create mode 100644 tools/lib/bpf/skel_internal.h
create mode 100644 tools/lib/bpf/strset.c
create mode 100644 tools/lib/bpf/strset.h
create mode 100644 tools/perf/util/bpf_counter.c
create mode 100644 tools/perf/util/bpf_counter.h
create mode 100644 tools/perf/util/bpf_skel/.gitignore
create mode 100644 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/.gitignore
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/Makefile
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod-events.h
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.h
create mode 100644 tools/testing/selftests/bpf/btf_helpers.c
create mode 100644 tools/testing/selftests/bpf/btf_helpers.h
create mode 100644 tools/testing/selftests/bpf/prog_tests/atomics.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/btf_dedup_split.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/btf_split.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/core_read_macros.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/global_func_args.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/ksyms_module.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/module_attach.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/recursion.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/static_linked.c
create mode 100644 tools/testing/selftests/bpf/progs/atomics.c
create mode 100644 tools/testing/selftests/bpf/progs/recursion.c
create mode 100644 tools/testing/selftests/bpf/progs/test_core_read_macros.c
create mode 100644 tools/testing/selftests/bpf/progs/test_core_reloc_module.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func10.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func11.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func12.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func13.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func14.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func15.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func16.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func9.c
create mode 100644 tools/testing/selftests/bpf/progs/test_global_func_args.c
create mode 100644 tools/testing/selftests/bpf/progs/test_ksyms_module.c
create mode 100644 tools/testing/selftests/bpf/progs/test_ksyms_weak.c
create mode 100644 tools/testing/selftests/bpf/progs/test_map_in_map_invalid.c
create mode 100644 tools/testing/selftests/bpf/progs/test_module_attach.c
create mode 100644 tools/testing/selftests/bpf/progs/test_static_linked1.c
create mode 100644 tools/testing/selftests/bpf/progs/test_static_linked2.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_and.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_fetch_add.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_or.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_xchg.c
create mode 100644 tools/testing/selftests/bpf/verifier/atomic_xor.c
--
2.20.1
1
379