All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
To: sj@kernel.org
Cc: corbet@lwn.net, damon@lists.linux.dev, linux-mm@kvack.org,
	rdunlap@infradead.org, sashiko-bot@kernel.org,
	skhan@linuxfoundation.org,
	Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Subject: Re: [RFC PATCH v0] Docs/mm/damon/design: document data attributes report infra design (beyond page table accessed-bit milestone 2)
Date: Wed, 21 Oct 2026 21:17:08 -0700	[thread overview]
Message-ID: <20261022041708.2690-1-ravis.opensrc@gmail.com> (raw)
In-Reply-To: <20261018200808.379209-1-sj@kernel.org>

Hi SJ,

On Sun, 18 Oct 2026 13:08:07 -0700 SJ Park <sj@kernel.org> wrote:

> Good question.  damon_report_attr() will save the register contents and pid
> into report, too.  And the probe in kdamond context will decode the instruction
> and get the memory address.  For physical address, it will also do the page
> table walk of the process of the pid.

I measured what the samples carry, to see how far decode would go.

On AMD, cpu-cycles:p is IBS Op, and its memory-op samples carry a
hardware data address.  On Intel (Granite Rapids), cycles samples carry
no data address at all; the PEBS memory events
(MEM_INST_RETIRED.ALL_LOADS/ALL_STORES) do.

Share of samples with an address inside the 2 GiB test buffer (random
loads and stores; perf record -d; one run per event):

  Xeon 6960P   cycles:p / cycles:pp / :ppp     0 %
  Xeon 6960P   mem_inst_retired.*:pp          100 %
  EPYC 9555P   cycles:p, cycles:pp, ibs_op//  ~21 % of all samples
                                              (the memory-op ones)

How often the saved AX holds the target address when AX is the base
register (perf record -d --intr-regs=AX; store to (%rax) vs
pointer-chase load mov (%rax), %rax):

  Xeon 6960P   store loop 100 %    pointer-chase loop 0 %
  EPYC 9555P   store loop   0 %    pointer-chase loop 0 %

PEBS saves registers just after the instruction retires, so a load that
overwrites its base register defeats decode.  IBS saves no general
registers (perf reports the registers at the NMI), so decode is not
reliable on AMD.  Decode in kdamond must also survive exec, munmap, exit
and pid reuse.  These are synthetic loops chosen to separate the cases;
how often real code hits the failing case is not measured.

For the physical address, taking it at sample time, while the task is
current, avoids walking a page table that may have changed by the time
kdamond runs.  IBS supplies it when valid; on Intel the producer can
call perf_prepare_sample() in the overflow NMI to do the walk.

So the suggestion is for the first report type to use the PMU-captured
address and load/store flag (AMD cpu-cycles:p; on Intel, the PEBS
memory events, which moves them into milestone 2).  Your call, of
course.

Thanks,
Ravi

  reply	other threads:[~2026-10-22  4:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17 19:57 [RFC PATCH v0] Docs/mm/damon/design: document data attributes report infra design (beyond page table accessed-bit milestone 2) SJ Park
2026-10-18 19:58 ` sashiko-bot
2026-10-18 20:08   ` SJ Park
2026-10-22  4:17     ` Ravi Jonnalagadda [this message]
2026-10-22  5:32       ` SJ Park
2026-10-23 19:48         ` Ravi Jonnalagadda
2026-10-24  0:49           ` SJ Park
2026-10-22  4:17 ` Ravi Jonnalagadda
2026-10-22  5:29   ` SJ Park
2026-10-23 19:51     ` Ravi Jonnalagadda
2026-10-24  0:42       ` SJ Park

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=20261022041708.2690-1-ravis.opensrc@gmail.com \
    --to=ravis.opensrc@gmail.com \
    --cc=corbet@lwn.net \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=rdunlap@infradead.org \
    --cc=sashiko-bot@kernel.org \
    --cc=sj@kernel.org \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.