[Intel-gfx] [PATCH rdma-next v3 1/2] lib/scatterlist: Add support in dynamic allocation of SG table from pages

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Sep 25 12:33:13 UTC 2020


On 25/09/2020 13:18, Maor Gottlieb wrote:
> On 9/25/2020 2:55 PM, Jason Gunthorpe wrote:
>> On Fri, Sep 25, 2020 at 10:13:30AM +0300, Leon Romanovsky wrote:
>>>>> diff --git a/tools/testing/scatterlist/main.c 
>>>>> b/tools/testing/scatterlist/main.c
>>>>> index 0a1464181226..4899359a31ac 100644
>>>>> +++ b/tools/testing/scatterlist/main.c
>>>>> @@ -55,14 +55,13 @@ int main(void)
>>>>>        for (i = 0, test = tests; test->expected_segments; test++, 
>>>>> i++) {
>>>>>            struct page *pages[MAX_PAGES];
>>>>>            struct sg_table st;
>>>>> -        int ret;
>>>>> +        struct scatterlist *sg;
>>>>>
>>>>>            set_pages(pages, test->pfn, test->num_pages);
>>>>>
>>>>> -        ret = __sg_alloc_table_from_pages(&st, pages, 
>>>>> test->num_pages,
>>>>> -                          0, test->size, test->max_seg,
>>>>> -                          GFP_KERNEL);
>>>>> -        assert(ret == test->alloc_ret);
>>>>> +        sg = __sg_alloc_table_from_pages(&st, pages, 
>>>>> test->num_pages, 0,
>>>>> +                test->size, test->max_seg, NULL, 0, GFP_KERNEL);
>>>>> +        assert(PTR_ERR_OR_ZERO(sg) == test->alloc_ret);
>>>> Some test coverage for relatively complex code would be very 
>>>> welcomed. Since
>>>> the testing framework is already there, even if it bit-rotted a bit, 
>>>> but
>>>> shouldn't be hard to fix.
>>>>
>>>> A few tests to check append/grow works as expected, in terms of how 
>>>> the end
>>>> table looks like given the initial state and some different page 
>>>> patterns
>>>> added to it. And both crossing and not crossing into sg chaining 
>>>> scenarios.
>>> This function is basic for all RDMA devices and we are pretty confident
>>> that the old and new flows are tested thoroughly.
>> Well, since 0-day is reporting that __i915_gem_userptr_alloc_pages is
>> crashing on this, it probably does need some tests :\
>>
>> Jason
> 
> It is crashing in the regular old flow which already tested.
> However, I will add more tests.

Do you want to take some of the commits from 
git://people.freedesktop.org/~tursulin/drm-intel sgtest? It would be 
fine by me. I can clean up the commit messages if you want.

https://cgit.freedesktop.org/~tursulin/drm-intel/commit/?h=sgtest&id=79102f4d795c4769431fc44a6cf7ed5c5b1b5214 
- this one undoes the bit rot and makes the test just work on the 
current kernel.

https://cgit.freedesktop.org/~tursulin/drm-intel/commit/?h=sgtest&id=b09bfe80486c4d93ee1d8ae17d5b46397b1c6ee1 
- this one you probably should squash in your patch. Minus the zeroing 
of struct sg_stable since that would hide the issue.

https://cgit.freedesktop.org/~tursulin/drm-intel/commit/?h=sgtest&id=97f5df37e612f798ced90541eece13e2ef639181 
- final commit is optional but I guess handy for debugging.

Regards,

Tvrtko


More information about the dri-devel mailing list