Commit Graph

9429 Commits

Author SHA1 Message Date
Bin Lai b42f03261c sched/debug: allow user modify sched_domain flags
Kernel-5.4 prohibit user to modify the sched_domain flags bit, but
we have to do it to optimize performance in some cases. So we remove
the prohibition of sched_domain flags moditication allow user do the
better tunning.

Signed-off-by: Bin Lai <robinlai@tencent.com>
Reviewed-by: Bauerchen <bauerchen@tencent.com>
2022-09-26 17:11:33 +08:00
sclaibin 9e42f94a72
Merge pull request #286 from xmmgithub/tk4/0009-kabi
Tk4/0009 kabi
2022-09-24 20:00:29 +08:00
Menglong Dong 3c01ec65a2 bpf: enable CONFIG_CGROUP_BPF for arm
Set CONFIG_CGROUP_BPF to y for arm

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-09-24 19:55:11 +08:00
sclaibin eb32155ad5
Merge pull request #284 from Tencent/tk4/0009-kabi-honglin
package/arm: enable build bpftool with kernel for arm
2022-09-24 18:58:15 +08:00
Menglong Dong 544e6d6dce Revert "bpf: config some eBPF feature that backported before"
This reverts commit 824a397665.
2022-09-24 16:21:48 +08:00
Honglin Li 14848b6f50 package: fix a warning/error in spec for x86/arm
Add %{_mandir}/man7/bpf-helpers.7.gz to solve
the bug with kernel.

Signed-off-by: Honglin Li <honglinli@tencent.com>
Reviewed-by: Haisu Wang <haisuwang@tencent.com>
2022-09-23 23:41:15 +08:00
Honglin Li 21aebbd3a3 package/arm: enable build bpftool with kernel for arm
Build and deliver kernel builtin bpftool

Signed-off-by: Honglin Li <honglinli@tencent.com>
Reviewed-by: Haisu Wang <haisuwang@tencent.com>
2022-09-23 23:41:06 +08:00
sclaibin 9669f99155
Merge pull request #282 from fatherMatrix/alex
Change filesystem MS-DOS and FAT to separate kernel module
2022-09-23 19:49:14 +08:00
Jinliang Zheng 742ada1748 Change filesystem MS-DOS and FAT to separate kernel module 2022-09-23 19:45:14 +08:00
sclaibin 5a0ef59dc6
Merge pull request #281 from Tencent/tk4/katrinzhou-fixpackkabi
package: support tag startswith x86
2022-09-23 16:05:59 +08:00
Yushan Zhou 7a426c3af1 package: support tag startswith x86
Tmanager generates tag to build kernel when branch specified.
The tag starts with x86, which leads to the build process failing
to parse the tag.
Modify the generate-rpms.sh to support building with "x86-*" tags.

Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
2022-09-23 15:32:01 +08:00
sclaibin e19db0fc9c
Merge pull request #278 from fatherMatrix/alex
Merge phytium patchs
2022-09-23 15:17:42 +08:00
sclaibin 8538fd5ef6
Merge pull request #277 from sclaibin/tk4/0009-kabi-hyperv
config: enable hyperv configurations for x86 platform
2022-09-23 15:14:14 +08:00
Haisu Wang 56fd14289a config: enable BTF for BPF CO-RE application in aarch64
BPF CO-RE applications like libbpf are need kernel
headers with all types, so it require BTF type
information built-in.

CONFIG_DEBUG_INFO_BTF have already enabled in x86_64,
enable in aarch64 to align.

Signed-off-by: Haisu Wang <haisuwang@tencent.com>
2022-09-23 12:56:29 +08:00
Tian Tao 4fd005b6fc drm/hisilicon: Fixed pcie resource conflict between drm and firmware
upstream commit: c3480301d750bd58bab35994ecf015a4682a17dd

