Re: [PATCH] regcache: disable cache_only before rewriting paging registers
From: Mark Brown
Date: Tue Jul 14 2026 - 07:25:23 EST
On Tue, Jul 14, 2026 at 04:58:45AM +0700, Bui Duc Phuc wrote:
> As described in the commit message, if regcache_sync() is called while
> cache_only is still enabled, it can return success even though the cache
> and the hardware are still out of sync, with cache_dirty remaining true.
> From the caller's perspective, that seems like a successful synchronization
> even though no synchronization actually occurred.
Right, we didn't explicitly add a check for that - I guess it never
occurred to anyone to do so since it's such a nonsensical thing to do.
> If that's the case, then it seems that neither of these approaches would
> be appropriate:
> 1. Automatically clearing cache_only before writing the selector register.
> 2. Making regcache_sync() reject calls when cache_only is still enabled.
Probably 2 is better.
> Would it then be correct to understand that calling regcache_sync() while
> cache_only is still enabled is simply considered incorrect API usage,
> and that in such a case the responsibility lies with the caller, rather than
> regcache_sync() itself ?
> If so, would it make sense to document this requirement explicitly,
> or perhaps emit a warning when regcache_sync() is called while
> cache_only is still enabled?
Yes.
Attachment:
signature.asc
Description: PGP signature