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 027B08017D for ; Mon, 16 Nov 2026 10:16:43 +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 6AGAFNNb022134; Mon, 16 Nov 2026 13:15:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGAFNNb022134 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794824128; bh=Jd2PerufKVokovO6MBBuEM9oui5yLGR9vSIZ6RVKwBk=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=phldKAJQnt70OzCDvUTqxdJdLIQXCzziixlhclL+KSLsnO6Rn6DLlBNaezM4oGIlT Mw0FoCIvAGPCozYNJajPbcKWccuvULDeYpZhV2pOGg/RettOCQYiBzb8GVkOm15jwu KApF6RYBm6jHle3xrvLwgPRIvr2hx9cN/ff6hQ+1yI0uZ3QNgloaD108vG3fi5oUIk WHULe7/LwOL+PFN2u+X6J87pjRsirjofZ0oezm5P81TlpO7NRCaW1dX4HKz42dUVtX JU6gkeHGPdZW80cUJx6MNcht3HcaL6PMImnUGdKa907ZAdihOGLGQip88jUszpiYPZ QArHcaOvd9KDA== Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AGAFLEj022130 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 13:15:22 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGAFLEj022130 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="UqBAB5QF" Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-492e3189fc9so2080403f8f.1 for ; Mon, 16 Nov 2026 02:15:22 -0800 (PST) X-Gm-Message-State: APuU4Z+ijoiPGhc5FljWwEgJTNarboZPAwDc7fXEDT84Ug+2JffSMpad 1zFFY5bK/oMJ6HOe2KtY+OZC98C9XYU+tQWuxwkOL8g65z4E/pfdceAXWURfQ7ssZSJoPNpbCKn ulmIEmLVpR2SmjPDCBkyRfxUYYwoDTMm3bfc3sT4MTwxwn4eU2RmqJA== X-Gm-Gg: AZFdTZc539/YjSKgwrEPUftcAIfSdaqT96Bcm45QBrEsGP0SVsN2mcC9OTcXwDEMxh2 h0yV0Q8n1/cRMPQWVwXkmw6dBuGWsl+/85X1+AdTzcHNkj1r8cTLJ6VC+b7qXVIBM7xA1ELeVyb pSIQ4vLZBFUeYacbv/NSm0PBN7/OsBgZHj6m/KeBLGqASmWznTMJMK0So6BpzDpAbXDG/7dwpmT xctuS5Zph8uCwaB3zaKImSM56x5Uoc/dlK58z5dCSbLJsnDE/9BO4gWX1Bn5dbE9d+zJE36itn6 D5/YOXa0ow== X-Received: by 2002:a5d:5d0a:0:b0:491:6b1b:7f25 with SMTP id ffacd0b85a97d-49c72e85578mr22472363f8f.45.1794824121230; Mon, 16 Nov 2026 02:15:21 -0800 (PST) X-Received: by 2002:a5d:5d0a:0:b0:491:6b1b:7f25 with SMTP id ffacd0b85a97d-49c72e85578mr22472307f8f.45.1794824120650; Mon, 16 Nov 2026 02:15:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794824120; cv=none; d=google.com; s=arc-20260327; b=h8qs4hpZtqA09SolE7DPKQyvi2bvKYPpO/k4UuE1TE8QYMlXhpdxKIFhpfFBm0HKy/ hop+OM36CdnJZk/XG/Dds4xfQHx2UQdPQrFC6hGVT4KpR4lKQI+h/7U/U3HoewlDOdK3 k+jizP9qsjXg5srBnjVELaff74tFo+cvliWvNv+kqipPneT/V8yoZjzobRN7BfnubV0G j0VqI8aBUXyA5YUmmvZkIwxv3GkbmQ9H8gcpMwTcDSoLjpskC5t5yTh7VSsb+LAXklGE lSfL82oekf9UPfluJyP6uVJtYYNhzZ47xIUR7X0CwhkkrCgKdy0aOAa1ht7W7fZhZaLt w8Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=QKUUXDz4l5MJYvtu9G+Ia9YgHWx/A6TPePv2gWSJV14=; fh=eKAYHx9JmX4YFPlnboSUFzb3a3DTopQh4inu4cRqxMo=; b=RTrp8bwJXghLIlUZUKupFdyCn5sJSferQDxPAFGBeCa6D3KG6bgs0gL4dKNDaX9X9e gES8p2fVvNIX22ky0cJiX8s5KI4Ctd00gpedpnxjUryDPwh217yqxCFIgQr8DIxI5fS6 cTEhw2LRvQiKw3vf2xtXeD4Zf4lo0hz8l+CbwNxnt9W4QVjoSSuKxxOrSai0Yx81Y6jS f5ceHyaB8ZzPvRAhzJ+/6vAoNYLE3EFntyQGMuBbSMGFf1lD96G+Fkt41IVRCkhurbQE WjWJsxLkTJBfeqtxkr+XqYxRPexoFfgjGZnyVbioGFof/wzraE+J0M4y51l2R7nDuR9/ e+1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=UqBAB5QF; 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 ffacd0b85a97d-49c5bd0ff79sor2129108f8f.0.2026.11.16.02.15.20 for (Google Transport Security); Mon, 16 Nov 2026 02:15:20 -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=UqBAB5QF; 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=1794824120; x=1795428920; darn=openvz.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=QKUUXDz4l5MJYvtu9G+Ia9YgHWx/A6TPePv2gWSJV14=; b=UqBAB5QFajKVXdT3TiRC+Y0X4GVb5nd9Mnqn8a3mYzTjUZUOV6ml4JF+kW+I3XnsdK ceKMQ1jY4outJGRjtLwut01zfYEf3oBwGXrrE4GfcrLWIgZUBoNW5pypLv3mbGlTv/BB RUi6CQFOGRhdTCzIzp3/BwUZ8h5+OinNIyY5+w8RBqjHbW5gPELf1jmYrqU+u/0Sd4bw 2NouFiUMI6EmLNWKgU7ndnGbslApwmp9o9zjHohm2Fy7okSHOAWofr5duI1MG2hPU1At QiN56rUwuchd16J+NISbFaEimWeFlWSGHUDBHasfFk2wdK5WjDw/KG/HXJQYPNrXUPTj 9/Ag== X-Received: by 2002:a05:6000:470b:b0:492:8dd4:baf8 with SMTP id ffacd0b85a97d-49c6d453907mr21514796f8f.6.1794824120000; Mon, 16 Nov 2026 02:15:20 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:cf0d:642d:d702:3c24]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c603f4d29sm21071719f8f.35.2026.11.16.02.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 02:15:19 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Mon, 16 Nov 2026 11:15:16 +0100 Message-ID: <20261116101516.154737-1-den@openvz.org> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1] 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