use the drm_fb_helper_remove_conflicting_pci_framebuffer to remove
the framebuffer initialized by fireware/bootloader to avoid resource
conflict.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1582524112-5628-1-git-send-email-tiantao6@hisilicon.com
2022-09-23 12:56:04 +08:00
Bin Lai c33f9f60e2 iommu/phytium: fix PLX acs bug on phytium platform
Phytium platform doesn't support PLX acs feature, it would affect
the device passthrough fucntion. So phytium provide this patch to
avoid this issue.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-09-23 12:39:52 +08:00
Bin Lai b0d12c3b1f irqchip/phytium-2500: make the msi interrupt dispatched to CPUs which in the same socket for kdump
Phytium-2500 CPU have a quirky hardware feature that the msi interrupt
must be handled in the same socket that follow the haredware connection.
So Phytium vendor provide this patch to handle this case for kdump.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-09-23 12:38:53 +08:00
Bin Lai c80a7b3863 arm64/phytium-2500: make sure that there is at least one online cpu on each node for kdump
If the storage device is located on socket1, the interrupt cann't
be handled on socket0 for phytium-2500. So we must guarantee that
there is at least one online cpu on each node, otherwise the kdump
may not work on phytium-2500 platform.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-09-23 12:38:43 +08:00
Bin Lai 21030b0eb7 arm64/config: change the max number of nodes and set default IOMMU passthrough
The number of nodes will exceed 16(2^4) for arm64 server(such as
phytium cpu), so we should change the max number of nodes to adapt
these equipment. There is something wrong with IOMMU compatibility
of phytium CPU, so we have to set IOMMU as default passthrough mode
to avoid this isssue. And we can change the IOMMU mode by cmdline
on other arm64 hardware.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-09-23 12:38:07 +08:00
Bin Lai 7980776b6e config: enable hyperv configurations for x86 platform
Hyperv is a native hypervisor that can create virtual machine on x86-64
platform. Enable all hyperv configurations for linux, then it can run
on windows hyperv.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-09-23 10:46:05 +08:00
sclaibin 796290fb62
Merge pull request #275 from xmmgithub/tk4/0009-kabi
bpf: config some eBPF feature that backported before
2022-09-22 19:42:08 +08:00
Menglong Dong 824a397665 bpf: config some eBPF feature that backported before
Some eBPF feature we backported before is not configured by default.
Now, we enable them, includes:

CONFIG_CGROUP_BPF=y
CONFIG_BPF_LSM=y
CONFIG_IPV6_SEG6_BPF=y
CONFIG_IPV6_SEG6_LWTUNNEL=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_STREAM_PARSER=y
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,bpf"

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-09-22 19:28:04 +08:00
sclaibin 753dcdbc31
Merge pull request #274 from Tencent/tk4/katrinzhou-fixpackkabi
generate-rpm.sh: unify package script
2022-09-22 16:29:05 +08:00
Yushan Zhou 872d8b4e8b generate-rpm.sh: unify package script
Modify generate-rpm.sh so that x86/arm can use the same tag.

Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
2022-09-22 16:12:16 +08:00
sclaibin 24f6003d96
Merge pull request #266 from nick-wang/tk4/0009-kabi
build and release bpftool package with kernel
2022-09-21 11:03:24 +08:00
sclaibin e7f772f9cd
Merge pull request #271 from Tencent/tk4/katrinzhou-fixperf
perf spec: remove perf obj default
2022-09-21 10:58:22 +08:00
Yushan Zhou 37f6ed3df6 perf spec: remove perf obj default
The bash script mkmakefile generates Makefile which includes itself.
It leads to dead cycle when build rpm packages.

Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
2022-09-19 14:44:26 +08:00
Haisu Wang 033110707f package: support repackage bpftool for tl2
tl2 release system using repackage trick instead of full tl2
env to build kernel and other packages from scratch.

Update the perf tools spec to support build bpftool with
perf and kernel tools.

