mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bence Csokas <bence.csokas@arm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	 Conor Dooley <conor@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	 Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-kernel@vger.kernel.org, Bence Csokas <bence.csokas@arm.com>
Subject: [PATCH RFC] Why does cpu_cache_invalidate_memregion() return 0 if there are no handlers?
Date: Tue, 22 Sep 2026 09:29:30 +0200	[thread overview]
Message-ID: <20260922-cci_enxio-v1-0-00bade212729@arm.com> (raw)

I noticed cpu_cache_invalidate_memregion() returns 0 if there are no
registered `cache_coherency_ops_inst`s, which I find counter-intuitive.

Is this intended?

From what I've seen, there are no in-tree users who do not check
cpu_cache_has_invalidate_memregion(). However, IMO the better solution
would be if the function would perform this check, and not the callee.

Furthermore, arch/x86/mm/pat/set_memory.c also implements this function,
but actually does the feature check, and WARNs and returns -ENXIO if it
fails that check.

As part of this RFC, I'll attach a patch that provides a low-overhead fix.

Signed-off-by: Bence Csokas <bence.csokas@arm.com>
---
Bence Csokas (1):
      cache: Make cpu_cache_invalidate_memregion() error out if there are no handlers

 lib/cache_maint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-cci_enxio-f3d31d9acec7

Best regards,
--  
Bence Csokas <bence.csokas@arm.com>


             reply	other threads:[~2026-09-22  7:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  7:29 Bence Csokas [this message]
2026-09-22  7:29 ` [PATCH RFC] cache: Make cpu_cache_invalidate_memregion() error out if there are no handlers Bence Csokas
2026-09-23  1:48   ` Jonathan Cameron
2026-09-23  2:18   ` Andrew Morton
2026-09-23  8:21     ` Bence Csókás
2026-09-23 17:31       ` Jonathan Cameron
2026-09-29 12:29         ` Bence Csókás
2026-09-30 17:29           ` Jonathan Cameron

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=20260922-cci_enxio-v1-0-00bade212729@arm.com \
    --to=bence.csokas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=conor@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangyicong@hisilicon.com \
    /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

all inboxes | Powered by JetHome®