From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B744A3CB2CC for ; Thu, 9 Jul 2026 18:30:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=158.69.130.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783621821; cv=none; b=fG+BSKXBrraYhndPXAiNDss/GWvDLLuzmsvhVqDjag/FDJMnH22Q3jIU+3xHKrKvuB12I2oRXd7lri2ifBl0qZktDxdkMuOZZ60sBllNnrn1Q3H2ZW8klqNbA/3KrKGk6Gwb4f2KNTuMO+gaQ1VyoBkiZ2jAVOY2uHW4S6rRhRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783621821; c=relaxed/simple; bh=2SqKdrMKLsr6INfCSVb9jSJAgLvXGoUzUCU5Gm+qLCw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OwT3aTnDWAGY5Qiq+hC9W5DWWiIM2rIBHPwzd2Mthcz20xk2QQYD48u7zS7RHp0/Hn8kxIRTSG2J1bBolEWTykQ2Sd/7no90j5TBqb6S6BJMz625pzjKDI7tK5t5KivoJY+PGBCnhGbz7ma6XqwYaPiTV5GhTRJkrHVrvGBmxbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=QLyw9/7f; arc=none smtp.client-ip=158.69.130.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="QLyw9/7f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1783621813; bh=52SMGokUgMR5LlapZBScXGzJ+QPGjBMCAhmmyoebgGQ=; h=From:To:Cc:Subject:Date:From; b=QLyw9/7fkvn2sG2i77lqxRj8NdtBZLXGLOX4ZtAqJvsfx6WDCCi2Re+7VVBvz+kkq vfmn64Apj7GkcIyF4VXcRINXUWa6u6FMKqedw0zR2cp+JLQG9EQa0LnPhf7FZrqdpQ wUAz1eRrIwPw6nldAFeax5orFeEbThNd4GFsVU2pgP2aiYBlhN8bt2gOvGWIHrBTKG 2Vi8vNdb+hIeT2WRpyhOOpHKborxZutNPAAObigIGdpSchASSEOILzMem4B1jf6Y71 8W1addwi5QDZN2jycP7USVegWsTg+wtoV6BZstwhAi/iogCDvaV1fYvt/GovGtA+gz xmcnlsAmNzEog== Received: from compudjdev.. (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4gx3RT00D6zVw2; Thu, 09 Jul 2026 14:30:12 -0400 (EDT) From: Mathieu Desnoyers To: "Paul E . McKenney" , Boqun Feng Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers Subject: [PATCH 1/2] hazptrtorture: Fix hazptr ownership issue Date: Thu, 9 Jul 2026 14:29:32 -0400 Message-ID: <20260709183009.6814-1-mathieu.desnoyers@efficios.com> 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 hazptr_torture_acquire is invoked from IPI on remote CPUs. It needs to immediately detach the hazptr from its local task so it can be released from other tasks. Without this fix, the hazptrtorture test fails loudly with a OOPS. It passes with the fix applied. [ This applies on top of linux-rcu dev branch at commit e5ee2ea2d00ae5a0ca53ccf9c9100f2357e1bd08 ] Signed-off-by: Mathieu Desnoyers --- kernel/rcu/hazptrtorture.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/hazptrtorture.c b/kernel/rcu/hazptrtorture.c index 5e7cb594f9e0..4507d0f09b8c 100644 --- a/kernel/rcu/hazptrtorture.c +++ b/kernel/rcu/hazptrtorture.c @@ -370,6 +370,11 @@ static void hazptr_torture_acquire(void *hppp_in) struct hazptr_pending *hppp = hppp_in; hppp->hpp_htp = cur_ops->readlock(&hppp->hpp_hc); + /* + * Acquiring a hazard pointer from a remote CPU. + * Detach hazptr from its task so it can be released by another task. + */ + hazptr_detach_from_task(&hppp->hpp_hc); atomic_long_inc(per_cpu_ptr(&hazptr_torture_acquires_irq, raw_smp_processor_id())); } @@ -411,6 +416,10 @@ hazptr_torture_reader_tail(struct hazptr_pending *hppp, struct torture_random_st preempt_enable(); if (irq_release && !(torture_random(trsp) % irq_release)) { guard(preempt)(); + /* + * Handling release from a remote CPU. + * Detach hazptr from its task so it can be released by another task. + */ hazptr_detach_from_task(&hppp->hpp_hc); cpu = cpumask_next_wrap(smp_processor_id(), cpu_online_mask); smp_call_function_single(cpu, hazptr_torture_release, hppp, 1); @@ -428,8 +437,11 @@ static void hazptr_torture_defer(struct hazptr_pending *hppp, struct torture_ran int cpu = torture_random(trsp) % nr_cpu_ids; struct llist_head *llhp; - hazptr_detach_from_task(&hppp->hpp_hc); guard(preempt)(); + /* + * Handling release from a remote CPU. + * Detach hazptr from its task so it can be released by another task. + */ hazptr_detach_from_task(&hppp->hpp_hc); cpu = cpumask_next_wrap(cpu, cpu_online_mask); llhp = per_cpu_ptr(&hazptr_pending, cpu); -- 2.43.0