Signed-off-by: Haisu Wang <haisuwang@tencent.com>
2022-09-19 14:18:31 +08:00
sclaibin 88d135662b
Merge pull request #267 from fatherMatrix/tk4/0009-kabi
Change filesystem UDF and VFAT to separate kernel module
2022-09-16 23:59:24 +08:00
Jinliang Zheng ff39a453b7 Change filesystem UDF and VFAT to separate kernel module
In early iso, UDF and VFAT were compiled into kernel by default. Make it
a separate kernel module in config.default and arm/config.default.
2022-09-16 23:54:59 +08:00
Haisu Wang 61daaa76b4 package: support bpftool in tlinux2
In tlinux2, use python2-docutils instead of python3-docutils.

Signed-off-by: Haisu Wang <haisuwang@tencent.com>
2022-09-16 22:58:55 +08:00
Haisu Wang eb2c1294e5 package: enable build bpftool with kernel
Build and deliver kernel builtin bpftool

Signed-off-by: Haisu Wang <haisuwang@tencent.com>
2022-09-16 22:57:13 +08:00
sclaibin cd5ddc84a6
Merge pull request #263 from sclaibin/tk4/0009-kabi-revert-lru-lock
Tk4/0009 kabi revert lru lock
2022-09-05 21:21:49 +08:00
Bin Lai 999b43609b Revert "mm/lru: introduce TestClearPageLRU"
This reverts commit 4702fd8039.
2022-09-05 20:56:40 +08:00
Bin Lai 4eda8b0c77 Revert "mm/compaction: do page isolation first in compaction"
This reverts commit f784a238c7.
2022-09-05 20:56:32 +08:00
Bin Lai 2ec5b7b539 Revert "mm/swap.c: serialize memcg changes in pagevec_lru_move_fn"
This reverts commit 4e9dc3310b.
2022-09-05 20:56:22 +08:00
Bin Lai 971b97b045 Revert "mm: memcontrol: charge swapin pages on instantiation"
This reverts commit 821adde85c.
2022-09-05 20:56:12 +08:00
Bin Lai 6ef3bc24ee Revert " mm/lru: replace pgdat lru_lock with lruvec lock"
This reverts commit 1b7478d8d0.
2022-09-05 20:56:02 +08:00
Bin Lai bb589f37a6 Revert " mm/lru: revise the comments of lru_lock"
This reverts commit 3df720cae4.
2022-09-05 20:55:51 +08:00
sclaibin 704259482e
Merge pull request #262 from Tencent/tk4/tallwu-0009-kabi
Tk4/tallwu 0009 kabi
2022-08-31 18:05:05 +08:00
Wu Tao 503cf46310 netfilter: nf_tables: do not allow RULE_ID to refer to another chain
[ Upstream commit 36d5b2913219ac853908b0f1c664345e04313856 ]

When doing lookups for rules on the same batch by using its ID, a rule from
a different chain can be used. If a rule is added to a chain but tries to
be positioned next to a rule from a different chain, it will be linked to
chain2, but the use counter on chain1 would be the one to be incremented.

When looking for rules by ID, use the chain that was used for the lookup by
name. The chain used in the context copied to the transaction needs to
match that same chain. That way, struct nft_rule does not need to get
enlarged with another member.

Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute")
Fixes: 75dd48e2e420 ("netfilter: nf_tables: Support RULE_ID reference in new rule")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tao Wu <tallwu@tencent.com>
2022-08-31 16:52:05 +08:00
Wu Tao dcc73ca84e netfilter: nf_tables: do not allow SET_ID to refer to another table
[ Upstream commit 470ee20e069a6d05ae549f7d0ef2bdbcee6a81b2 ]

When doing lookups for sets on the same batch by using its ID, a set from a
different table can be used.

Then, when the table is removed, a reference to the set may be kept after
the set is freed, leading to a potential use-after-free.

When looking for sets by ID, use the table that was used for the lookup by
name, and only return sets belonging to that same table.

This fixes CVE-2022-2586, also reported as ZDI-CAN-17470.

