Commit Graph

40 Commits

Author SHA1 Message Date
Lei Chen b5d85c9684 PCI: Probe bridge window attributes once at enumeration-time
upstream: 51c48b310183ab6ba5419edfc6a8de889cc04521

pci_bridge_check_ranges() determines whether a bridge supports the optional
I/O and prefetchable memory windows and sets the flag bits in the bridge
resources.  This *could* be done once during enumeration except that the
resource allocation code completely clears the flag bits, e.g., in the
pci_assign_unassigned_bridge_resources() path.

The problem with pci_bridge_check_ranges() in the resource allocation path
is that we may allocate resources after devices have been claimed by
drivers, and pci_bridge_check_ranges() *changes* the window registers to
determine whether they're writable.  This may break concurrent accesses to
devices behind the bridge.

Add a new pci_read_bridge_windows() to determine whether a bridge supports
the optional windows, call it once during enumeration, remember the
results, and change pci_bridge_check_ranges() so it doesn't touch the
bridge windows but sets the flag bits based on those remembered results.

Signed-off-by: Lei Chen <lennychen@tencent.com>
2020-12-25 15:38:45 +08:00
yongduan 3853775fa6 smp: smp_call_function_many_async
Run an asynchronous function on a many cpus.
smp_call_function_many_async_begin
for_each_csd
        smp_call_function_many_async
smp_call_function_many_async_end

Signed-off-by: yongduan <yongduan@tencent.com>
2020-12-01 10:34:56 +08:00
zgpeng 8cbbd36a38 proc: fix the display error of the processes field in /proc/stat
Signed-off-by: zhiguang peng <zgpeng@tencent.com>
2020-11-12 14:39:06 +08:00
Liu Hua 1fe0578c20 cgroup: add switch for subsystem stats isolated
Statictics of memcg, cpuset, cpuacct and blkio export by /proc/
 when switch enabled.

Signed-off-by: Liu Hua <shookliu@tencent.com>
2020-07-16 14:52:41 +08:00
chen xiaoguang e59390ab76 Revert "sched/BT: add RDT support for BT scheduler class"
This reverts commit a2119393bd.

Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>
2020-07-16 12:41:34 +08:00
He Chen de8ae6bfd2 sched/bt: cgroup support and ignore cpu binding for offline task
This commit add cpu.offline to cpu cgroup, echo 1 > cpu.offline would
convert all tasks under this cgroup to offline task. Beside, a new
sysctl sysctl_sched_bt_ignore_cpubind is added, which makes offline
tasks ignoring CPU binding and running on any CPU.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-06-24 10:09:06 +08:00
He Chen a2119393bd sched/BT: add RDT support for BT scheduler class
Offline tasks (BT tasks) may have some performance impact to online
tasks.
In this commit, we introduce Intel RDT features to limit offline tasks
L3 cache usage to avoid the influence caused by offline tasks.

Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-05-29 10:40:58 +08:00
Kaixu Xia b0e23ef723 pagecachelimit: add the slab(dentry&inode) limit support
Add the support that controlling slab(dentry&inode) limit and the
corresponding sysctl interface.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-05-29 10:40:24 +08:00
Xiaoming Gao 9de8b674e2 slub: add fast_slub_nr_free to track free objects
use lightweight track method to count free objects in
slub, remove heavy logic in spin_lock_irqsave.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-05-29 10:40:21 +08:00
brookxu b0009bfea9 writeback: eliminate work item allocation in bd_start_writeback()
commit <aac8d41cd438f25bf3110fc6b98f1d16d7dbc169>
commit <85009b4f5f0399669a44f07cb9a5622c0e71d419>

When someone calls wakeup_flusher_threads() or
wakeup_flusher_threads_bdi(), they schedule writeback of all dirty
pages in the system (or on that bdi). If we are tight on memory, we
can get tons of these queued from kswapd/vmscan. This causes (at
least) two problems:

