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 60AC7803BB for ; Mon, 16 Nov 2026 11:06:17 +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 6AGB501H023058; Mon, 16 Nov 2026 14:05:01 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGB501H023058 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="CpNPSzH3" Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AGB4xEq023054 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 14:04:59 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGB4xEq023054 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4bb66fc3aa6so15011415e9.2 for ; Mon, 16 Nov 2026 03:04:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEDgWf00bZPtzO//BllLDkO/0SwouWmVBzxLwudOZY7qWCUTY95cfrLq8aJ6LbS72phIDYn7Q==@openvz.org X-Gm-Message-State: APuU4Z+x9E7dsqxMSIFNuMRzMiddbzp7Ygp+/6qoPxCf2h7vdltYGvwS dqU9bgeTqRFdumJJ+Wwl3dnfAYpBvFTaV9ssspfk/3s613S4wRTF+tCFj1FTlVokAX/dwGgZXs3 Y68zBE40hiZ3n06p++dHMGvjVMcVrPLp/5bxSi3r9/FvhlLNsvChZSA== X-Gm-Gg: AYBFou3PUUupRws3zmQKednq4/tGTHpL53WFAWmqNblzJ+tJWS3L0YUzEToXHRq94gL ktvuMC5QrcY0B5OHlrIIJIN1BKTzghiCT3G7HuhxJU5kQ7OeUmhPIwiKSyQtoEQlYGsxCi+nmoe iGn2KspY3Zx1dsEM4w67UFLPCYtEkfgyia9vI4jOmdzg+1d2Vdm3Nn264xxmq2b/HF5dcRzh8eb zDz1Lgz/LcMsl8okF37/E1+U49EiKX5vXPLKQarS6/OBA2LKcIlaDPCJ5SDBuFuCvArXZvrBXYs HYbYJpovCtYcBcxY3lHXADq0ye+TihLVCev7N4h3/OEDbL6rTJlK4takBSRveDf5wXjUZQfx0MS gB1tCb+s4+co+nPkdWvOz5rNzNxCtKBw= X-Received: by 2002:a05:600c:3547:b0:4b6:267a:dd6e with SMTP id 5b1f17b1804b1-4bb55a8a402mr205695635e9.28.1794827099495; Mon, 16 Nov 2026 03:04:59 -0800 (PST) X-Received: by 2002:a05:600c:3547:b0:4b6:267a:dd6e with SMTP id 5b1f17b1804b1-4bb55a8a402mr205695015e9.28.1794827098926; Mon, 16 Nov 2026 03:04:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794827098; cv=none; d=google.com; s=arc-20260327; b=lWCZCDZjz8xD18wclItomWasvoFGRV5SxYJibYjEh53LCNGmf3k7p9UqR2igamfpZJ zA+lxJ6X0DK5ecKdPO6tlxzVJyhfPsL23NDbQyjnfADJT48BU8U0vB2+Oi5Xw+HxH9pU xiCVNTALEKSkmPOy0xZwRnHvrN9EwzOpEh1vnlC/uRnY0cRuKzDcKSBkeT+6wbjn2EJT Ik3ffOpek5Pa/8H2p9zZ/FJES1YHa/IcpQ1++sy/a0w0mV0SVbKEv1NXGlwAlUn//JH5 CADsZGZNch61AHYv8U6zEGK/zEJEaTClhYWcDHsi9c0FDy7l6FxtdPeRnlwyh+8VK3o/ 4j7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=plzezx9bXrznh08lPMzhDFvd6yjxHQ3Or/rbl27V0B0=; fh=8+L1GLzK3OTQKnTfH5/my9NmwzU+1/k679YBeB1tMzs=; b=cIZHkUilNnIF82vRKe1jrQjH9EjdjWQr7lDOqgJz3rkmgZvl678r8fwuRftgiIYMj5 Uj5Kqehd7tSzB1V4Nh0F/KIgVtFzn6xuFhKO/FqCda1AnTYtVb+MmBtW3LCJ/j7IT/nZ 9QxjAT6gs30ntjoTyCg11v7/te2CFS7xnlH8KuyXnfAEY4Glqn/1h5nmXIx/EMUweGg3 0pXtHjSyLNdVJVfrgZN0dd8Bg+5KN51eDhCffdi/55XHsS8IOtdK4hKyrtYROrDlg75O bKPMXC4u1xEBHndvWkQuUY+oegvKHWyjdMTTFQ9a26gm5toY20pKoBBnF8T7LdWRBMAg 8YsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=CpNPSzH3; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@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-49c64deb541si18845012f8f.427.2026.11.16.03.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 03:04:58 -0800 (PST) Received-SPF: pass (google.com: domain of vasileios.almpanis@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=CpNPSzH3; spf=pass (google.com: domain of vasileios.almpanis@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=vasileios.almpanis@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:Date:From:Subject:Content-Type: MIME-Version; bh=plzezx9bXrznh08lPMzhDFvd6yjxHQ3Or/rbl27V0B0=; b=CpNPSzH3ZZsP 1EJqTfWXau6X3UIv4ZNyHdXA4ZPabzX+0rZXgWKB2SyJaGLEHoeHoljFKoxzxOVU7Pgz5EMFtlcZX FryYbq4jnmnVGQdXRXEmCbPDNKA0uS0Lw6gztRaOtmJJQjkaWXvldcMWYlToyrvzkfPljecFVnLZx /2ho/Oe7dVs3QKeJQ7jNjXHfaRqT0teCxyO4G1j2lzw9gBMc372D5aCS0Wvt46nSXm63wZw8H5BKe TT7N+rd8ea4ZihsLIoJPxIX+ofaOO2GQ63P/CNbkai4sKs18C8nXEHF3WaQLHyBTOZHzE4mT01SdW 5qsLg63DYIzkV35KrqbFpA==; Received: from [130.117.225.5] (helo=dev010.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xSuRv-000f56-11; Mon, 16 Nov 2026 12:04:50 +0100 MIME-Version: 1.0 From: Vasileios Almpanis To: "Denis V. Lunev" In-Reply-To: <20261116101516.154737-1-den@openvz.org> References: <20261116101516.154737-1-den@openvz.org> Date: Mon, 16 Nov 2026 11:04:56 +0000 Message-Id: <179482709634.766664.14347639737025619145.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1794827098; l=3334; i=vasileios.almpanis@virtuozzo.com; s=20260812; h=from:subject:message-id; bh=CK1+o4iZ6P/1WvCWUNVSs78nywXscQFB1+mia4pXiII=; b=CVRbwh8msexAh1etmaSeDd/S63OKwHtnQOQW0odHRiL5dF0SCkmTesjSXCTxoCc3wQZ/A24q0 t5xx9niTEWqC4gDiTfJH1bKkG0uqRmVdK56L/MfnL40U4Od3ZUqovB0 X-Developer-Key: i=vasileios.almpanis@virtuozzo.com; a=ed25519; pk=HhuHDXAcPva9A8zccWEMRsb36reu+y4IVbBjXKxNUjw= X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [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 > 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 > > 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); LGTM but what about sched_show_task? It looks like it has the same issue. Lets fix it too while we are at it? We could protect it with RCU critical section. -- Vasileios Almpanis _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel