From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BD19C32694D; Thu, 19 Feb 2026 20:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771534198; cv=none; b=Zvgs/MUDmQmQx4XS8OrVIMPkcN/nyBiPRN/OCO9mPUzfg+mcCfPTcY/0Vwq1fEUTbaf0zrhjG7ruDTWOdNsbyseZeIwpdWASY3Po4ro2bOlC+UQ9YoKEi6qKhQoaFXbF4AqahBgIpjk+Jo7KYrnnW5mNYxoabMc1Xcecw2djj4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771534198; c=relaxed/simple; bh=HdS/P0tdqNUoUZPeNdLLdFO4qi/wOAr6/xUSt/yHgqM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=sixJsyc0WeULivqdMutIwRksoF8n34tXOJ50nDZzq5Jb0C0zxB/I8+QX9UXfifZ4eTeoA5WMsbiRtAZWMFm+bpLDzVZZ/aula5XUgNn4czR+nc634FUyPjgc2HOKYV59bR+KI36D2w1z7wyxTvTbu0srfAukiU+kc9AlJD4UzYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UIYuzZku; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UIYuzZku" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97482C2BCB1; Thu, 19 Feb 2026 20:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771534198; bh=HdS/P0tdqNUoUZPeNdLLdFO4qi/wOAr6/xUSt/yHgqM=; h=Date:From:To:Cc:Subject:References:From; b=UIYuzZkun41KUKuwyOvXv0jEyKxFYB3G8w6fcKxPKXxZxD5g+Oo0WrSnqQvt0uQEn Png98HwWP2S47M5decjDIT0Li9EJnR0O0WrRK13w9zkB0jWGu8f9sHjxZwD9znZADJ VgWTeQF0pT2YeiOvlGzlLUGWFiWwyl+8xs/VntXrB1GlH2PpM9VLwmfZZT0MqX5VFo jPzZjuw2XrbIz2nTk6ADJ8x4hRQLFRMrMFYEiclmLlJaNM7vEbdxNmsGxhnYCkn1Nf qg/npPLNloNmqu1bbvd/T0XIaQTCKZ5RMDM3j4P+dzagTEg0n3c8j77t1OytwR13J8 IT2CxT2Ja8XPw== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1vtAyL-00000000khG-23i4; Thu, 19 Feb 2026 15:50:05 -0500 Message-ID: <20260219205005.354355145@kernel.org> User-Agent: quilt/0.69 Date: Thu, 19 Feb 2026 15:49:52 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, Tom Zanussi , Petr Pavlu Subject: [for-linus][PATCH 5/5] tracing: Wake up poll waiters for hist files when removing an event References: <20260219204947.830172370@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Petr Pavlu The event_hist_poll() function attempts to verify whether an event file is being removed, but this check may not occur or could be unnecessarily delayed. This happens because hist_poll_wakeup() is currently invoked only from event_hist_trigger() when a hist command is triggered. If the event file is being removed, no associated hist command will be triggered and a waiter will be woken up only after an unrelated hist command is triggered. Fix the issue by adding a call to hist_poll_wakeup() in remove_event_file_dir() after setting the EVENT_FILE_FL_FREED flag. This ensures that a task polling on a hist file is woken up and receives EPOLLERR. Cc: stable@vger.kernel.org Cc: Mathieu Desnoyers Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Link: https://patch.msgid.link/20260219162737.314231-3-petr.pavlu@suse.com Fixes: 1bd13edbbed6 ("tracing/hist: Add poll(POLLIN) support on hist file") Signed-off-by: Petr Pavlu Signed-off-by: Steven Rostedt (Google) --- include/linux/trace_events.h | 5 +++++ kernel/trace/trace_events.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 0a2b8229b999..37eb2f0f3dd8 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -683,6 +683,11 @@ static inline void hist_poll_wakeup(void) #define hist_poll_wait(file, wait) \ poll_wait(file, &hist_poll_wq, wait) + +#else +static inline void hist_poll_wakeup(void) +{ +} #endif #define __TRACE_EVENT_FLAGS(name, value) \ diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 61fe01dce7a6..b659653dc03a 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -1311,6 +1311,9 @@ static void remove_event_file_dir(struct trace_event_file *file) free_event_filter(file->filter); file->flags |= EVENT_FILE_FL_FREED; event_file_put(file); + + /* Wake up hist poll waiters to notice the EVENT_FILE_FL_FREED flag. */ + hist_poll_wakeup(); } /* -- 2.51.0