public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: "Mikołaj Kołek" <kolek.mikolaj@gmail.com>,
	linux-man@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: perf_event_open.2: mmap ring buffer requirement for receiving overflow notifications
Date: Tue, 26 Nov 2024 11:15:25 +0100	[thread overview]
Message-ID: <20241126101525.scvaunb3fwyv7tun@devuan> (raw)
In-Reply-To: <Z0Vf3lrTUsbE_4NP@google.com>

[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]

Hi Namhyung,

On Mon, Nov 25, 2024 at 09:42:54PM -0800, Namhyung Kim wrote:
> Thanks for the report and the test code.  I agree that the current man
> page is a little confusing about the overflow notification.  I can see
> the following sentences in the "overflow handling" section.
> 
>   There are two ways to generate overflow notifications.
> 
>   The  first is to set a wakeup_events or wakeup_watermark value that
>   will trigger if a certain number of samples or bytes have been
>   written to the mmap ring buffer.  In this case, POLL_IN is indicated.
> 
>   The other way is by use of the PERF_EVENT_IOC_REFRESH ioctl.  This
>   ioctl adds to a counter that decrements each  time  the  event
>   overflows.  When nonzero, POLL_IN is indicated, but once the counter
>   reaches 0 POLL_HUP is indicated and the underlying event is disabled.
> 
> I think the first and the default way uses the ring buffer to determine
> overflow condition so it should be allocated before calling poll(2) or
> similar.  The second way doesn't seem to require ring buffers, but I
> haven't tested it actually.
> 
> Maybe we can add something like this to the first section:
> 
>   If the ring buffer is not allocated, POLL_HUP is indicated.

Thanks!  Would you mind sending a patch?

Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-11-26 10:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-23 20:49 perf_event_open.2: mmap ring buffer requirement for receiving overflow notifications Mikołaj Kołek
2024-11-23 21:29 ` Alejandro Colomar
2024-11-26  5:42 ` Namhyung Kim
2024-11-26 10:15   ` Alejandro Colomar [this message]
2024-11-26 22:13 ` Vince Weaver
2024-12-02 20:53   ` Namhyung Kim
2024-12-04 12:28     ` Peter Zijlstra
2024-12-04 19:30       ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241126101525.scvaunb3fwyv7tun@devuan \
    --to=alx@kernel.org \
    --cc=kolek.mikolaj@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox