lkml.org 
[lkml]   [2024]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: Sporadic regmap unit test failure in raw_sync
From
On 2/8/24 14:10, Mark Brown wrote:
> On Thu, Feb 08, 2024 at 01:45:13PM -0800, Guenter Roeck wrote:
>
>> # raw_sync: EXPECTATION FAILED at drivers/base/regmap/regmap-kunit.c:1305
>> Expected &hw_buf[6] != val, but
>> &hw_buf[6] ==
>> 57 30
>> val ==
>> 57 30
>> not ok 4 rbtree-big
>> ok 5 maple-little
>> ok 6 maple-big
>> # raw_sync: pass:5 fail:1 skip:0 total:6
>> not ok 25 raw_sync
>
>> This is with regmap: 'kunit: fix raw noinc write test wrapping'
>> applied on top of the upstream kernel (v6.8-rc3-47-g047371968ffc).
>> So far I have seen it only once, with the x86_64:q35 emulation in qemu.
>
> I guess it's possible that we randomly generated the same value for the
> initial and modified values here?


I think the diffs below should fix the problem. Would that do, or do you
have a better idea ?

Thanks,
Guenter

---
diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
index 4eb18f5d3265..666ece18726f 100644
--- a/drivers/base/regmap/regmap-kunit.c
+++ b/drivers/base/regmap/regmap-kunit.c
@@ -1266,7 +1266,11 @@ static void raw_sync(struct kunit *test)

hw_buf = (u16 *)data->vals;

- get_random_bytes(&val, sizeof(val));
+ /* values in val[] must be different from those in hw_buf[] */
+ val[0] = ~hw_buf[2];
+ if (val[0] == hw_buf[6])
+ val[0]++
+ val[1] = ~hw_buf[3];

/* Do a regular write and a raw write in cache only mode */
regcache_cache_only(map, true);

\
 
 \ /
  Last update: 2024-05-27 14:55    [W:0.101 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site