1) We consume a ton of memory just allocating writeback work items.
   We've seen as much as 600 million of these writeback work items
   pending. That's a lot of memory to pointlessly hold hostage,
   while the box is under memory pressure.

2) We spend so much time processing these work items, that we
   introduce a softlockup in writeback processing. This is because
   each of the writeback work items don't end up doing any work (it's
   hard when you have millions of identical ones coming in to the
   flush machinery), so we just sit in a tight loop pulling work
   items and deleting/freeing them.

Fix this by adding a 'start_all' bit to the writeback structure, and
set that when someone attempts to flush all dirty pages. The bit is
cleared when we start writeback on that work item. If the bit is
already set when we attempt to queue !nr_pages writeback, then we
simply ignore it.

This provides us one full flush in flight, with one pending as well,
and makes for more efficient handling of this type of writeback.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-05-29 10:40:18 +08:00
Hongbo Li 3d3057177e net: increase somaxconn
increase sysctl somaxconnn from 128 to 4096

Signed-off-by: Hongbo Li <herberthbli@tencent.com>
2020-05-29 10:40:02 +08:00
zgpeng f2ba303dbd vm: add max_map_count isolate switch
Add the max_map_count isolation switch kernel.isolate_max_map_count;
The isolation of max_map_count is turned on by default. If you want
to turn it off, set kernel.isolate_max_map_count to 0;

Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
2020-05-29 10:38:28 +08:00
Samuel Liao 660998b7a9 x86: add hygon family 18h 2020-03-13 19:37:23 +08:00
Lei Chen e8be225280 cgroup: blkio: adjust block io bps limit by weight
Kernel now supports cgroup bps and iops hard limit by io-throttling.
But that's not a scalable way, because block devices' bandwith is
always changing over time.

This patch dynamically adjusts bps limit of each blkio cgroup according
to its pre-set weight. Additionally, if a process has not issued any io
request during a time window, its weight will be shared by other processes
until its next io request.

Signed-off-by: Lei Chen <lennychen@tencent.com>
2020-03-11 11:11:46 +08:00
He Chen f1ac9bd18b sched/bt: add latency factor for bt load
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:10 +08:00
He Chen 0b667819c3 sched/bt: BT schduler cgroup support
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:10 +08:00
He Chen 0dd9de2d2b sched/bt: BT scheduler load balance support
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:09 +08:00
He Chen e6c42e61db sched/bt: BT scheduler bandwidth limit support
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:09 +08:00
He Chen b48a63ef2c sched: add offline scheduler class
The offline scheduler named BT sched is based on the CFS scheduler. We
also use the rb-tree as the run queue to save the runnable tasks. And the
vruntime concept is also used in the offline scheduler. And the priority
of offline scheduler is from 140 to 179. So now the schedulers in the
kernel are as follows: stop, RT, CFS, BT and idle.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Hua Liu <shookliu@tencent.com>
Signed-off-by: Xiaogguang Chen <xiaoggchen@tencent.com>
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Bin Fan <tombinfan@tencent.com>
Signed-off-by: He Chen <heddchen@tencent.com>
2020-03-02 22:03:09 +08:00
Xiaoming Gao 42c43458cb tools: add ttools module to support ptrace protect
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 15:12:03 +08:00
Fan Bin 314bf3d4ba MMC: Use the device ID implied from device tree
Signed-off-by: Fan Bin <tombinfan@tencent.com>
2020-01-02 14:52:13 +08:00
Luis Henriques 78b249729b ceph: quota: add initial infrastructure to support cephfs quotas
This patch adds the infrastructure required to support cephfs quotas as it
is currently implemented in the ceph fuse client.  Cephfs quotas can be
set on any directory, and can restrict the number of bytes or the number
of files stored beneath that point in the directory hierarchy.

Quotas are set using the extended attributes 'ceph.quota.max_files' and
'ceph.quota.max_bytes', and can be removed by setting these attributes to
'0'.

