Commit b9f5c38e authored by Ben Horgan's avatar Ben Horgan Committed by Catalin Marinas
Browse files

arm_mpam: Use non-atomic bitops when modifying feature bitmap



In the test__props_mismatch() kunit test we rely on the struct mpam_props
being packed to ensure memcmp doesn't consider packing. Making it packed
reduces the alignment of the features bitmap and so breaks a requirement
for the use of atomics. As we don't rely on the set/clear of these bits
being atomic, just make them non-atomic.

Reviewed-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: default avatarBen Horgan <ben.horgan@arm.com>
Fixes: 8c90dc68 ("arm_mpam: Probe the hardware features resctrl supports")
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Tested-by: default avatarShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: default avatarPeter Newman <peternewman@google.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent b5a69c48
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -200,8 +200,12 @@ struct mpam_props {
} PACKED_FOR_KUNIT;

#define mpam_has_feature(_feat, x)	test_bit(_feat, (x)->features)
#define mpam_set_feature(_feat, x)	set_bit(_feat, (x)->features)
#define mpam_clear_feature(_feat, x)	clear_bit(_feat, (x)->features)
/*
 * The non-atomic get/set operations are used because if struct mpam_props is
 * packed, the alignment requirements for atomics aren't met.
 */
#define mpam_set_feature(_feat, x)	__set_bit(_feat, (x)->features)
#define mpam_clear_feature(_feat, x)	__clear_bit(_feat, (x)->features)

/* The values for MSMON_CFG_MBWU_FLT.RWBW */
enum mon_filter_options {