From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.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 CC43B3CAA41; Wed, 30 Sep 2026 19:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790795619; cv=none; b=j7Xd4in6glwGwE5j9XiBKFPEy5013oCBW2p9brUdrql8VSJonny7m8TUqYyylM+k1iFV21tSWQT7acqrO4rm4WhzOXSs5Sb6LammGmV0//DL44vh7Wl1FDlPPJ836aczY+rRAeB330k5mMRSA+aOYnCTfFQb3xmWoqsAwUxWuMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790795619; c=relaxed/simple; bh=V9SgUmwAQMe5m/S2NY3i1wGcA0TU6CYiuSU3wfFGGZw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=faAxbdi7X6eRctzI+iCWp9WQYJnDQfRtfmeozS428HAxIQeDkd/pXwhOIYm9FEKZD9k0xzzP1nWjtSEegOFCtqLDRytgGrux0rh3odq74dyztE4xgq5Kx5keJItApUVsj/Bz57H3/jiCRaxjo6/aO7qOxWvkTiDnfKpb3zHj9r0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vfgfkAzD; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vfgfkAzD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30E111F000FF; Wed, 30 Sep 2026 19:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790795617; bh=KzYDQFihR65lbFB5TZJPFdX4YSpvJz96NuWoZ5RmPrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vfgfkAzD5ANXKtYvskVHrM7N7orRe26X+Beew+kpw7q4U3MTlkjuyCJfQoZqNUoXU pQTv1fXhurrXV9QRwbzMe1dg1wrk3buxrJS3IkgVdqNbG8heHpcB+YZafq5G1gatYq YY5qf5oVlv4P7rhciFwZXlpg25Hgh6nE7ZDdmXko= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vincent Donnefort , Sebastian Andrzej Siewior , Steven Rostedt Subject: [PATCH 6.6 0625/1193] ring-buffer: Acquire the lock with irqsave in rb_wake_up_waiters() Date: Wed, 30 Sep 2026 17:21:49 +0200 Message-ID: <20260930152448.128885847@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152434.301151190@linuxfoundation.org> References: <20260930152434.301151190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior commit 815e07c8fe885a87751c2496a30ae0dcd4118210 upstream. rb_wake_up_waiters() is a irq_work callback which is initialized with init_irq_work(). As such it will be invoked in thread context on PREEMPT_RT. Invoking the callback in IRQ context on PREEMPT_RT is not an option due its usage of wake_up_all(). Since this callback may run in thread context, it needs to acquire ring_buffer_per_cpu::reader_lock with disabling interrupts and may not assume that they are disabled. Use raw_spinlock_irqsave() to acquire ring_buffer_per_cpu::reader_lock. Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260911102152.YEtwkBj9@linutronix.de Fixes: 68282dd930ea3 ("ring-buffer: Fix resetting of shortest_full") Reviewed-by: Vincent Donnefort Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -907,14 +907,13 @@ static void rb_wake_up_waiters(struct ir struct ring_buffer_per_cpu *cpu_buffer = container_of(rbwork, struct ring_buffer_per_cpu, irq_work); - /* Called from interrupt context */ - raw_spin_lock(&cpu_buffer->reader_lock); - rbwork->wakeup_full = false; - rbwork->full_waiters_pending = false; + scoped_guard(raw_spinlock_irqsave, &cpu_buffer->reader_lock) { + rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; - /* Waking up all waiters, they will reset the shortest full */ - cpu_buffer->shortest_full = 0; - raw_spin_unlock(&cpu_buffer->reader_lock); + /* Waking up all waiters, they will reset the shortest full */ + cpu_buffer->shortest_full = 0; + } wake_up_all(&rbwork->full_waiters); }