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 D5FF9A0613
	for <public@inbox.dpdk.org>; Thu, 26 Sep 2019 15:55:37 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 36B881BDFD;
	Thu, 26 Sep 2019 15:55:37 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com
 [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 94AB9E07
 for <dev@dpdk.org>; Thu, 26 Sep 2019 15:55:35 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1569506135;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=sb2Yja/ObbqNi5fsGZWAzvCEF3D9nmMOHAG58+ytzII=;
 b=TX4/q176lI7T4fSYjbpf04s4yD8eZCECbSWJ4F+N9nDFh40nVHQ0ic+yC+bzpqz0HwL6wx
 9rW1eYQDuiqUx1CjjzHnBtTeAwaTI/IcYm0Njn60UylxaapETXhJQI+EGJdQhSjDPL63F9
 TKfPA2M7+idMbzdrippH5SxU9OtKuzQ=
Received: from mail-vk1-f197.google.com (mail-vk1-f197.google.com
 [209.85.221.197]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-87-bjJHXuHBMOiFd9A0z99nhg-1; Thu, 26 Sep 2019 09:55:29 -0400
Received: by mail-vk1-f197.google.com with SMTP id f199so1053904vka.17
 for <dev@dpdk.org>; Thu, 26 Sep 2019 06:55:25 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=yT/wN1W0RgnqkL03bB61aKBs4l/Cyph9K3zeJLwH98I=;
 b=YHPpCVrhf5qd6QFuQFUIutMfkqmYeE+Q8cdsIBK6GOequcqlju3DQD9JmWl47Lp7hC
 gALnbLguih9tzwH1OjkRr2tGeJ2uuIQRaCBXYaEw+CvQEFnE3X/EDHF/OwbEmOQ9vf8t
 mmM3Wpq51tSksFiCAZH/Kl5dD9ZKJltDbNNWs8N8Sde13eSKCSoxW+UmeFGQJJPa7jra
 A1gj85b+ZFtw5Y9sCQDwjKLf0pzfxkA8vLqWuLF69T9KizwOWr5U756r01YvZqyD7RwY
 49XnkbSwS/cUhTVzPQoVS1A6bV1o93nnphL/ASObim35PSVwzbEehSOpUgKTyJfgo4LU
 XUSA==
X-Gm-Message-State: APjAAAXrfPKIEcErGnq08jStsElOv8kNwkO0oa3Ao6eBpR+I/ccvlv1l
 9chCZVs9/SDCRTdmpHb2bJScbSt/6ck4YK1py9Pb63qtjuMX0SJsFvga+37JenxAqU/cAKdKBST
 P35Mpoj40vdO2pzzlJF0=
X-Received: by 2002:a67:be15:: with SMTP id x21mr1759092vsq.141.1569506122822; 
 Thu, 26 Sep 2019 06:55:22 -0700 (PDT)
X-Google-Smtp-Source: APXvYqxxUyvQtlXn14ov+RDuKpxI/kX4rrcdguvpBrxrMreu2TWpzYUhHC2iMVLijZa5RukjIwGR1WzJoSFU7cdCsmg=
X-Received: by 2002:a67:be15:: with SMTP id x21mr1759071vsq.141.1569506122380; 
 Thu, 26 Sep 2019 06:55:22 -0700 (PDT)
MIME-Version: 1.0
References: <26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.git.anatoly.burakov@intel.com>
 <CAJFAV8xQ__KNVSmf9e3C5T=T3FNjExR=7+F-O+vV+hv_OPUYsw@mail.gmail.com>
 <9e3271a8-8f86-a2ea-35ee-2ed3d98c5f0f@intel.com>
In-Reply-To: <9e3271a8-8f86-a2ea-35ee-2ed3d98c5f0f@intel.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 26 Sep 2019 15:55:10 +0200
Message-ID: <CAJFAV8xh-9p5C3o4fN502eFjkY3a8kCQ-a+yu+JaGT2vW2Dwsw@mail.gmail.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev <dev@dpdk.org>, John McNamara <john.mcnamara@intel.com>, 
 Marko Kovacevic <marko.kovacevic@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>
X-MC-Unique: bjJHXuHBMOiFd9A0z99nhg-1
X-Mimecast-Spam-Score: 0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [PATCH] eal/freebsd: add support for base virtaddr
	option
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>

Hello Anatoly,

On Mon, Aug 12, 2019 at 3:38 PM Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
>
> On 12-Aug-19 11:19 AM, David Marchand wrote:
> > On Tue, Jul 16, 2019 at 1:25 PM Anatoly Burakov
> > <anatoly.burakov@intel.com> wrote:
> >>
> >> According to our docs, only Linuxapp supports base-virtaddr option.
> >> That is, strictly speaking, not true because most of the things
> >> that are attempting to respect base-virtaddr are in common files,
> >> so FreeBSD already *mostly* supports this option in practice.
> >>
> >> This commit fixes the remaining bits to explicitly support
> >> base-virtaddr option, and moves the arg parsing from EAL to common
> >> options parsing code. Documentation is also updated to reflect
> >> that all platforms now support base-virtaddr.
> >>
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> ---
> >>   doc/guides/linux_gsg/eal_args.include.rst     |  6 +++
> >>   doc/guides/linux_gsg/linux_eal_parameters.rst |  6 ---
> >>   doc/guides/rel_notes/release_19_08.rst        |  5 +++
> >>   lib/librte_eal/common/eal_common_options.c    | 38 +++++++++++++++++=
+
> >>   lib/librte_eal/freebsd/eal/eal.c              | 13 ++++++-
> >>   lib/librte_eal/linux/eal/eal.c                | 39 -----------------=
--
> >>   6 files changed, 60 insertions(+), 47 deletions(-)
> >>
> >> diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/li=
nux_gsg/eal_args.include.rst
> >> index cf421a56e..ed8b0e35b 100644
> >> --- a/doc/guides/linux_gsg/eal_args.include.rst
> >> +++ b/doc/guides/linux_gsg/eal_args.include.rst
> >> @@ -86,6 +86,12 @@ Multiprocessing-related options
> >>
> >>       Set the type of the current process.
> >>
> >> +*   ``--base-virtaddr <address>``
> >> +
> >> +    Attempt to use a different starting address for all memory maps o=
f the
> >> +    primary DPDK process. This can be helpful if secondary processes =
cannot
> >> +    start due to conflicts in address map.
> >> +
> >
> > doc/guides/freebsd_gsg/freebsd_eal_parameters.rst:.. include::
> > ../linux_gsg/eal_args.include.rst
> >
> > Ok, a bit misleading to put in linux_gsg/, so writing this here if
> > someone else looks at this :-)
>
> This was agreed upon when this file was first introduced. We don't have
> a "common" section and there's no real way to create it without
> triggering a bunch of errors in doxygen, so it was decided that putting
> this in a Linux GSG is the best way to do this.
>
> >
> >
> >>   Memory-related options
> >>   ~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guide=
s/linux_gsg/linux_eal_parameters.rst
> >> index c63f0f49a..b2cc60e44 100644
> >> --- a/doc/guides/linux_gsg/linux_eal_parameters.rst
> >> +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst
> >> @@ -49,12 +49,6 @@ Multiprocessing-related options
> >>       allows running multiple independent DPDK primary/secondary proce=
sses under
> >>       different prefixes.
> >>
> >> -*   ``--base-virtaddr <address>``
> >> -
> >> -    Attempt to use a different starting address for all memory maps o=
f the
> >> -    primary DPDK process. This can be helpful if secondary processes =
cannot
> >> -    start due to conflicts in address map.
> >> -
> >>   Memory-related options
> >>   ~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_n=
otes/release_19_08.rst
> >> index 4a1fd8dd8..1b58d9282 100644
> >> --- a/doc/guides/rel_notes/release_19_08.rst
> >> +++ b/doc/guides/rel_notes/release_19_08.rst
> >> @@ -56,6 +56,11 @@ New Features
> >>        Also, make sure to start the actual text at the margin.
> >>        =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >>
> >> +* **FreeBSD now supports `--base-virtaddr` EAL option.**
> >> +
> >> +  FreeBSD version now also supports setting base virtual address for =
mapping
> >> +  pages and resources into its address space.
> >> +
> >>   * **Added MCS lock.**
> >>
> >>     MCS lock provides scalability by spinning on a CPU/thread local va=
riable
> >
> > Well, obviously, this needs some rebase on 19.11-rc0 :-)
>
> Yes, will do.
>
> >
> >> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_e=
al/common/eal_common_options.c
> >> index 512d5088e..156e48e19 100644
> >> --- a/lib/librte_eal/common/eal_common_options.c
> >> +++ b/lib/librte_eal/common/eal_common_options.c
> >> @@ -20,6 +20,7 @@
> >>   #include <rte_eal.h>
> >>   #include <rte_log.h>
>
> <snip>
>
> >> -       rte_mem_cfg_addr =3D mmap(NULL, sizeof(*rte_config.mem_config)=
,
> >> -                               PROT_READ | PROT_WRITE, MAP_SHARED, me=
m_cfg_fd, 0);
> >> +       rte_mem_cfg_addr =3D mmap(rte_mem_cfg_addr,
> >> +                       sizeof(*rte_config.mem_config), PROT_READ | PR=
OT_WRITE,
> >> +                       MAP_SHARED, mem_cfg_fd, 0);
> >>
> >>          if (rte_mem_cfg_addr =3D=3D MAP_FAILED){
> >>                  RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\=
n");
> >
> > Nit: when compared to Linux implementation, the reattach step does not
> > recommend using the --base-virtaddr in case the remmapping failed.
> >
>
> Good catch, will fix.

Can you prepare a v2?
Thanks.


--=20
David Marchand