Link: http://tracker.ceph.com/issues/22372
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-01-02 12:23:05 +08:00
Liu Yu 055200e6c8 ceph: Add new mount option req_resend
Which control whether to resend requests if timeout. Further more,
the patch adds a debugfs file which can change this option during mount.

Signed-off-by: Liu Yu <allanyuliu@tencent.com>
2020-01-02 12:22:54 +08:00
Zhang Zhi 805cdc8b06 ceph: re-send osd requests if timeout
When osd requests timeout, the defaut action is discarding all timeout
requests and reseting the connection. It then returns IO errors to
userspace.

The patch re-send all timeout requests instead of discarding,
so that make the timeout transparent to userspace.

Signed-off-by: Liu Yu <allanyuliu@tencent.com>
2020-01-02 12:22:48 +08:00
brookxu f22307c4c8 cpuset: fixed cpuset.stat process field value exception
The value of the cpuset.stat process field will be abnormal in
some scenarios. The reason for this problem is that the sum of
process_counts may be negative for several cpus.

Signed-off-by: brookxu <brookxu@tencent.com>
2020-01-02 12:20:45 +08:00
Chunguang Xu e7636c1b8b blkcg: add per blkcg diskstats
In order to facilitate each container to obtain its own IO statistics,
we implement per blkcg diskstats and expose some data from the host
into the container such as io_ticks.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-01-02 12:19:49 +08:00
Xiaoming Gao 3893c04cf1 x86/irq: remapping Move irq remapping mode enum
merge from AMD

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 12:19:01 +08:00
Xiaoming Gao fd8d092e2e Revert "iommu/amd: Support AMD platform with more than 255 CPU"
This reverts commit 7d65c03648b08c4a48fe8ce22fc1aadddcdf8f6f.
2020-01-02 12:18:52 +08:00
Zhiping du aee5a5fcc0 tcp: limit payload size of sacked skbs
[upstream commit 3b4929f65b0d8249f19a50245cd88ed1a2f78cff]

Jonathan Looney reported that TCP can trigger the following crash
in tcp_shifted_skb() :

	BUG_ON(tcp_skb_pcount(skb) < pcount);

This can happen if the remote peer has advertized the smallest
MSS that linux TCP accepts : 48

An skb can hold 17 fragments, and each fragment can hold 32KB
on x86, or 64KB on PowerPC.

This means that the 16bit witdh of TCP_SKB_CB(skb)->tcp_gso_segs
can overflow.

Note that tcp_sendmsg() builds skbs with less than 64KB
of payload, so this problem needs SACK to be enabled.
SACK blocks allow TCP to coalesce multiple skbs in the retransmit
queue, thus filling the 17 fragments to maximal capacity.

CVE-2019-11477 -- u16 overflow of TCP_SKB_CB(skb)->tcp_gso_segs

[upstream commit cd4ffa93f16efea290bb70537f98f518e1927e63]

tcp: fix fack_count accounting on
tcp_shift_skb_data()

