[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 13:54:38 UTC 2020


On 25/09/2020 14:39, Maor Gottlieb wrote:
> 
> On 9/25/2020 3:33 PM, Tvrtko Ursulin wrote:
>>
>> 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.
> 
> I will very appreciate it. Thanks

I've pushed a branch with tidied commit messages and a bit re-ordered to 
the same location. You can pull and include in your series:

  tools/testing/scatterlist: Rejuvenate bit-rotten test
  tools/testing/scatterlist: Show errors in human readable form

And "test fixes for sg append" you can squash (minus the sg_table 
zeroing) into your patch.

If this plan does not work for you, I can send two of my patches to lkml 
independently. What ever you prefer.

Regards,

Tvrtko


More information about the Intel-gfx mailing list