Kernel
  Threads by month 
                
            - ----- 2025 -----
 - November
 - October
 - September
 - August
 - July
 - June
 - 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
 
June 2021
- 31 participants
 - 112 discussions
 
                    
                        您好,我采用最细的openEuler-1.0测试perf spe-c2c的功能,但是发现/sys/devices下没有arm_spe_0这个目录
执行perf spe-c2c record时显示:
event syntax error: 'arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/'
                     \___ Cannot find PMU `arm_spe_0'. Missing kernel support?
想问下您这是为什么? 需要哪里开启spe功能吗?
                    
                  
                  
                          
                            
                            3
                            
                          
                          
                            
                            2
                            
                          
                          
                            
    
                          
                        
                    
                    
                        From: lisiheng <lisiheng(a)bingosoft.net>
PTP_KVM is used for high precision time sync between host and guests.
It relies on transferring the wall clock and counter value from the
host to the guest using a KVM-specific hypercall.
mainline inclusion
from mainline-v4.19
category: feature
bugzilla:https://gitee.com/openeuler/kernel/issues/I3R900
CVE: NA
Reference:
    https://www.kernel.org/doc/html/latest/_sources/virt/kvm/arm/ptp_kvm.rst.txt
    https://github.com/kata-containers/packaging/blob/master/kernel/patches/4.1…
Signed-off-by: lisiheng <lisiheng(a)bingosoft.net>
---
 drivers/clocksource/arm_arch_timer.c        | 24 ++++++
 drivers/ptp/Kconfig                         |  2 +-
 drivers/ptp/Makefile                        |  1 +
 drivers/ptp/ptp_kvm_arm64.c                 | 52 ++++++++++++
 drivers/ptp/{ptp_kvm.c => ptp_kvm_common.c} | 89 +++++----------------
 drivers/ptp/ptp_kvm_x86.c                   | 87 ++++++++++++++++++++
 fs/jbd2/transaction.c                       | 17 ----
 include/asm-generic/ptp_kvm.h               | 12 +++
 include/linux/arm-smccc.h                   |  5 ++
 virt/kvm/arm/hypercalls.c                   | 14 ++++
 10 files changed, 216 insertions(+), 87 deletions(-)
 create mode 100644 drivers/ptp/ptp_kvm_arm64.c
 rename drivers/ptp/{ptp_kvm.c => ptp_kvm_common.c} (55%)
 create mode 100644 drivers/ptp/ptp_kvm_x86.c
 create mode 100644 include/asm-generic/ptp_kvm.h
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 6847a5fe13fd..f84bed34e9ea 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1653,3 +1653,27 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 }
 TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init);
 #endif
+
+#if IS_ENABLED(CONFIG_PTP_1588_CLOCK_KVM)
+#include <linux/arm-smccc.h>
+int kvm_arch_ptp_get_clock_fn(long *cycle, struct timespec64 *ts,
+					struct clocksource **cs)
+{
+	struct arm_smccc_res hvc_res;
+
+	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
+			&hvc_res);
+
+	if ((long)(hvc_res.a0) < 0)
+		return -EOPNOTSUPP;
+
+	ts->tv_sec = hvc_res.a0;
+	ts->tv_nsec = hvc_res.a1;
+	*cycle = hvc_res.a2 << 32 | hvc_res.a3;
+	*cs = &clocksource_counter;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(kvm_arch_ptp_get_clock_fn);
+#endif
+
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index d137c480db46..318b3f5df1ea 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -109,7 +109,7 @@ config PTP_1588_CLOCK_PCH
 config PTP_1588_CLOCK_KVM
 	tristate "KVM virtual PTP clock"
 	depends on PTP_1588_CLOCK
-	depends on KVM_GUEST && X86
+	depends on KVM_GUEST && X86 || ARM64
 	default y
 	help
 	  This driver adds support for using kvm infrastructure as a PTP
diff --git a/drivers/ptp/Makefile b/drivers/ptp/Makefile
index 19efa9cfa950..1bf4940a88a6 100644
--- a/drivers/ptp/Makefile
+++ b/drivers/ptp/Makefile
@@ -4,6 +4,7 @@
 #
 
 ptp-y					:= ptp_clock.o ptp_chardev.o ptp_sysfs.o
+ptp_kvm-y				:= ptp_kvm_common.o ptp_kvm_$(ARCH).o
 obj-$(CONFIG_PTP_1588_CLOCK)		+= ptp.o
 obj-$(CONFIG_PTP_1588_CLOCK_DTE)	+= ptp_dte.o
 obj-$(CONFIG_PTP_1588_CLOCK_IXP46X)	+= ptp_ixp46x.o
diff --git a/drivers/ptp/ptp_kvm_arm64.c b/drivers/ptp/ptp_kvm_arm64.c
new file mode 100644
index 000000000000..07ee2fc2c7b1
--- /dev/null
+++ b/drivers/ptp/ptp_kvm_arm64.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ *  Virtual PTP 1588 clock for use with KVM guests
+ *  Copyright (C) 2019 ARM Ltd.
+ *  All Rights Reserved
+ */
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <asm/hypervisor.h>
+#include <linux/module.h>
+#include <linux/psci.h>
+#include <linux/arm-smccc.h>
+#include <linux/timecounter.h>
+#include <linux/sched/clock.h>
+#include <asm/arch_timer.h>
+
+
+int kvm_arch_ptp_init(void)
+{
+	struct arm_smccc_res hvc_res;
+
+	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
+					&hvc_res);
+	if ((long)(hvc_res.a0) < 0)
+		return -EOPNOTSUPP;
+
+	return 0;
+}
+
+int kvm_arch_ptp_get_clock_generic(struct timespec64 *ts,
+				   struct arm_smccc_res *hvc_res)
+{
+	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
+					hvc_res);
+	if ((long)(hvc_res->a0) < 0)
+		return -EOPNOTSUPP;
+
+	ts->tv_sec = hvc_res->a0;
+	ts->tv_nsec = hvc_res->a1;
+
+	return 0;
+}
+
+int kvm_arch_ptp_get_clock(struct timespec64 *ts)
+{
+	struct arm_smccc_res hvc_res;
+
+	kvm_arch_ptp_get_clock_generic(ts, &hvc_res);
+
+	return 0;
+}
diff --git a/drivers/ptp/ptp_kvm.c b/drivers/ptp/ptp_kvm_common.c
similarity index 55%
rename from drivers/ptp/ptp_kvm.c
rename to drivers/ptp/ptp_kvm_common.c
index c67dd11e08b1..69a7cd05d188 100644
--- a/drivers/ptp/ptp_kvm.c
+++ b/drivers/ptp/ptp_kvm_common.c
@@ -1,29 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Virtual PTP 1588 clock for use with KVM guests
  *
  * Copyright (C) 2017 Red Hat Inc.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
  */
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <uapi/linux/kvm_para.h>
 #include <asm/kvm_para.h>
-#include <asm/pvclock.h>
-#include <asm/kvmclock.h>
-#include <uapi/asm/kvm_para.h>
+#include <asm-generic/ptp_kvm.h>
 
 #include <linux/ptp_clock_kernel.h>
 
@@ -34,56 +24,31 @@ struct kvm_ptp_clock {
 
 DEFINE_SPINLOCK(kvm_ptp_lock);
 
-static struct pvclock_vsyscall_time_info *hv_clock;
-
-static struct kvm_clock_pairing clock_pair;
-static phys_addr_t clock_pair_gpa;
 
 static int ptp_kvm_get_time_fn(ktime_t *device_time,
 			       struct system_counterval_t *system_counter,
 			       void *ctx)
 {
-	unsigned long ret;
+	unsigned long ret, cycle;
 	struct timespec64 tspec;
-	unsigned version;
-	int cpu;
-	struct pvclock_vcpu_time_info *src;
+	struct clocksource *cs;
 
 	spin_lock(&kvm_ptp_lock);
 
 	preempt_disable_notrace();
-	cpu = smp_processor_id();
-	src = &hv_clock[cpu].pvti;
-
-	do {
-		/*
-		 * We are using a TSC value read in the hosts
-		 * kvm_hc_clock_pairing handling.
-		 * So any changes to tsc_to_system_mul
-		 * and tsc_shift or any other pvclock
-		 * data invalidate that measurement.
-		 */
-		version = pvclock_read_begin(src);
-
-		ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING,
-				     clock_pair_gpa,
-				     KVM_CLOCK_PAIRING_WALLCLOCK);
-		if (ret != 0) {
-			pr_err_ratelimited("clock pairing hypercall ret %lu\n", ret);
-			spin_unlock(&kvm_ptp_lock);
-			preempt_enable_notrace();
-			return -EOPNOTSUPP;
-		}
-
-		tspec.tv_sec = clock_pair.sec;
-		tspec.tv_nsec = clock_pair.nsec;
-		ret = __pvclock_read_cycles(src, clock_pair.tsc);
-	} while (pvclock_read_retry(src, version));
+
+	ret = kvm_arch_ptp_get_clock_fn(&cycle, &tspec, &cs);
+	if (ret != 0) {
+		pr_err_ratelimited("clock pairing hypercall ret %lu\n", ret);
+		spin_unlock(&kvm_ptp_lock);
+		preempt_enable_notrace();
+		return -EOPNOTSUPP;
+	}
 
 	preempt_enable_notrace();
 
-	system_counter->cycles = ret;
-	system_counter->cs = &kvm_clock;
+	system_counter->cycles = cycle;
+	system_counter->cs = cs;
 
 	*device_time = timespec64_to_ktime(tspec);
 
@@ -126,17 +91,13 @@ static int ptp_kvm_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
 
 	spin_lock(&kvm_ptp_lock);
 
-	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING,
-			     clock_pair_gpa,
-			     KVM_CLOCK_PAIRING_WALLCLOCK);
+	ret = kvm_arch_ptp_get_clock(&tspec);
 	if (ret != 0) {
 		pr_err_ratelimited("clock offset hypercall ret %lu\n", ret);
 		spin_unlock(&kvm_ptp_lock);
 		return -EOPNOTSUPP;
 	}
 
-	tspec.tv_sec = clock_pair.sec;
-	tspec.tv_nsec = clock_pair.nsec;
 	spin_unlock(&kvm_ptp_lock);
 
 	memcpy(ts, &tspec, sizeof(struct timespec64));
@@ -176,22 +137,12 @@ static void __exit ptp_kvm_exit(void)
 
 static int __init ptp_kvm_init(void)
 {
-	long ret;
-
-	if (!kvm_para_available())
-		return -ENODEV;
 
-	clock_pair_gpa = slow_virt_to_phys(&clock_pair);
-	hv_clock = pvclock_get_pvti_cpu0_va();
-
-	if (!hv_clock)
-		return -ENODEV;
-
-	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
-			KVM_CLOCK_PAIRING_WALLCLOCK);
-	if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)
-		return -ENODEV;
+	int ret;
 
+	ret = kvm_arch_ptp_init();
+	if (ret)
+		return -EOPNOTSUPP;
 	kvm_ptp_clock.caps = ptp_kvm_caps;
 
 	kvm_ptp_clock.ptp_clock = ptp_clock_register(&kvm_ptp_clock.caps, NULL);
diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c
new file mode 100644
index 000000000000..a52cf1c2990c
--- /dev/null
+++ b/drivers/ptp/ptp_kvm_x86.c
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Virtual PTP 1588 clock for use with KVM guests
+ *
+ * Copyright (C) 2017 Red Hat Inc.
+ */
+
+#include <asm/pvclock.h>
+#include <asm/kvmclock.h>
+#include <linux/module.h>
+#include <uapi/asm/kvm_para.h>
+#include <uapi/linux/kvm_para.h>
+#include <linux/ptp_clock_kernel.h>
+
+phys_addr_t clock_pair_gpa;
+struct kvm_clock_pairing clock_pair;
+struct pvclock_vsyscall_time_info *hv_clock;
+
+int kvm_arch_ptp_init(void)
+{
+	int ret;
+
+	if (!kvm_para_available())
+		return -ENODEV;
+
+	clock_pair_gpa = slow_virt_to_phys(&clock_pair);
+	hv_clock = pvclock_get_pvti_cpu0_va();
+	if (!hv_clock)
+		return -ENODEV;
+
+	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
+			     KVM_CLOCK_PAIRING_WALLCLOCK);
+	if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)
+		return -ENODEV;
+
+	return 0;
+}
+
+int kvm_arch_ptp_get_clock(struct timespec64 *ts)
+{
+	long ret;
+
+	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING,
+			     clock_pair_gpa,
+			     KVM_CLOCK_PAIRING_WALLCLOCK);
+	if (ret != 0)
+		return -EOPNOTSUPP;
+
+	ts->tv_sec = clock_pair.sec;
+	ts->tv_nsec = clock_pair.nsec;
+
+	return 0;
+}
+
+int kvm_arch_ptp_get_clock_fn(unsigned long *cycle, struct timespec64 *tspec,
+			      struct clocksource **cs)
+{
+	unsigned long ret;
+	unsigned int version;
+	int cpu;
+	struct pvclock_vcpu_time_info *src;
+
+	cpu = smp_processor_id();
+	src = &hv_clock[cpu].pvti;
+
+	do {
+		/*
+		 * We are using a TSC value read in the hosts
+		 * kvm_hc_clock_pairing handling.
+		 * So any changes to tsc_to_system_mul
+		 * and tsc_shift or any other pvclock
+		 * data invalidate that measurement.
+		 */
+		version = pvclock_read_begin(src);
+
+		ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING,
+				     clock_pair_gpa,
+				     KVM_CLOCK_PAIRING_WALLCLOCK);
+		tspec->tv_sec = clock_pair.sec;
+		tspec->tv_nsec = clock_pair.nsec;
+		*cycle = __pvclock_read_cycles(src, clock_pair.tsc);
+	} while (pvclock_read_retry(src, version));
+
+	*cs = &kvm_clock;
+
+	return 0;
+}
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index ffa6d3530f4b..4055929a043c 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -2085,7 +2085,6 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
 {
 	struct buffer_head *head;
 	struct buffer_head *bh;
-	bool has_write_io_error = false;
 	int ret = 0;
 
 	J_ASSERT(PageLocked(page));
@@ -2110,26 +2109,10 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
 		jbd_unlock_bh_state(bh);
 		if (buffer_jbd(bh))
 			goto busy;
-
-		/*
-		 * If we free a metadata buffer which has been failed to
-		 * write out, the jbd2 checkpoint procedure will not detect
-		 * this failure and may lead to filesystem inconsistency
-		 * after cleanup journal tail.
-		 */
-		if (buffer_write_io_error(bh)) {
-			pr_err("JBD2: Error while async write back metadata bh %llu.",
-			       (unsigned long long)bh->b_blocknr);
-			has_write_io_error = true;
-		}
 	} while ((bh = bh->b_this_page) != head);
 
 	ret = try_to_free_buffers(page);
-
 busy:
-	if (has_write_io_error)
-		jbd2_journal_abort(journal, -EIO);
-
 	return ret;
 }
 
diff --git a/include/asm-generic/ptp_kvm.h b/include/asm-generic/ptp_kvm.h
new file mode 100644
index 000000000000..d87a08495710
--- /dev/null
+++ b/include/asm-generic/ptp_kvm.h
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ *  linux/drivers/clocksource/arm_arch_timer.c
+ *
+ *  Copyright (C) 2019 ARM Ltd.
+ *  All Rights Reserved
+ */
+
+int kvm_arch_ptp_init(void);
+int kvm_arch_ptp_get_clock(struct timespec64 *ts);
+int kvm_arch_ptp_get_clock_fn(unsigned long *cycle,
+		struct timespec64 *tspec, void *cs);
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index 5b5f52ca6ac8..5a46bb6df894 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -76,6 +76,11 @@
 			   ARM_SMCCC_SMC_32,				\
 			   0, 1)
 
+#define ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID                            \
+	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
+			   ARM_SMCCC_SMC_32,                            \
+			   0, 2)
+
 #define ARM_SMCCC_ARCH_WORKAROUND_1					\
 	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,				\
 			   ARM_SMCCC_SMC_32,				\
diff --git a/virt/kvm/arm/hypercalls.c b/virt/kvm/arm/hypercalls.c
index 7a6c5f18dff2..495b25b9ed13 100644
--- a/virt/kvm/arm/hypercalls.c
+++ b/virt/kvm/arm/hypercalls.c
@@ -15,6 +15,9 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
 	u32 val = SMCCC_RET_NOT_SUPPORTED;
 	u32 feature;
 	gpa_t gpa;
+	struct timespec64 ts;
+	u64 cycles, cycle_high, cycle_low;
+	struct system_time_snapshot systime_snapshot;
 
 	switch (func_id) {
 	case ARM_SMCCC_VERSION_FUNC_ID:
@@ -63,6 +66,17 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
 	case ARM_SMCCC_HV_PV_SCHED_KICK_CPU:
 		val = kvm_pvsched_kick_vcpu(vcpu);
 		break;
+
+	case ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID:
+		ktime_get_real_ts64(&ts);
+		ktime_get_snapshot(&systime_snapshot);
+		cycles = systime_snapshot.cycles - vcpu_vtimer(vcpu)->cntvoff;
+		cycle_high = cycles >> 32;
+		cycle_low = cycles << 32 >> 32;
+
+		smccc_set_retval(vcpu, ts.tv_sec, ts.tv_nsec, cycle_high, cycle_low);
+		return 1;
+
 	default:
 		return kvm_psci_call(vcpu);
 	}
-- 
2.23.0
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            4
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [PATCH kernel-4.19] share_pool: Fix memleak of concurrent sp_free and sp_group_add_task
                        
                        
by Yang Yingliang 30 Jun '21
                    by Yang Yingliang 30 Jun '21
30 Jun '21
                    
                        From: Tang Yizhou <tangyizhou(a)huawei.com>
ascend inclusion
category: bugfix
bugzilla: NA
CVE: NA
-------------------------------------------------
We found a concurrency problem of sp_group_add_task and sp_free which
lead to memory leak.
After process A calls __sp_free and vfs_fallocate but before calling
__sp_area_drop, process B is being added to the same group by a manager
process, the *dead* spa freed by sp_free may be mapped into process B
again, then do_mm_populate is called.
When sp_group_add_task is finished, this spa is dropped and can't be
seen in /proc/sharepool/spa_stat, but the memory of spa still reside in
the group. It can only be freed when the group is dead.
To fix the problem, we add a member is_dead in spa. We can access it
when spg->rw_lock is held. This may sound a little strange if not
realizing the life cycle of spa has a direct relation with sp group.
Suggested-by: Ding Tianhong <dingtianhong(a)huawei.com>
Signed-off-by: Tang Yizhou <tangyizhou(a)huawei.com>
Reviewed-by: Ding Tianhong <dingtianhong(a)huwei.com>
Reviewed-by: 为珑 陈 <chenweilong(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 mm/share_pool.c | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/mm/share_pool.c b/mm/share_pool.c
index 61bbbd772c847..3e4e05f20c5ce 100644
--- a/mm/share_pool.c
+++ b/mm/share_pool.c
@@ -233,6 +233,7 @@ struct sp_area {
 	unsigned long region_vstart;	/* belong to normal region or DVPP region */
 	unsigned long flags;
 	bool is_hugepage;
+	bool is_dead;
 	atomic_t use_count;		/* How many vmas use this VA region */
 	struct rb_node rb_node;		/* address sorted rbtree */
 	struct list_head link;		/* link to the spg->head */
@@ -736,6 +737,10 @@ int sp_group_add_task(int pid, int spg_id)
 		prev = spa;
 
 		atomic_inc(&spa->use_count);
+
+		if (spa->is_dead == true)
+			continue;
+
 		spin_unlock(&sp_area_lock);
 
 		if (spa->type == SPA_TYPE_K2SPG && spa->kva) {
@@ -970,6 +975,7 @@ static struct sp_area *sp_alloc_area(unsigned long size, unsigned long flags,
 	spa->region_vstart = vstart;
 	spa->flags = flags;
 	spa->is_hugepage = (flags & SP_HUGEPAGE);
+	spa->is_dead = false;
 	spa->spg = spg;
 	atomic_set(&spa->use_count, 1);
 	spa->type = type;
@@ -1271,10 +1277,14 @@ int sp_free(unsigned long addr)
 		goto drop_spa;
 	}
 
-	if (!spg_valid(spa->spg))
+	down_write(&spa->spg->rw_lock);
+	if (!spg_valid(spa->spg)) {
+		up_write(&spa->spg->rw_lock);
 		goto drop_spa;
-
-	sp_dump_stack();
+	}
+	/* the life cycle of spa has a direct relation with sp group */
+	spa->is_dead = true;
+	up_write(&spa->spg->rw_lock);
 
 	down_read(&spa->spg->rw_lock);
 
@@ -1303,6 +1313,7 @@ int sp_free(unsigned long addr)
 drop_spa:
 	__sp_area_drop(spa);
 out:
+	sp_dump_stack();
 	sp_try_to_compact();
 	return ret;
 }
@@ -2362,15 +2373,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp
 			goto out_drop_area;
 		}
 
-		down_read(&spa->spg->rw_lock);
-		if (!spg_valid(spa->spg)) {
-			up_read(&spa->spg->rw_lock);
-			pr_info_ratelimited("share pool: no need to unshare uva(to group), "
-					    "sp group of spa is dead\n");
-			goto out_clr_flag;
-		}
-		up_read(&spa->spg->rw_lock);
-
 		/* alway allow kthread and dvpp channel destroy procedure */
 		if (current->mm && current->mm->sp_group != spa->spg) {
 			pr_err_ratelimited("share pool: unshare uva(to group) failed, "
@@ -2379,6 +2381,17 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp
 			goto out_drop_area;
 		}
 
+		down_write(&spa->spg->rw_lock);
+		if (!spg_valid(spa->spg)) {
+			up_write(&spa->spg->rw_lock);
+			pr_info_ratelimited("share pool: no need to unshare uva(to group), "
+					    "sp group of spa is dead\n");
+			goto out_clr_flag;
+		}
+		/* the life cycle of spa has a direct relation with sp group */
+		spa->is_dead = true;
+		up_write(&spa->spg->rw_lock);
+
 		down_read(&spa->spg->rw_lock);
 		__sp_free(spa->spg, uva_aligned, size_aligned, NULL);
 		up_read(&spa->spg->rw_lock);
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [PATCH kernel-4.19 01/23] net: hns3: configure promisc mode for VF asynchronously
                        
                        
by Yang Yingliang 30 Jun '21
                    by Yang Yingliang 30 Jun '21
30 Jun '21
                    
                        From: Jian Shen <shenjian15(a)huawei.com>
driver inclusion
category: bugfix
bugzilla: NA
CVE: NA
----------------------------
Currently, when host set VF untrusted, the driver will disable
the promisc mode of VF. It may be conflicted when the VF requests
the host to set promisc mode. So fix it by change promisc mode
for VF asynchronously. With this change, the promisc mode of VF
can be restored when the VF being trusted again.
Fixes: 5c1f0ff21058 ("net: hns3: add support for setting VF trust")
Signed-off-by: Jian Shen <shenjian15(a)huawei.com>
Signed-off-by: Yonglong Liu <liuyonglong(a)huawei.com>
Reviewed-by: li yongxin <liyongxin1(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 .../hisilicon/hns3/hns3pf/hclge_main.c        | 42 +++++++++++++------
 .../hisilicon/hns3/hns3pf/hclge_main.h        |  6 ++-
 .../hisilicon/hns3/hns3pf/hclge_mbx.c         | 40 ++++--------------
 3 files changed, 42 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index f3d728aa54bf3..23273f08ab50f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -10639,8 +10639,6 @@ static int hclge_set_vf_trust(struct hnae3_handle *handle, int vf, bool enable)
 	struct hclge_vport *vport = hclge_get_vport(handle);
 	struct hclge_dev *hdev = vport->back;
 	u32 new_trusted = enable ? 1 : 0;
-	bool en_bc_pmc;
-	int ret;
 
 	vport = hclge_get_vf_vport(hdev, vf);
 	if (!vport)
@@ -10649,19 +10647,11 @@ static int hclge_set_vf_trust(struct hnae3_handle *handle, int vf, bool enable)
 	if (vport->vf_info.trusted == new_trusted)
 		return 0;
 
-	/* Disable promisc mode for VF if it is not trusted any more. */
-	if (!enable && vport->vf_info.promisc_enable) {
-		en_bc_pmc = hdev->pdev->revision != 0x20;
-		ret = hclge_set_vport_promisc_mode(vport, false, false,
-						   en_bc_pmc);
-		if (ret)
-			return ret;
-		vport->vf_info.promisc_enable = 0;
-		hclge_inform_vf_promisc_info(vport);
-	}
-
 	vport->vf_info.trusted = new_trusted;
 
+	set_bit(HCLGE_VPORT_STATE_PROMISC_CHANGE, &vport->state);
+	hclge_task_schedule(hdev, 0);
+
 	return 0;
 }
 
@@ -11535,6 +11525,7 @@ static void hclge_sync_promisc_mode(struct hclge_dev *hdev)
 	u8 tmp_flags = 0;
 	bool vlan_en;
 	int ret;
+	int i;
 
 	if (vport->last_promisc_flags != vport->overflow_promisc_flags) {
 		set_bit(HCLGE_STATE_PROMISC_CHANGED, &hdev->state);
@@ -11555,6 +11546,31 @@ static void hclge_sync_promisc_mode(struct hclge_dev *hdev)
 			hclge_enable_vlan_filter(handle, vlan_en);
 		}
 	}
+
+	for (i = 1; i < hdev->num_alloc_vport; i++) {
+		bool uc_en = false;
+		bool mc_en = false;
+		bool bc_en;
+
+		vport = &hdev->vport[i];
+
+		if (!test_and_clear_bit(HCLGE_VPORT_STATE_PROMISC_CHANGE,
+					&vport->state))
+			continue;
+
+		if (vport->vf_info.trusted) {
+			uc_en = vport->vf_info.request_uc_en > 0;
+			mc_en = vport->vf_info.request_mc_en > 0;
+		}
+		bc_en = vport->vf_info.request_bc_en > 0;
+
+		ret = hclge_set_vport_promisc_mode(vport, uc_en, mc_en, bc_en);
+		if (ret) {
+			set_bit(HCLGE_VPORT_STATE_PROMISC_CHANGE,
+				&vport->state);
+			return;
+		}
+	}
 }
 
 static bool hclge_module_existed(struct hclge_dev *hdev)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index 8e7dff25cbfd5..4a664801fbe92 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -904,6 +904,7 @@ struct hclge_rss_tuple_cfg {
 enum HCLGE_VPORT_STATE {
 	HCLGE_VPORT_STATE_ALIVE,
 	HCLGE_VPORT_STATE_MAC_TBL_CHANGE,
+	HCLGE_VPORT_STATE_PROMISC_CHANGE,
 	HCLGE_VPORT_STATE_MAX
 };
 
@@ -926,7 +927,9 @@ struct hclge_vf_info {
 	u32 spoofchk;
 	u32 max_tx_rate;
 	u32 trusted;
-	u16 promisc_enable;
+	u8 request_uc_en;
+	u8 request_mc_en;
+	u8 request_bc_en;
 };
 
 struct hclge_vport {
@@ -1051,7 +1054,6 @@ int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev,
 				struct hclge_desc *desc);
 void hclge_report_hw_error(struct hclge_dev *hdev,
 			   enum hnae3_hw_error_type type);
-void hclge_inform_vf_promisc_info(struct hclge_vport *vport);
 void hclge_dbg_dump_rst_info(struct hclge_dev *hdev);
 bool hclge_vf_vlan_need_enable(struct hclge_vport *vport);
 int hclge_push_vf_link_status(struct hclge_vport *vport);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index e998322d59aae..d2bfa5f7f22f1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -321,35 +321,17 @@ static int hclge_get_vf_ring_vector_map(struct hclge_vport *vport,
 	return ret;
 }
 
-static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
-				     struct hclge_mbx_vf_to_pf_cmd *req)
+static void hclge_set_vf_promisc_mode(struct hclge_vport *vport,
+				      struct hclge_mbx_vf_to_pf_cmd *req)
 {
-	bool en_bc = req->msg.en_bc ? true : false;
-	bool en_uc = req->msg.en_uc ? true : false;
-	bool en_mc = req->msg.en_mc ? true : false;
-	int ret;
-
-	if (!vport->vf_info.trusted) {
-		en_uc = false;
-		en_mc = false;
-	}
-
-	ret = hclge_set_vport_promisc_mode(vport, en_uc, en_mc, en_bc);
-
-	vport->vf_info.promisc_enable = (en_uc || en_mc) ? 1 : 0;
-
-	return ret;
-}
-
-void hclge_inform_vf_promisc_info(struct hclge_vport *vport)
-{
-	u8 dest_vfid = (u8)vport->vport_id;
-	u8 msg_data[2];
+	struct hclge_dev *hdev = vport->back;
 
-	memcpy(&msg_data[0], &vport->vf_info.promisc_enable, sizeof(u16));
+	vport->vf_info.request_uc_en = req->msg.en_uc;
+	vport->vf_info.request_mc_en = req->msg.en_mc;
+	vport->vf_info.request_bc_en = req->msg.en_bc;
 
-	hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
-			   HCLGE_MBX_PUSH_PROMISC_INFO, dest_vfid);
+	set_bit(HCLGE_VPORT_STATE_PROMISC_CHANGE, &vport->state);
+	hclge_task_schedule(hdev, 0);
 }
 
 static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport,
@@ -837,11 +819,7 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
 					ret);
 			break;
 		case HCLGE_MBX_SET_PROMISC_MODE:
-			ret = hclge_set_vf_promisc_mode(vport, req);
-			if (ret)
-				dev_err(&hdev->pdev->dev,
-					"PF fail(%d) to set VF promisc mode\n",
-					ret);
+			hclge_set_vf_promisc_mode(vport, req);
 			break;
 		case HCLGE_MBX_SET_UNICAST:
 			ret = hclge_set_vf_uc_mac_addr(vport, req);
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            22
                            
                          
                          
                            
    
                          
                        
                    
                    
                        hulk inclusion
category: other
bugzilla: NA
CVE: NA
---------------------------
It's from https://gitee.com/src-openeuler/kernel/blob/openEuler-20.03-LTS-SP2/kabi_wh…
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Reviewed-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 kabi/2019-V1/kabi-list.arm64 | 718 ++++++++++++++++++++++++++++++++++-
 1 file changed, 713 insertions(+), 5 deletions(-)
diff --git a/kabi/2019-V1/kabi-list.arm64 b/kabi/2019-V1/kabi-list.arm64
index af8f6a3085356..e9617085311e4 100644
--- a/kabi/2019-V1/kabi-list.arm64
+++ b/kabi/2019-V1/kabi-list.arm64
@@ -1,13 +1,32 @@
 # kabi compatibility list for arm64
+acpi_bus_get_device
+acpi_check_dsm
 acpi_dev_found
+acpi_disabled
+acpi_dma_configure
 acpi_evaluate_dsm
 acpi_evaluate_object
+acpi_format_exception
+acpi_gbl_FADT
+acpi_get_devices
+acpi_get_handle
+acpi_get_name
+acpi_get_table
+acpi_gsi_to_irq
+acpi_handle_printk
+acpi_has_method
+acpi_lid_open
 acpi_match_device
 __acpi_node_get_property_reference
+acpi_os_map_memory
 acpi_os_unmap_generic_address
+acpi_os_unmap_memory
+acpi_register_gsi
+acpi_unregister_gsi
 add_timer
 add_wait_queue
 add_wait_queue_exclusive
+admin_timeout
 alloc_chrdev_region
 alloc_cpu_rmap
 __alloc_disk_node
@@ -23,51 +42,73 @@ anon_inode_getfd
 apei_hest_parse
 apei_map_generic_address
 apei_read
+__arch_clear_user
 __arch_copy_from_user
+__arch_copy_in_user
 __arch_copy_to_user
+arch_timer_read_counter
+arch_wb_cache_pmem
 arm64_const_caps_ready
 arp_tbl
 async_schedule
 ata_link_next
 ata_tf_to_fis
 _atomic_dec_and_lock
+atomic_notifier_call_chain
 atomic_notifier_chain_register
 atomic_notifier_chain_unregister
 attribute_container_find_class_device
 autoremove_wake_function
+backlight_device_register
+backlight_device_unregister
+backlight_force_update
 bdevname
+bdev_read_only
 bdget_disk
+_bin2bcd
 bin2hex
 bio_add_page
 bio_alloc_bioset
 bio_chain
+bio_clone_fast
 bio_devname
 bio_endio
+bio_free_pages
 bio_init
 bio_integrity_add_page
 bio_integrity_alloc
 bio_put
+bioset_exit
+bioset_init
 __bitmap_and
 __bitmap_andnot
 __bitmap_clear
+__bitmap_complement
 __bitmap_equal
 bitmap_find_free_region
 bitmap_find_next_zero_area_off
 bitmap_free
 __bitmap_intersects
+__bitmap_or
 __bitmap_parse
+bitmap_parselist
 bitmap_print_to_pagebuf
 bitmap_release_region
 __bitmap_set
 __bitmap_weight
+__bitmap_xor
 bitmap_zalloc
 bit_wait
 blk_alloc_queue
+blk_check_plugged
 blk_cleanup_queue
 blkdev_get_by_path
 __blkdev_issue_discard
+blkdev_issue_discard
 blkdev_issue_flush
+blkdev_issue_write_same
 __blkdev_issue_zeroout
+blkdev_issue_zeroout
 blkdev_put
 blk_execute_rq
 blk_execute_rq_nowait
@@ -93,6 +134,7 @@ blk_mq_pci_map_queues
 blk_mq_quiesce_queue
 blk_mq_rdma_map_queues
 blk_mq_requeue_request
+blk_mq_run_hw_queues
 blk_mq_start_request
 blk_mq_tagset_busy_iter
 blk_mq_tag_to_rq
@@ -102,8 +144,10 @@ blk_mq_unquiesce_queue
 blk_mq_update_nr_hw_queues
 blk_poll
 blk_put_queue
+blk_put_request
 blk_queue_bounce_limit
 blk_queue_chunk_sectors
+blk_queue_dma_alignment
 blk_queue_flag_clear
 blk_queue_flag_set
 blk_queue_flag_test_and_set
@@ -116,21 +160,29 @@ blk_queue_max_discard_segments
 blk_queue_max_hw_sectors
 blk_queue_max_segments
 blk_queue_max_segment_size
+blk_queue_max_write_same_sectors
 blk_queue_max_write_zeroes_sectors
 blk_queue_physical_block_size
+blk_queue_rq_timeout
 blk_queue_segment_boundary
+blk_queue_split
+blk_queue_stack_limits
 blk_queue_update_dma_alignment
 blk_queue_virt_boundary
 blk_queue_write_cache
+blk_rq_append_bio
 blk_rq_count_integrity_sg
 blk_rq_map_integrity_sg
 blk_rq_map_kern
 blk_rq_map_sg
 blk_rq_map_user
+blk_rq_map_user_iov
 blk_rq_unmap_user
 blk_set_queue_dying
+blk_set_stacking_limits
 blk_start_plug
 blk_status_to_errno
+blk_verify_command
 blocking_notifier_call_chain
 blocking_notifier_chain_register
 blocking_notifier_chain_unregister
@@ -140,6 +192,7 @@ bpf_prog_put
 bpf_prog_sub
 bpf_trace_run1
 bpf_trace_run2
+bpf_trace_run3
 bpf_trace_run5
 bpf_warn_invalid_xdp_action
 bsg_job_done
@@ -155,8 +208,10 @@ btree_remove
 btree_update
 build_skb
 bus_find_device
+cache_line_size
 call_netdevice_notifiers
 call_rcu_sched
+call_srcu
 call_usermodehelper
 cancel_delayed_work
 cancel_delayed_work_sync
@@ -168,6 +223,8 @@ cdev_device_add
 cdev_device_del
 cdev_init
 cgroup_attach_task_all
+__chash_table_copy_in
+__chash_table_copy_out
 __check_object_size
 __class_create
 class_destroy
@@ -184,13 +241,20 @@ clk_unprepare
 clk_unregister
 __close_fd
 commit_creds
+compat_alloc_user_space
 complete
+complete_all
 complete_and_exit
+completion_done
+component_add
+component_del
 _cond_resched
 configfs_register_subsystem
 configfs_unregister_subsystem
 config_group_init
 config_group_init_type_name
+console_lock
+console_unlock
 __const_udelay
 consume_skb
 _copy_from_iter
@@ -217,11 +281,15 @@ cpus_read_unlock
 crc32c
 __crc32c_le_shift
 crc32_le
+crc8
+crc8_populate_msb
+crc_t10dif
 crypto_ahash_digest
 crypto_ahash_final
 crypto_ahash_setkey
 crypto_alloc_ahash
 crypto_alloc_akcipher
+crypto_alloc_shash
 crypto_destroy_tfm
 crypto_inc
 __crypto_memneq
@@ -230,6 +298,8 @@ crypto_register_alg
 crypto_register_kpp
 crypto_register_shash
 crypto_register_skciphers
+crypto_shash_final
+crypto_shash_update
 crypto_unregister_akcipher
 crypto_unregister_alg
 crypto_unregister_kpp
@@ -243,16 +313,23 @@ dcb_getapp
 dcb_ieee_delapp
 dcb_ieee_getapp_mask
 dcb_ieee_setapp
+dcbnl_cee_notify
 dcb_setapp
+debugfs_create_atomic_t
 debugfs_create_dir
 debugfs_create_file
 debugfs_create_regset32
+debugfs_create_symlink
+debugfs_create_u16
+debugfs_create_u32
 debugfs_create_u64
 debugfs_create_u8
 debugfs_initialized
+debugfs_lookup
 debugfs_remove
-debugfs_remove_recursive
+default_llseek
 default_wake_function
+__delay
 delayed_work_timer_fn
 del_gendisk
 del_timer
@@ -263,6 +340,7 @@ dev_addr_add
 dev_addr_del
 dev_alloc_name
 dev_attr_phy_event_threshold
+dev_base_lock
 dev_change_flags
 dev_close
 dev_disable_lro
@@ -275,6 +353,7 @@ dev_get_by_index_rcu
 __dev_get_by_name
 dev_get_by_name
 dev_get_flags
+dev_get_iflink
 dev_get_stats
 device_add
 device_add_disk
@@ -287,6 +366,7 @@ device_for_each_child
 device_get_mac_address
 device_get_next_child_node
 device_initialize
+device_link_add
 device_property_present
 device_property_read_string
 device_property_read_string_array
@@ -297,6 +377,7 @@ device_release_driver
 device_remove_file
 device_remove_file_self
 device_reprobe
+device_set_wakeup_capable
 device_set_wakeup_enable
 device_unregister
 _dev_info
@@ -309,9 +390,11 @@ devlink_param_driverinit_value_set
 devlink_params_register
 devlink_params_unregister
 devlink_param_value_changed
+devlink_port_attrs_set
 devlink_port_register
 devlink_port_type_clear
 devlink_port_type_eth_set
+devlink_port_type_ib_set
 devlink_port_unregister
 devlink_region_create
 devlink_region_destroy
@@ -319,6 +402,9 @@ devlink_region_shapshot_id_get
 devlink_region_snapshot_create
 devlink_register
 devlink_unregister
+dev_mc_add
+dev_mc_add_excl
+dev_mc_del
 devm_clk_get
 devm_free_irq
 devm_hwmon_device_register_with_groups
@@ -328,6 +414,7 @@ devm_ioremap_resource
 devm_iounmap
 devm_kfree
 devm_kmalloc
+devm_kmemdup
 devm_mdiobus_alloc_size
 devm_request_threaded_irq
 _dev_notice
@@ -339,128 +426,370 @@ dev_printk
 dev_queue_xmit
 dev_remove_pack
 dev_set_mac_address
+dev_set_mtu
 dev_set_name
 dev_set_promiscuity
 dev_trans_start
 dev_uc_add
+dev_uc_add_excl
+dev_uc_del
 _dev_warn
 d_find_alias
 disable_irq
 disable_irq_nosync
 dma_alloc_from_dev_coherent
+dma_common_get_sgtable
 dma_common_mmap
+dma_fence_add_callback
+dma_fence_array_create
+dma_fence_context_alloc
+dma_fence_free
+dma_fence_get_status
+dma_fence_init
+dma_fence_release
+dma_fence_signal
+dma_fence_signal_locked
+dma_fence_wait_any_timeout
+dma_fence_wait_timeout
 dma_get_required_mask
 dmam_alloc_coherent
+dmam_free_coherent
 dmam_pool_create
 dma_pool_alloc
 dma_pool_create
 dma_pool_destroy
 dma_pool_free
 dma_release_from_dev_coherent
+dmi_check_system
+dmi_get_system_info
 dmi_match
-do_gettimeofday
 __do_once_done
 __do_once_start
+do_wait_intr
 down
 downgrade_write
 down_interruptible
 down_read
 down_read_trylock
+down_timeout
 down_trylock
 down_write
+down_write_killable
 down_write_trylock
 d_path
 dput
 dql_completed
 dql_reset
+drain_workqueue
+driver_create_file
+driver_for_each_device
 driver_register
+driver_remove_file
 driver_unregister
+drm_add_edid_modes
 drm_add_modes_noedid
+drm_atomic_add_affected_connectors
+drm_atomic_add_affected_planes
+drm_atomic_commit
+drm_atomic_get_connector_state
 drm_atomic_get_crtc_state
+drm_atomic_get_plane_state
 drm_atomic_helper_check
+drm_atomic_helper_check_modeset
+drm_atomic_helper_check_planes
+drm_atomic_helper_check_plane_state
+drm_atomic_helper_cleanup_planes
 drm_atomic_helper_commit
+drm_atomic_helper_commit_cleanup_done
+drm_atomic_helper_commit_hw_done
+__drm_atomic_helper_connector_destroy_state
 drm_atomic_helper_connector_destroy_state
+__drm_atomic_helper_connector_duplicate_state
 drm_atomic_helper_connector_duplicate_state
+__drm_atomic_helper_connector_reset
 drm_atomic_helper_connector_reset
+__drm_atomic_helper_crtc_destroy_state
 drm_atomic_helper_crtc_destroy_state
+__drm_atomic_helper_crtc_duplicate_state
 drm_atomic_helper_crtc_duplicate_state
 drm_atomic_helper_crtc_reset
 drm_atomic_helper_disable_plane
+drm_atomic_helper_legacy_gamma_set
 drm_atomic_helper_page_flip
+__drm_atomic_helper_plane_destroy_state
 drm_atomic_helper_plane_destroy_state
+__drm_atomic_helper_plane_duplicate_state
 drm_atomic_helper_plane_duplicate_state
 drm_atomic_helper_plane_reset
+drm_atomic_helper_prepare_planes
 drm_atomic_helper_resume
 drm_atomic_helper_set_config
+drm_atomic_helper_setup_commit
 drm_atomic_helper_shutdown
 drm_atomic_helper_suspend
+drm_atomic_helper_swap_state
+drm_atomic_helper_update_legacy_modeset_state
 drm_atomic_helper_update_plane
+drm_atomic_helper_wait_for_dependencies
+drm_atomic_helper_wait_for_fences
+drm_atomic_helper_wait_for_flip_done
+drm_atomic_state_alloc
+drm_atomic_state_default_clear
+drm_atomic_state_default_release
+__drm_atomic_state_free
+drm_atomic_state_init
+drm_calc_vbltimestamp_from_scanoutpos
+drm_color_lut_extract
 drm_compat_ioctl
 drm_connector_attach_encoder
 drm_connector_cleanup
 drm_connector_init
+drm_connector_list_iter_begin
+drm_connector_list_iter_end
+drm_connector_list_iter_next
+drm_connector_register
+drm_connector_set_path_property
+drm_connector_unregister
+drm_connector_update_edid_property
+drm_crtc_accurate_vblank_count
+drm_crtc_add_crc_entry
+drm_crtc_arm_vblank_event
 drm_crtc_cleanup
+__drm_crtc_commit_free
+drm_crtc_enable_color_mgmt
+drm_crtc_force_disable_all
+drm_crtc_from_index
+drm_crtc_handle_vblank
+drm_crtc_helper_set_config
+drm_crtc_helper_set_mode
+drm_crtc_init
 drm_crtc_init_with_planes
 drm_crtc_send_vblank_event
+drm_crtc_vblank_count
+drm_crtc_vblank_get
 drm_crtc_vblank_off
 drm_crtc_vblank_on
+drm_crtc_vblank_put
+drm_cvt_mode
 drm_dbg
+drm_debugfs_create_files
+drm_detect_hdmi_monitor
+drm_detect_monitor_audio
 drm_dev_alloc
+drm_dev_put
 drm_dev_register
 drm_dev_unref
 drm_dev_unregister
+drm_dp_atomic_find_vcpi_slots
+drm_dp_atomic_release_vcpi_slots
+drm_dp_aux_register
+drm_dp_aux_unregister
+drm_dp_bw_code_to_link_rate
+drm_dp_calc_pbn_mode
+drm_dp_channel_eq_ok
+drm_dp_check_act_status
+drm_dp_clock_recovery_ok
+drm_dp_dpcd_read
+drm_dp_dpcd_read_link_status
+drm_dp_dpcd_write
+drm_dp_find_vcpi_slots
+drm_dp_get_adjust_request_pre_emphasis
+drm_dp_get_adjust_request_voltage
+drm_dp_link_rate_to_bw_code
+drm_dp_link_train_channel_eq_delay
+drm_dp_link_train_clock_recovery_delay
+drm_dp_mst_allocate_vcpi
+drm_dp_mst_deallocate_vcpi
+drm_dp_mst_detect_port
+drm_dp_mst_get_edid
+drm_dp_mst_hpd_irq
+drm_dp_mst_reset_vcpi_slots
+drm_dp_mst_topology_mgr_destroy
+drm_dp_mst_topology_mgr_init
+drm_dp_mst_topology_mgr_resume
+drm_dp_mst_topology_mgr_set_mst
+drm_dp_mst_topology_mgr_suspend
+drm_dp_update_payload_part1
+drm_dp_update_payload_part2
+drm_edid_header_is_valid
+drm_edid_is_valid
+drm_edid_to_sad
+drm_edid_to_speaker_allocation
 drm_encoder_cleanup
 drm_encoder_init
 drm_err
+drm_fb_helper_add_one_connector
 drm_fb_helper_alloc_fbi
 drm_fb_helper_blank
+drm_fb_helper_cfb_copyarea
+drm_fb_helper_cfb_fillrect
+drm_fb_helper_cfb_imageblit
 drm_fb_helper_check_var
+drm_fb_helper_debug_enter
+drm_fb_helper_debug_leave
 drm_fb_helper_fill_fix
 drm_fb_helper_fill_var
 drm_fb_helper_fini
+drm_fb_helper_hotplug_event
 drm_fb_helper_init
 drm_fb_helper_initial_config
+drm_fb_helper_ioctl
+drm_fb_helper_lastclose
+drm_fb_helper_output_poll_changed
 drm_fb_helper_pan_display
 drm_fb_helper_prepare
+drm_fb_helper_remove_one_connector
 drm_fb_helper_setcmap
 drm_fb_helper_set_par
+drm_fb_helper_set_suspend
+drm_fb_helper_set_suspend_unlocked
 drm_fb_helper_single_add_all_connectors
 drm_fb_helper_sys_copyarea
 drm_fb_helper_sys_fillrect
 drm_fb_helper_sys_imageblit
 drm_fb_helper_unregister_fbi
+drm_format_plane_cpp
 drm_framebuffer_cleanup
 drm_framebuffer_init
+drm_framebuffer_unregister_private
+drm_gem_dmabuf_kmap
+drm_gem_dmabuf_kunmap
+drm_gem_dmabuf_mmap
+drm_gem_dmabuf_release
+drm_gem_dmabuf_vmap
+drm_gem_dmabuf_vunmap
+drm_gem_fb_create_handle
+drm_gem_fb_destroy
 drm_gem_handle_create
+drm_gem_handle_delete
+drm_gem_map_attach
+drm_gem_map_detach
+drm_gem_map_dma_buf
 drm_gem_object_init
 drm_gem_object_lookup
 drm_gem_object_put_unlocked
 drm_gem_object_release
+drm_gem_prime_export
+drm_gem_prime_fd_to_handle
+drm_gem_prime_handle_to_fd
+drm_gem_prime_import
+drm_gem_private_object_init
+drm_gem_unmap_dma_buf
+drm_get_edid
+drm_get_edid_switcheroo
+drm_get_format_name
+drm_get_max_iomem
 drm_global_item_ref
 drm_global_item_unref
 drm_handle_vblank
+drm_hdmi_avi_infoframe_from_display_mode
+drm_hdmi_vendor_infoframe_from_display_mode
+drm_helper_connector_dpms
+drm_helper_disable_unused_functions
+drm_helper_hpd_irq_event
 drm_helper_mode_fill_fb_struct
 drm_helper_probe_single_connector_modes
+drm_helper_resume_force_mode
+drm_i2c_encoder_detect
+drm_i2c_encoder_init
+drm_i2c_encoder_mode_fixup
+drm_i2c_encoder_restore
+drm_i2c_encoder_save
+drm_invalid_op
 drm_ioctl
 drm_irq_install
 drm_irq_uninstall
+drm_is_current_master
+drm_kms_helper_hotplug_event
+drm_kms_helper_is_poll_worker
 drm_kms_helper_poll_disable
 drm_kms_helper_poll_enable
+drm_kms_helper_poll_fini
+drm_kms_helper_poll_init
+drm_match_cea_mode
+drm_mm_init
+drm_mm_insert_node_in_range
+drm_mm_print
+drm_mm_remove_node
+drm_mm_takedown
 drm_mode_config_cleanup
 drm_mode_config_init
 drm_mode_config_reset
+drm_mode_copy
+drm_mode_create_dvi_i_properties
+drm_mode_create_scaling_mode_property
+drm_mode_create_tv_properties
 drm_mode_crtc_set_gamma_size
+drm_mode_debug_printmodeline
+drm_mode_destroy
+drm_mode_duplicate
+drm_mode_equal
+drm_mode_get_hv_timing
+drm_mode_is_420_only
 drm_mode_legacy_fb_format
 drm_mode_object_find
 drm_mode_object_put
+drm_mode_probed_add
+drm_mode_set_crtcinfo
+drm_modeset_lock
+drm_modeset_lock_all
+drm_modeset_lock_all_ctx
+drm_mode_set_name
+drm_modeset_unlock
+drm_modeset_unlock_all
+drm_mode_vrefresh
+drm_object_attach_property
+drm_object_property_set_value
 drm_open
 drm_plane_cleanup
+drm_plane_create_alpha_property
+drm_plane_create_color_properties
+drm_plane_create_zpos_immutable_property
+drm_plane_create_zpos_property
+drm_plane_force_disable
+drm_plane_init
 drm_poll
+drm_primary_helper_destroy
+drm_primary_helper_funcs
+drm_prime_gem_destroy
+drm_prime_pages_to_sg
+drm_prime_sg_to_page_addr_arrays
+drm_printf
+__drm_printfn_seq_file
+drm_property_add_enum
+drm_property_create
+drm_property_create_enum
+drm_property_create_range
+__drm_puts_seq_file
 drm_read
 drm_release
+drm_scdc_read
+drm_scdc_write
+drm_sched_dependency_optimized
+drm_sched_entity_destroy
+drm_sched_entity_fini
+drm_sched_entity_flush
+drm_sched_entity_init
+drm_sched_entity_push_job
+drm_sched_entity_set_rq
+drm_sched_fini
+drm_sched_hw_job_reset
+drm_sched_init
+drm_sched_job_init
+drm_sched_job_recovery
+drm_send_event_locked
+drm_syncobj_create
+drm_syncobj_find
+drm_syncobj_find_fence
+drm_syncobj_free
+drm_syncobj_get_fd
+drm_syncobj_get_handle
+drm_syncobj_replace_fence
 drm_universal_plane_init
 drm_vblank_init
+drm_vma_node_allow
 drm_vma_node_is_allowed
+drm_vma_node_revoke
 dst_init
 dst_release
 dummy_dma_ops
@@ -469,17 +798,21 @@ __dynamic_dev_dbg
 __dynamic_netdev_dbg
 __dynamic_pr_debug
 elfcorehdr_addr
+emergency_restart
 enable_irq
+errno_to_blk_status
 ether_setup
 eth_get_headlen
 eth_mac_addr
 eth_platform_get_mac_address
 ethtool_convert_legacy_u32_to_link_mode
 ethtool_convert_link_mode_to_legacy_u32
+ethtool_intersect_link_masks
 ethtool_op_get_link
 ethtool_op_get_ts_info
 eth_type_trans
 eth_validate_addr
+eventfd_ctx_fdget
 eventfd_ctx_fileget
 eventfd_ctx_put
 eventfd_fget
@@ -491,6 +824,7 @@ fc_block_scsi_eh
 fc_eh_timed_out
 fc_get_event_number
 fc_host_post_event
+fc_host_post_vendor_event
 fc_release_transport
 fc_remote_port_add
 fc_remote_port_delete
@@ -503,12 +837,15 @@ fget
 filemap_fault
 filp_close
 filp_open
+find_get_pid
 find_last_bit
 find_next_bit
 find_next_zero_bit
 find_pid_ns
 find_vma
 finish_wait
+firmware_request_nowarn
+fixed_size_llseek
 flex_array_alloc
 flex_array_free
 flex_array_get
@@ -522,6 +859,7 @@ flush_workqueue
 force_sig
 fortify_panic
 fput
+free_fib_info
 free_irq
 free_irq_cpu_rmap
 free_netdev
@@ -537,30 +875,49 @@ __f_setown
 fwnode_property_read_string
 fwnode_property_read_u32_array
 fwnode_property_read_u8_array
+gcd
+generate_random_uuid
+generic_end_io_acct
 generic_file_llseek
+generic_handle_irq
+generic_make_request
+generic_start_io_acct
 genlmsg_put
 genl_notify
 genl_register_family
 genl_unregister_family
 genphy_read_status
 genphy_restart_aneg
+gen_pool_add_virt
+gen_pool_alloc
+gen_pool_create
+gen_pool_destroy
+gen_pool_free
+gen_pool_virt_to_phys
 get_cpu_idle_time_us
 get_cpu_iowait_time_us
 get_device
 __get_free_pages
+get_gendisk
 get_phy_device
+get_pid_task
 get_random_bytes
-get_seconds
+__get_task_comm
 get_task_mm
+get_unused_fd_flags
 get_user_pages
 get_user_pages_fast
 get_user_pages_remote
 get_zeroed_page
+gic_pmr_sync
 gre_add_protocol
 gre_del_protocol
 groups_alloc
 groups_free
 guid_parse
+handle_simple_irq
+hdmi_avi_infoframe_pack
+hdmi_infoframe_pack
 hest_disable
 hex_to_bin
 hrtimer_cancel
@@ -570,50 +927,104 @@ hrtimer_start_range_ns
 hrtimer_try_to_cancel
 __hw_addr_sync_dev
 __hw_addr_unsync_dev
+hwmon_device_register
+hwmon_device_register_with_groups
+hwmon_device_register_with_info
+hwmon_device_unregister
+i2c_add_adapter
 i2c_add_numbered_adapter
+i2c_bit_add_bus
+i2c_bit_algo
 i2c_del_adapter
 i2c_generic_scl_recovery
+i2c_new_device
 i2c_recover_bus
+i2c_smbus_read_byte_data
+i2c_smbus_write_byte_data
+i2c_transfer
+i2c_unregister_device
 __ib_alloc_cq
 ib_alloc_device
+ib_alloc_odp_umem
 __ib_alloc_pd
+__ib_alloc_xrcd
 __ib_create_cq
+ib_create_qp
+ib_create_send_mad
 ib_create_srq
 ib_dealloc_device
 ib_dealloc_pd
+ib_dereg_mr
 ib_destroy_cq
 ib_destroy_qp
 ib_destroy_srq
 ib_dispatch_event
 ib_drain_qp
 ib_event_msg
+ib_find_cached_pkey
 ib_free_cq
+ib_free_send_mad
+ib_get_cached_pkey
+ib_get_eth_speed
+ib_get_gids_from_rdma_hdr
+ib_get_rdma_header_version
 ib_map_mr_sg
+ib_modify_qp
 ib_modify_qp_is_ok
 ib_mr_pool_destroy
 ib_mr_pool_get
 ib_mr_pool_init
 ib_mr_pool_put
+ib_post_send_mad
+ib_process_cq_direct
+ib_query_pkey
 ib_query_port
+ib_query_qp
 ib_register_client
 ib_register_device
+ib_register_mad_agent
+ib_sa_cancel_query
+ib_sa_guid_info_rec_query
+ib_sa_register_client
+ib_sa_unregister_client
 ib_sg_to_pages
+ib_ud_header_init
+ib_ud_header_pack
+ib_ud_ip4_csum
+ib_umem_copy_from
 ib_umem_get
+ib_umem_odp_map_dma_pages
+ib_umem_odp_unmap_dma_pages
 ib_umem_page_count
 ib_umem_release
 ib_unregister_client
 ib_unregister_device
+ib_unregister_mad_agent
+ib_uverbs_get_ucontext
 ib_wc_status_msg
 ida_alloc_range
 ida_destroy
 ida_free
+idr_alloc
+idr_alloc_cyclic
+idr_alloc_u32
+idr_destroy
+idr_find
+idr_for_each
+idr_get_next
+idr_get_next_ul
+idr_preload
+idr_remove
+idr_replace
 in4_pton
 in6_pton
 in_aton
 in_dev_finish_destroy
 in_egroup_p
+__inet6_lookup_established
 inet_addr_is_any
 inet_get_local_port_range
+__inet_lookup_established
 inet_proto_csum_replace16
 inet_proto_csum_replace4
 inet_pton_with_scope
@@ -632,6 +1043,10 @@ input_register_handle
 input_register_handler
 input_unregister_handle
 input_unregister_handler
+interval_tree_insert
+interval_tree_iter_first
+interval_tree_iter_next
+interval_tree_remove
 int_to_scsilun
 invalidate_partition
 iomem_resource
@@ -639,6 +1054,9 @@ iommu_get_domain_for_dev
 iommu_group_get
 iommu_group_id
 iommu_group_put
+iommu_iova_to_phys
+iommu_map
+iommu_unmap
 __ioremap
 ioremap_cache
 io_schedule
@@ -648,15 +1066,20 @@ iov_iter_advance
 iov_iter_bvec
 iov_iter_init
 iov_iter_npages
+__iowrite32_copy
 __iowrite64_copy
 ip6_dst_hoplimit
 ip6_local_out
+ip6_route_output_flags
+ip_compute_csum
 ip_defrag
+__ip_dev_find
 ip_do_fragment
 ip_local_out
 ipmi_create_user
 ipmi_destroy_user
-ipmi_register_smi
+ipmi_free_recv_msg
+ipmi_poll_interface
 ipmi_request_settime
 ipmi_set_gets_events
 ipmi_set_my_address
@@ -668,17 +1091,30 @@ __ip_select_ident
 ip_send_check
 ip_set_get_byname
 ip_set_put_byindex
+ip_tos2prio
 ip_tunnel_get_stats64
 iput
 __ipv6_addr_type
+ipv6_chk_addr
 ipv6_ext_hdr
 ipv6_find_hdr
 ipv6_skip_exthdr
 ipv6_stub
 ip_vs_proto_name
 irq_cpu_rmap_add
+irq_create_mapping
+__irq_domain_add
+irq_domain_remove
+irq_find_mapping
+irq_get_irq_data
+irq_poll_complete
+irq_poll_disable
+irq_poll_enable
+irq_poll_init
+irq_poll_sched
 irq_set_affinity_hint
 irq_set_affinity_notifier
+irq_set_chip_and_handler_name
 irq_to_desc
 is_acpi_data_node
 is_acpi_device_node
@@ -743,6 +1179,8 @@ kasprintf
 kernel_bind
 kernel_connect
 kernel_cpustat
+kernel_recvmsg
+kernel_sendmsg
 kernel_setsockopt
 kernel_sock_shutdown
 kernel_write
@@ -754,6 +1192,8 @@ kfree_const
 kfree_skb
 kfree_skb_list
 kfree_skb_partial
+kgdb_active
+kgdb_breakpoint
 kill_fasync
 kimage_voffset
 __kmalloc
@@ -773,10 +1213,12 @@ kmemdup
 kobject_add
 kobject_create_and_add
 kobject_del
+kobject_get
 kobject_init
 kobject_init_and_add
 kobject_put
 kobject_set_name
+kobject_uevent
 kobject_uevent_env
 krealloc
 kset_create_and_add
@@ -785,6 +1227,7 @@ kset_register
 kset_unregister
 ksize
 kstrdup
+kstrdup_const
 kstrndup
 kstrtobool
 kstrtobool_from_user
@@ -800,10 +1243,13 @@ kstrtoull
 kstrtoull_from_user
 kthread_bind
 kthread_create_on_node
+kthread_park
 kthread_should_stop
 kthread_stop
+kthread_unpark
 ktime_get
 ktime_get_coarse_real_ts64
+ktime_get_raw
 ktime_get_raw_ts64
 ktime_get_real_seconds
 ktime_get_real_ts64
@@ -815,15 +1261,22 @@ kvfree
 kvmalloc_node
 kzfree
 lcm
+led_classdev_resume
+led_classdev_suspend
+led_classdev_unregister
 __list_add_valid
 __list_del_entry_valid
 list_sort
+llist_add_batch
 __ll_sc_atomic64_add
+__ll_sc_atomic64_add_return
 __ll_sc_atomic64_andnot
+__ll_sc_atomic64_fetch_add
 __ll_sc_atomic64_fetch_andnot
 __ll_sc_atomic64_fetch_andnot_release
 __ll_sc_atomic64_fetch_or
 __ll_sc_atomic64_fetch_or_acquire
+__ll_sc_atomic64_fetch_xor
 __ll_sc_atomic64_or
 __ll_sc_atomic64_sub
 __ll_sc_atomic64_sub_return
@@ -839,6 +1292,7 @@ __ll_sc___cmpxchg_case_mb_8
 __local_bh_enable_ip
 __lock_page
 lock_page_memcg
+lockref_get
 lock_sock_nested
 logic_inw
 logic_outw
@@ -849,6 +1303,7 @@ mark_page_accessed
 match_hex
 match_int
 match_strdup
+match_string
 match_token
 match_u64
 _mcount
@@ -857,9 +1312,13 @@ mdev_from_dev
 mdev_get_drvdata
 mdev_parent_dev
 mdev_register_device
+mdev_register_driver
 mdev_set_drvdata
 mdev_unregister_device
+mdev_unregister_driver
 mdio45_probe
+mdiobus_alloc_size
+mdiobus_free
 mdiobus_get_phy
 mdiobus_read
 __mdiobus_register
@@ -889,15 +1348,17 @@ mempool_kmalloc
 memscan
 mem_section
 memset
+__memset_io
 memstart_addr
 memzero_explicit
+metadata_dst_alloc
 misc_deregister
 misc_register
-mlxfw_firmware_flash
 mmput
 __mmu_notifier_register
 mmu_notifier_register
 mmu_notifier_unregister
+mmu_notifier_unregister_no_release
 mod_delayed_work_on
 mod_timer
 mod_timer_pending
@@ -932,15 +1393,21 @@ __ndelay
 ndo_dflt_bridge_getlink
 ndo_dflt_fdb_add
 __neigh_create
+neigh_destroy
+__neigh_event_send
+neigh_lookup
+netdev_alloc_frag
 __netdev_alloc_skb
 netdev_bind_sb_channel_queue
 netdev_crit
 netdev_err
 netdev_features_change
 netdev_info
+netdev_lower_get_next
 netdev_master_upper_dev_get
 netdev_master_upper_dev_get_rcu
 netdev_master_upper_dev_link
+netdev_notice
 netdev_printk
 netdev_reset_tc
 netdev_rss_key_fill
@@ -959,6 +1426,7 @@ netif_carrier_off
 netif_carrier_on
 netif_device_attach
 netif_device_detach
+netif_get_num_default_rss_queues
 netif_napi_add
 netif_napi_del
 netif_receive_skb
@@ -970,6 +1438,7 @@ netif_set_real_num_tx_queues
 netif_set_xps_queue
 netif_tx_stop_all_queues
 netif_tx_wake_queue
+netlink_ack
 netlink_broadcast
 __netlink_dump_start
 netlink_has_listeners
@@ -1066,12 +1535,53 @@ nr_irqs
 nr_node_ids
 ns_capable
 nsecs_to_jiffies
+ns_to_timespec
 ns_to_timespec64
 ns_to_timeval
 numa_node
+nvme_alloc_request
+nvme_cancel_request
+nvme_change_ctrl_state
+nvme_cleanup_cmd
+nvme_complete_async_event
+nvme_complete_rq
+nvme_disable_ctrl
+nvme_enable_ctrl
+nvme_fc_register_localport
+nvme_fc_register_remoteport
+nvme_fc_set_remoteport_devloss
+nvme_fc_unregister_localport
+nvme_fc_unregister_remoteport
+nvme_init_ctrl
+nvme_init_identify
+nvme_io_timeout
+nvme_kill_queues
+nvme_remove_namespaces
+nvme_reset_ctrl
+nvme_reset_ctrl_sync
+nvme_set_queue_count
+nvme_setup_cmd
+nvme_shutdown_ctrl
+nvme_start_ctrl
+nvme_start_freeze
+nvme_start_queues
+nvme_stop_ctrl
+nvme_stop_queues
+nvme_submit_sync_cmd
+nvmet_fc_rcv_fcp_abort
+nvmet_fc_rcv_fcp_req
+nvmet_fc_rcv_ls_req
+nvmet_fc_register_targetport
+nvmet_fc_unregister_targetport
+nvme_unfreeze
+nvme_uninit_ctrl
+nvme_wait_freeze
+nvme_wait_freeze_timeout
+nvme_wq
 of_device_is_compatible
 of_find_device_by_node
 of_fwnode_ops
+of_led_classdev_register
 of_match_node
 of_mdiobus_register
 of_node_put
@@ -1079,6 +1589,7 @@ of_parse_phandle
 of_parse_phandle_with_fixed_args
 of_phy_find_device
 on_each_cpu
+orderly_poweroff
 out_of_line_wait_on_bit
 override_creds
 __page_file_index
@@ -1113,14 +1624,23 @@ param_set_int
 path_get
 path_put
 pci_alloc_irq_vectors_affinity
+pci_assign_unassigned_bus_resources
 pcibios_resource_to_bus
+pci_bus_read_config_dword
+pci_bus_resource_n
 pci_bus_type
+pci_cfg_access_lock
+pci_cfg_access_unlock
+pci_check_and_mask_intx
 pci_choose_state
 pci_cleanup_aer_uncorrect_error_status
 pci_clear_master
 pci_clear_mwi
+pci_d3cold_disable
+pci_dev_driver
 pci_dev_get
 pci_device_is_present
+pci_dev_present
 pci_dev_put
 pci_disable_device
 pci_disable_link_state
@@ -1130,43 +1650,64 @@ pci_disable_pcie_error_reporting
 pci_disable_rom
 pci_disable_sriov
 pcie_bandwidth_available
+pcie_capability_clear_and_set_word
 pcie_capability_read_dword
 pcie_capability_read_word
 pcie_capability_write_word
 pcie_flr
+pcie_get_speed_cap
+pcie_get_width_cap
+pci_enable_atomic_ops_to_root
 pci_enable_device
 pci_enable_device_mem
 pci_enable_msi
 pci_enable_msix_range
 pci_enable_pcie_error_reporting
+pci_enable_rom
 pci_enable_sriov
 pci_enable_wake
 pcie_print_link_status
+pcie_relaxed_ordering_enabled
 pcie_set_readrq
 pci_find_capability
 pci_find_ext_capability
 pci_free_irq
 pci_free_irq_vectors
+pci_get_class
 pci_get_device
 pci_get_domain_bus_and_slot
+pci_get_slot
+pci_ignore_hotplug
+pci_intx
 pci_iomap
 pci_ioremap_bar
 pci_irq_get_affinity
 pci_irq_vector
+pci_map_rom
 pci_match_id
+pcim_enable_device
 pcim_iomap
+pcim_iomap_regions
+pcim_iomap_table
 pcim_iounmap
+pci_msi_mask_irq
+pci_msi_unmask_irq
 pci_num_vf
+pci_platform_rom
 pci_prepare_to_sleep
 pci_read_config_byte
 pci_read_config_dword
 pci_read_config_word
+pci_read_vpd
 __pci_register_driver
 pci_release_regions
+pci_release_resource
 pci_release_selected_regions
 pci_request_irq
 pci_request_regions
 pci_request_selected_regions
+pci_rescan_bus
+pci_resize_resource
 pci_restore_state
 pci_save_state
 pci_select_bars
@@ -1176,10 +1717,15 @@ pci_set_power_state
 pci_sriov_configure_simple
 pci_sriov_get_totalvfs
 pci_sriov_set_totalvfs
+pci_stop_and_remove_bus_device
 pci_stop_and_remove_bus_device_locked
 pci_try_set_mwi
+pci_unmap_rom
 pci_unregister_driver
 pci_vfs_assigned
+pci_vpd_find_info_keyword
+pci_vpd_find_tag
+pci_wait_for_pending_transaction
 pci_wake_from_d3
 pci_write_config_byte
 pci_write_config_dword
@@ -1194,6 +1740,8 @@ perf_trace_buf_alloc
 perf_trace_run_bpf_submit
 pfn_valid
 phy_attach_direct
+phy_attached_info
+phy_connect
 phy_connect_direct
 phy_device_free
 phy_device_register
@@ -1209,6 +1757,7 @@ phy_start_aneg
 phy_stop
 phy_suspend
 pid_task
+pid_vnr
 platform_bus_type
 platform_device_register
 platform_device_register_full
@@ -1218,6 +1767,8 @@ platform_driver_unregister
 platform_get_irq
 platform_get_resource
 platform_get_resource_byname
+pm_power_off
+pm_runtime_allow
 __pm_runtime_disable
 pm_runtime_enable
 pm_runtime_forbid
@@ -1225,7 +1776,11 @@ __pm_runtime_idle
 __pm_runtime_resume
 pm_runtime_set_autosuspend_delay
 __pm_runtime_set_status
+__pm_runtime_suspend
 __pm_runtime_use_autosuspend
+pm_schedule_suspend
+power_supply_is_system_supplied
+prandom_bytes
 prandom_u32
 prepare_creds
 prepare_to_wait
@@ -1258,6 +1813,8 @@ __put_net
 __put_page
 __put_task_struct
 put_unused_fd
+qed_get_eth_ops
+qed_put_eth_ops
 queue_delayed_work_on
 queued_read_lock_slowpath
 queued_spin_lock_slowpath
@@ -1271,6 +1828,7 @@ radix_tree_lookup
 radix_tree_next_chunk
 __radix_tree_next_slot
 radix_tree_preload
+radix_tree_tagged
 radix_tree_tag_set
 raid_class_attach
 raid_class_release
@@ -1279,28 +1837,46 @@ raw_notifier_call_chain
 raw_notifier_chain_register
 raw_notifier_chain_unregister
 rb_erase
+__rb_erase_color
 rb_first
+rb_first_postorder
+__rb_insert_augmented
 rb_insert_color
 rb_next
+rb_next_postorder
+rb_replace_node
+rbt_ib_umem_for_each_in_range
+rbt_ib_umem_lookup
 rcu_barrier
 __rdma_accept
 rdma_bind_addr
 rdma_connect
 rdma_consumer_reject_data
+rdma_copy_ah_attr
+rdma_create_ah
 __rdma_create_id
 rdma_create_qp
+rdma_destroy_ah
+rdma_destroy_ah_attr
 rdma_destroy_id
 rdma_destroy_qp
 rdma_disconnect
 rdma_event_msg
+rdma_is_zero_gid
 rdma_listen
 rdma_nl_put_driver_u32
 rdma_nl_put_driver_u64
 rdma_notify
+rdma_port_get_link_layer
+rdma_query_ah
+rdma_query_gid
 rdma_reject
 rdma_reject_msg
 rdma_resolve_addr
 rdma_resolve_route
+rdma_restrack_get
+rdma_restrack_put
+rdma_roce_rescan_device
 rdma_rw_ctx_destroy
 rdma_rw_ctx_init
 rdma_rw_ctx_post
@@ -1308,23 +1884,29 @@ rdma_rw_ctx_wrs
 rdma_set_afonly
 read_cache_pages
 recalc_sigpending
+refcount_dec_and_mutex_lock
 refcount_dec_and_test_checked
 refcount_dec_checked
 refcount_dec_if_one
 refcount_inc_checked
 refcount_inc_not_zero_checked
 register_acpi_hed_notifier
+register_acpi_notifier
 register_blkdev
 __register_chrdev
 register_chrdev_region
 register_console
 register_die_notifier
+register_fib_notifier
+register_inet6addr_notifier
+register_inetaddr_notifier
 register_ip_vs_scheduler
 register_kprobe
 register_module_notifier
 register_netdev
 register_netdevice
 register_netdevice_notifier
+register_netevent_notifier
 register_oom_notifier
 register_pernet_device
 register_pernet_subsys
@@ -1333,16 +1915,25 @@ register_sysctl_table
 regmap_read
 regmap_write
 release_firmware
+release_pages
 __release_region
 release_sock
 remap_pfn_range
+remove_conflicting_framebuffers
 remove_proc_entry
 remove_wait_queue
 request_firmware
 request_firmware_direct
+request_firmware_nowait
 __request_module
 __request_region
 request_threaded_irq
+reservation_object_add_excl_fence
+reservation_object_add_shared_fence
+reservation_object_get_fences_rcu
+reservation_object_reserve_shared
+reservation_object_wait_timeout_rcu
+reservation_ww_class
 reset_devices
 revalidate_disk
 revert_creds
@@ -1350,6 +1941,11 @@ rhashtable_destroy
 rhashtable_free_and_destroy
 rhashtable_init
 rhashtable_insert_slow
+rhashtable_walk_enter
+rhashtable_walk_exit
+rhashtable_walk_next
+rhashtable_walk_start_check
+rhashtable_walk_stop
 rhltable_init
 rht_bucket_nested
 rht_bucket_nested_insert
@@ -1397,6 +1993,7 @@ sas_port_add_phy
 sas_port_alloc_num
 sas_port_delete
 sas_port_delete_phy
+sas_port_free
 sas_prep_resume_ha
 sas_queuecommand
 sas_read_port_mode_page
@@ -1411,11 +2008,15 @@ sas_suspend_ha
 sas_target_alloc
 sas_target_destroy
 sas_unregister_ha
+save_stack_trace
 save_stack_trace_tsk
 sbitmap_queue_clear
 __sbitmap_queue_get
 scatterwalk_map_and_copy
+sched_clock
+sched_setscheduler
 schedule
+schedule_hrtimeout
 schedule_hrtimeout_range
 schedule_timeout
 schedule_timeout_interruptible
@@ -1429,15 +2030,19 @@ scsi_build_sense_buffer
 scsi_change_queue_depth
 scsi_cmd_get_serial
 scsi_command_normalize_sense
+scsi_device_get
 scsi_device_lookup
 scsi_device_put
 scsi_device_set_state
+scsi_device_type
 scsi_dma_map
 scsi_dma_unmap
+__scsi_execute
 scsi_get_vpd_page
 scsi_host_alloc
 scsi_host_busy
 scsi_host_get
+scsi_host_lookup
 scsi_host_put
 scsi_internal_device_block_nowait
 scsi_internal_device_unblock_nowait
@@ -1446,17 +2051,23 @@ scsi_is_host_device
 scsi_is_sdev_device
 __scsi_iterate_devices
 scsilun_to_int
+scsi_normalize_sense
 scsi_print_command
 scsi_queue_work
+scsi_register_driver
 scsi_remove_device
 scsi_remove_host
 scsi_remove_target
+scsi_sanitize_inquiry_string
 scsi_scan_host
 scsi_sense_key_string
 scsi_unblock_requests
 sdev_prefix_printk
 __secpath_destroy
 secpath_dup
+secure_tcp_seq
+secure_tcpv6_seq
+security_d_instantiate
 security_release_secctx
 security_secid_to_secctx
 security_tun_dev_alloc_security
@@ -1469,11 +2080,14 @@ send_sig
 seq_list_next
 seq_list_start
 seq_lseek
+seq_open
 seq_printf
 seq_putc
 seq_put_decimal_ull
 seq_puts
 seq_read
+seq_release
+seq_write
 set_cpus_allowed_ptr
 set_current_groups
 set_device_ro
@@ -1484,12 +2098,17 @@ set_page_dirty
 set_page_dirty_lock
 set_user_nice
 sg_alloc_table_chained
+sg_alloc_table_from_pages
 sg_copy_from_buffer
 sg_copy_to_buffer
+sg_free_table
 sg_free_table_chained
 sg_init_table
 sgl_alloc
 sgl_free
+sg_miter_next
+sg_miter_start
+sg_miter_stop
 sg_nents
 sg_next
 __sg_page_iter_next
@@ -1499,6 +2118,10 @@ sg_pcopy_to_buffer
 sg_zero_buffer
 sigprocmask
 si_meminfo
+simple_attr_open
+simple_attr_read
+simple_attr_release
+simple_attr_write
 simple_open
 simple_read_from_buffer
 simple_strtol
@@ -1527,6 +2150,7 @@ skb_ensure_writable
 __skb_flow_dissect
 __skb_get_hash
 __skb_gso_segment
+skb_gso_validate_mac_len
 __skb_pad
 skb_partial_csum_set
 skb_pull
@@ -1539,6 +2163,7 @@ skb_realloc_headroom
 __skb_recv_datagram
 skb_scrub_packet
 skb_set_owner_w
+skb_store_bits
 skb_trim
 skb_try_coalesce
 skb_tstamp_tx
@@ -1559,14 +2184,18 @@ snprintf
 sock_alloc_send_pskb
 sock_create
 sock_create_kern
+sock_edemux
 sockfd_lookup
 sock_init_data
+sock_queue_err_skb
 sock_recv_errqueue
 sock_release
 sock_zerocopy_callback
+softnet_data
 sort
 sprintf
 sprint_symbol
+srcu_barrier
 __srcu_read_lock
 __srcu_read_unlock
 sscanf
@@ -1596,8 +2225,13 @@ strsep
 strspn
 strstr
 submit_bio
+__sw_hweight32
 __sw_hweight64
 __sw_hweight8
+swiotlb_nr_tbl
+switchdev_port_same_parent_id
+__symbol_put
+sync_file_create
 synchronize_irq
 synchronize_net
 synchronize_rcu_bh
@@ -1618,6 +2252,7 @@ sysfs_remove_group
 sysfs_remove_link
 sysfs_streq
 system_state
+system_unbound_wq
 system_wq
 sys_tz
 t10_pi_complete
@@ -1625,15 +2260,24 @@ t10_pi_prepare
 t10_pi_type1_crc
 t10_pi_type3_crc
 tap_get_socket
+task_active_pid_ns
 tasklet_init
 tasklet_kill
 __tasklet_schedule
 __task_pid_nr_ns
 tcf_block_cb_register
 tcf_block_cb_unregister
+tcp_gro_complete
+tcp_hashinfo
+tc_setup_cb_egdev_register
+tc_setup_cb_egdev_unregister
+time64_to_tm
 timecounter_cyc2time
 timecounter_init
 timecounter_read
+tls_get_record
+tls_validate_xmit_skb
+to_drm_sched_fence
 totalram_pages
 trace_define_field
 trace_event_buffer_commit
@@ -1642,7 +2286,9 @@ trace_event_ignore_this_pid
 trace_event_raw_init
 trace_event_reg
 trace_handle_return
+__tracepoint_dma_fence_emit
 __tracepoint_xdp_exception
+trace_print_array_seq
 trace_print_flags_seq
 trace_print_symbols_seq
 trace_raw_output_prep
@@ -1651,38 +2297,75 @@ trace_seq_putc
 try_module_get
 try_wait_for_completion
 ttm_bo_add_to_lru
+ttm_bo_clean_mm
 ttm_bo_del_sub_from_lru
 ttm_bo_device_init
 ttm_bo_device_release
 ttm_bo_dma_acc_size
+ttm_bo_eviction_valuable
+ttm_bo_evict_mm
 ttm_bo_global_init
 ttm_bo_global_release
 ttm_bo_init
 ttm_bo_init_mm
+ttm_bo_init_reserved
 ttm_bo_kmap
 ttm_bo_kunmap
+ttm_bo_lock_delayed_workqueue
 ttm_bo_manager_func
+ttm_bo_mem_put
+ttm_bo_mem_space
 ttm_bo_mmap
+ttm_bo_move_accel_cleanup
+ttm_bo_move_memcpy
+ttm_bo_move_to_lru_tail
+ttm_bo_move_ttm
+ttm_bo_pipeline_move
+ttm_bo_put
+ttm_bo_unlock_delayed_workqueue
 ttm_bo_unref
 ttm_bo_validate
+ttm_bo_wait
+ttm_dma_page_alloc_debugfs
+ttm_dma_populate
+ttm_dma_tt_fini
+ttm_dma_tt_init
+ttm_dma_unpopulate
+ttm_eu_backoff_reservation
+ttm_eu_fence_buffer_objects
+ttm_eu_reserve_buffers
+ttm_fbdev_mmap
 ttm_mem_global_init
 ttm_mem_global_release
+ttm_page_alloc_debugfs
+ttm_pool_populate
+ttm_pool_unpopulate
+ttm_populate_and_map_pages
+ttm_sg_tt_init
+ttm_tt_bind
 ttm_tt_fini
 ttm_tt_init
+ttm_tt_set_placement_caching
+ttm_unmap_and_unpopulate_pages
 __udelay
 udp4_hwcsum
 udp_encap_enable
+uio_event_notify
 __uio_register_device
 uio_unregister_device
 unlock_page
 unlock_page_memcg
 unmap_mapping_range
 unregister_acpi_hed_notifier
+unregister_acpi_notifier
 unregister_blkdev
 __unregister_chrdev
 unregister_chrdev_region
 unregister_console
 unregister_die_notifier
+unregister_fib_notifier
+unregister_inet6addr_notifier
+unregister_inetaddr_notifier
 unregister_ip_vs_scheduler
 unregister_kprobe
 unregister_module_notifier
@@ -1690,6 +2373,7 @@ unregister_netdev
 unregister_netdevice_many
 unregister_netdevice_notifier
 unregister_netdevice_queue
+unregister_netevent_notifier
 unregister_oom_notifier
 unregister_pernet_device
 unregister_pernet_subsys
@@ -1705,6 +2389,13 @@ usleep_range
 uuid_gen
 uuid_null
 uuid_parse
+_uverbs_alloc
+uverbs_copy_to
+uverbs_destroy_def_handler
+uverbs_fd_class
+uverbs_get_flags32
+uverbs_get_flags64
+uverbs_idr_class
 vfio_register_iommu_driver
 vfio_unregister_iommu_driver
 vfree
@@ -1712,13 +2403,16 @@ vfs_fallocate
 vfs_fsync
 vfs_getattr
 vfs_statfs
+vga_client_register
 vlan_dev_real_dev
 vlan_dev_vlan_id
+vlan_dev_vlan_proto
 vmalloc
 __vmalloc
 vmalloc_node
 vmalloc_to_page
 vmap
+vm_insert_page
 vm_mmap
 vm_munmap
 vm_zone_stat
@@ -1730,27 +2424,41 @@ vunmap
 vzalloc
 vzalloc_node
 wait_for_completion
+wait_for_completion_interruptible
 wait_for_completion_interruptible_timeout
 wait_for_completion_io_timeout
+wait_for_completion_killable
 wait_for_completion_timeout
 wait_on_page_bit
 __wake_up
 wake_up_bit
+__wake_up_locked
 wake_up_process
 __wake_up_sync_key
 __warn_printk
+work_busy
 write_cache_pages
+ww_mutex_lock
 ww_mutex_lock_interruptible
 ww_mutex_unlock
 xdp_do_flush_map
 xdp_do_redirect
 xdp_return_frame
 xdp_return_frame_rx_napi
+xdp_rxq_info_is_reg
 xdp_rxq_info_reg
 xdp_rxq_info_reg_mem_model
 xdp_rxq_info_unreg
 xdp_rxq_info_unused
+xfrm_replay_seqhi
+xz_dec_end
+xz_dec_init
+xz_dec_run
 yield
 zap_vma_ptes
 zerocopy_sg_from_iter
 zgid
+zlib_inflate
+zlib_inflateEnd
+zlib_inflateInit2
+zlib_inflate_workspacesize
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            1
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [PATCH openEuler-1.0-LTS 001/149] iommu/vt-d: Duplicate iommu_resv_region objects per device list
                        
                        
by Yang Yingliang 30 Jun '21
                    by Yang Yingliang 30 Jun '21
30 Jun '21
                    
                        From: Eric Auger <eric.auger(a)redhat.com>
[ Upstream commit 5f64ce5411b467f1cfea6c63e2494c22b773582b ]
intel_iommu_get_resv_regions() aims to return the list of
reserved regions accessible by a given @device. However several
devices can access the same reserved memory region and when
building the list it is not safe to use a single iommu_resv_region
object, whose container is the RMRR. This iommu_resv_region must
be duplicated per device reserved region list.
Let's remove the struct iommu_resv_region from the RMRR unit
and allocate the iommu_resv_region directly in
intel_iommu_get_resv_regions(). We hold the dmar_global_lock instead
of the rcu-lock to allow sleeping.
Fixes: 0659b8dc45a6 ("iommu/vt-d: Implement reserved region get/put callbacks")
Signed-off-by: Eric Auger <eric.auger(a)redhat.com>
Reviewed-by: Lu Baolu <baolu.lu(a)linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel(a)suse.de>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 drivers/iommu/intel-iommu.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index d62fb1c31749b..58614c469db4f 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -387,7 +387,6 @@ struct dmar_rmrr_unit {
 	u64	end_address;		/* reserved end address */
 	struct dmar_dev_scope *devices;	/* target devices */
 	int	devices_cnt;		/* target device count */
-	struct iommu_resv_region *resv; /* reserved region handle */
 };
 
 struct dmar_atsr_unit {
@@ -4214,7 +4213,6 @@ static inline void init_iommu_pm_ops(void) {}
 int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg)
 {
 	struct acpi_dmar_reserved_memory *rmrr;
-	int prot = DMA_PTE_READ|DMA_PTE_WRITE;
 	struct dmar_rmrr_unit *rmrru;
 	size_t length;
 
@@ -4228,22 +4226,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg)
 	rmrru->end_address = rmrr->end_address;
 
 	length = rmrr->end_address - rmrr->base_address + 1;
-	rmrru->resv = iommu_alloc_resv_region(rmrr->base_address, length, prot,
-					      IOMMU_RESV_DIRECT);
-	if (!rmrru->resv)
-		goto free_rmrru;
 
 	rmrru->devices = dmar_alloc_dev_scope((void *)(rmrr + 1),
 				((void *)rmrr) + rmrr->header.length,
 				&rmrru->devices_cnt);
 	if (rmrru->devices_cnt && rmrru->devices == NULL)
-		goto free_all;
+		goto free_rmrru;
 
 	list_add(&rmrru->list, &dmar_rmrr_units);
 
 	return 0;
-free_all:
-	kfree(rmrru->resv);
 free_rmrru:
 	kfree(rmrru);
 out:
@@ -4461,7 +4453,6 @@ static void intel_iommu_free_dmars(void)
 	list_for_each_entry_safe(rmrru, rmrr_n, &dmar_rmrr_units, list) {
 		list_del(&rmrru->list);
 		dmar_free_dev_scope(&rmrru->devices, &rmrru->devices_cnt);
-		kfree(rmrru->resv);
 		kfree(rmrru);
 	}
 
@@ -5258,22 +5249,33 @@ static void intel_iommu_remove_device(struct device *dev)
 static void intel_iommu_get_resv_regions(struct device *device,
 					 struct list_head *head)
 {
+	int prot = DMA_PTE_READ | DMA_PTE_WRITE;
 	struct iommu_resv_region *reg;
 	struct dmar_rmrr_unit *rmrr;
 	struct device *i_dev;
 	int i;
 
-	rcu_read_lock();
+	down_read(&dmar_global_lock);
 	for_each_rmrr_units(rmrr) {
 		for_each_active_dev_scope(rmrr->devices, rmrr->devices_cnt,
 					  i, i_dev) {
+			struct iommu_resv_region *resv;
+			size_t length;
+
 			if (i_dev != device)
 				continue;
 
-			list_add_tail(&rmrr->resv->list, head);
+			length = rmrr->end_address - rmrr->base_address + 1;
+			resv = iommu_alloc_resv_region(rmrr->base_address,
+						       length, prot,
+						       IOMMU_RESV_DIRECT);
+			if (!resv)
+				break;
+
+			list_add_tail(&resv->list, head);
 		}
 	}
-	rcu_read_unlock();
+	up_read(&dmar_global_lock);
 
 	reg = iommu_alloc_resv_region(IOAPIC_RANGE_START,
 				      IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1,
@@ -5288,10 +5290,8 @@ static void intel_iommu_put_resv_regions(struct device *dev,
 {
 	struct iommu_resv_region *entry, *next;
 
-	list_for_each_entry_safe(entry, next, head, list) {
-		if (entry->type == IOMMU_RESV_MSI)
-			kfree(entry);
-	}
+	list_for_each_entry_safe(entry, next, head, list)
+		kfree(entry);
 }
 
 #ifdef CONFIG_INTEL_IOMMU_SVM
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            148
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [PATCH openEuler-1.0-LTS 01/27] mm, oom: reorganize the oom report in dump_header
                        
                        
by Yang Yingliang 30 Jun '21
                    by Yang Yingliang 30 Jun '21
30 Jun '21
                    
                        From: yuzhoujian <yuzhoujian(a)didichuxing.com>
mainline inclusion
from mainline-5.0-rc1
commit ef8444ea01d7442652f8e1b8a8b94278cb57eafd
category: bugfix
bugzilla: 51815, https://gitee.com/openeuler/kernel/issues/I3IJ9I
CVE: NA
-------------------------------------------------
OOM report contains several sections.  The first one is the allocation
context that has triggered the OOM.  Then we have cpuset context followed
by the stack trace of the OOM path.  The tird one is the OOM memory
information.  Followed by the current memory state of all system tasks.
At last, we will show oom eligible tasks and the information about the
chosen oom victim.
One thing that makes parsing more awkward than necessary is that we do not
have a single and easily parsable line about the oom context.  This patch
is reorganizing the oom report to
1) who invoked oom and what was the allocation request
[  515.902945] tuned invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
2) OOM stack trace
[  515.904273] CPU: 24 PID: 1809 Comm: tuned Not tainted 4.20.0-rc3+ #3
[  515.905518] Hardware name: Inspur SA5212M4/YZMB-00370-107, BIOS 4.1.10 11/14/2016
[  515.906821] Call Trace:
[  515.908062]  dump_stack+0x5a/0x73
[  515.909311]  dump_header+0x55/0x28c
[  515.914260]  oom_kill_process+0x2d8/0x300
[  515.916708]  out_of_memory+0x145/0x4a0
[  515.917932]  __alloc_pages_slowpath+0x7d2/0xa16
[  515.919157]  __alloc_pages_nodemask+0x277/0x290
[  515.920367]  filemap_fault+0x3d0/0x6c0
[  515.921529]  ? filemap_map_pages+0x2b8/0x420
[  515.922709]  ext4_filemap_fault+0x2c/0x40 [ext4]
[  515.923884]  __do_fault+0x20/0x80
[  515.925032]  __handle_mm_fault+0xbc0/0xe80
[  515.926195]  handle_mm_fault+0xfa/0x210
[  515.927357]  __do_page_fault+0x233/0x4c0
[  515.928506]  do_page_fault+0x32/0x140
[  515.929646]  ? page_fault+0x8/0x30
[  515.930770]  page_fault+0x1e/0x30
3) OOM memory information
[  515.958093] Mem-Info:
[  515.959647] active_anon:26501758 inactive_anon:1179809 isolated_anon:0
 active_file:4402672 inactive_file:483963 isolated_file:1344
 unevictable:0 dirty:4886753 writeback:0 unstable:0
 slab_reclaimable:148442 slab_unreclaimable:18741
 mapped:1347 shmem:1347 pagetables:58669 bounce:0
 free:88663 free_pcp:0 free_cma:0
...
4) current memory state of all system tasks
[  516.079544] [    744]     0   744     9211     1345   114688       82             0 systemd-journal
[  516.082034] [    787]     0   787    31764        0   143360       92             0 lvmetad
[  516.084465] [    792]     0   792    10930        1   110592      208         -1000 systemd-udevd
[  516.086865] [   1199]     0  1199    13866        0   131072      112         -1000 auditd
[  516.089190] [   1222]     0  1222    31990        1   110592      157             0 smartd
[  516.091477] [   1225]     0  1225     4864       85    81920       43             0 irqbalance
[  516.093712] [   1226]     0  1226    52612        0   258048      426             0 abrtd
[  516.112128] [   1280]     0  1280   109774       55   299008      400             0 NetworkManager
[  516.113998] [   1295]     0  1295    28817       37    69632       24             0 ksmtuned
[  516.144596] [  10718]     0 10718  2622484  1721372 15998976   267219             0 panic
[  516.145792] [  10719]     0 10719  2622484  1164767  9818112    53576             0 panic
[  516.146977] [  10720]     0 10720  2622484  1174361  9904128    53709             0 panic
[  516.148163] [  10721]     0 10721  2622484  1209070 10194944    54824             0 panic
[  516.149329] [  10722]     0 10722  2622484  1745799 14774272    91138             0 panic
5) oom context (contrains and the chosen victim).
oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0-1,task=panic,pid=10737,uid=0
An admin can easily get the full oom context at a single line which
makes parsing much easier.
Link: http://lkml.kernel.org/r/1542799799-36184-1-git-send-email-ufo19890607@gmai…
Signed-off-by: yuzhoujian <yuzhoujian(a)didichuxing.com>
Acked-by: Michal Hocko <mhocko(a)suse.com>
Cc: Andrea Arcangeli <aarcange(a)redhat.com>
Cc: David Rientjes <rientjes(a)google.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov(a)linux.intel.com>
Cc: Roman Gushchin <guro(a)fb.com>
Cc: Tetsuo Handa <penguin-kernel(a)i-love.sakura.ne.jp>
Cc: Yang Shi <yang.s(a)alibaba-inc.com>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
(cherry picked from commit ef8444ea01d7442652f8e1b8a8b94278cb57eafd)
Signed-off-by: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Signed-off-by: Liu Shixin <liushixin2(a)huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
(cherry picked from commit 985eab72d54b5ac73189d609486526b5e30125ac)
Signed-off-by: Lu Jialin <lujialin4(a)huawei.com>
Reviewed-by: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 include/linux/oom.h    | 10 ++++++++++
 kernel/cgroup/cpuset.c |  4 ++--
 mm/oom_kill.c          | 29 ++++++++++++++++++++---------
 mm/page_alloc.c        |  4 ++--
 4 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 2b2a40cc19bf4..123538b89dc8d 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -15,6 +15,13 @@ struct notifier_block;
 struct mem_cgroup;
 struct task_struct;
 
+enum oom_constraint {
+	CONSTRAINT_NONE,
+	CONSTRAINT_CPUSET,
+	CONSTRAINT_MEMORY_POLICY,
+	CONSTRAINT_MEMCG,
+};
+
 /*
  * Details of the page allocation that triggered the oom killer that are used to
  * determine what should be killed.
@@ -42,6 +49,9 @@ struct oom_control {
 	unsigned long totalpages;
 	struct task_struct *chosen;
 	unsigned long chosen_points;
+
+	/* Used to print the constraint info. */
+	enum oom_constraint constraint;
 };
 
 extern struct mutex oom_lock;
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index a4ce9474a078c..feb91177247c8 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2681,9 +2681,9 @@ void cpuset_print_current_mems_allowed(void)
 	rcu_read_lock();
 
 	cgrp = task_cs(current)->css.cgroup;
-	pr_info("%s cpuset=", current->comm);
+	pr_cont(",cpuset=");
 	pr_cont_cgroup_name(cgrp);
-	pr_cont(" mems_allowed=%*pbl\n",
+	pr_cont(",mems_allowed=%*pbl",
 		nodemask_pr_args(¤t->mems_allowed));
 
 	rcu_read_unlock();
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 2e09b03432c08..51104048b4e7f 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -250,11 +250,11 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
 	return points > 0 ? points : 1;
 }
 
-enum oom_constraint {
-	CONSTRAINT_NONE,
-	CONSTRAINT_CPUSET,
-	CONSTRAINT_MEMORY_POLICY,
-	CONSTRAINT_MEMCG,
+static const char * const oom_constraint_text[] = {
+	[CONSTRAINT_NONE] = "CONSTRAINT_NONE",
+	[CONSTRAINT_CPUSET] = "CONSTRAINT_CPUSET",
+	[CONSTRAINT_MEMORY_POLICY] = "CONSTRAINT_MEMORY_POLICY",
+	[CONSTRAINT_MEMCG] = "CONSTRAINT_MEMCG",
 };
 
 /*
@@ -483,16 +483,25 @@ static void dump_tasks(struct mem_cgroup *memcg, const nodemask_t *nodemask)
 	rcu_read_unlock();
 }
 
+static void dump_oom_summary(struct oom_control *oc, struct task_struct *victim)
+{
+	/* one line summary of the oom killer context. */
+	pr_info("oom-kill:constraint=%s,nodemask=%*pbl",
+			oom_constraint_text[oc->constraint],
+			nodemask_pr_args(oc->nodemask));
+	cpuset_print_current_mems_allowed();
+	pr_cont(",task=%s,pid=%d,uid=%d\n", victim->comm, victim->pid,
+		from_kuid(&init_user_ns, task_uid(victim)));
+}
+
 static void dump_header(struct oom_control *oc, struct task_struct *p)
 {
-	pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=%*pbl, order=%d, oom_score_adj=%hd\n",
-		current->comm, oc->gfp_mask, &oc->gfp_mask,
-		nodemask_pr_args(oc->nodemask), oc->order,
+	pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), order=%d, oom_score_adj=%hd\n",
+		current->comm, oc->gfp_mask, &oc->gfp_mask, oc->order,
 			current->signal->oom_score_adj);
 	if (!IS_ENABLED(CONFIG_COMPACTION) && oc->order)
 		pr_warn("COMPACTION is disabled!!!\n");
 
-	cpuset_print_current_mems_allowed();
 	dump_stack();
 	if (is_memcg_oom(oc))
 		mem_cgroup_print_oom_info(oc->memcg, p);
@@ -503,6 +512,8 @@ static void dump_header(struct oom_control *oc, struct task_struct *p)
 	}
 	if (sysctl_oom_dump_tasks)
 		dump_tasks(oc->memcg, oc->nodemask);
+	if (p)
+		dump_oom_summary(oc, p);
 }
 
 /*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6bf3d4461430e..2b5a60a856680 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3529,13 +3529,13 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	pr_warn("%s: %pV, mode:%#x(%pGg), nodemask=%*pbl\n",
+	pr_warn("%s: %pV, mode:%#x(%pGg), nodemask=%*pbl",
 			current->comm, &vaf, gfp_mask, &gfp_mask,
 			nodemask_pr_args(nodemask));
 	va_end(args);
 
 	cpuset_print_current_mems_allowed();
-
+	pr_cont("\n");
 	dump_stack();
 	warn_alloc_show_mem(gfp_mask, nodemask);
 }
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            26
                            
                          
                          
                            
    
                          
                        
                    30 Jun '21
                    
                        From: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
hulk inclusion
category: feature
bugzilla: 51827
CVE: NA
--------------------------------------
We first kill the process from the low priority memcg if OOM occurs.
If the process is not found, then fallback to normal handle.
Signed-off-by: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 include/linux/memcontrol.h |  12 ++++
 mm/Kconfig                 |  12 ++++
 mm/memcontrol.c            | 127 +++++++++++++++++++++++++++++++++++++
 mm/oom_kill.c              |  52 ++++++++++++++-
 4 files changed, 202 insertions(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index f354e76221db2..c4d4658c7d6df 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -287,6 +287,12 @@ struct mem_cgroup {
 	bool			tcpmem_active;
 	int			tcpmem_pressure;
 
+#ifdef CONFIG_MEMCG_QOS
+	/* Currently support 0 and -1.
+	 * in the future it can expand to other value.
+	 */
+	int	memcg_priority;
+#endif
 #ifdef CONFIG_MEMCG_KMEM
         /* Index in the kmem_cache->memcg_params.memcg_caches array */
 	int kmemcg_id;
@@ -321,6 +327,12 @@ struct mem_cgroup_extension {
 	struct mem_cgroup memcg;
 };
 
+#ifdef CONFIG_MEMCG_QOS
+bool memcg_low_priority_scan_tasks(int (*)(struct task_struct *, void *),
+				   void *);
+void memcg_print_bad_task(void *arg, int ret);
+#endif
+
 /*
  * size of first charge trial. "32" comes from vmscan.c's magic value.
  * TODO: maybe necessary to use big numbers in big irons.
diff --git a/mm/Kconfig b/mm/Kconfig
index 92be0a1ad61f7..7edf3c4c1252b 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -512,6 +512,18 @@ config USERSWAP
 	  Support for User Swap. This is based on userfaultfd. We can implement
 	  our own swapout and swapin functions in usersapce.
 
+config MEMCG_QOS
+	bool "Enable Memory Cgroup Priority"
+	depends on MEMCG
+	depends on X86 || ARM64
+	default y
+	help
+	  MEMCG_QOS means that we first kill the process from the low priority
+	  memcg if OOM occurs. If the process is not found, then fallback to
+	  normal handle.
+
+	  If unsure, say "n".
+
 config CMA
 	bool "Contiguous Memory Allocator"
 	depends on HAVE_MEMBLOCK && MMU
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f401be9d45a5c..31352be988114 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1105,6 +1105,9 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
 			break;
 		}
 	}
+#ifdef CONFIG_MEMCG_QOS
+	memcg_print_bad_task(arg, ret);
+#endif
 	return ret;
 }
 
@@ -3400,6 +3403,119 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css,
 }
 #endif
 
+#ifdef CONFIG_MEMCG_QOS
+static void memcg_qos_init(struct mem_cgroup *memcg)
+{
+	struct mem_cgroup *parent = parent_mem_cgroup(memcg);
+
+	if (!parent)
+		return;
+
+	if (parent->memcg_priority && parent->use_hierarchy)
+		memcg->memcg_priority = parent->memcg_priority;
+}
+
+static s64 memcg_qos_read(struct cgroup_subsys_state *css,
+				      struct cftype *cft)
+{
+	return mem_cgroup_from_css(css)->memcg_priority;
+}
+
+static int memcg_qos_write(struct cgroup_subsys_state *css,
+				       struct cftype *cft, s64 val)
+{
+	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
+
+	if (val >= 0)
+		memcg->memcg_priority = 0;
+	else
+		memcg->memcg_priority = -1;
+
+	return 0;
+}
+
+static struct mem_cgroup *memcg_find_max_usage(struct mem_cgroup *last)
+{
+	struct mem_cgroup *iter, *max_memcg = NULL;
+	struct cgroup_subsys_state *css;
+	unsigned long usage, max_usage = 0;
+
+	rcu_read_lock();
+	css_for_each_descendant_pre(css, &root_mem_cgroup->css) {
+		iter = mem_cgroup_from_css(css);
+
+		if (!iter->memcg_priority || iter == root_mem_cgroup ||
+			iter == last)
+			continue;
+
+		usage = mem_cgroup_usage(iter, false);
+		if (usage > max_usage) {
+			max_usage = usage;
+			max_memcg = iter;
+		}
+	}
+	rcu_read_unlock();
+
+	return max_memcg;
+}
+
+bool memcg_low_priority_scan_tasks(int (*fn)(struct task_struct *, void *),
+				   void *arg)
+{
+	struct mem_cgroup *max, *last = NULL;
+	struct oom_control *oc = arg;
+	struct css_task_iter it;
+	struct task_struct *task;
+	int ret = 0;
+	bool retry = true;
+
+retry:
+	max = memcg_find_max_usage(last);
+	if (!max)
+		return false;
+
+	css_task_iter_start(&max->css, 0, &it);
+	while (!ret && (task = css_task_iter_next(&it))) {
+		if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
+			pr_info("task %s is dying.\n", task->comm);
+			continue;
+		}
+
+		ret = fn(task, arg);
+	}
+	css_task_iter_end(&it);
+
+	if (ret)
+		return false;
+
+	if (!oc->chosen && retry) {
+		last = max;
+		retry = false;
+		goto retry;
+	}
+
+	if (oc->chosen)
+		pr_info("The bad task [%d:%s] is from low-priority memcg.\n",
+				oc->chosen->pid, oc->chosen->comm);
+
+	return oc->chosen ? true : false;
+}
+
+void memcg_print_bad_task(void *arg, int ret)
+{
+	struct oom_control *oc = arg;
+
+	if (!ret && oc->chosen) {
+		struct mem_cgroup *memcg;
+
+		memcg = mem_cgroup_from_task(oc->chosen);
+		if (memcg->memcg_priority)
+			pr_info("The bad task [%d:%s] is from low-priority memcg.\n",
+				oc->chosen->pid, oc->chosen->comm);
+	}
+}
+#endif
+
 #ifdef CONFIG_NUMA
 static int memcg_numa_stat_show(struct seq_file *m, void *v)
 {
@@ -4324,6 +4440,13 @@ static struct cftype mem_cgroup_legacy_files[] = {
 	{
 		.name = "pressure_level",
 	},
+#ifdef CONFIG_MEMCG_QOS
+	{
+		.name = "qos_level",
+		.read_s64 = memcg_qos_read,
+		.write_s64 = memcg_qos_write,
+	},
+#endif
 #ifdef CONFIG_NUMA
 	{
 		.name = "numa_stat",
@@ -4657,6 +4780,10 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
 		return -ENOMEM;
 	}
 
+#ifdef CONFIG_MEMCG_QOS
+	memcg_qos_init(memcg);
+#endif
+
 	/* Online state pins memcg ID, memcg ID pins CSS */
 	atomic_set(&memcg->id.ref, 1);
 	css_get(css);
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1c8236cbb9022..22a6f88d1f4d9 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -317,6 +317,49 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)
 	return CONSTRAINT_NONE;
 }
 
+#ifdef CONFIG_MEMCG_QOS
+/**
+ * We choose the task in low-priority memcg firstly. For the same state, we
+ * choose the task with the highest number of 'points'.
+ */
+static bool oom_next_task(struct task_struct *task, struct oom_control *oc,
+			unsigned long points)
+{
+	struct mem_cgroup *cur_memcg;
+	struct mem_cgroup *oc_memcg;
+
+
+	if (!points)
+		return true;
+
+	if (!oc->chosen)
+		return false;
+
+	oc_memcg = mem_cgroup_from_task(oc->chosen);
+	cur_memcg = mem_cgroup_from_task(task);
+
+	if (cur_memcg->memcg_priority == oc_memcg->memcg_priority) {
+		if (points < oc->chosen_points)
+			return true;
+		return false;
+	}
+	/* if oc is low-priority, so skip the task */
+	if (oc_memcg->memcg_priority)
+		return true;
+
+	return false;
+}
+#else
+static inline bool oom_next_task(struct task_struct *task,
+				struct oom_control *oc, unsigned long points)
+{
+	if (!points || points < oc->chosen_points)
+		return true;
+
+	return false;
+}
+#endif
+
 static int oom_evaluate_task(struct task_struct *task, void *arg)
 {
 	struct oom_control *oc = arg;
@@ -347,7 +390,7 @@ static int oom_evaluate_task(struct task_struct *task, void *arg)
 	}
 
 	points = oom_badness(task, NULL, oc->nodemask, oc->totalpages);
-	if (!points || points < oc->chosen_points)
+	if (oom_next_task(task, oc, points))
 		goto next;
 
 select:
@@ -376,6 +419,13 @@ static void select_bad_process(struct oom_control *oc)
 	else {
 		struct task_struct *p;
 
+#ifdef CONFIG_MEMCG_QOS
+		if (memcg_low_priority_scan_tasks(oom_evaluate_task, oc)) {
+			oc->chosen_points =
+				oc->chosen_points * 1000 / oc->totalpages;
+			return;
+		}
+#endif
 		rcu_read_lock();
 		for_each_process(p)
 			if (oom_evaluate_task(p, oc))
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            4
                            
                          
                          
                            
    
                          
                        
                    
                    
                        From: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
hulk inclusion
category: feature
bugzilla: 51827
CVE: NA
--------------------------------------
We first kill the process from the low priority memcg if OOM occurs.
If the process is not found, then fallback to normal handle.
Signed-off-by: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
Reviewed-by: Liu Shixin <liushixin2(a)huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 include/linux/memcontrol.h |  12 ++++
 mm/Kconfig                 |  12 ++++
 mm/memcontrol.c            | 127 +++++++++++++++++++++++++++++++++++++
 mm/oom_kill.c              |  49 +++++++++++++-
 4 files changed, 199 insertions(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0a55493f41da0..d59ce25206de4 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -296,6 +296,12 @@ struct mem_cgroup {
 	bool			tcpmem_active;
 	int			tcpmem_pressure;
 
+#ifdef CONFIG_MEMCG_QOS
+	/* Currently support 0 and -1.
+	 * in the future it can expand to other value.
+	 */
+	int	memcg_priority;
+#endif
 #ifdef CONFIG_MEMCG_KMEM
         /* Index in the kmem_cache->memcg_params.memcg_caches array */
 	int kmemcg_id;
@@ -327,6 +333,12 @@ struct mem_cgroup {
 	/* WARNING: nodeinfo must be the last member here */
 };
 
+#ifdef CONFIG_MEMCG_QOS
+bool memcg_low_priority_scan_tasks(int (*)(struct task_struct *, void *),
+				   void *);
+void memcg_print_bad_task(void *arg, int ret);
+#endif
+
 /*
  * size of first charge trial. "32" comes from vmscan.c's magic value.
  * TODO: maybe necessary to use big numbers in big irons.
diff --git a/mm/Kconfig b/mm/Kconfig
index 8225489c6439d..12601505c4a4a 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -516,6 +516,18 @@ config USERSWAP
 	  Support for User Swap. This is based on userfaultfd. We can implement
 	  our own swapout and swapin functions in usersapce.
 
+config MEMCG_QOS
+	bool "Enable Memory Cgroup Priority"
+	depends on MEMCG
+	depends on X86 || ARM64
+	default y
+	help
+	  MEMCG_QOS means that we first kill the process from the low priority
+	  memcg if OOM occurs. If the process is not found, then fallback to
+	  normal handle.
+
+	  If unsure, say "n".
+
 config CMA
 	bool "Contiguous Memory Allocator"
 	depends on HAVE_MEMBLOCK && MMU
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6b4b487f6ce75..5b90dd9871878 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1240,6 +1240,9 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
 			break;
 		}
 	}
+#ifdef CONFIG_MEMCG_QOS
+	memcg_print_bad_task(arg, ret);
+#endif
 	return ret;
 }
 
@@ -3641,6 +3644,119 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css,
 }
 #endif
 
+#ifdef CONFIG_MEMCG_QOS
+static void memcg_qos_init(struct mem_cgroup *memcg)
+{
+	struct mem_cgroup *parent = parent_mem_cgroup(memcg);
+
+	if (!parent)
+		return;
+
+	if (parent->memcg_priority && parent->use_hierarchy)
+		memcg->memcg_priority = parent->memcg_priority;
+}
+
+static s64 memcg_qos_read(struct cgroup_subsys_state *css,
+				      struct cftype *cft)
+{
+	return mem_cgroup_from_css(css)->memcg_priority;
+}
+
+static int memcg_qos_write(struct cgroup_subsys_state *css,
+				       struct cftype *cft, s64 val)
+{
+	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
+
+	if (val >= 0)
+		memcg->memcg_priority = 0;
+	else
+		memcg->memcg_priority = -1;
+
+	return 0;
+}
+
+static struct mem_cgroup *memcg_find_max_usage(struct mem_cgroup *last)
+{
+	struct mem_cgroup *iter, *max_memcg = NULL;
+	struct cgroup_subsys_state *css;
+	unsigned long usage, max_usage = 0;
+
+	rcu_read_lock();
+	css_for_each_descendant_pre(css, &root_mem_cgroup->css) {
+		iter = mem_cgroup_from_css(css);
+
+		if (!iter->memcg_priority || iter == root_mem_cgroup ||
+			iter == last)
+			continue;
+
+		usage = mem_cgroup_usage(iter, false);
+		if (usage > max_usage) {
+			max_usage = usage;
+			max_memcg = iter;
+		}
+	}
+	rcu_read_unlock();
+
+	return max_memcg;
+}
+
+bool memcg_low_priority_scan_tasks(int (*fn)(struct task_struct *, void *),
+				   void *arg)
+{
+	struct mem_cgroup *max, *last = NULL;
+	struct oom_control *oc = arg;
+	struct css_task_iter it;
+	struct task_struct *task;
+	int ret = 0;
+	bool retry = true;
+
+retry:
+	max = memcg_find_max_usage(last);
+	if (!max)
+		return false;
+
+	css_task_iter_start(&max->css, 0, &it);
+	while (!ret && (task = css_task_iter_next(&it))) {
+		if (test_tsk_thread_flag(task, TIF_MEMDIE)) {
+			pr_info("task %s is dying.\n", task->comm);
+			continue;
+		}
+
+		ret = fn(task, arg);
+	}
+	css_task_iter_end(&it);
+
+	if (ret)
+		return false;
+
+	if (!oc->chosen && retry) {
+		last = max;
+		retry = false;
+		goto retry;
+	}
+
+	if (oc->chosen)
+		pr_info("The bad task [%d:%s] is from low-priority memcg.\n",
+				oc->chosen->pid, oc->chosen->comm);
+
+	return oc->chosen ? true : false;
+}
+
+void memcg_print_bad_task(void *arg, int ret)
+{
+	struct oom_control *oc = arg;
+
+	if (!ret && oc->chosen) {
+		struct mem_cgroup *memcg;
+
+		memcg = mem_cgroup_from_task(oc->chosen);
+		if (memcg->memcg_priority)
+			pr_info("The bad task [%d:%s] is from low-priority memcg.\n",
+				oc->chosen->pid, oc->chosen->comm);
+	}
+}
+#endif
+
 #ifdef CONFIG_NUMA
 
 #define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
@@ -4596,6 +4712,13 @@ static struct cftype mem_cgroup_legacy_files[] = {
 	{
 		.name = "pressure_level",
 	},
+#ifdef CONFIG_MEMCG_QOS
+	{
+		.name = "qos_level",
+		.read_s64 = memcg_qos_read,
+		.write_s64 = memcg_qos_write,
+	},
+#endif
 #ifdef CONFIG_NUMA
 	{
 		.name = "numa_stat",
@@ -4947,6 +5070,10 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
 		return -ENOMEM;
 	}
 
+#ifdef CONFIG_MEMCG_QOS
+	memcg_qos_init(memcg);
+#endif
+
 	/* Online state pins memcg ID, memcg ID pins CSS */
 	atomic_set(&memcg->id.ref, 1);
 	css_get(css);
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 0dbd6d2a31733..f46c8fa9a1254 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -318,6 +318,49 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)
 	return CONSTRAINT_NONE;
 }
 
+#ifdef CONFIG_MEMCG_QOS
+/**
+ * We choose the task in low-priority memcg firstly. For the same state, we
+ * choose the task with the highest number of 'points'.
+ */
+static bool oom_next_task(struct task_struct *task, struct oom_control *oc,
+			unsigned long points)
+{
+	struct mem_cgroup *cur_memcg;
+	struct mem_cgroup *oc_memcg;
+
+
+	if (!points)
+		return true;
+
+	if (!oc->chosen)
+		return false;
+
+	oc_memcg = mem_cgroup_from_task(oc->chosen);
+	cur_memcg = mem_cgroup_from_task(task);
+
+	if (cur_memcg->memcg_priority == oc_memcg->memcg_priority) {
+		if (points < oc->chosen_points)
+			return true;
+		return false;
+	}
+	/* if oc is low-priority, so skip the task */
+	if (oc_memcg->memcg_priority)
+		return true;
+
+	return false;
+}
+#else
+static inline bool oom_next_task(struct task_struct *task,
+				struct oom_control *oc, unsigned long points)
+{
+	if (!points || points < oc->chosen_points)
+		return true;
+
+	return false;
+}
+#endif
+
 static int oom_evaluate_task(struct task_struct *task, void *arg)
 {
 	struct oom_control *oc = arg;
@@ -348,7 +391,7 @@ static int oom_evaluate_task(struct task_struct *task, void *arg)
 	}
 
 	points = oom_badness(task, NULL, oc->nodemask, oc->totalpages);
-	if (!points || points < oc->chosen_points)
+	if (oom_next_task(task, oc, points))
 		goto next;
 
 select:
@@ -377,6 +420,10 @@ static void select_bad_process(struct oom_control *oc)
 	else {
 		struct task_struct *p;
 
+#ifdef CONFIG_MEMCG_QOS
+		if (memcg_low_priority_scan_tasks(oom_evaluate_task, oc))
+			return;
+#endif
 		rcu_read_lock();
 		for_each_process(p)
 			if (oom_evaluate_task(p, oc))
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            3
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [PATCH kernel-4.19 1/6] share_pool: Set initial value to variable node_id
                        
                        
by Yang Yingliang 30 Jun '21
                    by Yang Yingliang 30 Jun '21
30 Jun '21
                    
                        From: Peng Wu <wupeng58(a)huawei.com>
ascend inclusion
category: bugfix
bugzilla: NA
CVE: NA
-------------------------------------------
Setting an initial value to variable node_id in function
shmem_getpage_gfp. Otherwise, Oops is triggered in some
scenarios.
[20987.530901] Internal error: Oops: 96000007 [#1] SMP
[20987.541162] Modules linked in: cfg80211 rfkill ib_isert iscsi_target_mod rpcrdma ib_srpt target_core_mod dm_mirror dm_region_hash ib_srp scsi_transport_srp dm_log sunrpc dm_mod ib_ipoib rdma_ucm ib_uverbs ib_iser ib_umad rdma_cm ib_cm iw_cm aes_ce_blk crypto_simd cryptd hns_roce_hw_v2 aes_ce_cipher ghash_ce hns_roce sha1_ce ib_core sg ipmi_ssif hi_sfc sbsa_gwdt mtd sch_fq_codel ip_tables realtek hclge hinic sha2_ce sha256_arm64 hns3 ipmi_si hisi_sas_v3_hw hibmc_drm host_edma_drv hnae3 hisi_sas_main ipmi_devintf ipmi_msghandler
[20987.639396] Process move_pages03 (pid: 40173, stack limit = 0x00000000804b9d00)
[20987.654773] CPU: 50 PID: 40173 Comm: move_pages03 Kdump: loaded Not tainted 4.19.195+ #1
[20987.671794] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 1.08 12/14/2019
[20987.687355] pstate: 80400009 (Nzcv daif +PAN -UAO)
[20987.697433] pc : __alloc_pages_nodemask+0x7c/0xdc0
[20987.707510] lr : alloc_pages_vma+0xac/0x318
[20987.716304] sp : ffff0001537cb690
[20987.723268] x29: ffff0001537cb690 x28: 00000000006200ca
[20987.734439] x27: 0000000000000000 x26: ffff802fd24439c8
[20987.745610] x25: 0000000000000000 x24: 00000000ffff0000
[20987.756782] x23: 0000000000000000 x22: 0000000000000000
[20987.767952] x21: 00000000ffff0000 x20: ffff000009b69000
[20987.779123] x19: ffff802fd24439c8 x18: 0000000000000000
[20987.790294] x17: 0000000000000000 x16: 0000000000000000
[20987.801466] x15: 0000000000000000 x14: 0000000000000000
[20987.812637] x13: 0000000000000000 x12: 0000000000000000
[20987.823808] x11: ffff000009b69748 x10: 0000000000000040
[20987.834978] x9 : 0000000000000000 x8 : ffff0001537cb978
[20987.846149] x7 : 0000000000000000 x6 : 000000000000003f
[20987.857320] x5 : 0000000000000000 x4 : 00000000007fffff
[20987.868491] x3 : ffff000009b6c998 x2 : 0000000000000000
[20987.879662] x1 : 0000000000250015 x0 : ffff000009b69788
[20987.890833] Call trace:
[20987.895970] __alloc_pages_nodemask+0x7c/0xdc0
[20987.905312] alloc_pages_vma+0xac/0x318
[20987.913374] shmem_alloc_page+0x6c/0xc0
[20987.921436] shmem_alloc_and_acct_page+0x124/0x1f8
[20987.931510] shmem_getpage_gfp+0x16c/0x1028
[20987.940305] shmem_fault+0x94/0x2a0
[20987.947636] __do_fault+0x50/0x220
[20987.954784] do_shared_fault+0x28/0x228
[20987.962846] __handle_mm_fault+0x610/0x8f0
[20987.971457] handle_mm_fault+0xe4/0x1d8
[20987.979520] do_page_fault+0x210/0x4f8
[20987.987398] do_translation_fault+0xa8/0xbc
[20987.996192] do_mem_abort+0x68/0x118
[20988.003706] el0_da+0x24/0x28
[20988.009941] Code: b9404c64 72a004a1 b9401062 0a04039c (f875d800)
Fixes: d3edfd4f60bae ("share_pool: Alloc shared memory on a specified memory node")
Signed-off-by: Peng Wu <wupeng58(a)huawei.com>
Reviewed-by: 为珑 陈 <chenweilong(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
 mm/shmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index f08d5ce17a092..4522348cfc189 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1737,7 +1737,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 	int error;
 	int once = 0;
 	int alloced = 0;
-	int node_id;
+	int node_id = shmem_node_id(vma);
 
 	if (index > (MAX_LFS_FILESIZE >> PAGE_SHIFT))
 		return -EFBIG;
@@ -1889,7 +1889,6 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 			goto alloc_nohuge;
 		}
 
-		node_id = shmem_node_id(vma);
 
 alloc_huge:
 		page = shmem_alloc_and_acct_page(gfp, inode, index, true,
-- 
2.25.1
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            5