v4.15 or since commit 737ff314563 ("tcp: use sequence distance to
detect reordering") had switched from the packet-based FACK tracking
to sequence-based.

v4.14 and older still have the old logic and hence on
tcp_skb_shift_data() needs to retain its original logic and have
@fack_count in sync. In other words, we keep the increment of pcount
with
tcp_skb_pcount(skb) to later used that to update fack_count. To make it
more explicit we track the new skb that gets incremented to pcount in
@next_pcount, and we get to avoid the constant invocation of
tcp_skb_pcount(skb) all together.

Fixes: a5f1faa40101 ("tcp: limit payload size of sacked skbs")

Fixes: 832d11c5cd07 ("tcp: Try to restore large SKBs while SACK processing")

Signed-off-by: Zhiping Du <zhipingdu@tencent.com>
2020-01-02 12:16:23 +08:00
Kaixu Xia de046697ad arm64: implement ftrace with regs by using patchable-function-entry
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 12:14:57 +08:00
Wenbin Zeng 4caf63c8ab auth_gss fix: rpcsec_gss_exit_net has no chance to run when use-gss-proxy==1
When use-gss-proxy is set to 1, write_gssp will lead to 2 get_net calls
in gssp_rpc_create, the paired put_net calls are supposed to be made
in rpcsec_gss_net_ops->exit i.e. rpcsec_gss_exit_net, but this will
never happen because rpcsec_gss_exit_net (via ops_exit_list) is called
by cleanup_net and cleanup_net will never run unless net->count becomes
0, since the paired put_net calls of gssp_rpc_create are not made yet,
net->count cannot drop to 0. This is dead lock situation.

This fix introduced a new method i.e. evict in struct proc_ns_operations,
which is called in nsfs_evict, moving rpcsec_gss_exit_net into the code
path of nsfs_evict gives it a chance to run.

Signed-off-by: Wenbin Zeng <wenbinzeng@tencent.com>
2020-01-02 12:13:47 +08:00
Shengmiao Liao 74913e31a6 iommu/amd: Support AMD platform with more than 255 CPU
x86: irq_remapping: Move irq remapping mode enum
iommu/amd: Add support for higher 64-bit IOMMU Control Register
iommu/amd: Add support for IOMMU XT mode

Signed-off-by: Shengmiao Liao <samuelliao@tencent.com>
2020-01-02 12:12:33 +08:00
Chunguang Xu e133d113ca pagecachelimit: page cache reclaim asynchronous
add /proc/sys/vm/vm_pagecache_limit_async interface which
allow page caches reclaimed in kpclimitd, it will not consume
work threads runtime, but oom may be occured. it's closed default.

Signed-off-by: Zhiping Du <zhipingdu@tencent.com>
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-01-02 12:02:39 +08:00
Chunguang Xu 6711b34671 pagecachelimit: limit the pagecache ratio of totalram
limit the pagecache ratio of totalram

Signed-off-by: Zhiping Du <zhipingdu@tencent.com>
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
2020-01-02 12:01:22 +08:00
Kaixu Xia 954836b8d1 mounts: add shield mountpoint in container support
Add shield mountpoint in container support
$ echo "set /dev/name /mnt/point" >/proc/tkernel/shield_mounts
to shield the mountpoint
$ echo "clear /dev/name /mnt/point" >/proc/tkernel/shield_mounts
to delete the mountpoint shielded

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Weiwei Li <nuonuoli@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2020-01-02 11:55:00 +08:00
Liu Hua ec970f2dff vm:isolate max_map_count by pid namespace
Signed-off-by: Zhiguang Peng <zgpeng@tencent.com>
Signed-off-by: Liu Hua <shookliu@tencent.com>
2020-01-02 11:51:53 +08:00
Liu Hua 8e8d690592 cpuset: add cpuinfo and stat show
We add cpuinfo and stat for each container which
used for docker to get cpu stat just for current
container.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Weiwei Li <nuonuoli@tencent.com>
Signed-off-by: Liu Hua <shookliu@tencent.com>
2020-01-02 11:46:17 +08:00
Xiaoming Gao 34bbe3bcb8 signal: add print_fatal_signals_src_dst sysctl to switch dump fatal signals from sender side
the print_fatal_signals sysctl can only dump fatal signals from receiver's side,
cannot find who and why send these fatal signals, so add a new sysctl
print_fatal_signals_src_dst to switch dump fatal signals from sender side.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 11:44:57 +08:00
Lorin Liu 3dd54ca17c proc: add pid mapping between host and container
create a pid mapping data to parent processes in file  /proc/$PID/status
create a proc file (/proc/$PID/hostinfo), mapping pid data to host pid

Signed-off-by: Lorin Liu <lorinliu@tencent.com>
2020-01-02 11:44:36 +08:00
Xiaoming Gao 78a8c3c2c2 Init Repo base on 4.14.105 long term, and add base tlinux kernel interfaces
Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
2020-01-02 10:51:04 +08:00