The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "Will Deacon" <will@kernel.org>,
	"Nicolin Chen" <nicolinc@nvidia.com>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Jean-Philippe Brucker" <jpb@kernel.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Mikołaj Lenczewski" <miko.lenczewski@arm.com>,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3-sva: Enable Hardware Access and Hardware Dirty bits
Date: Wed, 13 May 2026 17:38:31 +0000	[thread overview]
Message-ID: <agS3FzgDlMADXU1e@google.com> (raw)
In-Reply-To: <20260513143213.GA787748@nvidia.com>

On Wed, May 13, 2026 at 11:32:13AM -0300, Jason Gunthorpe wrote:
> On Wed, May 13, 2026 at 02:27:48PM +0000, Pranjal Shrivastava wrote:
> 
> > Now, if we're work on an SVA page, with only SMMU supporting HTTU. A DMA
> > writes to the page and the process (CPU) calls fsync(). IIUC, it performs
> > a lookup in the Page Cache specifically for folios tagged as DIRTY.
> > Since, vmscan didn't run yet, this could potentally drop the writes..
> 
> How does it work differently in the MM when the CPU has BBM support?

Hmm... I looked at fsync and I see that it eventually calls 
folio_mkclean() (via writeback [1]), which performs an rmap_walk() [2]
to harvest dirty bits from PTEs into the respective struct folios.
Similarly, the vm_scan path does the same thing via try_to_unmap [3].

Since the MM subsystem actively scans the tables during writeback, it
doesn't matter if the dirty bits were flipped asynchronously by HW (w/o
kernel traps).

I guess that settles it, we don't need to gate this behind cpu_has_hw_af()
and we need not care about the CONFIG_ARM64_HW_AFDBM either.

Reviewed by: Pranjal Shrivastava <praan@google.com>

Thanks,
Praan

[1] https://elixir.bootlin.com/linux/v7.1-rc3/source/mm/page-writeback.c#L2905
[2] https://elixir.bootlin.com/linux/v7.1-rc3/source/mm/rmap.c#L1103
[3] https://elixir.bootlin.com/linux/v7.1-rc3/source/mm/rmap.c#L2164

  reply	other threads:[~2026-05-13 17:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260503135413.1108138-1-nicolinc@nvidia.com>
2026-05-07 22:30 ` [PATCH] iommu/arm-smmu-v3-sva: Enable Hardware Access and Hardware Dirty bits Pranjal Shrivastava
2026-05-08 12:35   ` Jason Gunthorpe
2026-05-08 13:12     ` Pranjal Shrivastava
2026-05-08 13:27       ` Jason Gunthorpe
2026-05-08 13:31       ` Robin Murphy
2026-05-08 13:57         ` Pranjal Shrivastava
2026-05-08 14:24           ` Robin Murphy
2026-05-09  7:56             ` Nicolin Chen
2026-05-11 13:22               ` Pranjal Shrivastava
2026-05-13 11:42                 ` Will Deacon
2026-05-13 14:27                   ` Pranjal Shrivastava
2026-05-13 14:32                     ` Jason Gunthorpe
2026-05-13 17:38                       ` Pranjal Shrivastava [this message]
2026-05-11 13:21             ` Pranjal Shrivastava

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=agS3FzgDlMADXU1e@google.com \
    --to=praan@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jpb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miko.lenczewski@arm.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=will@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