Reported-by: Team Orca of Sea Security (@seasecresponse)
Fixes: 958bee14d071 ("netfilter: nf_tables: use new transaction infrastructure to handle sets")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tao Wu <tallwu@tencent.com>
2022-08-31 16:51:25 +08:00
sclaibin 59b3981402
Merge pull request #259 from xmmgithub/tk4/0009-kabi
eBPF feature backport
2022-08-30 17:28:56 +08:00
Menglong Dong c4c47ae2bf net: bpf: disable the usage of bpf_dispatcher for XDP
The usage of bpf_dispatcher for XDP caused kernel panic, and the reason
has not found. Therefore, disable it for now.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-08-30 11:33:36 +08:00
Menglong Dong 222c6939d6 bpf: disable 'optimize bpf_tail_call' for now
The feature 'optimize-bpf_tail_call' result in kernel crash, therefore
disable it for now.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-08-30 11:33:36 +08:00
Menglong Dong f59ac5605a bpf: xskmap: make xsk_map_gen_lookup return int
The return type of map_gen_lookup() in struct is bpf_map_ops, therefore
make xsk_map_gen_lookup correspoding to it.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-08-30 11:33:35 +08:00
Daniel Borkmann 3c46c41ef3 bpf, selftests: Add redirect_peer selftest
Extend the test_tc_redirect test and add a small test that exercises the new
redirect_peer() helper for the IPv4 and IPv6 case.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201010234006.7075-7-daniel@iogearbox.net
2022-08-30 11:33:35 +08:00
Daniel Borkmann f179f8acfa bpf, selftests: Make redirect_neigh test more extensible
Rename into test_tc_redirect.sh and move setup and test code into separate
functions so they can be reused for newly added tests in here. Also remove
the crude hack to override ifindex inside the object file via xxd and sed
and just use a simple map instead. Map given iproute2 does not support BTF
fully and therefore neither global data at this point.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20201010234006.7075-6-daniel@iogearbox.net
2022-08-30 11:33:35 +08:00
Daniel Borkmann 01c5774d82 bpf: Allow for map-in-map with dynamic inner array map entries
Recent work in f4d05259213f ("bpf: Add map_meta_equal map ops") and 134fede4eecf
("bpf: Relax max_entries check for most of the inner map types") added support
for dynamic inner max elements for most map-in-map types. Exceptions were maps
like array or prog array where the map_gen_lookup() callback uses the maps'
max_entries field as a constant when emitting instructions.

We recently implemented Maglev consistent hashing into Cilium's load balancer
which uses map-in-map with an outer map being hash and inner being array holding
the Maglev backend table for each service. This has been designed this way in
order to reduce overall memory consumption given the outer hash map allows to
avoid preallocating a large, flat memory area for all services. Also, the
number of service mappings is not always known a-priori.

The use case for dynamic inner array map entries is to further reduce memory
overhead, for example, some services might just have a small number of back
ends while others could have a large number. Right now the Maglev backend table
for small and large number of backends would need to have the same inner array
map entries which adds a lot of unneeded overhead.

Dynamic inner array map entries can be realized by avoiding the inlined code
generation for their lookup. The lookup will still be efficient since it will
be calling into array_map_lookup_elem() directly and thus avoiding retpoline.
The patch adds a BPF_F_INNER_MAP flag to map creation which therefore skips
inline code generation and relaxes array_map_meta_equal() check to ignore both
maps' max_entries. This also still allows to have faster lookups for map-in-map
when BPF_F_INNER_MAP is not specified and hence dynamic max_entries not needed.

