From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id DE654803BB for ; Mon, 16 Nov 2026 13:46:08 +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 6AGDiskR025925; Mon, 16 Nov 2026 16:44:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGDiskR025925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794836696; bh=Jd2PerufKVokovO6MBBuEM9oui5yLGR9vSIZ6RVKwBk=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=oFikMxeXuCILcTXiV5mPU7yNIu/blfo12CdzsUv8HeSdT9dBsYA5LWVZXyQj1m0uB s7tqV9par/uUuvKeRvUh81PG5C10KMp/UpZYXMMXPe2kSL+yqs3bQD1q1tcczKuoM1 LAlQckdHl+2YvqsyRJ8nwYFi/RBLdfFsUJ95SpByN2w94QiY5jQJbCKyiUqYJLx3x4 YxJX+0yyWx/yDA5FCazbxEaDnjuxInIk5WY/pHm3vnCpZIcD/73+IeAmevb+qa6DzJ m78tZqV74cYATJOpwqHQJK2EAZiqEs8eLt3GRh9VmKSNoHx/w216Df3mhRC8SAbjb+ AOUsaZrURsxDA== Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AGDio61025904 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 16:44:50 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGDio61025904 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="tOZFu2jF" Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a16dc2323cso26635095e9.3 for ; Mon, 16 Nov 2026 05:44:50 -0800 (PST) X-Gm-Message-State: APuU4Z+OWk1ZlFyF6uHtLxaoB3foYBKKWGHG/67t1XWiFiqsNges/VZb rtjxWO/fhK4BsyhJJIEN8s5jcSOVagKZ/SCcjyDZMRhyX4DSjf0hB/Zq9i8zNScgtucGd2l0XgJ JaIhj0YTgDGw0p4KpxuJv82vgwm9iMOa9zFQXpn/cSldMLkW506QbKg== X-Gm-Gg: AYBFou3j4TPLBaECPAi8mQaL8m4PModKefb/wzs7HDs5i52xT5ZUnNBQhHT6maDun6M Iyh4PQ9hbWBD0wgoSe7iH8DPwQozi0b0xAhHoqht4wehCtH180uZnUghgK8IJr8K8tSKmEBqDs7 WfR2sPpcXvBUeCLleMjX7Y6L3q+X/saOKFNV3ZvAWQFtw4zEVQIcLmX/lTxwvjzz+k5ncnSKvyL 5tUA8plknVMBF2i8IuKLc/1VYZrIMO71ZUdFuAIvXaQj0pw6a5zMST9fzNYkcE9AAYvutd1i7db SbrK59Ss1Q== X-Received: by 2002:a05:600c:4746:b0:4a1:813f:2a60 with SMTP id 5b1f17b1804b1-4bb55a6a642mr239016275e9.11.1794836689934; Mon, 16 Nov 2026 05:44:49 -0800 (PST) X-Received: by 2002:a05:600c:4746:b0:4a1:813f:2a60 with SMTP id 5b1f17b1804b1-4bb55a6a642mr239015845e9.11.1794836689606; Mon, 16 Nov 2026 05:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794836689; cv=none; d=google.com; s=arc-20260327; b=pl9Ld3VNCvMO+H+eXjj2UrSST9ejMPVIfmjoax14yZ5ZkH+k5YoskL+vo/s1jGTVPT tPCAkxPHuno6UZEyFyTU+g2LdjzmJVMFMKO7gpH5xwOnaHB271q5Tvn06QQOljkYVsyC PD127ht/sQnqTdSDrcDQ6PJO/9TiP6pw+RH2YF7YtlgZ830ewIoMmGKlYmooX9E4AE5n XLnFizuG4mNP40eDZK59e8YD00Q2KZP41ZVoBI6N5OhdzuNWUkrR0zCEZL/jpA4Y05dI QWyt8yAgQkYgQgw5yY4oddNA1uYU7N9chum88wbiLlt7Y/uYyh7Lzf91wy1qwcGuOMKj mUtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=QKUUXDz4l5MJYvtu9G+Ia9YgHWx/A6TPePv2gWSJV14=; fh=eKAYHx9JmX4YFPlnboSUFzb3a3DTopQh4inu4cRqxMo=; b=BbUxBivjslpYFHsIeYg3F2q4ShK3+4W/ObXiwPYPtnfH0DQSD8+u7Xzwdj2eK8wZ3x doIc0tneBEQVaXSMmylprI5w2RqDSBEw4Zj1s3l7EjQE4rZG9BXyzn/iov/aGQ4CEsFv FFxqmB8/fABC+67VKk7rLfJYtLZUAi3i3i0yO3AqhKVHhfNyOjC+tvWWZd/wF4u6naju zY5jFo3RZKbM3RijZ6wPLXhhlm8zOi8UwrIdQKkfG086atmU+7xZBHBhkHm1WCr3NQ+x 4/BxmsH49W9Pw2D2j++SVxVWQ4dlfZv18m9u12dj2Sh0Nwup22mMA9T9TMKQQkRpMRei zlQQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=tOZFu2jF; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4bb64ef5865sor10643075e9.1.2026.11.16.05.44.49 for (Google Transport Security); Mon, 16 Nov 2026 05:44:49 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) client-ip=2a06:5b06:b600:300:cf0d:642d:d702:3c24; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=tOZFu2jF; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:cf0d:642d:d702:3c24 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794836689; x=1795441489; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QKUUXDz4l5MJYvtu9G+Ia9YgHWx/A6TPePv2gWSJV14=; b=tOZFu2jFotIzRDA/ZbJEUZ67aTrVy2Bh6MViOIGTRN4eTj33oMRTdOAkzWjLc0BHn/ rkDblX+KJ1/Xwh1W9quz+g5RokgJ48kpiTu82dhqFdG0Tbxsfj0u1bqdw5v7N5+OgKVw sCnczrViH4yb5izmAOid36j9EdyhR6/jkJ1RA0fdFbkOpD1vATGy+2brrArzyPpXDODu LqyxNr0AVLncfslIZwya/NEohx3J6qhQe9QKVWei0cDPCalYNis8kkm0y/VfeE9MK663 Qm/rnEzatr9nm0Zq17s2Q0cppN7C4FKZpnQF53abf+BqNUpcRBbxSKbl0BFMoOAcKlJK OCyQ== X-Received: by 2002:a05:600c:1988:b0:4a2:1a:a116 with SMTP id 5b1f17b1804b1-4bb5e2693b0mr192489235e9.0.1794836689122; Mon, 16 Nov 2026 05:44:49 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:cf0d:642d:d702:3c24]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb675200e4sm125713015e9.0.2026.11.16.05.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 05:44:48 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Mon, 16 Nov 2026 14:44:43 +0100 Message-ID: <20261116134445.438480-2-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261116134445.438480-1-den@openvz.org> References: <20261116134445.438480-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 1/3] sched/stats: fix a hard lockup on task_lock in update_sched_lat() 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 From: Denis V. Lunev Commit ead7be4fd3ca ("ve: Switch from ->task_ve to *task_ve() helpers") made update_sched_lat() look the ve up with get_task_ve(), which takes task_lock. update_sched_lat() runs from __update_stats_wait_end() under rq->__lock with interrupts off whenever kernel.sched_schedstats is on, while task_lock is taken elsewhere with interrupts on. Any lock taken in an interrupt and held across a wakeup then closes a cycle. wbt does it on an I/O completion: CPU A: /proc reader CPU B: NVMe irq CPU C: scheduler ------------------- --------------- ---------------- getdents64(/proc/X/fd) task_lock(X) nvme_irq() wbt_done() lock wq __schedule() rq_lock(C) pick X nvme_irq() wbt_done() lock wq -> spins wake W, slept on C: rq_lock(C) -> spins set_next_entity(X) update_sched_lat(X) get_task_ve(X) task_lock(X) -> spins wq is the wbt wait queue of the device and W a writer throttled on it. W slept in iowait on C, so try_to_wake_up() locks C's rq to move the iowait count off it before migrating W. Every other CPU completing I/O on that device then spins on wq too, and the hard lockup detector panics the node. The put_ve() under rq->__lock is unsafe as well: dropping the last reference queues the css release work, and that wakeup may need the rq lock already held. Read the pointer with task_ve() and take no reference, as the code did before that commit. Whoever switches the ve of the task, the old one is freed from css_free after an RCU grace period, and rq->__lock with interrupts off is an RCU read-side critical section. Fixes: ead7be4fd3ca ("ve: Switch from ->task_ve to *task_ve() helpers") https://virtuozzo.atlassian.net/browse/VSTOR-155276 Feature: ve: ve generic structures Signed-off-by: Denis V. Lunev --- kernel/sched/stats.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 08ed7c8a9c4a..ede339b768cf 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -23,10 +23,8 @@ void __update_stats_wait_start(struct rq *rq, struct task_struct *p, static inline void update_sched_lat(struct task_struct *t, u64 delta, u64 now) { #ifdef CONFIG_VE - struct ve_struct *ve __free(put_ve) = get_task_ve(t); - KSTAT_LAT_PCPU_ADD(&kstat_glob.sched_lat, delta); - KSTAT_LAT_PCPU_ADD(&ve->sched_lat_ve, delta); + KSTAT_LAT_PCPU_ADD(&task_ve(t)->sched_lat_ve, delta); t->alloc_lat[KSTAT_SCHED].totlat += delta; t->alloc_lat[KSTAT_SCHED].count++; -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel