[RFC PATCH 1/6] arm_mpam: Clean up config update checks in mpam_apply_config()

Dave Martin Dave.Martin at arm.com
Thu Dec 12 09:06:36 PST 2024


Hi all,

On Thu, Dec 12, 2024 at 03:39:55PM +0000, Dave Martin wrote:
> In mpam_apply_config(), a simple memcmp() test is used to check
> whether the config passed by the caller is already installed or
> not.
> 
> This check will never find a match except (very occasionally) by
> accident, since the component's version of the struct contains
> things that the caller won't pass or doesn't know (such as the
> garbage collection record).  There might also be random padding.
> 
> This may result in MSCs being reprogrammed unnecessarily.
> 
> Instead, only compare fields that the caller specified.  If
> anything is present in the caller's config and doesn't match the
> installed config, paste it across.  If nothing was pasted across
> then the MSC reprogramming step is skipped (as the previous code
> attempted to do).
> 
> Signed-off-by: Dave Martin <Dave.Martin at arm.com>
> 
> ---
> 
> There are comments in the code suggesting a change of this sort.
> I may or may not have gone in the right direction with this, and
> I have only tried to clean up the behaviour rather than optimising.
> 
> No attempt is made to skip unnecessary MSC register updates if the MSC
> reprogramming goes ahead.
> 
> NOT well tested, yet.
> ---

Oops, git rebase didn't spot that this patch had already been applied,
due to adjacent hunks inserted in the meantime from other patches.

This patch can be dropped from this series.

[...]

Cheers
---Dave



More information about the linux-arm-kernel mailing list