Example code generation where inner map is dynamic sized array:

  # bpftool p d x i 125
  int handle__sys_enter(void * ctx):
  ; int handle__sys_enter(void *ctx)
     0: (b4) w1 = 0
  ; int key = 0;
     1: (63) *(u32 *)(r10 -4) = r1
     2: (bf) r2 = r10
  ;
     3: (07) r2 += -4
  ; inner_map = bpf_map_lookup_elem(&outer_arr_dyn, &key);
     4: (18) r1 = map[id:468]
     6: (07) r1 += 272
     7: (61) r0 = *(u32 *)(r2 +0)
     8: (35) if r0 >= 0x3 goto pc+5
     9: (67) r0 <<= 3
    10: (0f) r0 += r1
    11: (79) r0 = *(u64 *)(r0 +0)
    12: (15) if r0 == 0x0 goto pc+1
    13: (05) goto pc+1
    14: (b7) r0 = 0
    15: (b4) w6 = -1
  ; if (!inner_map)
    16: (15) if r0 == 0x0 goto pc+6
    17: (bf) r2 = r10
  ;
    18: (07) r2 += -4
  ; val = bpf_map_lookup_elem(inner_map, &key);
    19: (bf) r1 = r0                               | No inlining but instead
    20: (85) call array_map_lookup_elem#149280     | call to array_map_lookup_elem()
  ; return val ? *val : -1;                        | for inner array lookup.
    21: (15) if r0 == 0x0 goto pc+1
  ; return val ? *val : -1;
    22: (61) r6 = *(u32 *)(r0 +0)
  ; }
    23: (bc) w0 = w6
    24: (95) exit

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201010234006.7075-4-daniel@iogearbox.net
2022-08-30 11:33:35 +08:00
Daniel Borkmann 13dc0ea1ed bpf: Add redirect_peer helper
Add an efficient ingress to ingress netns switch that can be used out of tc BPF
programs in order to redirect traffic from host ns ingress into a container
veth device ingress without having to go via CPU backlog queue [0]. For local
containers this can also be utilized and path via CPU backlog queue only needs
to be taken once, not twice. On a high level this borrows from ipvlan which does
similar switch in __netif_receive_skb_core() and then iterates via another_round.
This helps to reduce latency for mentioned use cases.

Pod to remote pod with redirect(), TCP_RR [1]:

  # percpu_netperf 10.217.1.33
          RT_LATENCY:         122.450         (per CPU:         122.666         122.401         122.333         122.401 )
        MEAN_LATENCY:         121.210         (per CPU:         121.100         121.260         121.320         121.160 )
      STDDEV_LATENCY:         120.040         (per CPU:         119.420         119.910         125.460         115.370 )
         MIN_LATENCY:          46.500         (per CPU:          47.000          47.000          47.000          45.000 )
         P50_LATENCY:         118.500         (per CPU:         118.000         119.000         118.000         119.000 )
         P90_LATENCY:         127.500         (per CPU:         127.000         128.000         127.000         128.000 )
         P99_LATENCY:         130.750         (per CPU:         131.000         131.000         129.000         132.000 )

    TRANSACTION_RATE:       32666.400         (per CPU:        8152.200        8169.842        8174.439        8169.897 )

Pod to remote pod with redirect_peer(), TCP_RR:

  # percpu_netperf 10.217.1.33
          RT_LATENCY:          44.449         (per CPU:          43.767          43.127          45.279          45.622 )
        MEAN_LATENCY:          45.065         (per CPU:          44.030          45.530          45.190          45.510 )
      STDDEV_LATENCY:          84.823         (per CPU:          66.770          97.290          84.380          90.850 )
         MIN_LATENCY:          33.500         (per CPU:          33.000          33.000          34.000          34.000 )
         P50_LATENCY:          43.250         (per CPU:          43.000          43.000          43.000          44.000 )
         P90_LATENCY:          46.750         (per CPU:          46.000          47.000          47.000          47.000 )
         P99_LATENCY:          52.750         (per CPU:          51.000          54.000          53.000          53.000 )

    TRANSACTION_RATE:       90039.500         (per CPU:       22848.186       23187.089       22085.077       21919.130 )

  [0] https://linuxplumbersconf.org/event/7/contributions/674/attachments/568/1002/plumbers_2020_cilium_load_balancer.pdf
  [1] https://github.com/borkmann/netperf_scripts/blob/master/percpu_netperf

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201010234006.7075-3-daniel@iogearbox.net
2022-08-30 11:33:35 +08:00