From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D948F1D8A for ; Tue, 28 Aug 2018 14:56:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2018 05:56:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,299,1531810800"; d="scan'208";a="69728400" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.19.107]) ([10.252.19.107]) by orsmga006.jf.intel.com with ESMTP; 28 Aug 2018 05:56:25 -0700 To: Tiwei Bie Cc: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org References: <20180828075327.18842-1-tiwei.bie@intel.com> <986b3012-552b-6673-d716-9acacb5e9528@intel.com> <20180828084203.GA69008@fbsd.sh.intel.com> From: "Burakov, Anatoly" Message-ID: <43248994-1461-3fc1-0ff8-4c96ae3cad89@intel.com> Date: Tue, 28 Aug 2018 13:56:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180828084203.GA69008@fbsd.sh.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC] net/virtio-user: avoid parsing process mappings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2018 12:56:49 -0000 On 28-Aug-18 9:42 AM, Tiwei Bie wrote: > On Tue, Aug 28, 2018 at 09:12:38AM +0100, Burakov, Anatoly wrote: >> On 28-Aug-18 8:53 AM, Tiwei Bie wrote: > [...] >>> >>> - for (i = 0; i < num; ++i) { >>> - mr = &msg->payload.memory.regions[i]; >>> - mr->guest_phys_addr = huges[i].addr; /* use vaddr! */ >>> - mr->userspace_addr = huges[i].addr; >>> - mr->memory_size = huges[i].size; >>> - mr->mmap_offset = 0; >>> - fds[i] = open(huges[i].path, O_RDWR); >>> + start_addr = (uint64_t)(uintptr_t)ms->addr; >>> + end_addr = start_addr + ms->len; >>> + >>> + /* >>> + * XXX workaround! >>> + * >>> + * For --single-file-segments case, offset should be: >>> + * offset = rte_fbarray_find_idx(&msl->memseg_arr, ms) * msl->page_sz; >>> + * >>> + * But it's not true for non-single-file-segments case. >>> + * >>> + * This is a temporary workaround which assumes the file will >>> + * also be mapped from the beginning in --single-file-segments >>> + * case. It should be replaced when we have a memory API to >>> + * get the offset. >> >> Yes, this is an unfortunate consequence of having split personalities in >> memory subsystem. A good solution would be to just deprecate >> non-single-file segments mode and always use it, but we cannot do that >> because we support kernel versions that do not support fallocate() on >> hugetlbfs (and it still leaves legacy mem mode, which effectively >> behaves like non-single-file segments as far as virtio is concerned). >> >> How about we add this API in v2 for seg fd patchset? > > Sure, thanks! > > Besides, I saw another minor issue. When --legacy-mem > and --single-file-segments are both specified, the EAL > init doesn't fail, but fd can't be got successfully. > I'll have to look into this, because as far as i recall, i've submitted a patch specifically prohibiting legacy mem combined with single file segments. I'll double check though. Thanks for testing! -- Thanks, Anatoly