From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C61DA04C1 for ; Thu, 21 Nov 2019 14:17:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4208B2BBD; Thu, 21 Nov 2019 14:17:30 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id E5DC12BA2; Thu, 21 Nov 2019 14:17:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 05:17:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,226,1571727600"; d="scan'208";a="205067922" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.92]) ([10.237.220.92]) by fmsmga008.fm.intel.com with ESMTP; 21 Nov 2019 05:17:23 -0800 To: "Xueming(Steven) Li" , David Marchand Cc: Asaf Penso , dev , dpdk stable References: <1573570228-15676-1-git-send-email-xuemingl@mellanox.com> <1573570228-15676-2-git-send-email-xuemingl@mellanox.com> <9766477f-8efc-9143-6aaa-2dfb595aa622@intel.com> <8e45a13a-1a00-bbc3-f688-dbc8c69878a8@intel.com> From: "Burakov, Anatoly" Message-ID: <9c848371-b8ee-f36c-b7cd-1aabcfb230c6@intel.com> Date: Thu, 21 Nov 2019 13:17:22 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <8e45a13a-1a00-bbc3-f688-dbc8c69878a8@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 2/2] malloc: fix realloc padded element size X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 21-Nov-19 1:15 PM, Burakov, Anatoly wrote: > On 21-Nov-19 12:55 PM, Xueming(Steven) Li wrote: >> Hi Anatoly, >> >>> -----Original Message----- >>> From: Burakov, Anatoly >>> Sent: Thursday, November 21, 2019 8:30 PM >>> To: David Marchand ; Xueming(Steven) Li >>> >>> Cc: Asaf Penso ; dev ; dpdk stable >>> >>> Subject: Re: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded >>> element size >>> >>> On 20-Nov-19 1:25 PM, David Marchand wrote: >>>> On Wed, Nov 20, 2019 at 3:12 AM Xueming(Steven) Li >>>> wrote: >>>>> >>>>>> -----Original Message----- >>>>>> From: David Marchand >>>>>> Sent: Wednesday, November 20, 2019 4:47 AM >>>>>> To: Xueming(Steven) Li ; Anatoly Burakov >>>>>> >>>>>> Cc: Asaf Penso ; dev ; dpdk stable >>>>>> >>>>>> Subject: Re: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded >>>>>> element size >>>>>> >>>>>> On Tue, Nov 12, 2019 at 3:50 PM Xueming Li >>>>>> wrote: >>>>>>> >>>>>>> When resize a memory with next element, the original element size >>>>>>> grows. >>>>>>> If the orginal element has padding, the real inner element size >>>>>>> didn't grow as well and this causes trailer verification failure >>>>>>> when malloc debug enabled. >>>>>> >>>>>> I did not see this when running the malloc_autotest with debug >>>>>> enabled. >>>>>> What is missing for me to catch it? >>>>>> >>>>> Yes, it happens rarely, depends on memory fragment. I only caught >>>>> this in >>> middle of a long test. >>>>> >>>>>> >>>>>> Just a bit chilly to apply this series. >>>>>> The first patch seems an optimisation. >>>>>> The second one seems more interesting if we fix the debug mode, but >>>>>> I suppose we can live without them in 19.11. >>>>> Few people enable memory debug option, they are there for years. >>>> >>>> Had a discussion offlist with Anatoly. >>>> Those two issues are hard to catch but the fixes are relevant and >>>> Anatoly is confident. >>>> I will take this in rc3. >>>> >>>> Series applied, thanks. >>>> >>> >>> To test them, i had to modify malloc to always create padded elements :) >> >> I fix another issue in element join, as I made some local enhancement >> patch on memory, it's required, not sure whether it help on public code. >> >> diff --git a/lib/librte_eal/common/malloc_elem.c >> b/lib/librte_eal/common/malloc_elem.c >> index afacb1813c..c3fa0d1039 100644 >> --- a/lib/librte_eal/common/malloc_elem.c >> +++ b/lib/librte_eal/common/malloc_elem.c >> @@ -487,6 +487,10 @@ join_elem(struct malloc_elem *elem1, struct >> malloc_elem *elem2) >>          else >>                  elem1->heap->last = elem1; >>          elem1->next = next; >> +       if (elem1->pad) { >> +               struct malloc_elem *inner = RTE_PTR_ADD(elem1, >> elem1->pad); >> +               inner->size += elem2->size; >> +       } >>   } >> >> > > This looks like a good change as well - while we /mostly/ join elements > when they're free, there is one case where we can join a free element > with one already occupied - and /that/ element could be padded, which we > currently don't update. So, this patch would help the public code as well. (that said, the += should be replaced with explicit calculation of correct size, as this joining may be run multiple times, and we don't want incorrect size accumulating...) > >> >>> >>> -- >>> Thanks, >>> Anatoly > > -- Thanks, Anatoly