Skip to content

Commit b9f5c38

Browse files
benhor01ctmarinas
authored andcommitted
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: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com> Fixes: 8c90dc6 ("arm_mpam: Probe the hardware features resctrl supports") Reviewed-by: Gavin Shan <gshan@redhat.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent b5a69c4 commit b9f5c38

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/resctrl/mpam_internal.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,12 @@ struct mpam_props {
200200
} PACKED_FOR_KUNIT;
201201

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

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

0 commit comments

Comments
 (0)