From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E8C7AA04DB;
	Thu, 15 Oct 2020 20:34:19 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 84EC11DE05;
	Thu, 15 Oct 2020 20:34:18 +0200 (CEST)
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id C0B431DD32
 for <dev@dpdk.org>; Thu, 15 Oct 2020 20:34:15 +0200 (CEST)
IronPort-SDR: eYiX5oMZeBBb8qC9hKI46nMcbtPD+hDdz/KfTug6rndcx67Rf0wXtvF+iVIhGqq2841QVtPpAQ
 D6eE+MPaBTjA==
X-IronPort-AV: E=McAfee;i="6000,8403,9775"; a="183978961"
X-IronPort-AV: E=Sophos;i="5.77,380,1596524400"; d="scan'208";a="183978961"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 15 Oct 2020 11:34:14 -0700
IronPort-SDR: qLx5g4aWqQ+wno52Vm63K6fjIATWNnEFhnlTvABnZQYfIDqkojrrLOpS/rNPHhchz3mJaeO6sb
 5eTjeejnAsAw==
X-IronPort-AV: E=Sophos;i="5.77,380,1596524400"; d="scan'208";a="521945531"
Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.243.220])
 ([10.213.243.220])
 by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 15 Oct 2020 11:34:13 -0700
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Mohakud, Amiya Ranjan" <amohakud@rbbn.com>, dpdk-dev <dev@dpdk.org>
Cc: "Dey, Souvik" <sodey@rbbn.com>
References: <DM6PR03MB3547EDC8BAAD1DA17AE4470EB9020@DM6PR03MB3547.namprd03.prod.outlook.com>
 <DM6PR03MB3547EC4B79D729E897B08713B9020@DM6PR03MB3547.namprd03.prod.outlook.com>
 <af096009-bf8c-500a-0a87-2c831f80fccc@intel.com>
 <DM6PR03MB3547B1A6E139678008618F68B9020@DM6PR03MB3547.namprd03.prod.outlook.com>
 <9fbe81bd-1feb-db15-4b37-7bc51483b82c@intel.com>
 <DM6PR03MB3547CA7EBD6815E77EF7615FB9020@DM6PR03MB3547.namprd03.prod.outlook.com>
 <DM6PR03MB3547649C0113C1826DB82A30B9020@DM6PR03MB3547.namprd03.prod.outlook.com>
 <58888db2-a3c5-befc-6886-d510c7fd6646@intel.com>
Message-ID: <edd2a559-d18c-1419-300a-08e9f72504aa@intel.com>
Date: Thu, 15 Oct 2020 19:34:11 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
 Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <58888db2-a3c5-befc-6886-d510c7fd6646@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Subject: Re: [dpdk-dev] eal: DPDK: 18.11.6 version rte_eal_init() function
 cleans the runtime directory in 5.4.35 kernel
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On 15-Oct-20 7:01 PM, Burakov, Anatoly wrote:
> On 15-Oct-20 5:14 PM, Mohakud, Amiya Ranjan wrote:
>> + Souvik
>>
>> *From:*Mohakud, Amiya Ranjan
>> *Sent:* 15 October 2020 21:38
>> *To:* Burakov, Anatoly <anatoly.burakov@intel.com>; dpdk-dev 
>> <dev@dpdk.org>
>> *Subject:* RE: [dpdk-dev] eal: DPDK: 18.11.6 version rte_eal_init() 
>> function cleans the runtime directory in 5.4.35 kernel
>>
>> Hi Anatoly - Thanks for helping on this.
>>
>> I am not aware, where the primary process re-creates the files. Can 
>> you please point me to that? As per my code browsing and 
>> understanding, I can see, fbarray_memzone file gets created in 
>> rte_eal_memzone_init()->rte_fbarray_init() and it stays there till 
>> eal_clean_runtime_dir() gets called towards end of rte_eal_init(). 
>> This does not get deleted in 4.19 kernel, but in 5.4, it does.
>>
>> /I'm not sure i understand. Primary process is supposed to clear the
>> files. It will then recreate them. Are you suggesting that it's clearing
>> them *after* it has created them?/
>>
>> /
>> /Going by my observation, the file highlighted below gets deleted by 
>> the time rte_eal_init() is over.
>>
>> srwxr-xr-x 1 root root      0 Oct 15 11:24 mp_socket
>>
>> -rw------- 1 root root  12432 Oct 15 11:24 hugepage_info
>>
>> -rw------- 1 root root 188416 Oct 15 11:24 fbarray_memzone
>>
>> -rw------- 1 root root 397312 Oct 15 11:24 fbarray_memseg-2048k-0-1
>>
>> -rw------- 1 root root 397312 Oct 15 11:24 fbarray_memseg-2048k-0-0
>>
>> -rw------- 1 root root 397312 Oct 15 11:24 fbarray_memseg-2048k-0-3
>>
>> -rw------- 1 root root 397312 Oct 15 11:24 fbarray_memseg-2048k-0-2
>>
>> -rw------- 1 root root  16529 Oct 15 11:24 config
>>
>> Please reach out to me for further clarification.
>>
>> Regards
>>
>> Amiya
> 
> Hi,
> 
> Sorry, yes, you're right (it's been a while since i looked at the code), 
> it removes unused stuff at the end of init. There's even a comment 
> explaining why that's done :D
> 
> It sounds like closing the file descriptor also drops the lock. This 
> locking business is a huge pain because we have to support old kernels 
> which don't have the only sane file locking implementation that Linux has.
> 
> While i wouldn't go as far as to say "this is a kernel regression" as 
> most likely it's me who's at fault here, but this definitely shouldn't 
> happen. Unfortunately, i won't be online for the next two weeks, but 
> i'll definitely look into this after i'm back, so thanks for your report.
> 

Hi,

Just to clarify:

Removing stuff at the end of the init process is intended process. This 
is because every process will create their own shadow page tables, and 
defunct processes will not remove them afterwards. This is done because 
otherwise the tmpfs will slowly fill up with unused processes' fbarrays.

What is *not* intended behavior is primary process removing *its own* 
filesystem entries - this shouldn't happen, and in fact wouldn't have 
happened if the file locking was working as it was intended. Normally, 
when seeing files that are locked (in use), EAL will skip them, so that 
only files that are not in use would be deleted. It looks like you're 
observing exactly that - primary process removing *its own* files for 
some reason.

-- 
Thanks,
Anatoly