From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 679B2C4363D for ; Fri, 25 Sep 2020 14:07:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3680E208A9 for ; Fri, 25 Sep 2020 14:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbgIYOHv (ORCPT ); Fri, 25 Sep 2020 10:07:51 -0400 Received: from mga11.intel.com ([192.55.52.93]:6570 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgIYOHu (ORCPT ); Fri, 25 Sep 2020 10:07:50 -0400 IronPort-SDR: fI89OUCxyn3dSZLCZkzWu8Pm72wtzZthr5BKvi/caeRd4/PJ0zNwOxrt28Ro00kZgswSSL8nZT 6kCh+kJJVzew== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="158879207" X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="158879207" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 06:54:45 -0700 IronPort-SDR: dk03fEEi9qPyhqM7EwMAHy0s+gOrBDoBRLjKg62nh1DCt22erA2Hjz2fGiIdaCN+F1Vla5tS05 r4RnbuAL/0xQ== X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="455841547" Received: from mlevy2-mobl.ger.corp.intel.com (HELO [10.251.176.131]) ([10.251.176.131]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 06:54:41 -0700 Subject: Re: [Intel-gfx] [PATCH rdma-next v3 1/2] lib/scatterlist: Add support in dynamic allocation of SG table from pages To: Maor Gottlieb , Jason Gunthorpe , Leon Romanovsky Cc: Christoph Hellwig , Doug Ledford , linux-rdma@vger.kernel.org, intel-gfx@lists.freedesktop.org, Roland Scheidegger , dri-devel@lists.freedesktop.org, David Airlie , VMware Graphics , Maor Gottlieb References: <20200922083958.2150803-1-leon@kernel.org> <20200922083958.2150803-2-leon@kernel.org> <118a03ef-d160-e202-81cc-16c9c39359fc@linux.intel.com> <20200925071330.GA2280698@unreal> <20200925115544.GY9475@nvidia.com> <65ca566b-7a5e-620f-13a4-c59eb836345a@nvidia.com> <33942b10-8eef-9180-44c5-b7379b92b824@linux.intel.com> <9d69d68d-7868-609b-c703-dfe9fec93a0f@nvidia.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <45919218-9a73-e3e3-cc03-5255a227f341@linux.intel.com> Date: Fri, 25 Sep 2020 14:54:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <9d69d68d-7868-609b-c703-dfe9fec93a0f@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org 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