From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81911201278 for ; Sat, 15 Aug 2026 02:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786760436; cv=none; b=pdqvSRI5VVVUt7xVG6eYxVt+ZCZP2HgxBjZzZ3T7x+ZfvwK8ItDGouOfXruEMreo0mF42dcSWIYWvoIprSRcLEYfIzOJEdNghZmxdp17f5fTJjBPRRDDYiUqb/43ZYYR90BgjW6+tz7jSg0iZTLGo0JFSYYIQs0Qf48gMQI6aPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786760436; c=relaxed/simple; bh=0GEb5Od/PvQ0CVIdukkmwdJNdI6cQzLzbMS4Sv189cw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PjNeQizXsAtBa3947oEr7/GpXTBmvbwYooceR3O8I5Bdyx5Gaz1YEYwlezl/f7MUkKg4QPDgljVFVjnGx4oD4+dtYSR+WPvrX+bX5+UQ1QKbWhFRNxMzetgzJgr/OiykJb1aykz4JQlUdFW49pOokj1obYieHWkZKKvcF8qg+PA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=f6nVfrY2; arc=none smtp.client-ip=91.218.175.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="f6nVfrY2" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=0GEb5Od/PvQ0CVIdukkmwdJNdI6cQzLzbMS4Sv189cw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1786760431; v=1; x=1787365231; b=f6nVfrY2JKtiSNDY0WwEjg1TYbT1ddb58oJ0yvj+N8+bgMruNBAQCLNgeYf4Oj/vIUKUOuYL N4zzCcbQrI6ngDCkPH4NucnMH8PoP4Y12B0FXYFdySAnLnmTQos/r9wdzyO3ooeo7VCfBEyp2jy qSw7lfZzruqRBeev206qyjpk= X-Envelope-To: linux-kernel@vger.kernel.org Received: from ctao-book.. (111.162.215.50) by smtp.migadu.com with ESMTPS id 1b23676e190949c0; Sat, 15 Aug 2026 02:20:30 +0000 X-Migadu-Flow: FLOW_OUT From: Tao Cui To: tj@kernel.org Cc: void@manifault.com, arighi@nvidia.com, changwoo@igalia.com, mingo@redhat.com, peterz@infradead.org, sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, cui.tao@linux.dev, Tao Cui Subject: [PATCH v2] sched_ext: Don't BUG_ON a destroyed DSQ in process_deferred_reenq_users Date: Sat, 15 Aug 2026 10:20:17 +0800 Message-ID: <20260815022017.3305427-1-cui.tao@linux.dev> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Tao Cui scx_bpf_dsq_reenq() queues a deferred reenq (dru) that runs from run_deferred(), not ops.dispatch(). If the DSQ is destroyed before the dru runs, process_deferred_reenq_users() sees dsq->id == SCX_DSQ_INVALID and hits the BUG_ON. destroy_dsq() doesn't flush pending drus, so just skip. Fixes: 84b1a0ea0b7c ("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") Signed-off-by: Tao Cui --- Change in v2: Only skip SCX_DSQ_INVALID and keep the BUG_ON for other builtin ids instead of skipping every builtin-flagged id, per Tejun. --- kernel/sched/ext/ext.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c index 26dbbbfe5a87..7d097209e778 100644 --- a/kernel/sched/ext/ext.c +++ b/kernel/sched/ext/ext.c @@ -4637,6 +4637,10 @@ static void process_deferred_reenq_users(struct rq *rq) /* see schedule_dsq_reenq() */ smp_mb(); + /* destroy_dsq() may have raced and invalidated @dsq, nothing to reenq */ + if (unlikely(dsq->id == SCX_DSQ_INVALID)) + continue; + BUG_ON(dsq->id & SCX_DSQ_FLAG_BUILTIN); reenq_user(rq, dsq, reenq_flags); } -- 2.43.0