We don't need to enable cpuid faults if /proc/vz/cpuid_override was never used. If task was attached to ve before a write to 'cpuid_override' it will not get cpuid faults now. It shouldn't be a problem since the proper use of 'cpuid_override' requires stopping all containers.
https://jira.sw.ru/browse/PSBM-121823 Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com> --- arch/x86/kernel/cpuid_fault.c | 21 ++------------------- kernel/ve/ve.c | 5 ++++- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/arch/x86/kernel/cpuid_fault.c b/arch/x86/kernel/cpuid_fault.c index 1e8ffacc4412..cb6c2216fa8a 100644 --- a/arch/x86/kernel/cpuid_fault.c +++ b/arch/x86/kernel/cpuid_fault.c @@ -1,3 +1,4 @@ +#include <linux/cpuid_override.h> #include <linux/gfp.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -9,25 +10,7 @@ #include <linux/veowner.h> #include <linux/uaccess.h> -struct cpuid_override_entry { - unsigned int op; - unsigned int count; - bool has_count; - unsigned int eax; - unsigned int ebx; - unsigned int ecx; - unsigned int edx; -}; - -#define MAX_CPUID_OVERRIDE_ENTRIES 16 - -struct cpuid_override_table { - struct rcu_head rcu_head; - int size; - struct cpuid_override_entry entries[MAX_CPUID_OVERRIDE_ENTRIES]; -}; - -static struct cpuid_override_table __rcu *cpuid_override __read_mostly; +struct cpuid_override_table __rcu *cpuid_override __read_mostly; static DEFINE_SPINLOCK(cpuid_override_lock); static void cpuid_override_update(struct cpuid_override_table *new_table) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index aad8ce69ca1f..0d4d0ab70369 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -9,6 +9,7 @@ * 've.c' helper file performing VE sub-system initialization */ +#include <linux/cpuid_override.h> #include <linux/ctype.h> #include <linux/init.h> #include <linux/kernel.h> @@ -801,6 +802,7 @@ static void ve_attach(struct cgroup_taskset *tset) { struct cgroup_subsys_state *css; struct task_struct *task; + extern struct cpuid_override_table __rcu *cpuid_override; cgroup_taskset_for_each(task, css, tset) { struct ve_struct *ve = css_to_ve(css); @@ -816,7 +818,8 @@ static void ve_attach(struct cgroup_taskset *tset) /* Leave parent exec domain */ task->parent_exec_id--; - set_tsk_thread_flag(task, TIF_CPUID_OVERRIDE); + if (cpuid_override_on()) + set_tsk_thread_flag(task, TIF_CPUID_OVERRIDE); task->task_ve = ve; } } -- 2.26.2 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel