mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bui Duc Phuc <phucduc.bui@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	rafael@kernel.org,  Danilo Krummrich <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH] regcache: disable cache_only before rewriting paging registers
Date: Mon, 13 Jul 2026 21:59:46 +0700	[thread overview]
Message-ID: <CAABR9nHWV_qMWaYOeWroU6cPH3n3pDjbafHmXMeMVfiqC562Aw@mail.gmail.com> (raw)
In-Reply-To: <687d81be-566c-481a-9ece-08526c33ff91@sirena.org.uk>

Hi Mark,

Thanks for the clarification.

>
> Yes, calling regcache_sync() with the cache enabled is not particularly
> sensible - it basically exists to put all the changes made while a
> device was in cache only mode (including due to suspend which is the
> main case for that) onto the device.

That was actually my understanding as well. Initially, I was considering a
patch that would make it unnecessary to explicitly call
regcache_cache_only(map, true) again when regcache_sync() fails.

The idea was roughly:
1. check cache_only at the beginning of regcache_sync(), and if it is
    already true, emit a warning and return immediately;
2.  if regcache_sync() fails, automatically restore cache_only = true
     before returning.

However, after reviewing the existing users of regcache_sync(), I found
that there are several drivers that call regcache_sync() without first calling
regcache_cache_only(map, false). That made me think such a change
could break existing users, so I decided not to pursue that approach.

If the intended usage is indeed that regcache_cache_only(map, false) should
always be set before regcache_sync() is ever used, then I'm happy to revisit
this approach and also prepare follow-up patches for the drivers that don't
currently follow that pattern.

I'd appreciate your thoughts on whether that would be the right direction.

Best regards,
Phuc

  reply	other threads:[~2026-07-13 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  7:30 phucduc.bui
2026-07-13 11:58 ` Mark Brown
2026-07-13 13:07   ` Bui Duc Phuc
2026-07-13 13:43     ` Mark Brown
2026-07-13 14:59       ` Bui Duc Phuc [this message]
2026-07-13 15:06         ` Mark Brown
2026-07-13 21:58           ` Bui Duc Phuc
2026-07-14 11:23             ` Mark Brown
2026-07-14 23:02               ` Bui Duc Phuc

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=CAABR9nHWV_qMWaYOeWroU6cPH3n3pDjbafHmXMeMVfiqC562Aw@mail.gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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