From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id DD46C8017D for ; Tue, 6 Oct 2026 14:58:14 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 696Ev1mT025534; Tue, 6 Oct 2026 17:57:02 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Ev1mT025534 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="at02ftb0" Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 696Eup9I025500 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 6 Oct 2026 17:56:52 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Eup9I025500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a009f82bedso14233225e9.0 for ; Tue, 06 Oct 2026 07:56:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxmMej3Mp5eYDsAWpRKgtlQJO3xT5jQ6Xgahb4fTBt6OBhYbI//gDYX9lFaMX0YYh3O4eIMOw==@openvz.org X-Gm-Message-State: AFuF++lgpGmEhxTaFNB/q57t9iN2qMDEOLKx1DcONMsFI9LkCYetUz1U hhIRjuzCGFKAPbFnIaF97Ojc3wkh0qO9b6fx4/v1P9TUyuy2wsmsIufhgLwMhp56E5p1OVfap1/ +j6SG8em5LOcaVjPI8OtE01Q3k2qeCdPJfu8+i+7xByq7pplT9nG4zw== X-Gm-Gg: AYBFou1r7uGDldKCQOLjEts4PNOY1JEGtjlhX11QOTBiL7jADu4N/vZWUBndtXzsg1s /mOYX1w3XVcLqkxUKMi1VL3lhlWBp5aIxeYCKz7B1VfD/MsmSlgTZMssK4aahS7Ac9uSc5YoeLn cx4bQEdnsu2aNNtYui7CuAWe1yuCb0kJAWnsvFt0WvXCEAia86EcV5yRg11xHNEbatHHzGj09ux w6++2t5J+yGVusSU/SoIlhJ4hnXbJhN2JTcy+GJfs4GJjM04VKZOScEtVHNbClcTkNTfJ/BqW0K aBkNXJ0c2/VcEAhqVHeD5jjq/XA2eWMMqA6gJAv5PFNReLF6TFPHDsvzR0L2Ohf9haIiouEw+Jw QeKt28Qoh84xCS2CUKQ== X-Received: by 2002:a05:600c:c16d:b0:49f:ce73:5e94 with SMTP id 5b1f17b1804b1-4a17b55cca1mr25187085e9.34.1791298611598; Tue, 06 Oct 2026 07:56:51 -0700 (PDT) X-Received: by 2002:a05:600c:c16d:b0:49f:ce73:5e94 with SMTP id 5b1f17b1804b1-4a17b55cca1mr25186745e9.34.1791298611025; Tue, 06 Oct 2026 07:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791298611; cv=none; d=google.com; s=arc-20260327; b=q61ZbS/3MUqIPJ/pnn5kwmTVImpsQPbv87L+r4FZ8AepYangrgivWG3bKWlq1Tug4f UfMTKTUAY5VAojR7YJVVZqV1WatngXFup0zr5eG5d5GN6nlomh+atz1gMjXWzqlhscWc zu5/NNR6hmABJJWECWkhu8DxUXjzJIklNB+NuTTPTYMNUieg5UMPfeO/x5zUei9NWNee Tn+0h0wOYz5Kezq3GfhbRFlsvXeYRsoMmh3vn9Gn5/ZrxeJk0U1dIinnANVqcWBRRTpi ttuScf0Yd+sMGq4c23LUXkHesPPW/r7AF5L8wskO5Vu0Mua4qnUr1Pq8FmbRTwIXtfx1 Q9Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=4/G+69KwyrOESPjYDDHRqtLykNTv0mGDfi/NMitsOW8=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=bIH8GfdZrf2CxXUswQkFF+2SnGhFw3dxVGNTVjh/ufq3sOSqRQDhiCrAhL6idI8bCR AmquYjBs8KgMohWP4xUZzynIRmRlCiloPhJM9nhnVakitV+5d87FnV3Q9G+q4NteWVhO VLW/Z3Osx6gTKqSwSqPyLiCnkshcyJFmmmTkRitA/+ydT9YybBZ2hxb7XnRw5/WTLBL9 vbsRLXYbrHMmgX22K+3rJS1DgdzHFkYlgxnqcxQqK9KWU8/3cebyWS223X6wURo4BUez 3JzHW7HorNFvmUD4qya6Mw6OdsCU1UAM4CpbY2nPKGnGYf142AMOPo1PsaU+CVVgswJG 9cKw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=at02ftb0; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48b5b3159f1si25316424f8f.66.2026.10.06.07.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2026 07:56:51 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=at02ftb0; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=4/G+69KwyrOESPjYDDHRqtLykNTv0mGDfi/NMitsOW8=; b=at02ftb0sLJeejCf3B2 i41i3C2tVJay7tSLSSOKczcPU6MEQIi9NBtWUSfmqlYE2TKewU+s07MeoIu9z90zNcFZ18chtt4o9 iuYtGalBzh34cMR5R6LwPKFg5p/PjqbEqyecl9Obn3xh3V/3+deXi26d96dZuGsUu+ZcnYeGLzFH5 oFbW0O2OyLv2k/Z4Z9j/1QDxK0HlHdBj8RoVRF+4MUdV7pZSoS0lSYa5QWJHqe1hL3NfF9P4B9U// xmtCkOi/cpW4aPidqztbp3lG1NYr3zHTgI3UF7GIaIlbHK6ZwzvqGga2A2nSQIm4S5iwHzIVqNThr nApRIdwnPPXLnZQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xE6Xp-00DosW-2u; Tue, 06 Oct 2026 16:56:40 +0200 From: Konstantin Khorenko Date: Tue, 06 Oct 2026 16:56:35 +0200 MIME-Version: 1.0 Message-Id: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v1-2-741609f4f03a@virtuozzo.com> References: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v1-0-741609f4f03a@virtuozzo.com> In-Reply-To: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v1-0-741609f4f03a@virtuozzo.com> To: Pavel Tikhomirov , Vasileios Almpanis X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2528; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=KpAeQeg//S4LBWOdMeFvbbhdn8lXgcPxQfDcnbT2Fb4=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqxQwwbFXpM+X3U6Slhcmd8RcxaVXWrfwksuJ6Y hVPaD+1ZxCJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCasUMMAAKCRBRlgpH+WFc KjRFD/9VD7Wd+u5nC2NGx6JW5G9NR9Ddm6YoZloy3v3+0mG44kEvWaaEdTptxtc3bKccn3xbxO1 BbXQYGAe/pI+9CWfDLNJVZHfNLyQz+J+dWIJBm/unfkWIWDuYuMNAJ/g1n74lQc8Xj2+9Pv0VXU C8CLj70Ar+sXuy4Q+RElrc6XhW+xHFaHv28Dknd+JMlpuJLevgIVKv8FrHqkbzw41EksfxA8SnD ylT9B6u8c7lUhyQgocrnDAj5qNLO6tRR1Zg1D2gX+44nn/yb8bXb9NvnsezA+h65TE+uJ0jWsZl Q3iXY8Jg4rowcX9JhvNiivoGr4z5NO17i+0SwiM69CwgqbmrIFrVLRVKKkde+ZSfKLi2AKuyYEa HVa6ip28yKmmv+8i9mhgxN8bDWEexoqgQKBYfb3DtOTxEs6Uu1oPTIJE8O2Ejn6aeWOpM1HZlxx up79xGCQzAfWBPM+QWOUqNiPk+bpKBIpOPUoCwrIMhkn+0YIA4iDlKlxU9rcamWy8csVvhwKt5j vyPXXzsVgSWtcy1mMmIK7XHN/ox0AB68gg749nwvcdpd7diZqI6yDLWfzMz5jjYr76kadoEfmDx FFveYBWV9pdeEdgfW9KzVAXdf18RRo6Qlh3SwqEgwE2KFHlsYzymTCUYkjK6ZEuowvclf3scuRU +zgNo1DQ0HlMELQ== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 2/5] x86/ve: enable CPUID faulting at once when the current task enters a VE X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org ve_setup_task() only sets TIF_CPUID_OVERRIDE. The MSR follows the flag in __switch_to_xtra(), so a task that enters a VE through unshare() or setns() keeps executing CPUID natively until it is scheduled out for the first time and sees the host values instead of the override table. Add set_cpuid_override(), which sets the flag and, like disable_cpuid(), flips the CPU state synchronously when the task is the current one. Tasks set up through clone() are not running yet and are still handled at their first switch-in. https://virtuozzo.atlassian.net/browse/VSTOR-148843 Feature: x86: cpu pools (cpuid override) Signed-off-by: Konstantin Khorenko --- arch/x86/kernel/process.c | 12 ++++++++++++ include/linux/cpuid_override.h | 3 +++ kernel/ve/ve.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 28fc4168b6c9f..2673f2e51a833 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -381,6 +382,17 @@ static void enable_cpuid(void) preempt_enable(); } +#ifdef CONFIG_VE +void set_cpuid_override(struct task_struct *tsk) +{ + preempt_disable(); + if (!test_and_set_tsk_thread_flag(tsk, TIF_CPUID_OVERRIDE) && + tsk == current) + set_cpuid_faulting(true); + preempt_enable(); +} +#endif + static int get_cpuid_mode(void) { return !test_thread_flag(TIF_NOCPUID); diff --git a/include/linux/cpuid_override.h b/include/linux/cpuid_override.h index 1f5223728c9ba..83a955b628cdf 100644 --- a/include/linux/cpuid_override.h +++ b/include/linux/cpuid_override.h @@ -35,4 +35,7 @@ static inline bool cpuid_override_on(void) { return rcu_access_pointer(cpuid_override); } + +struct task_struct; +void set_cpuid_override(struct task_struct *tsk); #endif diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 579628a8a310a..8df881039c3c6 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1857,7 +1857,7 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *ve) #ifdef CONFIG_X86 if (cpuid_override_on()) - set_tsk_thread_flag(task, TIF_CPUID_OVERRIDE); + set_cpuid_override(task); #endif } EXPORT_SYMBOL(ve_setup_task); -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel