[PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

Subsystems: performance events subsystem, the rest

STALE584d

7 messages, 3 authors, 2025-03-14 · open the first message on its own page

[PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Tao Chen <hidden>
Date: 2025-03-13 05:11:23

The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
 kernel/events/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
 
 static void perf_output_wakeup(struct perf_output_handle *handle)
 {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
 
 	handle->event->pending_wakeup = 1;
 
-- 
2.43.0

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Ingo Molnar <mingo@kernel.org>
Date: 2025-03-13 10:05:48

* Tao Chen [off-list ref] wrote:
quoted hunk
The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
 kernel/events/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
 
 static void perf_output_wakeup(struct perf_output_handle *handle)
 {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
So what does EPOLLRDNORM mean to begin with? There doesn't seem to be 
separate/specific handling of it anywhere in the kernel that I can 
see...

Thanks,

	Ingo

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Tao Chen <hidden>
Date: 2025-03-13 17:03:24

在 2025/3/13 18:05, Ingo Molnar 写道:
* Tao Chen [off-list ref] wrote:
quoted
The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
  kernel/events/ring_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
  
  static void perf_output_wakeup(struct perf_output_handle *handle)
  {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
So what does EPOLLRDNORM mean to begin with? There doesn't seem to be
separate/specific handling of it anywhere in the kernel that I can
see...
It seems that if user set pollfd with POLLRDNORM, perf_poll will not return until timeout even if perf_output_wakeup called, whereas POLLIN returns.
Thanks,

	Ingo

-- 
Best Regards
Tao Chen

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Ingo Molnar <mingo@kernel.org>
Date: 2025-03-13 17:09:51

* Tao Chen [off-list ref] wrote:
在 2025/3/13 18:05, Ingo Molnar 写道:
quoted
* Tao Chen [off-list ref] wrote:
quoted
The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
  kernel/events/ring_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
  static void perf_output_wakeup(struct perf_output_handle *handle)
  {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
So what does EPOLLRDNORM mean to begin with? There doesn't seem to be
separate/specific handling of it anywhere in the kernel that I can
see...
It seems that if user set pollfd with POLLRDNORM, perf_poll will not return
until timeout even if perf_output_wakeup called, whereas POLLIN returns.
Mind adding this to the changelog, and explain that this patch fixes 
this particular poll() functionality and semantics for userspace?

Thanks,

	Ingo

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Tao Chen <hidden>
Date: 2025-03-13 23:26:39

在 2025/3/14 01:09, Ingo Molnar 写道:
explain that this patch fixes
this particular poll() functionality and semantics
will do it, thanks.

-- 
Best Regards
Tao Chen

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Namhyung Kim <namhyung@kernel.org>
Date: 2025-03-14 02:31:34

Hello,

On Thu, Mar 13, 2025 at 06:09:45PM +0100, Ingo Molnar wrote:
* Tao Chen [off-list ref] wrote:
quoted
在 2025/3/13 18:05, Ingo Molnar 写道:
quoted
* Tao Chen [off-list ref] wrote:
quoted
The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
  kernel/events/ring_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
  static void perf_output_wakeup(struct perf_output_handle *handle)
  {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
So what does EPOLLRDNORM mean to begin with? There doesn't seem to be
separate/specific handling of it anywhere in the kernel that I can
see...
It seems that if user set pollfd with POLLRDNORM, perf_poll will not return
until timeout even if perf_output_wakeup called, whereas POLLIN returns.
Mind adding this to the changelog, and explain that this patch fixes 
this particular poll() functionality and semantics for userspace?
Off topic, but I think it should return something (either POLLHUP or
POLLERR) when the event goes to an error state like pinned events are
not scheduled.

Thanks,
Namhyung

Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Ingo Molnar <mingo@kernel.org>
Date: 2025-03-14 08:39:06

* Namhyung Kim [off-list ref] wrote:
Hello,

On Thu, Mar 13, 2025 at 06:09:45PM +0100, Ingo Molnar wrote:
quoted
* Tao Chen [off-list ref] wrote:
quoted
在 2025/3/13 18:05, Ingo Molnar 写道:
quoted
* Tao Chen [off-list ref] wrote:
quoted
The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <redacted>
---
  kernel/events/ring_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
  static void perf_output_wakeup(struct perf_output_handle *handle)
  {
-	atomic_set(&handle->rb->poll, EPOLLIN);
+	atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);
So what does EPOLLRDNORM mean to begin with? There doesn't seem to be
separate/specific handling of it anywhere in the kernel that I can
see...
It seems that if user set pollfd with POLLRDNORM, perf_poll will not return
until timeout even if perf_output_wakeup called, whereas POLLIN returns.
Mind adding this to the changelog, and explain that this patch fixes 
this particular poll() functionality and semantics for userspace?
Off topic, but I think it should return something (either POLLHUP or
POLLERR) when the event goes to an error state like pinned events are
not scheduled.
Mind sending a patch for that?

Thanks,

	Ingo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help